MyChat Server script event: OnConfMessage, a new message in a conference
The event that occurs at the moment of sending a message to a conference by any user.
Event template
function OnConfMessage(iCID, iUIN, iUID, iMsgType: integer; sConfName, sMsg: 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 the message sender (number >=0); |
iUID |
integer |
unique identifier of the conference (number >=0); |
sConfName |
string |
text name of a conference; |
iMsgType |
integer |
|
sMsg |
string |
message text. |
Return value
By default, this function must return the value "true". However, if you decide to cancel the message sending to a conference you can set the value to "false" and then this message will be deleted and won't show up neither for the sender nor for all conference members.
Example
function OnConfMessage(iCID, iUIN, iUID, iMsgType: integer; sConfName, sMsg: string): boolean;
var
bFlag: boolean;
begin
bFlag := true;
if sConfName = 'main' then begin
if iUIN <> 3 then bFlag := false;
end;
result := bFlag;
end;
begin
end.
The script checks who send messages to text conferences and in which of them. If this message is sent to the conference "main" and the sender's UIN is differ from 3 (for example, this is a conference moderator), then this message is deleted. In this way we can make a filter like "No one can send messages to the conference "main" except John Doe, and he has UIN=3".