net.sf.jqql.packets.out
Class ClusterSendIMExPacket
java.lang.Object
net.sf.jqql.packets.Packet
net.sf.jqql.packets.OutPacket
net.sf.jqql.packets.BasicOutPacket
net.sf.jqql.packets.out.ClusterCommandPacket
net.sf.jqql.packets.out.ClusterSendIMExPacket
- Direct Known Subclasses:
- ClusterSendTempIMPacket
public class ClusterSendIMExPacket
- extends ClusterCommandPacket
EX fixed cluster message sending packet, has more flags, compared to current fixed cluster message sending packet.
For Compatibility, the TX is remained.
1. head
2. subcommand, 1 byte, 0x1A
3. cluster internal ID, 4 byte
4. total length of data behind, 2 byte
5. Content Type, 2 byte, 0x0001 is plain text, 0x0002 means exists custom face.
6. message fragment count, 1 byte. cluster message fragment at most as large as 700 byte, but this is differnet from normal message:
this 700 byte contains these control info
7. fragment sequence, 1 byte, begin from 0
8. message id, 2 byte, the same message of different fragment has the same id.
9. 4 byte, unknown.
10. message content, append space to the last fragment
Note: space in tail is a must. Without the space, it will cause some default face to present as mess code.
11. message tail, contain some message parameter, like font color, and so on. The order is:
1. font decoration attribute, bold, tialic and so on. 2 byte, concrete setting is:
i. bit0-bit4 is used to present font size, thus the largest is 32
ii. bit5 presents bold or not
iii. bit6 presents italic or not
iv. bit7 presents underline or not
2. color Red,, 1 byte
3. color Green, 1 byte
4. color Blue, 1 byte
5. 1 unknown byte, set 0 first
6. message encoding, 2 byte, 0x8602 is GB, 0x0000 is EN, other unknown, seems can be custom, for server seems not to interfere
7. a piece of length changable info, after the font name is an enter, like 0xcb, 0xcc, 0xe5 presents SongTi
12. 1 byte, present the length of part 11 and 12
13. tail
Notice: only the last fragment has part 11 and 12.
扩展固定群消息发送包,相对于已经有的固定群消息发送包来说,这个多了一些标志,
同时旧的群消息发送包为了兼容性的考虑TX依然保留:
1. 头部
2. 子命令,1字节,0x1A
3. 群内部ID,4字节
4. 后面的数据的总长度,2字节
5. Content Type, 2字节,0x0001表示纯文件,0x0002表示有自定义表情
6. 消息分片数,1字节。群消息分片也是最大700字节,但是这个和普通消息不一样的是:这个700包含了这些控制信息
7. 分片序号,1字节,从0开始
8. 消息id,2字节,同一条消息的不同分片id相同
9. 4字节,未知
10. 消息内容,最后一个分片追加空格
Note: 结尾处的空格是必须的,如果不追加空格,会导致有些缺省表情显示为乱码
11. 消息的尾部,包含一些消息的参数,比如字体颜色啦,等等等等,顺序是
1. 字体修饰属性,bold,italic之类的,2字节,具体的设置是
i. bit0-bit4用来表示字体大小,所以最大是32
ii. bit5表示是否bold
iii. bit6表示是否italic
iv. bit7表示是否underline
2. 颜色Red,1字节
3. 颜色Green,1字节
4. 颜色Blue,1字节
5. 1个未知字节,置0先
6. 消息编码,2字节,0x8602为GB,0x0000为EN,其他未知,好像可以自定义,因为服务器好像不干涉
7. 可变长度的一段信息,字体名后面跟一个回车符,比如0xcb, 0xce, 0xcc, 0xe5,表示宋体
12. 1字节,表示11和12部分的字节长度
13. 尾部
注意:只有最后一个分片有11, 12部分
- Author:
- luma
Fields inherited from class net.sf.jqql.packets.Packet |
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user |
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, setKey, setSendCount, setTimeout |
Methods inherited from class net.sf.jqql.packets.Packet |
equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, setDuplicated, setHeader, setSequence |
fontStyle
protected FontStyle fontStyle
message
protected String message
totalFragments
protected int totalFragments
fragmentSequence
protected int fragmentSequence
messageId
protected char messageId
ClusterSendIMExPacket
public ClusterSendIMExPacket(QQUser user)
- Parameters:
user
-
ClusterSendIMExPacket
public ClusterSendIMExPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
- Parameters:
buf
- length
- user
-
- Throws:
PacketParseException
getPacketName
public String getPacketName()
- Overrides:
getPacketName
in class ClusterCommandPacket
- Returns:
- descriptive name of packet
包的描述性名称
putBody
protected void putBody(ByteBuffer buf)
- Description copied from class:
Packet
- initialize packet body
初始化包体
- Overrides:
putBody
in class ClusterCommandPacket
- Parameters:
buf
- ByteBuffer
getFragmentSequence
public int getFragmentSequence()
- Returns:
- Returns the fragmentSequence.
setFragmentSequence
public void setFragmentSequence(int fragmentSequence)
- Parameters:
fragmentSequence
- The fragmentSequence to set.
getTotalFragments
public int getTotalFragments()
- Returns:
- Returns the totalFragments.
setTotalFragments
public void setTotalFragments(int totalFragments)
- Parameters:
totalFragments
- The totalFragments to set.
getMessageId
public char getMessageId()
- Returns:
- Returns the messageId.
setMessageId
public void setMessageId(char messageId)
- Parameters:
messageId
- The messageId to set.
getMessage
public String getMessage()
- Returns:
- Returns the message.
setMessage
public void setMessage(String message)
- Parameters:
message
- The message to set.
getBlue
public int getBlue()
- Returns:
- Returns the blue.
setBlue
public void setBlue(int blue)
- Parameters:
blue
- The blue to set.
isBold
public boolean isBold()
- Returns:
- Returns the bold.
setBold
public void setBold(boolean bold)
- Parameters:
bold
- The bold to set.
getEncoding
public char getEncoding()
- Returns:
- Returns the encoding.
setEncoding
public void setEncoding(char encoding)
- Parameters:
encoding
- The encoding to set.
getFontName
public String getFontName()
- Returns:
- Returns the fontName.
setFontName
public void setFontName(String fontName)
- Parameters:
fontName
- The fontName to set.
getGreen
public int getGreen()
- Returns:
- Returns the green.
setGreen
public void setGreen(int green)
- Parameters:
green
- The green to set.
isItalic
public boolean isItalic()
- Returns:
- Returns the italic.
setItalic
public void setItalic(boolean italic)
- Parameters:
italic
- The italic to set.
getRed
public int getRed()
- Returns:
- Returns the red.
setRed
public void setRed(int red)
- Parameters:
red
- The red to set.
isUnderline
public boolean isUnderline()
- Returns:
- Returns the underline.
setUnderline
public void setUnderline(boolean underline)
- Parameters:
underline
- The underline to set.
getFontSize
public int getFontSize()
- Returns:
- Returns the fontSize.
setFontSize
public void setFontSize(int fontSize)
- Parameters:
fontSize
- The fontSize to set.