📄 clustercreatetempclusterpacket.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.Util;
import edu.tsinghua.lumaqq.qq.beans.QQUser;
/**
* 创建临时群的请求包
* 1. 头部
* 2. 子命令类型,1字节,0x30
* 3. 临时群类型,1字节
* 4. 父群内部ID,4字节
* 5. 名称长度,1字节
* 6. 名称
* 7. 成员QQ号,4字节
* 8. 如果有更多成员,重复6部分
* 10. 尾部
*
* @author luma
*/
public class ClusterCreateTempClusterPacket extends ClusterCommandPacket {
private int parentClusterId;
private String name;
private int[] members;
private byte type;
/**
* @param buf
* @param length
* @param user
* @throws PacketParseException
*/
public ClusterCreateTempClusterPacket(ByteBuffer buf, int length,
QQUser user) throws PacketParseException {
super(buf, length, user);
}
/**
* @param user
*/
public ClusterCreateTempClusterPacket(QQUser user) {
super(user);
subCommand = QQ.QQ_CLUSTER_CMD_CREATE_TEMP_CLUSTER;
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.qq.packets.OutPacket#putBody(java.nio.ByteBuffer)
*/
protected void putBody(ByteBuffer buf) {
// 子命令类型,1字节,0x30
buf.put(subCommand);
// 临时群类型,1字节
buf.put(type);
// 父群内部ID,4字节
buf.putInt(parentClusterId);
// 名称长度,1字节
byte[] b = Util.getBytes(name);
buf.put((byte)(b.length & 0xFF));
// 名称
buf.put(b);
// 成员QQ号,4字节
for(int i = 0; i < members.length; i++)
buf.putInt(members[i]);
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
/**
* @return Returns the parentClusterId.
*/
public int getParentClusterId() {
return parentClusterId;
}
/**
* @param parentClusterId The parentClusterId to set.
*/
public void setParentClusterId(int parentClusterId) {
this.parentClusterId = parentClusterId;
}
/**
* @return Returns the members.
*/
public int[] getMembers() {
return members;
}
/**
* @param members The members to set.
*/
public void setMembers(int[] members) {
this.members = members;
}
/**
* @return Returns the tempType.
*/
public byte getType() {
return type;
}
/**
* @param tempType The tempType to set.
*/
public void setType(byte tempType) {
this.type = tempType;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -