?? getfriendonlinepacket.java
字號:
/*
* LumaQQ - Java QQ Client
*
* Copyright (C) 2004 luma <stubma@163.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package edu.tsinghua.lumaqq.qq.packets.out;
import java.nio.ByteBuffer;
import edu.tsinghua.lumaqq.qq.PacketParseException;
import edu.tsinghua.lumaqq.qq.QQ;
import edu.tsinghua.lumaqq.qq.packets.OutPacket;
/**
* <pre>
* 獲取在線好友列表的請求包,格式為
* 1. 頭部
* 2. 1個字節,只有值為0x02或者0x03時服務器才有反應,不然都是返回0xFF
* 經過初步的試驗,發現3得到的好友都是一些系統服務,號碼比如72000001到72000013,
* 就是那些移動QQ,會員服務之類的;而2是用來得到好友的
* 3. 1個字節,得到好友列表的位置,也就是position,這個position的含義和
* GetFriendListPacket中的position相同,只不過這個position單位是1 byte,
* 當然也有可能GetFriendListPacket中的position也是1 byte,不好說
* 4. 1個未知字節,設成0
* 5. 2個未知字節,設成0
* 6. 尾部
* </pre>
*
* @author 馬若劼
*/
public class GetFriendOnlinePacket extends OutPacket {
// position,缺省設成0
private byte startPosition;
/**
* 構造函數
*/
public GetFriendOnlinePacket() {
super(QQ.QQ_CMD_GET_FRIEND_ONLINE, true);
startPosition = QQ.QQ_FRIEND_ONLINE_LIST_POSITION_START;
}
/**
* @param buf
* @param length
* @throws PacketParseException
*/
public GetFriendOnlinePacket(ByteBuffer buf, int length)
throws PacketParseException {
super(buf, length);
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.qq.packets.OutPacket#putBody(java.nio.ByteBuffer)
*/
protected void putBody(ByteBuffer buf) {
buf.put((byte)0x2);
buf.put(startPosition);
buf.put((byte)0);
buf.put((byte)0);
buf.put((byte)0);
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.qq.packets.OutPacket#parseBody(java.nio.ByteBuffer)
*/
protected void parseBody(ByteBuffer buf) throws PacketParseException {
buf.get();
startPosition = buf.get();
}
/**
* @return Returns the position.
*/
public byte getStartPosition() {
return startPosition;
}
/**
* @param position The position to set.
*/
public void setStartPosition(byte position) {
this.startPosition = position;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -