Class TRtcAbsMultiGateClientLink

Description
Hierarchy
Fields
Methods
Properties

Unit

Declaration

type TRtcAbsMultiGateClientLink = class(TRtcAbsGateClient)

Description

Abstract RTC Multi-Gate Client Link class

Implements basic functionality required by components using a Multi-Gate-Client component.

All events on this component are called from within a thread context of the connection component triggering each event, which means that components events will be called from multiple threads (depending on what triggered the event) and all the code you write for handling this components events should be thread-safe.

Every component based on TRtcAbsMultiGateClientLink allocates one "MyGroupID" for its exlusive use. Because the max number of available Group IDs is limited to 4095, it will NOT be possible to have more than 4095 components based on TRtcAbsMultiGateClientLink working with the exact same TRtcHttpMultiGateClient component, but ... since 4095 is quite a big number, it is highly unlikely that we will ever need so many different components processing data coming from a single TRtcHttpMultiGateClient component.

Hierarchy

Overview

Methods

Public constructor Create(AOwner:TComponent); override;
Public destructor Destroy; override;
Public function UserInfo(const UserAddr:RtcString):RtcString;
Public function PingUser(const UserAddr:RtcString):boolean;
Public function VerifyUser(const UserAddr:RtcString):boolean;
Public function UserNotVerified(const UserAddr:RtcString):boolean;
Public function UserAllowed(const UserAddr:RtcString; const action:word):boolean;
Public function AddUserToGroup(const UserAddr:RtcString):boolean;
Public function IsUserInGroup(const UserAddr:RtcString):boolean;
Public function RemoveUserFromGroup(const UserAddr:RtcString):boolean;
Public function UsersInGroup:integer;
Public function DisbandGroup:boolean;
Public function SendToGroup(CallID:word; const data:RtcByteArray):boolean; overload;
Public function SendToGroup(CallID:word; const data:RtcString):boolean; overload;
Public function SendToGroup(CallID:word):boolean; overload;
Public function SendBytes(const UserAddr:RtcString; GroupID:TGateUID; CallID:word; const data:RtcByteArray):boolean; overload;
Public function SendBytes(const UserAddr:RtcString; GroupID:TGateUID; CallID:word; const data:RtcString):boolean; overload;
Public function SendBytes(const UserAddr:RtcString; GroupID:TGateUID; CallID:word):boolean; overload;
Public function AddFriend(const UserAddr:RtcString):boolean;
Public function RemoveFriend(const UserAddr:RtcString):boolean;
Public function LeaveUsersGroup(const OwnerAddr:RtcString; GroupID:TGateUID):boolean;

Properties

Published property MyGroupID: TGateUID read GetMyGroupID write SetMyGroupID stored False;
Published property MultiClient: TRtcHttpMultiGateClient read GetMultiClient write SetMultiClient;

Description

Methods

Public constructor Create(AOwner:TComponent); override;
 
Public destructor Destroy; override;
 
Public function UserInfo(const UserAddr:RtcString):RtcString;

Uses "UserInfo" method on the "MultiClient" (TRtcHttpMultiGateClient) component to return the last received "UserInfo" string for the User "UserAddr" (UserID@GateAddr:GatePort). The "UserInfo" string is received from the Gateway with Account notifications, contains the "GateUserInfo" property assigned on the Client for which the notification was sent and remains populated while the User is logged in with at least one Account managed by the "MultiClient" component.

Public function PingUser(const UserAddr:RtcString):boolean;

Uses "Ping" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Ping the user "UserAddr" (UserID@GateAddr:GatePort) and get notified if the User is OFF-LINE. Returns TRUE if connection component was found and the PING command was placed in its sending buffers.

Public function VerifyUser(const UserAddr:RtcString):boolean;

Uses "RequestUserVerifications" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Request verifications for all "Linked" accounts logged in with "UserAddr" which have NOT beed verified. Returns TRUE if at least one verification request was sent. "OnInfoReceived" events will be triggered with "Data.Command" = "gc_AccountVerified" for all remote Accounts where verification was successful.

Public function UserNotVerified(const UserAddr:RtcString):boolean;

Uses "UserNotVerified" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Check if the User "UserAddr" (UserID@GateAddr:GatePort) is NOT (fully) verified. Returns TRUE if the User is logged in on at least one "Linked" (remote Private) account for which we have NOT yet received a positive account verification. If this property returns TRUE, you can use the "VerifyUser" method to ask the User to verify all logged in but NOT yet verified "Linked" accounts.

Public function UserAllowed(const UserAddr:RtcString; const action:word):boolean;

Uses "UserAllowed" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Check if the User "UserAddr" (UserID@GateAddr:GatePort) is allowed to perform Action "action", Based on Permissions for "Public" accounts and *VERIFIED* "Private" or "Linked" Accounts.

Public function AddUserToGroup(const UserAddr:RtcString):boolean;

Uses "AddUserToMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Add User "UserAddr" (UserID@GateAddr:GatePort) to My Group. Returns TRUE if connection component was found and the command was placed in its sending buffers. If the User is NOT online, or the User goes Off-Line, or we lose connection to the Gateway where the User was logged in, the User will automatically be removed from our Group.

Public function IsUserInGroup(const UserAddr:RtcString):boolean;

Uses "IsUserInMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Return TRUE if the user "UserAddr" (UserID@GateAddr:GatePort) is in My Group.

Public function RemoveUserFromGroup(const UserAddr:RtcString):boolean;

Uses "RemoveUserFromMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Remove User "UserAddr" (UserID@GateAddr:GatePort) from My Group. Returns TRUE if connection component was found and the command was placed in its sending buffers.

