|
From Plugins to Scripts
This document is intended to be read by developers familiar with
the old plugin system of Messenger Plus! 3.
The old plugins system previously offered by Messenger Plus! has
been deprecated and is no longer supported by Messenger Plus! Live.
Developers of such plugins are faced with two options when
upgrading their old plugins for Messenger Plus Live!:
- Create a script proxy that will call their old plugin DLL.
- Recreate their features from scratch in the new Messenger Plus!
Live scripting system.
If you're in a hurry, solution 1 may sound appealing so you may
want to know that this solution comes with a couple of limitations.
First, the scripting API does not give direct access to the old
Messenger COM object (from the days of Windows Messenger 4) which
means that if your plugin was using the "iMessengerObj" or
"oMessenger" parameter of Initialize, it will need to be
modified to work in the new system. Also, if your plugin was
created with the C/C++ interface (as opposed to the VB interface),
you will need to use a DataBloc object to create the structure
parameters for functions like ParseCommand.
Recreating your features directly in the scripting system may
take longer but will bring several new advantages. The main obvious
one is the rich API offered by the scripting system compared to the
one that was available for plugins. Your script will be able to do
much more and with less code. You'll also be able to take advantage
of the interface windows
feature of Messenger Plus! Live and create windows for your script
that will completely blend in Messenger. Nevertheless, if you want
to directly load your old plugin DLL, here is how to do it:
//Load a C plugin DLL
function LoadPlugin_Dll(DllPath)
{
if(Interop.Call(DllPath, "Initialize", 8, "", 0) == 1)
Debug.Trace("The C plugin has been initialized");
}
//Load a VB ActiveX object
function LoadPlugin_VB(ProgId)
{
var PluginObj = new ActiveXObject(ProgId);
if(PluginObj)
{
if(PluginObj.Initialize(8, "", undefined) == true)
Debug.Trace("The VB plugin has been initialized");
}
}
Here is an upgrade listing that will
help you make the switch from the old system to the new one.
C/C++ Developers:
| Plugins Interface |
Scripting System |
Additional Information |
| Initialize
|
OnEvent_Initialize
OnEvent_Signin
|
You should send 8 for the
nVersion parameter.
sUserEmail is an empty string when
called from OnEvent_Initialize and Email when called from OnEvent_Signin.
iMessengerObj must be null (send
0). |
| Uninitialize
|
OnEvent_Uninitialize
OnEvent_Signout
|
None. |
| Configure
|
OnGetScriptMenu
OnEvent_MenuClicked
|
Scripts create their own menus with OnGetScriptMenu or the
ScriptInfo file. You can
create your own "Configure" menu from there. |
| PublishInfo
|
OnGetScriptCommands
|
Scripts return the list of commands they support in
OnGetScriptCommands or specify them in the ScriptInfo file. This information
is used for informational purposes only in windows such as the
Command Helper. It is the responsibility of scripts to parse every
message sent for eventual commands or tags to replace. |
| ParseCommand
|
OnEvent_ChatWndSendMessage
|
Messenger Plus! Live does not search for specific script
commands in messages sent by the user. Instead, every message is
sent to scripts so that they can do their own analysis of the
message. This removes the need for all your commands to start with
"/x" and gives you much more flexibility for the output.
pParam->iConversationWnd must be
null (send 0).
pParam->sContactName should be an
empty string. |
| ParseTag
|
OnEvent_ChatWndSendMessage
|
Messenger Plus! Live does not search for specific script tags
in messages sent by the user. Instead, every message is sent to
scripts so that they can do their own analysis of the message. This
removes the need for all your tags to start with "!X" and gives you
much more flexibility for the output.
pParam->iConversationWnd must be
null (send 0).
pParam->sContactName should be an
empty string. |
| ReceiveNotify
|
OnEvent_ChatWndReceiveMessage
|
Messenger Plus! Live does not search for specific markers in
messages that are received. Instead, every message is sent to
scripts so that they can do their own analysis of the message.
pParam->iConversationWnd must be
null (send 0).
pParam->sContactName is set to the
Origin parameter of the event. |
| DisplayToast
|
MsgPlus.DisplayToast
MsgPlus.DisplayToastContact
|
None. |
| SetNewName
|
Messenger.MyName
|
None. |
| AddEventEntry
|
MsgPlus.LogEvent
|
None. |
Additional note: when calling your old
C/C++ plugin, make sure to convert your strings to ANSI if your
plugin was not using the Unicode handlers. In JScript, every string
is Unicode by default.
Visual Basic Developers:
| Plugins Interface |
Scripting System |
Additional Information |
| Initialize
|
OnEvent_Initialize
OnEvent_Signin
|
You should send 8 for the
nVersion parameter.
sUserEmail is an empty string when
called from OnEvent_Initialize and Email when called from OnEvent_Signin.
oMessenger must be undefined. |
| Uninitialize
|
OnEvent_Uninitialize
OnEvent_Signout
|
None. |
| Configure
|
OnGetScriptMenu
OnEvent_MenuClicked
|
Scripts create their own menus with OnGetScriptMenu or the
ScriptInfo file. You can
create your own "Configure" menu from there. |
GetPublishInfo
GetPublishCommandInfo
|
OnGetScriptCommands
|
Scripts return the list of commands they support in
OnGetScriptCommands or specify them in the ScriptInfo file. This information
is used for informational purposes only in windows such as the
Command Helper. It is the responsibility of scripts to parse every
message sent for eventual commands or tags to replace. |
| GetPublishTagInfo
|
None |
Scripts should create entries in their own menu. |
| ParseCommand
|
OnEvent_ChatWndSendMessage
|
Messenger Plus! Live does not search for specific script
commands in messages sent by the user. Instead, every message is
sent to scripts so that they can do their own analysis of the
message. This removes the need for all your commands to start with
"/x" and gives you much more flexibility for the output.
oConversationWnd must be undefined. |
| ParseTag
|
OnEvent_ChatWndSendMessage
|
Messenger Plus! Live does not search for specific script tags
in messages sent by the user. Instead, every message is sent to
scripts so that they can do their own analysis of the message. This
removes the need for all your tags to start with "!X" and gives you
much more flexibility for the output.
oConversationWnd must be undefined. |
| ReceiveNotify
|
OnEvent_ChatWndReceiveMessage
|
Messenger Plus! Live does not search for specific markers in
messages that are received. Instead, every message is sent to
scripts so that they can do their own analysis of the message.
oConversationWnd must be undefined.
sContactName is set to the
Origin parameter of the event. |
| DisplayToast
|
MsgPlus.DisplayToast
MsgPlus.DisplayToastContact
|
None. |
| SetNewName
|
Messenger.MyName
|
None. |
| AddEventEntry
|
MsgPlus.LogEvent
|
None. |
See Also
Interop Object, DataBloc Object, JScript's
ActiveXObject.
|