JML

net.sf.jqql.packets.in
Class DownloadGroupFriendReplyPacket

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.DownloadGroupFriendReplyPacket

public class DownloadGroupFriendReplyPacket
extends BasicInPacket

 reply packet of download group friend list requst, its format is
 1. header
 2. handle byte, download is 0x1
 3. reply code, 1 byte
 4. 4 unknown byte, all 0
 5. beginning friend number of next download packet, 4 byte
 6. firend QQ number, 4 byte
 7. firend type, 0x1 means common friend, 0x4 means group
 8. group sequence, 1 byte, but it's strange, not 1, 2, 3, but sequence multiply 4, for example if is belong group 2,
    then this is 8, note if my friend group is 0, that is maybe not 4 multiple, can't know it's what.
    but divide 4 to get group sequence is still usefull
 9. if has more friend, repeat 4, 5, 6 part
 10. tail

 this packet data parsed can be accessed by hashMap friends, every group is a list, group index is key,
 for example group 0, group 1, parting can get a list object, list include friend QQ number
 请求下载分组好友列表的回复包,格式为
 1. 头部
 2. 操作字节,下载为0x1
 3. 回复码,1字节
 4. 4个未知字节,全0
 5. 下一个下载包的起始好友号,4字节
 6. 好友的QQ号,4字节
 7. 好友类型,0x1表示普通好友,0x4表示群
 8. 分组序号,1字节,但是这个很奇怪,不是1,2,3那样的,而是用序号乘4,比如如果是属于第2个组,
    那么这个就是8,注意我的好友组是第0组,但是有可能这个数字不是4的倍数,那就不知道什么
    意思了,但是除以4得到组序号的方法仍然不受影响
 9. 如果还有更多好友,重复4,5,6部分
 10. 尾部
 
 这个包解析后产生的数据可以通过哈希表friends访问,每一个组为一个list,用组的索引为key,
 比如第0,第1组,分别可以得到一个List对象,list中包含了好友的qq号
 

Author:
luma

Field Summary
 int beginFrom
           
 List<DownloadFriendEntry> friends
           
 byte replyCode
           
 byte subCommand
           
 
Fields inherited from class net.sf.jqql.packets.Packet
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user
 
Constructor Summary
DownloadGroupFriendReplyPacket(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

friends

public List<DownloadFriendEntry> friends

beginFrom

public int beginFrom

replyCode

public byte replyCode

subCommand

public byte subCommand
Constructor Detail

DownloadGroupFriendReplyPacket

public DownloadGroupFriendReplyPacket(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