Event for creating a new message on the common announcement board of MyChat messenger.
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.
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 truе — 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. |
True, if you allow to place an announcement on the board, False — if not.
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 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 displayed in the chat:
Also, the HTML file is created in "c:\denwer\home\company\www\bbs.html":
It looks like in a browser: