JML

net.sf.jqql.packets.in
Class SystemNotificationPacket

java.lang.Object
  extended by net.sf.jqql.packets.Packet
      extended by net.sf.jqql.packets.InPacket
          extended by net.sf.jqql.packets.BasicInPacket
              extended by net.sf.jqql.packets.in.SystemNotificationPacket

public class SystemNotificationPacket
extends BasicInPacket

 system notification packet, is there any difference between system info and system notification of ReceiveIMPacket?
 system notification means message that you haven't been added friend, so have source and purpose, other haven't 
 received, system notification is sent to everybody by system.
 system notification format is:
 1. header, header means system notification type, now known have 4
 2. for common system notification, its formate is:
         many field divided by ox1F, for known type, parting is message type, source,  
         purpose, extra content. for unknown
         type, front three is the same, after is unknown
    of QQ_SYS_BEING_ADDED_EX, message text format is:
    i. byte length of follow content 
    ii. unknown content, don't know how to decrypt
   
    of QQ_SYS_ADD_FRIEND_REQUEST_EX, message text format is:
    i. byte length of message text
    ii. message text
    iii. whether allow the other side to add me as friend, 0x01 means yes, 0x02 means not
    
    of QQ_SYS_ADD_FRIEND_APPROVED_AND_ADD, message text format is:
    i. unknown 1 byte, 0x00
 3. tail

 系统消息包,系统消息和ReceiveIMPacket里面的系统通知有什么区别呢?
 系统消息是表示你被别人加为好友了之类的消息,所以有源有目的,其他人
 收不到的,系统通知是系统发给大家的消息。好了,废话这么多,系统消息的
 格式是:
 1. 头部,头部说明了系统消息的类型,目前已知的有四种
 2. 对于一般的系统通知,其格式为:
       以0x1F相隔的多个字段,对于已知的类型,分别是消息类型,源,目的,附加内容,对于未知的
    消息类型,前面三个是一样的,后面的就未知了
    
    对于QQ_SYS_BEING_ADDED_EX,消息正文的格式为:
    i. 后面内容的字节长度
    ii. 未知内容,不知用什么才能解密
    
    对于QQ_SYS_ADD_FRIEND_REQUEST_EX,其消息正文的格式为
    i. 消息正文字节长度
    ii. 消息正文
    iii. 是否允许对方加自己为好友,0x01表示允许,0x02表示不允许
    
    对于QQ_SYS_ADD_FRIEND_APPROVED_AND_ADD,其消息正文的格式为
    i. 未知的1字节,0x00
 3. 尾部
 
Note: only use 0x00A8 of 2005 to send authentication message, will receive QQ_SYS_ADD_FRIEND_REQUEST_EX message Note: 只有使用2005的0x00A8发送认证消息,才会收到QQ_SYS_ADD_FRIEND_REQUEST_EX消息

Author:
luma

Field Summary
 boolean allowAddReverse
           
static String DIVIDER
           
 int from
           
 String message
           
 int to
           
 int type
           
 
Fields inherited from class net.sf.jqql.packets.Packet
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user
 
Constructor Summary
SystemNotificationPacket(ByteBuffer buf, int length, QQUser user)
          constructed function 构造函数
 
Method Summary
 String getPacketName()
           
protected  void parseBody(ByteBuffer buf)
          parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起
 
Methods inherited from class net.sf.jqql.packets.BasicInPacket
decryptBody, encryptBody, getBodyBytes, getCryptographStart, getFamily, getHeadLength, getLength, getTailLength, parseHeader, parseTail, putBody, putHead, putTail, toString
 
Methods inherited from class net.sf.jqql.packets.InPacket
validateHeader
 
Methods inherited from class net.sf.jqql.packets.Packet
dump, equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, setDuplicated, setHeader, setSequence
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DIVIDER

public static final String DIVIDER

type

public int type

from

public int from

to

public int to

message

public String message

allowAddReverse

public boolean allowAddReverse
Constructor Detail

SystemNotificationPacket

public SystemNotificationPacket(ByteBuffer buf,
                                int length,
                                QQUser user)
                         throws PacketParseException
constructed function 构造函数

Parameters:
buf - 缓冲区 // buffer
length - 包长度 // packet length
Throws:
PacketParseException - 解析出错 // parse error
Method Detail

getPacketName

public String getPacketName()
Overrides:
getPacketName in class BasicInPacket
Returns:
descriptive name of packet 包的描述性名称

parseBody

protected void parseBody(ByteBuffer buf)
                  throws PacketParseException
Description copied from class: Packet
parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起

Specified by:
parseBody in class Packet
Parameters:
buf - ByteBuffer
Throws:
PacketParseException - if parse error 如果解析出错

JML