JML

net.sf.jqql.packets.out
Class GetOnlineOpPacket

java.lang.Object
  extended by net.sf.jqql.packets.Packet
      extended by net.sf.jqql.packets.OutPacket
          extended by net.sf.jqql.packets.BasicOutPacket
              extended by net.sf.jqql.packets.out.GetOnlineOpPacket

public class GetOnlineOpPacket
extends BasicOutPacket

 get online friend list request packet, format:
 1. head
 2. 1 byte, server resposes for value 0x02 or 0x03, or else return 0xFF
    via initial test, we find that 3 get friends that are all system service, number like 72000001
    to 72000013, are QQ mobile, member service and so on; and 2 is used to get friends.
 3. intial position, 4 byte. This initial position has  totally different meaning from the field from the friend list we get. May be
     they are designed by two teams.
      the inital position need reply packet to get. As we know, online friend reply packet can at most get 30 friends for one time.
    If your online friends count exceeds 30, you need to cout the value. The first request packet, the field surely 0, later request
    packet is relatd to the previous one. The concrete rule is like this, find the biggest QQ number in 30 friends from the previus reply
    packet, and then add 1 to his QQ number, and it's next request packet initial position.
 6. tail
 获取在线好友列表的请求包,格式为
 1. 头部
 2. 1个字节,只有值为0x02或者0x03时服务器才有反应,不然都是返回0xFF
    经过初步的试验,发现3得到的好友都是一些系统服务,号码比如72000001到72000013,
    就是那些移动QQ,会员服务之类的;而2是用来得到好友的
 3. 起始位置,4字节。这个起始位置的含义与得到好友列表中的字段完全不同。估计是两拨人
    设计的,-_-!...
    这个起始位置需要有回复包得到,我们已经知道,在线好友的回复包一次最多返回30个好友,
    那么如果你的在线好友超过30个,就需要计算这个值。第一个请求包,这个字段肯定是0,后面
    的请求包和前一个回复包就是相关的了。具体的规则是这样的,在前一个回复包中的30个好友里面,
    找到QQ号最大的那个,然后把他的QQ号加1,就是下一个请求包的起始位置了!
 6. 尾部
 

Author:
luma

Field Summary
 
Fields inherited from class net.sf.jqql.packets.OutPacket
ack, key, resendCountDown, sendCount, seq, timeout
 
Fields inherited from class net.sf.jqql.packets.Packet
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user
 
Constructor Summary
GetOnlineOpPacket(ByteBuffer buf, int length, QQUser user)
           
GetOnlineOpPacket(QQUser user)
          constructor 构造函数
 
Method Summary
 String getPacketName()
           
 int getStartPosition()
           
 byte getSubCommand()
           
protected  void putBody(ByteBuffer buf)
          initialize packet body 初始化包体
 void setStartPosition(int position)
           
 void setSubCommand(byte subCommand)
           
 
Methods inherited from class net.sf.jqql.packets.BasicOutPacket
decryptBody, encryptBody, getBodyBytes, getCryptographStart, getFamily, getHeadLength, getLength, getTailLength, parseHeader, parseTail, postFill, putHead, putTail, toString, validateHeader
 
Methods inherited from class net.sf.jqql.packets.OutPacket
dump, fill, getKey, getNextSeq, getSendCount, getTimeout, needAck, needResend, parseBody, setKey, setSendCount, setTimeout
 
Methods inherited from class net.sf.jqql.packets.Packet
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
 

Constructor Detail

GetOnlineOpPacket

public GetOnlineOpPacket(QQUser user)
constructor 构造函数


GetOnlineOpPacket

public GetOnlineOpPacket(ByteBuffer buf,
                         int length,
                         QQUser user)
                  throws PacketParseException
Parameters:
buf -
length -
Throws:
PacketParseException
Method Detail

getPacketName

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

putBody

protected void putBody(ByteBuffer buf)
Description copied from class: Packet
initialize packet body 初始化包体

Specified by:
putBody in class Packet
Parameters:
buf - ByteBuffer

getStartPosition

public int getStartPosition()
Returns:
Returns the position.

setStartPosition

public void setStartPosition(int position)
Parameters:
position - The position to set.

getSubCommand

public byte getSubCommand()
Returns:
Returns the subCommand.

setSubCommand

public void setSubCommand(byte subCommand)
Parameters:
subCommand - The subCommand to set.

JML