net.sf.jqql.packets.out
Class SendIMPacket
java.lang.Object
net.sf.jqql.packets.Packet
net.sf.jqql.packets.OutPacket
net.sf.jqql.packets.BasicOutPacket
net.sf.jqql.packets.out.SendIMPacket
public class SendIMPacket
- extends BasicOutPacket
message sent packet, format:
1. head
2. sender's QQ number, 4 byte
3. receiver's QQ number, 4 byte
4. sender's QQ version, 2 byte
5. sender's QQ number, 4 byte
6. receiver's QQ number, 4 byte(amazing, duplicated QQ number for sender and receiver)
7. md5 1 time processed result of sender's QQ number and session key.
8. message type, 2 byte
9. session ID, 2 byte. If the operation need to send several packets to finish. The id of the packets should be the same.
10. send time, 4 byte
11. sender's head, 2 byte
12. font infor, 4 byte, set to 0x00000001, unkown meaning
13. message fragment count, 1 byte. If it' s quite a long message, here need to set a fragment value. QQ is 700 byte for a fragment
by default. This 700 byte is pure message, exclude any other part.
14. fragment sequence, 1 byte, begin with 0
发送消息的包,格式为
1. 头部
2. 发送者QQ号,4个字节
3. 接收者的QQ号,4个字节
4. 发送者QQ版本,2字节
5. 发送者QQ号,4字节
6. 接收者QQ号,4个字节(奇怪,为什么要搞两个在里面)
7. 发送者QQ号和session key合在一起用md5处理一次的结果,16字节
8. 消息类型,2字节
9. 会话ID,2字节,如果是一个操作需要发送多个包才能完成,则这个id必须一致
10. 发送时间,4字节
11. 发送者头像,2字节
12. 字体信息,4字节,设成0x00000001吧,不懂具体意思
13. 消息分片数,1字节,如果消息比较长,这里要置一个分片值,QQ缺省是700字节一个分片,这个700字节是纯消息,
不包含其他部分
14. 分片序号,1字节,从0开始
15. message id, 2 byte. different fragment of the same message has the same id
16. message manner, is sent by human or auto reply, 1 byte
17. message content, the last fragment should be appended to with a space.
Note: the ending space is a must, without it, cause some default face to be shown as mess code
18. message tail, include some message parameter, like font color and so on, order in:
1. font decoration attribute, bold, italic and etc, 2 byte, digits known are:
i. bit0-bit4 used to indicate font size, so the max size is 32
ii. bit5 to indicate bold or not
iii, bit6 to indicate italic or not
iv. bit7 to indicate 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, seem to customable, for server doesn't
interfere.
7. font name, like 0xcb, 0xce, 0xcc, 0xe5
19. 1 byte, stands for byte length of part 18, 19
20. tail
15. 消息的id,2字节,同一条消息的不同分片id相同
16. 消息方式,是发送的,还是自动回复的,1字节
17. 消息内容,最后一个分片的结尾需要追加一个空格。
Note: 结尾处的空格是必须的,如果不追加空格,会导致有些缺省表情显示为乱码
18. 消息的尾部,包含一些消息的参数,比如字体颜色啦,等等等等,顺序是
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表示宋体
19. 1字节,表示18和19部分的字节长度
20. 包尾部
requst send file packet, another usage of this packet, format is:
1- 14. part 1-14 are the same, only part 8 is some part different. For UDP request, part 8 is 0x0035. For TCP
it's 0x0001
15-17. I doubt it's the same as the one of send message packet. However, in this situation, this part is not used, filled with 0
11 byte 0 total
18. transfer type, 1 byte, indicate send file or send face
19. connection mode byte, UDP is 0, TCP is 3
20. 4 byte sender's external IP(may be proxy's IP)
21. 2 byte sender's port
22. 2 byte port, first listening port, TCP has no this part
23. 4 byte address, read IP
24. 2 byte port, second listerning port
25. space is appended to the end. 1 byte, 0x20
26. delimiter 0x1F
27. name of file to send
28. delimiter 0x1F
29. append "byte" in Chinese form to the back of byte count which is in string form. Fox example, if the file size
is 3 byte, this is "3 byte" in string form and in Chinese form.
30. tail
请求传送文件的包,这是这个包的另一种用法,其格式为
1 - 14. 1到14部分均与发送消息包相同,只有第8部分不同,对于UDP的请求,8部分是0x0035,对于TCP,是0x0001
15 - 17. 怀疑也和发送消息包相同,但是在这种情况中,这部分没有使用,为全0,一共11个0字节
18. 传输类型,1字节,表示是传文件还是传表情
19. 连接方式字节,UDP是0, TCP是3
20. 4个字节的发送者外部ip地址(也就是可能为代理地址)
21. 2个字节的发送者端口
22. 2个字节的端口,第一个监听端口,TCP没有这个部分
23. 4个字节的地址,真实IP
24. 2个字节的端口,第二个而监听端口
25. 空格符号做为上述信息的结束,一个字节,0x20
26. 分隔符0x1F
27. 要传送的文件名
28. 分隔符0x1F
29. 字节数的字符串形式后跟" 字节",比如文件大小3字节的话,就是"3 字节"这个字符串的编码形式
30. 尾部
aggree to send file packet, format:
1- 24. except part 8, other parts are the same. as send message packet For UDP, part 8 is 0x0037, For TCP, it's 0x0003
For UDP, the last local ip and port are 0; ForTCP it has no part 22
25. tail
同意传送文件的包,格式为
1 - 24. 除了8部分,其他均与发送消息包相同。对于UDP的情况,8部分是0x0037,TCP是0x0003。
UDP时,最后的本地ip和端口都是0;TCP时没有22部分
25. 尾部
deny to receive file packet, format:
1-19, except for part 8, others are the same as agree send file packet. For UDP, part 8 is 0x0039
For TCP, it's 0x0005
20. tail
拒绝接收文件的包,格式为
1 - 19. 除了8部分,均与同意传送文件包相同。对于UDP的情况,8部分是0x0039,对于TCP,是0x0005
20. 尾部
notice my IP info, format:
1-24. except for part 8, all are the same as request file sending packet. Part 8 is 0x003B
25. tail
通知我的IP信息,格式为
1 - 24. 除了8部分,均与请求传送文件包相同。8部分是0x003B
25. 尾部
cancel sending file, format:
1- 18. except for part 8, all are the same as request send file packet. part 8 is 0x0049
19. tail
取消传送文件,格式为
1 - 18. 除了8部分,均与请求传送文件包相同。8部分是0x0049
19. 尾部
request other connect me proactive packet, format:
1-18. Except for part 8, all are the same as request send file packet. Part 8 is 0x003F
19. tail
要求别人主动连接我的包,格式为
1 - 18. 除了8部分,均与请求传送文件包相同。8部分是0x003F
19. 尾部
- 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, parseBody, setKey, setSendCount, setTimeout |
Methods inherited from class net.sf.jqql.packets.Packet |
equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, setDuplicated, setHeader, setSequence |
SendIMPacket
public SendIMPacket(QQUser user)
- constructor
构造函数
SendIMPacket
public SendIMPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
- Parameters:
buf
- length
-
- Throws:
PacketParseException
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
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.
getReceiver
public int getReceiver()
- Returns:
- Returns the receiver.
setReceiver
public void setReceiver(int receiver)
- Parameters:
receiver
- The receiver to set.
getMessageType
public char getMessageType()
- Returns:
- Returns the messageType.
setMessageType
public void setMessageType(char messageType)
- Parameters:
messageType
- The messageType to set.
getReplyType
public byte getReplyType()
- Returns:
- Returns the replyType.
setReplyType
public void setReplyType(byte replyType)
- Parameters:
replyType
- The replyType to set.
setFileName
public void setFileName(String filePath)
- Parameters:
filePath
- The filePath to set.
setFileSize
public void setFileSize(int size)
- Parameters:
fileSize
- The fileSize to set.
setDirectPort
public void setDirectPort(int port)
- Parameters:
port
- The port to set.
getSessionId
public char getSessionId()
- Returns:
- Returns the requestSequence.
setSessionId
public void setSessionId(char requestSequence)
- Parameters:
requestSequence
- The requestSequence to set.
getLocalIp
public byte[] getLocalIp()
- Returns:
- Returns the localIp.
setLocalIp
public void setLocalIp(byte[] localIp)
- Parameters:
localIp
- The localIp to set.
getLocalPort
public char getLocalPort()
- Returns:
- Returns the localPort.
setLocalPort
public void setLocalPort(int localPort)
- Parameters:
localPort
- The localPort to set.
getTransferType
public byte getTransferType()
setTransferType
public void setTransferType(byte transferType)
isFakeIp
public boolean isFakeIp()
setFakeIp
public void setFakeIp(boolean fakeIp)
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 byte[] getMessage()
- Returns:
- the message
setMessage
public void setMessage(byte[] message)
- Parameters:
message
- the message to set