Hello There, Guest! (LoginRegister)

Skinning Documentation

Introduction to Scripting
Getting Started
What's a Messenger Plus! Script?
Scripting Environment
Your First Script
Working with Scripts
From Plugins to Scripts
Packaging your Script
Windows for your Script
Testing your Windows
Objects Reference
Debug Object
Description
Functions
Trace
ClearDebuggingWindow
Properties
DebuggingWindowVisible
Messenger Object
Description
Functions
AutoSignin
Signout
OpenChat
Properties
Version
VersionBuild
ContactListWndHandle
CurrentChats
ReceiveFileDir
MyContacts
MyEmail
MyUserId
MyStatus
MyName
MyPersonalMessage
MyCurrentMedia
MyDisplayPicture
CustomEmoticons
MsgPlus Object
Description
Functions
DisplayToast
DisplayToastContact
CreateWnd
CreateChildWnd
AddTimer
CancelTimer
PlaySound
LockMessenger
LogEvent
RemoveFormatCodes
DownloadFile
UploadFileFTP
LoadScriptFile
ExtractFromZIP
Properties
Version
VersionBuild
ScriptRegPath
ScriptFilesPath
MessengerIsLocked
UILangCode
ChatWnds Object
Description
Functions
Iterator
Properties
Count
ChatWnd Object
Description
Functions
SendMessage
SendFile
AddContact
DisplayInfoMessage
ResetInfoMessage
EditText_GetCurSelStart
EditText_GetCurSelEnd
EditText_SetCurSel
EditText_ReplaceSel
HistoryText_GetCurSelStart
HistoryText_GetCurSelEnd
HistoryText_GetTextRange
Properties
Handle
Contacts
EditText
EditChangeAllowed
ChatLogEnabled
OverrideFmtEnabled
IsMobileChat
Contacts Object
Description
Functions
Iterator
GetContact
Properties
Count
Contact Object
Description
Properties
Email
Network
Status
Name
PersonalMessage
CurrentMedia
Blocked
DisplayPicture
IsFloating
Emoticons Object
Description
Functions
Iterator
GetEmoticon
Properties
Count
Emoticon Object
Description
Properties
Shortcut
Name
PictureFile
PlusWnd Object
Description
Functions
Close
RegisterMessageNotification
GetControlHandle
SendControlMessage
GetControlText
SetControlText
GetElementPos
Button and Checkmark Controls
Button_IsChecked
Button_SetCheckState
Button_SetElementText
ComboBox Controls
Combo_AddItem
Combo_RemoveItem
Combo_GetCurSel
Combo_SetCurSel
Combo_GetItemData
Combo_GetCount
ListBox Controls
LstBox_AddItem
LstBox_GetItemText
LstBox_RemoveItem
LstBox_GetCurSel
LstBox_SetCurSel
LstBox_GetItemData
LstBox_GetCount
ListView Controls
LstView_AddItem
LstView_SetItemText
LstView_GetItemText
LstView_RemoveItem
LstView_GetItemData
LstView_GetCount
LstView_GetSelectedState
LstView_SetSelectedState
LstView_GetCheckedState
LstView_SetCheckedState
LstView_SetItemIcon
Edit and RichEdit Controls
EditBox_SetCurSel
EditBox_ReplaceSel
EditBox_GetCurSelStart
EditBox_GetCurSelEnd
RichEdit_GetTextRange
RichEdit_SetCharFormat
Browser Controls
Browser_GetInterface
Image Elements
ImageElmt_SetImageFile
Properties
Handle
Visible
WindowId
Interop Object
Description
Functions
Call
Call2
FreeDll
GetLastError
Allocate
GetCallbackPtr
DataBloc Object
Description
Functions
GetAt
SetAt
ReadString
WriteString
ReadBSTR
WriteBSTR
ReadWORD
WriteWORD
ReadDWORD
WriteDWORD
ReadInterfacePtr
WriteInterfacePtr
Properties
Size
DataPtr
Events Reference
Messenger Events
OnEvent_Signin
OnEvent_SigninReady
OnEvent_Signout
OnEvent_MyStatusChange
OnEvent_MyNameChange
OnEvent_MyPsmChange
OnEvent_MyMediaChange
OnEvent_ContactSignin
OnEvent_ContactSignout
OnEvent_ContactStatusChange
OnEvent_ContactNameChange
OnEvent_ContactPsmChange
OnEvent_ContactMediaChange
OnEvent_ContactBlocked
OnEvent_ContactUnblocked
OnEvent_ContactListWndCreated
OnEvent_ContactListWndDestroyed
OnEvent_ChatWndCreated
OnEvent_ChatWndDestroyed
OnEvent_ChatWndContactAdded
OnEvent_ChatWndContactRemoved
OnEvent_ChatWndReceiveMessage
OnEvent_ChatWndSendMessage
OnEvent_ChatWndEditKeydown
Messenger Plus! Events
OnEvent_Initialize
OnEvent_Uninitialize
OnEvent_MessengerLocked
OnEvent_MessengerUnlocked
OnEvent_Timer
OnEvent_MenuClicked
OnEvent_EnterPersonalizedStatus
OnEvent_LeavePersonalizedStatus
OnEvent_DownloadFileComplete
OnEvent_UploadFileComplete
OnGetScriptMenu
OnGetScriptCommands
Events Templates
ScriptsCommandTemplate
ToastCallbackTemplate
Interface Windows Events
OnWindowidEvent_Cancel
OnWindowidEvent_Destroyed
OnWindowidEvent_MessageNotification
OnWindowidEvent_CtrlClicked
OnWindowidEvent_ComboSelChanged
OnWindowidEvent_EditTextChanged
OnWindowidEvent_LstBoxSelChanged
OnWindowidEvent_LstBoxDblClicked
OnWindowidEvent_LstViewClicked
OnWindowidEvent_LstViewRClicked
OnWindowidEvent_LstViewDblClicked
OnWindowidEvent_LstViewSelStateChanged
XML Schemas Reference
ScriptInfo File
Information
Examples
Schema Documentation
Interface Windows
Information
Examples
Schema Documentation

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.