Dev:MSN Protocol Extensions

Jump to: navigation, search



This text is supposed to define some protocol extensions, not supported by the official MSN protocol, that would be used between non-official MSN clients. For example, a message that has no limit in it's length, and resuming download of a file transfer, encrypted messages, etc...

Long messages Extension

This should allow sending long messages, overriding the protocol limit (400 characters). Right now AMSN splits long messages, but these are received splitted too. With this extension, the client should be able to join the messages when received.

The idea is like that, instead of a message like this :

 MSG 13549 A 561
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 X-MMS-IM-Format: FN=helvetica; EF=; CO=a00000; CS=0; PF=22

we would have this :

 MSG 13549 A 561
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Partial-message: 1432054343 2 5
 X-MMS-IM-Format: FN=helvetica; EF=; CO=a00000; CS=0; PF=22

The new header information is "Partial-message", it would have 3 arguments, the first one being an ID, and ID for the partial message sent... the second arg is the sequence of the message, and the last arg is the total number of messages (so we can free some memory once it's finished).

I think that's all we need to say :)

now here's how to do it in amsn.

Sending the message

Once we send a splitted message, we generate a unique ID.. send the messge with the "Partial-message: $ID $idx $total" where $idx would be an autoincremented variable starting at 1, and $total is the total number of messages ([expr [string length $msg] / 400] with the result being an integer).

Receiving the message

When we receive a message with a header "Partial-message", we should verify that the ID don't already exist.. if it's not, then we create a variable to store it, an array would be fine.. we shouldn't use the chatid for this situation, because it can change if a user joins the conversation in the middle of sending a partial message. but we shouldn't take the risk that 2 people send a partial message with the same ID... to avoid this, we'll use the toplevel widget name. that's a little dangerous because we forget about the abstraction used with the chatid (in re-engineering the code, we should make sure the chatid never changes for a window), anyways, we would use an array like this :

 set longmsg_${win_name}_${ID}(total) $total
 set longmsg_${win_name}_${ID}(used) 1
 set longmsg_${win_name}_${ID}(1) [$tw index end]

so we would store in the array, the total number of messages, and the number of used messages (we increment it by 1 everytime we get a partial message for that id, and once it's equal to $total, we unset the variable).Then we set for the array, with a name equal to the partial message sequence, the inserting point where the text should be inserted in the widget... (which is the end of the widget index). Once we receive a message and the ID already exists, we get it's sequence -1 (if we receive msg with $seq = 2, we search for $longmsg_${win_name}_${ID}([expr $seq -1]), then instead of inserting the text in the end index, we insert it in the index stored in the array. Now we get a problem for retreiving the next inserting point.. because we can't use end... we don't know if we received other messages meanwhile.. and we can't use the previous inserting point + $msglen because we don't know if we got smileys in that message... if anyone has any ideas.. please post. anyways, once we get the next inserting point, we store it.. we increment the "used" array entry.. and we verify, if user == total, we unset the array. and it's DONE.

Any comments, fixes, rephrasing my words because I don't know how to explain anything... would be welcome ;)

Real time chat (extended typing notification)

Another kind of non-official messages, that someone told about some time ago, is kind of "ICQ real time chat", were you can see what the other people is typing (did you try it?).

The idea would be to include extra information in the typing notification messages, so you can see what the other people is typing in real time. So, the contents of the input box would be sent on the typing notification too, if the user enabled that feature.

Message encryption

This was discussed some time ago. It looks like gaim supports it, maybe we should take a look to be compatble:

gaim encryption

Personal tools