Script event of MyChat Server: OnConfJoin

Script event of MyChat Server: OnConfJoin

The event occurs only when a user himself attempts to join a text conference. It is does not work if the user is added to a conference by the server.

 

Event template

function OnConfJoin(iCID, iUIN, iUID: integer; sConfName: string): boolean;
begin
  // your own code
  
  result := true;
end;

begin

end.

You can put your code instead of the comment.

 

Description of parameters

Parameter

Type

Value

iCID

integer

Connection ID of the client, unique session identifier in the online structure of network connections to the server;

iUIN

integer

unique identifier of a user (number > 0);

iUID

integer

unique identifier of a conference (number > 0);

sConfName

string

text name of a conference.

 

Return value

By default, this function must return the value "true" but you can forbid the user to enter the conference by changing it to "false". No automatic warning messages or notifications about any errors will be displayed in the client.

 

Example

function OnConfJoin(iCID, iUIN, iUID: integer; sConfName: string): boolean;
var
  iHour: integer;
  bFlag: boolean;
begin
  bFlag := true;
  iHour := HourOf(Now);
  
    if (iHour >= 18) or (iHour < 9) then 
      if sConfName = 'main' then begin
        mSendCustomMsgToClientConsoleByCID(iCID, 'Sorry, you can''t enter to this conference. Entering time is 9:00 - 18:00',
                                           'Error', true, true, 78); 
        bFlag := false;
      end;
  
  result := bFlag;
end;

begin

end.

The script checks that the entering to a conference is allowed in working time from  9:00 to 18:00 only. If a user tries to enter there in any other time the script will forbid him to do so and send the following notification:

 

Notification in MyChat console about impossibility to enter the conference
 

See also

HourOf

mSendCustomMsgToClientConsoleByCID