HTML
  Home arrow HTML arrow Page 6 - The MSN Messenger Protocol Torn Apart: Par...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

The MSN Messenger Protocol Torn Apart: Part 1/3
By: Neville Mehta
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 88
    2002-10-20

    Table of Contents:
  • The MSN Messenger Protocol Torn Apart: Part 1/3
  • Digging Into the Protocol
  • The Workings of the Protocol
  • Change Your Initial Status
  • Order the List
  • User Statuses
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The MSN Messenger Protocol Torn Apart: Part 1/3 - User Statuses


    (Page 6 of 7 )

    Every time a user comes online your msn messenger alerts you, doesn't it? The client knows when this happens because the server tells it. That's what your client should be ready to handle. The server uses NLN and FLN commands to tell us the real time status of users. Lets have a closer look:

    NLN AWY yourpal1@hotmail.com Pal1
    FLN yourpal2@hotmail.com


    Look at the first command. It begins with the NLN command identifier. The NLN command notifies the client when users go online or their online state changes. The NLN command doesn't contain any transaction id because you really don't need to respond to this message (respond as in respond back to the server with a command). It's just to let you know that a users online state has changed. After that we have the current state of the user. 'AWY' in this case means the user has changed his status to away. After that we have the respective users email id and his screen name.

    Let's have a look at the second command. It's the FLN command identifier. The FLN command notifies the client when the user goes offline. Again, this command doesn't have a transaction id (the same reason why the NLN command doesn't have a transaction id). This command sends us just one more parameter, which is the users email id that has gone offline.

    Challenges
    In order to make sure that your msn client is active, the server keeps sending something called challenges at regular intervals. These commands are sent at random times. Let me show you what these commands are and how you should respond to them. This is a typical challenge message the server would send you:

    CHL 0 90938290383838737622

    It contains the command identifier CHL. Next we have a transaction id, which is 0. Whenever the server needs to send you any commands it usually would use the transaction id of 0. The final parameter is a challenge string.

    What you would have to do is take this challenge string, concatenate it with the string 'Q1P7W2E4J9R8U3S5' and encrypt the resultant string with the MD5 algorithm. So in this case you would encrypt '90938290383838737622Q1P7W2E4J9R8U3S5' using the MD5 algorithm and send it back to the server. We would send a reply, which looked like this:

    QRY 9 msmsgs@msnmsgr.com 32
    1293ft670983hydr5423yhdv67f6f4f5


    We respond to this challenge with the QRY command. We send with it an all-new unique transaction id. Next, we send the string 'msmsgs@msnmsgr.com' and finally the number 32. 32 denotes the number of bytes in the command excluding the current line, which contains the QRY command identifier. After that we have a line break and we send the encrypted MD5 digest along.

    The server would respond back with this message:

    QRY 10

    The server sends you the QRY command with the same transaction id you had used to send the server the answer of the challenge i.e. 10. Receiving this message would mean you have successfully passed the challenge. In case you fail to challenge, the server would disconnect you and send you an error command.

    Server Messages
    There are a few other server messages that the server sends to us on a few occasions. Again, it's up to you to respond to them or not.

    This is the message command the server sends to us when we receive a new email:

    MSG Hotmail Hotmail 340
    MIME-Version: 1.0
    Content-Type: text/x-msmsgsemailnotification; charset=UTF-8

    From: Mehta
    Message-URL: /cgi-bin/getmsg?msg=MSG1029401739.3&start=1610592&
                  len=402&curmbox=ACTIVE
    Post-URL: https://lc1.law13.hotmail.passport.com
                         /ppsecure/domessengerlogin/EN
    Subject: Hi
    Dest-Folder: ACTIVE
    From-Addr: example@passport.com
    id: 2


    The first 3 lines I have already explained earlier. The Content-Type of this message is 'text/x-msmsgsemailnotification'. The mime body again contains the details about the new email message, which has just arrived. It contains details like its subject, who it is from, which email id is it from etc.

    This is the message the server sends to us when delete an email from our inbox:

    MSG Hotmail Hotmail 145
    MIME-Version: 1.0
    Content-Type: text/x-msmsgsactivemailnotification; charset=UTF-8

    Src-Folder: ACTIVE
    Dest-Folder: trash
    Message-Delta: 1


    The first 3 lines are explained earlier. The Content-Type of this message is 'text/x-msmsgsactivemailnotification'. The mime body again contains the details about the inbox and message deleted.

    More HTML Articles
    More By Neville Mehta


       · Hello, im 15 years old vb programmer and i want to make a clone of msn messenger...
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek