Script event for MyChat Server: OnRegistered
The event for successful registration of a user. Occurs only during independent user registration in MyChat Client.
It does not trigger when you create a user from Admin Panel or via Integration API.
Event template
procedure OnRegistered(iCID, iUIN: integer; var iRole: integer; var bBlocked: boolean);
begin
// your own code
end;
begin
end.
You can write any of your code instead of the comment.
Description of parameters
Parameter |
Type |
Value |
iCID |
integer |
Client connection ID, unique session identifier in the online structure of network connections to the server; |
iUIN |
integer |
numeric identifier of the user that has just registered; |
iRole |
integer |
index for the user rights group, number. It can be changed; |
bBlocked |
boolean |
changeable parameter. False (by default) a user is allowed to connect to the server, True the user's account will be blocked. |
Example
procedure OnRegistered(iCID, iUIN: integer; var iRole: integer; var bBlocked: boolean);
var
sGroupName: string;
x: integer;
begin
sGroupName := mGetRoleNameByID(iRole);
if sGroupName = 'Guests' then x := mGetRoleIDByName('MyGroupForAllNewUsers');
if x <> -1 then iRole := x;
end;
begin
end.
The script "catches" the event for successful registration of a new user, and if a rights group "Guests" is assigned to him, then he is transferred to already created rights group "MyGroupForAllNewUsers".