enhydraboy

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

MSN6中,可以定义自己的头像。那么自己做的机器人其实也可以显示头像。jmsn没有提供这个特性。
只能自己修改代码了。
关键是协议。我跟踪了msn的通讯协议,发现,首先,你要向服务器申明你的头像信息。这个信息是在<msnobj>实体内实现的。

对方的msn messenger会发现你有头像信息,会通过SS向你发送msn p2p的invite msnmsng请求。然后你回应,传送头像二进制流。就是一个p2p通讯的过程。
目前,还在研究中。发现,每个p2p消息中,都包含了一个48字节的一个头。至于是什么内容,今天刚刚得到一位朋友的指点。
1.  This is a DWORD and contains the SessionID, which is zero when the Clients are negotiating  about the session. This field is only used when actually sending data (DP’s, CE’s etc). The  value of this field in Ink messages is always 64!

2.  This field is again a DWord, which identifies the message (the so called Base Identifier). In  Ink this field has the same value in all messages. In other transfers this value will range  from BaseID - 3 to BaseID + 3. The number can range between 4 and 4,25 billion
(4 ~ 4 250 000 000).

3. This field is a QWord, and contains the offset of the data you are sending, if the size is over  1202 bytes. For example, if you send 2404 bytes, the first message would contain the value  zero (seeing you haven’t send something yet), and the second message would have the value  1202, because you just send 1202 bytes.

4. This field is once again a QWord, and contains the size of total data being send in this total. If there is no data you can leave this to zero and often the Flag field (field 6) should be set to the value of 2.

5. This field is a DWord and contains the size of the data being send in this message. Note that “data” does NOT include the headers, only the data send between the Header and the Footer! For example, when sending a 5000 bytes file, field four would contain the value of 5000, and this field would contain only 1202, because you can’t transfer more than 1202 bytes in one message. This field and the fourth field are equal to each other when you aren’t sending actually file data (or Ink data in our case).


6. The sixth field, DWord, is the Flag field. The value of this field is 0 when no Flags are  specified. It will be 2 when the message is a reply to another message, 8 if there’s an error in  the binary fields of the received packet. The Flag will contain the value 32 if you are sending  DP or CE data, and the value 16777264 when it’s data of a file transfer.

7. This DWord contains the BaseID of the previous received message, *if* the SessionID is not  included in the binary headers, nor in the data sent in this message. Seeing the SessionID is  specified when sending Ink you can just put a random number here (1 ~ 1 000 000 000  would be good enough).

8. This field (A DWord) contains the value of the seventh field of the previous received message.

9. The ninth field is a QWord, and contains the value of the fourth field of the previous received  message.

10. This DWord comes AFTER the data, and therefore it’s the Footer. This DWord contains the  value zero when there is no actual file data (DP’s, CE’s etc) being send. It has the value 1  hen you send DP’s, CE’s or other data, and it has the value 3 when sending Ink.

posted on 2004-06-29 09:03  Enhydraboy  阅读(2008)  评论(1编辑  收藏  举报