|
OnEvent_ChatWndReceiveMessage
The OnEvent_ChatWndReceiveMessage event is fired when a
new message is received in a chat window. The event is generated
for any message added to the history control which includes the
messages sent by the current user. It can be used to modify the
message before it is displayed to the user.
Syntax
[string] OnEvent_ChatWndReceiveMessage(
[object] ChatWnd,
[string] Origin,
[string] Message,
[enum] MessageKind
);
Parameters
- ChatWnd
- [object] Reference to the ChatWnd object attached to the chat
generating the event.
- Origin
- [string] Name of the user that sent the message, as it
appears in the chat window (before Messenger Plus! processes the
text). You can generally use this parameter and compare it to the
current user's name to know
if the message came from a different computer. Also, remember that
the name of the contacts as reported in Contact::Name can differ from the name
displayed in the chat if a nickname was added by the current user.
See Remarks.
- Message
- [string] Message that is being added in the chat window's
history control. The value of this parameter depends on
MessageKind.
- MessageKind
-
[enum] Number
specifying the kind of message received. It can be one of the
following identifiers:
|
MSGKIND_UNKNOWN (0)
MSGKIND_SAYS (1)
MSGKIND_WINKS (2)
MSGKIND_VOICECLIPS (3)
MSGKIND_SEARCHING (4)
MSGKIND_FIND (5)
MSGKIND_SAYSOFFLINE (6)
|
Unknown
Text message typed by the user
A wink being sent
A voice clip being sent
A search made with the "Search" button
The result of a search made with "Search"
A text message sent while the current user was offline
|
Return Value
A string containing the message to be displayed in the chat
window instead of Message. If you do
not want to modify the message, simply return Message without changing it. The new string will
be parsed for possible format codes. It is important to remember
that the new message cannot be longer than the original one (use
Message.length) and will be cut if necessary. Also,
Messenger will not re-parse the message for emoticons codes.
Remarks
The value returned by this event handler is ignored if
MessageKind specifies a wink or a
voice clip.
Because Messenger Plus! analyses received messages only when
they reach the chat window, it is not possible to determine exactly
from which contact the message came from. However, several methods
can be used to guess if the message was actually sent by the
current user. For example, to determine whether or not the
personalized status messages should be sent when a message is
received, Messenger Plus! compares the time of the last ChatWndSendMessage event with the
current time. If it is less than 1 second, the message is
considered to come from the current user and the previously
recorded time is reset. Even if this method of analysis can seem
too simplistic, it works in almost every scenario as it is
extremely rare to receive a message sent by a contact between the
time the "Send" button was pressed and the time the message of the
current user was added to the window (as Messenger does not wait to
receive a reply from the server before adding the message to the
history control).
Messenger Plus! 4.23 and earlier: enumeration names are not
available, numbers must be used instead.
Event Information
| Event Source |
Windows Live Messenger |
| Availability |
Messenger Plus! Live 4.00 |
See Also
Messenger Events, ChatWnd Object.
|