The MSN Messenger Protocol Torn Apart: Part 1/3 - Change Your Initial Status
(Page 4 of 7 )
After we are authenticated, the first thing we do is to change our current status. We have a command called CHG. This command helps us to change our current status. This is what we sent to the server to change our initial status:
CHG 7 NLN We have the command identifier CHG. We have the unique transaction id. We also have a parameter called "NLN". NLN tells the server to change our status to online. Like NLN, we have various parameters for other statuses. For example this would be the command we would send the server if we wanted to change our status to Hidden or Invisible:
CHG 7 HDN Yes, HDN is the parameter we send to tell the server to change our status to Hidden/Invisible. There is a list of these parameters and what each one does in Microsoft's official draft on the protocol. I have attached the same at the end of this article.
The server then sends us back this reply confirming the status change:
CHG 7 HDN The reply consists of the command identifier, the transaction id and the current status of the user.
Retrieval of a Few Important Server Messages By now, the client should be ready for a few messages from the server. What are these messages? Well, we could regard them as commands sent to us by the server but commands having a different format. We have seen the standard command format, which looks like this:
<COMMAND IDENTIFIER> <TRANSACTION ID> <PARAMETERS> The message command doesn't in anyway look like this. If we see one such message we would be able to understand the format. As soon as we notify the server of our initial status, the server sends us this message command:
MSG Hotmail Hotmail 450
MIME-Version: 1.0
Content-Type: text/x-msmsgsprofile; charset=UTF-8
LoginTime: 1034601891
EmailEnabled: 1
MemberIdHigh: 93760
MemberIdLow: -52562410
lang_preference: 1033
preferredEmail: neville2150895@hotmail.com
country: IN
PostalCode:
Gender: m
Kid: 0
Age: 19
BDayPre: 2
Birthday: 30245
Wallet: 0
Flags: 1031
sid: 507
kv: 4
MSPAuth: 4voZp65RUDJlf6KzMhWAgJKts*N3Wn8OVQB6AW
JfFNos3D0een95XDaOLIFTt3q6!L7M*cdoHvKQ6*2NrYOaMG7Q$$ This is what the command looks like. We first have MSG, which is the command identifier. The next two parameters, say Hotmail and Hotmail and finally the number 450. The number 450 denotes the total number of bytes in the entire message excluding the current line (The line which has MSG in it, the first line).
Next, we have the mime version and content-type. The mime version would be same in all cases but the mime content-type is "text/x-msmsgsprofile" in this case. The char set of the message is mentioned in the same line thereafter. All the lines after that consist of the mime body.
This message, which the server sent us contains details about the .NET passport we signed into. The body of this message thus contains details of the user signed in like age, gender, birthday, postal code etc.
Another such message we should be ready to except is the following one:
MSG Hotmail Hotmail 221
MIME-Version: 1.0
Content-Type: text/x-msmsgsinitialemailnotification; charset=UTF-8
Inbox-Unread: 0
Folders-Unread: 2
Inbox-URL: /cgi-bin/HoTMaiL
Folders-URL: /cgi-bin/folders
Post-URL: http://www.hotmail.com Again, like all other message commands, this one consists of the command identifier, the two Hotmail parameters and the total number of bytes on the first line. Next we have a mime version, which is the same in all messages and the Content-Type, which is "text/x-msmsgsinitialemailnotification" in this case. We also have the char set on the same line thereafter.
This message contains details about email in the inbox of the user. You must have noticed when you login into your messenger account and you have any new unread mails you are prompted. Well this is the message responsible for that prompt. You see the string Inbox-Unread :0 in the mime body. That shows there are 0 unread mails in your inbox. This message also has a few other details about your inbox.
Again, these are messages that your client may or may not want to respond to. I have just included these in this article to let you know about the entire process in detail. In your version of msn messenger it’s entirely up to you to prompt the user about new mail. In this case if you don’t want your messenger to care about new unread mails in your inbox then you could ignore these messages. The first message sent to us by the server, which has the users .NET passport details passed through, is quite useless.
Next: Order the List >>
More HTML Articles
More By Neville Mehta