Script event for MyChat Server: OnPrivateRequest
The event that occurs when attempting to open a private dialogue between two users.
Template event
function OnPrivateRequest(iCID, iUIN, iUINTo, iRole, iRoleReciever, iTask: integer): boolean;
begin
// your own code
result := true;
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 |
unique identifier of the private dialogue initiator (число >=0); |
iUINTo |
integer |
unique identifier of the message recipient (number >=0); |
iRole |
integer |
index for the sender's rights group; |
iRoleReciever |
integer |
index for the recipient's rights group; |
iTask |
integer |
task type: 0 regular private message, 1 an attempt for sending files from the program, 2 an attempt to send files from the context menu of Windows Explorer (Explorer). |
Return value
By default, this function must return the value "true". If you set the value "false" a private dialogue won't open and there will be no messages displayed.
Example
function OnPrivateRequest(iCID, iUIN, iUINTo, iRole, iRoleReciever, iTask: integer): boolean;
begin
if (iUIN = 6) and (iUINTo = 3) then begin
mSendCustomMsgToClientConsoleByCID(iCID, 'You are not allowed to talk to this person' + CRLF +
'All questions to Google :)',
'Error', true, true, 74);
result := false;
end else result := true;
end;
begin
end.
The script checks which user is trying to hide the private dialogue session and if a user with UIN 6 starts the conversation with a user that has UIN 3 then the private conversation attempt is overlapped and none of these users receives any message.
However, in the example we send a system message to a user that tries to start the conversation in order to notify him that the private conversation is impossible since the administrator has forbidden it.
See also
mSendCustomMsgToClientConsoleByCID
Created with the Personal Edition of HelpNDoc: Effortlessly Convert Your Word Doc to an eBook: A Step-by-Step Guide