Public function UsersInGroup:integer;

Uses "UsersInMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Return the current total number of users in My Group.

Public function DisbandGroup:boolean;

Uses "DisbandMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Remove ALL USERS from My Group and Disband My Group, if "AddUserToGroup" method was used on THIS component or "AddUserToMyGroup" was used on the "MultiClient" (TRtcHttpGateClient) component. Returns TRUE if connection component was found and the command was placed in its sending buffers.

Public function SendToGroup(CallID:word; const data:RtcByteArray):boolean; overload;

Uses "SendToMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Send "data" (Content, max 16MB in size) with "CallID" (0..65000) to My Group.

You can use any CallID from 0 - 65000, but do NOT use CallIDs above 65000! Returns TRUE if connection component was found and the package was placed in its sending buffers.

Public function SendToGroup(CallID:word; const data:RtcString):boolean; overload;

Uses "SendToMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Send "data" (Content, max 16MB in size) with "CallID" (0..65000) to My Group.

You can use any CallID from 0 - 65000, but do NOT use CallIDs above 65000! Returns TRUE if connection component was found and the package was placed in its sending buffers.

Public function SendToGroup(CallID:word):boolean; overload;

Uses "SendToMyGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Send "CallID" (0..65000) with no extra content to My Group.

You can use any CallID from 0 - 65000, but do NOT use IDs above 65000! Returns TRUE if connection component was found and the package was placed in its sending buffers.

Public function SendBytes(const UserAddr:RtcString; GroupID:TGateUID; CallID:word; const data:RtcByteArray):boolean; overload;

Uses "SendBytes" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Send "data" (Content, max 16MB in size) with "CallID" (0..65000) to "UserAddr" and "GroupID".

You can use any CallID from 0 - 65000, but do NOT use CallIDs above 65000! Returns TRUE if connection component was found and the package was placed in its sending buffers.

Public function SendBytes(const UserAddr:RtcString; GroupID:TGateUID; CallID:word; const data:RtcString):boolean; overload;

Uses "SendBytes" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Send "data" (Content, max 16MB in size) with "CallID" (0..65000) to "UserAddr" and "GroupID".

You can use any CallID from 0 - 65000, but do NOT use CallIDs above 65000! Returns TRUE if connection component was found and the package was placed in its sending buffers.

Public function SendBytes(const UserAddr:RtcString; GroupID:TGateUID; CallID:word):boolean; overload;

Uses "SendBytes" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Send "CallID" (0..65000) with no extra content to "UserAddr" and "GroupID".

You can use any CallID from 0 - 65000, but do NOT use IDs above 65000! Returns TRUE if connection component was found and the package was placed in its sending buffers.

Public function AddFriend(const UserAddr:RtcString):boolean;

Uses "AddFriend" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Add User "UserAddr" as our Friend, giving the User permission to add us to his User Group(s) on the Gateway. If the user "UserAddr" is online and was NOT already in our Friends list, we will receive the "gc_FriendAdd" command from the Gateway and the user "UserAddr" will receive the "gc_BeFriend" command. If the user is off-line, we will receive a "gc_UserOffLine" command. If the user is already in our friends list, nothing changes and the Gateway won't send any notification messages to us or the user. Returns TRUE if connection component was found and the command was placed in its sending buffers.

Public function RemoveFriend(const UserAddr:RtcString):boolean;

Uses "RemoveFriend" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Remove User "UserAddr" from our Friends list, revoking Users permissions to add us to his User Group(s) on the Gateway. If user "UserAddr" was in our Friends list on the Gateway, we will receive the "gc_FriendRemove" command from the Gateway and the user "UserAddr" will receive the "gc_UnFriend" command. Removing a User from our Friends list will not close open User Groups, but it will prevent the User from adding us to more Groups. NOTE: Removing Friends is not necessary, because our Frields list will be cleared on the Gateway if a User logs out or looses connection.

Returns TRUE if connection component was found and the command was placed in its sending buffers.

Public function LeaveUsersGroup(const OwnerAddr:RtcString; GroupID:TGateUID):boolean;

Uses "LeaveUsersGroup" method on the "MultiClient" (TRtcHttpMultiGateClient) component to Leave Group "GroupID" owned by user "OwnerAddr" (OwnerID@GateAddr:GatePort). Returns TRUE if connection component was found and the command was placed in its sending buffers.

Properties

Published property MyGroupID: TGateUID read GetMyGroupID write SetMyGroupID stored False;

"My" Group ID, allocated automatically when a new MultiClient component is assigned and removed automatically when the MultiClient component is removed.

Assigning a new value to this property automatically removes any previously assigned "My" GroupID and allocates the closest currently unused Group ID, starting from the value being assigned, then checking higher and lower values. Should the search for an available Group ID fail, an exception will be reaised.

When a MultiClient property is NOT assigned, this property is always zero (0).

Published property MultiClient: TRtcHttpMultiGateClient read GetMultiClient write SetMultiClient;

Set the MultiClient property to a RtcHttpMultiGateClient component to listen to all events from that component. Setting the MultiClient property also allocates a new "MyGroupID". If another "MultiClient" component was previously assigned, the old "MyGroupID" will also be released, before allocating a new "MyGroupID". If the MultiClient component being assigned does NOT have any available Group IDs, this MultiClient property will be set to NIL and an exception will be raised. Set "MultiClient:=NIL" and make sure it is NIL, before destroying THIS component. "AfterClientRemoved" event is triggered when the component is safe to destroy.


Generated by PasDoc 0.14.0.