Introduction
Based on previous article (Creating Windows Live Messenger Addins by Filip van der Meeren), this article shows how to build a slightly more complex addin for our MSN Messenger Live. Built step by step as my mind or friends suggested features, at this point of its evolution, this addin includes:
- Macro: to activate / deactivate feature, run commands and settings
- Responder: an autoresponder, customizable by user to reply, message and costants
- Links: a simple, and not ever perfect, engine to keep tracks of URLs in our conversations
- Encryption: a bit less user friendly (not my fault) way to have an ecrypted chat
- Import/Export: all that stuff is nice, but i use MSN on many PC, so here it is, serializations and XML config file.
Background
In the article by Filip, we saw how it was simple to expand our chat experience in less than 10 minutes. But what if we want something bit more complex? Actually, the addin-system is not that powerful as I thought it was. Maybe cause security needs, or a desired behaviour. In the addin system, we have Incoming and Outcoming events for messaging: the foundations of our addin. As a consequence we have methods to send to user or from user: text messages, nudges or actions. Here we found first obstacle.
There's no way to know if the user is sending us the message is human or another addin. Better if the Incoming event is not fired when another addin writes to us. If this is in a first view it is a nice way to bypass a bad loop (for moron programmers) like two autoresponders exchanging the same <I'm away>; in the other hand, it gives me the "pleasure" to make stuff less user friendly, especially in Encryption. Maybe in the next MSNML they could give us a extended User class. Another behavior I disliked a bit, just for anesthetics, is when a message is canceled; the addin engine warns us about replying to the canceled message, but if I canceled it...maybe it's cause I do not want to see it again, no? (Use macro for an example)
Using the addin
What's cool in this addin? From beginner to intermediate, I think there's so-so-so-simple XML serialization, bidirectional encryption, and links "harvesting" (just because I found this so useful).
How to use this addin is extremely simple (to me ):
Autoresponder
you can specify a "message to all" simply with an empty string in the user field. Otherwise, the user could be a "part" of the friendly name. I.e. "desk" for "DesktopKing". By the way, "desk" could also match "Deskopulos", so be careful. No regular expression are used.
Two simple constants can be used, "%M" and "%U" to create funny responder messages.
The Autoresponder can be switched on/off writing the matching macro as a simple message, it will be canceled (so no remote user can see that). By default the macro is "!res".
Encryption
This is the most amazing feature (not totally my fault!). Definitions creation is the same as the autoresponder but there does not exist a password, so user has to be always declared.
Now, what happen when I wrote "Hello world" to my friend?
Simply, because the other side's addin will not wakeup at our addin's send-message, we have to send encrypted text semi-automatically. This means: we write "Hello world", a popup dialog appears, we can confirm to encrypt or cancel.
Cancel: text will be sent as no addin in the middle, in clear text
Encrypt: we will have the encrypted sentences in the windows clipboard. Popup will close, and all we have to do is to paste (I told you semi-automatic) into messenger and hit send. I know what are you thinking, "now the popup will appear again..and re-encrypt", almost, but the addin will recognize encrypted text for that user and let it go untouched.
On the popup you have both in received and sentmessages, and history (unless you are able to decrypt in mind encrypted text).
Links harvesting
Here we have, an image from link popup, called by default macro "!lnk". We can double click to open new default browser at given URL, or automatically Send it to our chatting friend. I like this to keep track of all links i receive for contacts, and have always available also in future. Yes because links are saved inside the setting file.
Points of Interest
I know, I don't show any source code, because I know you can see source inside the embedded project, and because there's no extreme level programming inside. So why this article? To show how much can be in a limited time to expand our "beloved" program. I'll be happy to any comments, constructive or destructive, if you use it and find it useful, I'd like to hear.
How to install
You need to modify registry to allow addin use (see base article for that). You need to registry DLL in the GAC. How to, without VS2005? Simply drag'n'drop DLL into "C:\Windows\Assembly" (or whatever else yours is) folder, than add it to MSNML.
History
Yet no history at all, maybe if someone will include a better regex url grab, or a workaround for semi-automatic encryption.