Script event for MyChat Server: OnBBSMessage
Event for creating a new message on the common announcement board of MyChat messenger.
Event template
function OnBBSMessage(iCID, iUIN: integer; bStick: boolean; dtPosted, dtExpire: double; 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); |
bStick |
boolean |
"pinned" announcement. If true, place a message on top of all messages on the board; |
dtPosted |
double |
date/time of the message placement on the board; |
dtExpire |
double |
date/time of the announcement relevance. When it expires the announcement will be archived; |
sMsg |
string |
message text. |
Return value
True, if you allow to place an announcement on the board, False if not.
Example
const
sFileName = 'c:\denwer\home\company\www\bbs.html';
function OnBBSMessage(iCID, iUIN: integer; bStick: boolean; dtPosted, dtExpire: double; sMsg: string): boolean;
var
s: string;
begin
s := ReplaceString(sMsg, '<', '<', true, false);
s := ReplaceString(s, '>', '>', true, false);
s := '' + CRLF +
'' + CRLF +
s +
'
' + CRLF +
FormatDateTime('[dd.mm.yyyy hh:nn]', dtPosted) + ' ' +
mGetUserAttribute(iUIN, 'DisplayName') + CRLF +
'' + CRLF +
'';
DeleteFile(sFileName);
AddLineToFile(s, sFileName);
result := true;
end;
begin
end.
The script creates an HTML file for placement on the corporate WEB server, where it duplicates the message text and indicates the sender and the date of the announcement placement.
When you place the message on the announcement on the board it is displayed in the chat.
Also, the HTML file is created in "c:\denwer\home\company\www\bbs.html":
It looks like in a browser: