Turn: http://www.cnblogs.com/cccc/archive/2009/10/23/1588649.html
1. Search for servers that support the qq http protocol.
People may be confused by some counterfeits. They may think that QQ's HTTP Server communicates based on 80 ports (for example, 218.17.209.23: 80, the HTTP-based server should be: http://tqq.tencent.com: 8000, a server that communicates through port 8000.
Because the HTTP server of QQ does not support the get method in the HTTP protocol, it supports the POST method. Therefore, if we want to transmit parameters to the HTTP protocol of QQ, we must use the POST method.
2. C # and Delphi implement http post communication.
C #:
In C #, The system. web space provides an object called WebClient. With this object, C # can directly send Web client requests to the server. To submit the POST method to the server, you must use its uploaddata () method. First, convert the request information to byte (because post submits the stream data of characters) and use it as the uploaddata () parameter. Use uploaddata () for data submission, and finally return the post feedback. As follows:
WebClient _ client = new WebClient ();
String postvalues = "ver = 1.0 & cmd = query_stat & seq = 12321 & uin = 29501213 & Tn = 50 & UN = 0 ";
Byte [] bytearray = system. Text. encoding. ASCII. getbytes (postvalues );
Byte [] pagedata = _ client. uploaddata (host, "Post", bytearray );
In this way, we use C # To submit an http post method.
When the value is passed in and returned, it is based on the UTF-8, C # display Chinese is very often.
3. Implement logon for QQ users.
In QQ communication, users must log on before sending information to each other. Qq login is very important. The user we see is online, not the user's QQ has been connected to the server, but regularly sent a message to the server, proving that they are still connected to the line, if it exceeds the time limit, QQ considers the user to be offline.
In the logon protocol, the QQ password is encrypted with the standard MD5, while C # is self-contained, but cannot be used directly. It must be processed before being converted to the standard MD5, the processing code is as follows:
Public static string MD5 (string tocrystring)
{
Md5cryptoserviceprovider hashmd5;
Hashmd5 = new md5cryptoserviceprovider ();
Return bitconverter. tostring (hashmd5.computehash (encoding. default. getbytes (tocrystring ))). replace ("-",""). tolower (); // ASP is in lower case and all characters are reduced to write
}
After learning about how QQ encrypts user passwords, we began to parse QQ's HTTP logon protocol. We passed the Protocol as a post parameter to the server, the server returns the corresponding information to the client:
Incoming protocol:
Ver = 1.1 & cmd = login & seq = & uin = & PS = & M5 = 1 & lc = 9326b87b234e7235
Ver is used to describe the version of the QQ protocol, CMD is the command to describe the protocol, login is the login of QQ, seq is a mark set by him to prevent repeated sending, generally, we can place a section of the current time value. (C #: datetime. now. ticks. tostring (). substring () Delphi: copystr (inttostr (gettickcount (),). uin indicates the QQ number, PS, is the value of the MD5 encrypted password.
Response Protocol:
Ver = 1.1 & cmd = login & seq = 11281 & uin = & res = 0 & rs = 0 & HI = 60 & Li = 300 (successful)
If RES is 0, a success is returned. If RS is 0, the logon is successful.
Ver = 1.1 & cmd = login & seq = 11422 & uin = 315103947 & res = 0 & rs = 1 & RA = Logon Failed
If RS is set to 1, the logon fails. Then, a prompt is displayed, indicating the cause.
4. Obtain the QQ list.
If you add your friends, your friends will be put into your QQ friends list, to obtain the QQ list, we must send the protocol to the QQ server to obtain the Friends List (I will not repeat the known parameters ):
Ver = 1.1 & cmd = List & seq = & uin = & Tn = 160 & UN = 0
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = List & seq = 43661 & uin = 29501213 & res = 0 & FN = 1 & Sn = 24 & UN = 561256,1943497 ,....
Your friend's QQ number is next to UN, and each number is separated. Then we only need to get the code after UN and list it as OK. C # You can use string. Split (',') to put values into the list for processing, while Delphi can use split () to put values into tstrings for processing.
5. Obtain the QQ friends online list
Obtaining the QQ friends online list is similar to obtaining the friends list. The only difference is that query_stat is used for different commands. The Protocol is as follows:
Ver = 1.1 & cmd = query_stat & seq = & uin = & Tn = 50 & UN = 0
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = query_stat & seq =-1 & uin = 29501213 & res = 0 & fc = 141,270,270, & FN = 1 & Sn = 3 & St = 10, 10, 10, & amp; UN =
FCIS the ID of the QQ image. For example, the ID of the image is, and the first image is 91.bmp. The algorithm is ID/3 + 1. St is the status of QQ users, 10 is online, 20 is offline, and 30 is busy. UN is the QQ number of online users, and NK is the QQ nickname of online users. St, UN, NK, and data separated by commas correspond to each other.
6. Obtain QQ user information.
If you want to see the QQ user's real name, mail, age, personal instructions, and other information, you must send a friend information to the server:
Ver = 1.1 & cmd = getinfo & seq = & uin = & Lv = 2 & UN =
UN is the QQ number for viewing user information.
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = getinfo & seq = 12707 & uin = 415103947 & res = 0 & ad = Kunming, Yunnan & Ag = 0 & EM = Microprogramer@hotmail.com & fc = 270 & HP = msger.org (under construction ...) & JB = programmer & Lv = 2 & PC = 650000 & pH = 0871-6466529 & pr = the network is the media % 252c relationship. This % 252c information is mainly for customers of finance % 252c. % 0d % 0a & Pv = Yunnan Province & Rn = Liu X & SC = social University & SX = 0 & UN = 24259132 & nk = Weicheng
The contact address of an ad user. AG indicates the user's age, EM indicates the user's mail, FC indicates the user's profile picture, HP indicates the user's website, JB indicates the user's occupation, and PC indicates the user's zip code, pH indicates the user's contact number, PR indicates the user's profile, PV indicates the user's province, RN indicates the user's real name, SC indicates the user's graduation institution, SX indicates the user's gender, and UN indicates the user's QQ number, NK is the nickname of the user QQ.
7. Add QQ friends.
To add a friend, you need to send the addtolist command to the server. The specific command is as follows:
Ver = 1.1 & cmd = addtolist & seq = & uin = & UN =
UN adds the user's QQ number for us.
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = addtolist & seq = 13666 & uin = 415103947 & res = 0 & Cd = 0 & UN = 24259132
CD indicates the identity authentication status of the added QQ account. If CD is set to 0, it indicates "allow anyone to list me as a friend", and if CD is set to 1, it indicates "you need to recognize your ID card to list me as a friend ", if CD is 3, "no one is allowed to list me as a friend ". If the value of CD is 0, after the information is returned, the user directly adds it as a friend. If the value of CD is 1, a response should be sent and added as a friend.
8. The response is added as a friend.
The response is added as a friend by both parties: 1. If you send a request and add a friend as a friend, if the other party needs verification, you must send a response to add a friend as a friend. 2. If the other party sends a friend request to you, you can add a friend response. One is to add a friend, and the other is to pass verification, the first is to reject a friend. We want to send a command to the server:
Ver = 1.1 & cmd = ack_addtolist & seq = & uin = & UN = & Cd = & rs =
CD is the response status, and CD is 0, which indicates "Verification passed ". If the value of CD is 1, it indicates that "the peer is rejected as a friend ". If CD is set to 2, "add a friend to the requester" is displayed ". RS is the reason for your request.
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = ack_addtolist & seq = 1130 & uin = 415103947 & res = 0 &
9. delete a friend.
It is easy to delete friends. If you send the delfromlist command to the server, you can delete users:
Ver = 1.1 & cmd = delfromlist & seq = & uin = & UN =
UN indicates the QQ number of the user to be deleted.
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = delfromlist & seq = 24514 & uin = 415103947 & res = 0 &
10. Change the current user status.
You can set QQ to the online or invisible status. We can send change_stat to the server to change the current status. The specific command is as follows:
Ver = 1.1 & cmd = change_stat & seq = & uin = & St =
St is the status to be changed, 10 is online, 20 is offline, and 30 is busy.
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = change_stat & seq = 17512 & uin = 415103947 & res = 0 &
11. log out
To log out, send the logout command to the server. The specific command is as follows:
Ver = 1.1 & cmd = logout & seq = & uin =
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = logout & seq = 15803 & uin = 415103947 & res = 0
12. Get a friend QQ message
To receive messages from friends, send the getmsgex command to the server. The specific command is as follows:
Ver = 1.1 & cmd = getmsgex & seq = & uin =
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = getmsgex & seq = 56661 & uin = 29501213 & res = 0 & Mn = 3 & mt = 99,9, 9, & UN = 24259132,24259132, 24259132, & Mg = 30, asdfasdfasdfasdf, asdfasdfasdf ,&
Mt indicates the message type, 99 indicates the system message, and 9 indicates the user message. "UN" indicates the user who sent the message, "mg" indicates the message sent, and "mg" indicates some specific system meanings. For example, when MT is 99 and Mg is 30, if the value of UN is 24259132, the user 4259132 is in a busy state. You can refresh the friends list based on the message to Improve the efficiency.
13. send messages to friends QQ
To send a message to a friend, send the cltmsg command to the server. The specific command is as follows:
Ver = 1.1 & cmd = cltmsg & seq = & uin = & UN = & Mg =
UN indicates the QQ number of the user who sent the message, and Mg indicates the message sent to the user.
If the server receives the Protocol successfully, return:
Ver = 1.1 & cmd = cltmsg & seq = 15803 & uin = 415103947 & res = 0
Well, the above is an incomplete HTTP-based QQ protocol analysis. With the above Protocol, You can implement many things, such as QQ robot, QQ advertising system, and instant messaging integration tools.
Qq protocol network protocol-request part
// Log on
Ver = 1.0 & cmd = login & seq = & uin = & PS = & M5 = 1 & lc = 9326b87b234e7235
// Obtain the message
Ver = 1.0 & cmd = getmsgex & seq = & uin =
// Send a message
Ver = 1.0 & cmd = cltmsg & seq = & uin = & UN = & Mg =
// Friend list
Ver = 1.0 & cmd = List & seq = & uin = & Tn = 160 & UN = 0
// Obtain the friend status
Ver = 1.0 & cmd = query_stat & seq = & uin = & Tn = 50 & UN = 0
// Obtain friend information
Ver = 1.0 & cmd = getinfo & seq = & uin = & Lv = 2 & UN =
// Add friends
Ver = 1.0 & cmd = addtolist & seq = & uin = & UN =
// Respond to the other party's request and add you as a friend's response
Ver = 1.0 & cmd = ack_addtolist & seq = & uin = & UN = & Cd = & rs =
// Delete a friend
Ver = 1.0 & cmd = delfromlist & seq = & uin = & UN =
// Search for friends
Ver = 1.0 & cmd = finger & seq = & uin = & Ag = & SX = & Pv =
// Change your status. The st code should be consistent with the code for getting friend status.
Ver = 1.0 & cmd = change_stat & seq = & uin = & St =
// Log out
Ver = 1.0 & cmd = logout & seq = & uin =
1. Study description
Tencent has an http qq interface in 8000 of tqq.tencent.com. Through this interface, you can perform some basic operations, such: login, logout, and change login status (online, busy, offline, and invisible) add and delete friends, view friends information, send verification information (accept added as friends, apply to add peer as friends, reject added as friends), send and receive user messages, system information.
At present, I am studying the http qq protocol of Version 1.1. The research is based on the results of Weicheng. I dare not say anything beyond it, but it is more detailed and accurate.
2. Interface Description:
Interface location: tqq.tencent.com: 8000
Communication Protocol: HTTP
Data transmission method: Post
HTTP request format:
Posthttp/1.1
HOST: tqq.tencent.com: 8000
Content-Type: text/plain; charset = UTF-8
Content-Length: Length
Connection: Close
Data
The length is the data length. The data format is as follows:
Ver = 1.1 & cmd = command & seq = Mark & uin = QQ number &....
The preceding four parameters are mandatory for each request. In this example, Ver indicates the Protocol version. Currently, it is 1.1. It is said that 1.2 has come out. In this case, the server returns NULL. CMD indicates the operation instruction, there are login, list, query_stat, getinfo, addtolist, ack_addtolist, delfromlist, change_stat, getmsgex, cltmsg, and logout. seq is the flag of the current request to prevent repeated sending. The current time can be used, you can also use a random number. uin is the QQ number of the current operation. However, different cmd parameters are required. I will publish my research results below.
3. Research Results:
(1). Login
Note: You must log on before you perform any other operations. Other commands can be correctly executed only after Logon (RES = 0 is returned). Otherwise, the server returns res = 20, but the exception is logout. After you log on to the server, the server will verify your identity based on your IP address * and the uin parameter. A computer can log on to multiple QQ accounts at the same time, which does not affect each other because of the uin parameter.
* I can confirm that the server is verified by IP address because the server cannot obtain other information through my request. ^_^
Submit data: ver = 1.1 & cmd = login & seq = Mark & uin = QQ number & PS = qqpassword & M5 = 1 & lc = 9326b87b234e7235
Note: The QQ password is a string encrypted with MD5. in PHP, MD5 () can be used for encryption;
The role of the M5 parameter is unknown, but it is better to be 1.
The LC parameter is a bit mysterious and cannot be changed at all. Otherwise, the server will not respond (if there is no response, null is returned ).
Return: ver = 1.1 & cmd = login & seq = Mark & uin = QQ number & res = 0 & rs = 0 & HI = 60 & Li = 300 (successful)
Ver = 1.1 & cmd = login & seq = Mark & uin = QQ number & res = 0 & rs = 1 & RA = incorrect password (incorrect password)
Ver = 1.1 & cmd = login & seq = Mark & uin = QQ number & res = 5 (illegal QQ number, such as 100)
NULL (uin is a character, PS is null, LC error)
(2). Get the friends list
Submit data: ver = 1.1 & cmd = List & seq = Mark & uin = QQ No. & Tn = 160 & UN = 0
Note: tn and UN are not clear about the specific representation, but the value of TN will affect the returned results. Is there any UN that has no effect on the results?
Return: ver = 1.1 & cmd = List & seq = Mark & uin = QQ number & res = 0 & FN = 9 (when Tn = 0 or there is no tn parameter, FN indicates the number of friends)
Ver = 1.1 & cmd = List & seq = Mark & uin = QQ number & res = 0 & FN = 1 & Sn = 9 & UN = 3814526 ,..., (If tn exists and is not 0, FN = 1, Sn indicates the number of friends, and UN indicates the list of friends, separated)
Ver = 1.1 & cmd = List & seq = Mark & uin = QQ number & res = 20 (incorrect login)
NULL (uin, TN, and UN are characters)
(3). Get the online friends list
Submit data: ver = 1.1 & cmd = query_stat & seq = Mark & uin = QQ No. & Tn = 50 & UN = 0
Note: tn and UN are not clear about the specific representation, but the value of TN will affect the returned results. Is there any UN that has no effect on the results?
Return: ver = 1.1 & cmd = query_stat & seq = Mark & uin = QQ number & res = 0 & fc = 0, & FN = 1 & Sn = 1 & St = 10, & UN = 106814, & nk = hackfan good, (if tn exists and is not 0, FN = 1, Sn indicates the number of online friends, the FC, St, UN, and NK values are separated by commas (,), indicating the Avatar, status, number, And nickname respectively)
Ver = 1.1 & cmd = query_stat & seq = Mark & uin = QQ number & res = 20 (incorrect logon)
NULL (uin, TN, and UN are characters)
Note: FCIS the ID of the QQ image. For example, the ID of the header image is, and the image used by its header is 91.bmp. Its algorithm is ID/3 + 1;
St is the status of QQ users, 10 is online, 20 is offline (or invisible), and 30 is busy;
Note: When Tn = 0 or does not exist, the server returns:
Ver = 1.1 & cmd = query_stat & seq = Mark & uin = QQ number
HTTP/1.1 200 OK
Server: Tencent imserver/1.0.0
Content-Type: text/plain; charset = UTF-8
Content-Length: 56
Ver = 1.1 & cmd = query_stat & seq = Mark & uin = QQ number & res = 0 & FN = 1
HTTP/1.1 200 OK
Server: Tencent imserver/1.0.0
Content-Type: text/plain; charset = UTF-8
Content-Length: 77
Ver = 1.1 & cmd = query_stat & seq = Mark & uin = QQ number & res = 0 & fc = & FN = 1 & Sn = 0 & St = & UN = & nk =
Two times are returned. In the first result, FN is the number of online friends, and the data returned for the second time is basically useless.
(4). View friend information
Submit data: ver = 1.1 & cmd = getinfo & seq = Mark & uin = QQ number & Lv = Query type & UN = queried QQ number
Note: Lv = is a simplified query, Lv = 2 is a common query, and LV> = 3 is a detailed query.
Return: ver = 1.1 & cmd = getinfo & seq = Mark & uin = QQ number & res = 0 & Lv = 0 & UN = 106814 & nk = hackfan (simplified query)
Ver = 1.1 & cmd = getinfo & seq = Mark & uin = qqno & res = 0 & ad = address & Ag = 19 & EM = hackfan@qq.com & fc = 0 & HP = http://blog.hackfan.net & JB = student
& Lv = 2 & PC = zip code & pH = phone & pr = the guy is updating. net frameword ...... & Pv = Jiangsu & Rn = Hu Jiyang & SC = Graduate School & SX = 0 & UN = 106814 & nk = hackfan
Good (normal query)
Ver = 1.1 & cmd = getinfo & seq = Mark & uin = QQ number & res = 0 & ad = address & Ag = 19 & bt = 2 & Co = 6 & Ct = Suzhou & CV = % 01 & Cy = People's Republic of China
& EM = hackfan@qq.com & fc = 0 & HP = http://blog.hackfan.net & id =-& JB = student & Lv = 3 & mo = 136 * & mt = 0 & mv = & PC = zip code & pH = phone & pr = the guy is
Updating. net frameword ...... & Pv = Jiangsu & Rn = Hu Jiyang & SC = Graduate School & SH = 3 & SX = 0 & UN = 106814 & nk = hackfan (for details)
Ver = 1.1 & cmd = getinfo & seq = Mark & uin = QQ number & res = 20 (incorrect logon)
NULL (uin, LV, and UN are characters)
Note: ad is the contact address.
AG is age
BT is the blood type
CO is a constellation
CT is a city
CV is unknown *
Cy is a country
Em is email
FC is the Avatar
HP is a website
The ID is unknown.
JB is a profession
LV is the query code (that is, the sent LV)
Mo is a mobile phone.
Mt is unknown
Mv is unknown
PC is zip code
PH indicates the contact number.
PR for introduction
PV is saved
RN is the real name
SC is a graduate school
SH is a Chinese zodiac
SX is gender
UN is the QQ number
NK is a nickname
Blood type: 0 => '',
1 => 'A ',
2 => 'B ',
3 => 'o type ',
4 => 'AB type ',
5 => 'others'
Constellation: 0 => '',
1 => 'aquarius ',
2 => 'pisces ',
3 => 'sheepse ',
4 => 'taurus ',
5 => 'gemins ',
6 => 'loan ',
7 => 'Leo ',
8 => 'virgo ',
9 => 'libra ',
10 => 'scorpio ',
11 => 'sagittarius ',
12 => 'capricorn'
Zodiac: 0 => '',
1 => 'rat ',
2 => 'niu ',
3 => 'hu ',
4 => rabbit ',
5 => 'long ',
6 => 'snake ',
7 => 'Ma ',
8 => 'yang ',
9 => 'Monkey ',
10 => 'chicken ',
11 => 'Dog ',
12 => 'pipi'
Gender: 0 => 'male ',
1 => female'
(5). Add friends
Submit data: ver = 1.1 & cmd = addtolist & seq = Mark & uin = QQ number & UN = other party's QQ number
Return: ver = 1.1 & cmd = addtolist & seq = Mark & uin = QQ number & res = 0 & Cd = 0 & UN = QQ number of the other party (can be added as a friend, at this time, he is already your friend)
Ver = 1.1 & cmd = addtolist & seq = Mark & uin = QQ number & res = 0 & Cd = 1 & UN = other party's QQ number (verification required)
Ver = 1.1 & cmd = addtolist & seq = Mark & uin = QQ number & res = 0 & Cd = 2 & UN = QQ number of the other party (never add as a friend)
Ver = 1.1 & cmd = addtolist & seq = Mark & uin = QQ number & res = 20 (incorrect login)
NULL (uin and UN are characters)
(5). Send verification
Note: 1. If you add a peer as a friend, you need to send a verification message.
2. The recipient adds you as a friend and sends a verification message. You must pass or reject the verification message.
In both cases, verification messages must be sent.
Submit data: ver = 1.1 & cmd = ack_addtolist & seq = Mark & uin = QQ number & UN = other party's QQ number & Cd = verification type & rs = reason
Note: If the value of CD is 0, it indicates "Verification passed". If the value of CD is 1, it indicates that "the peer is rejected as a friend". If the value of CD is 2, it indicates "adding a friend to the peer ".
Return: ver = 1.1 & cmd = ack_addtolist & seq = Mark & uin = QQ number & res = 0 (SUCCESS)
Ver = 1.1 & cmd = ack_addtolist & seq = Mark & uin = QQ number & res = 3 (*)
Ver = 1.1 & cmd = ack_addtolist & seq = Mark & uin = QQ number & res = 20 (incorrect logon)
NULL (uin, UN, Cd are characters, RS is not UTF-8 characters)
* If the server returns res = 3, the response time of this conversation is 20 s. When sending a verification request, the request must be sent twice (the request content does not need to be the same). One of the res is 3, the other party cannot receive the request, and the other party can receive the request if the request content is 0. When Cd> = 3, Res = 3, and response time is 20 s.
(6). Delete friends
Submit data: ver = 1.1 & cmd = delfromlist & seq = Mark & uin = QQ number & UN = deleted QQ number
Return: ver = 1.1 & cmd = delfromlist & seq = Mark & uin = QQ number & res = 0 & (SUCCESS)
Ver = 1.1 & cmd = delfromlist & seq = Mark & uin = QQ number & res = 3 (Response Time: 30 s, consequences of repeated sending)
Ver = 1.1 & cmd = delfromlist & seq = Mark & uin = QQ number & res = 20 (incorrect logon)
NULL (uin and UN are characters)
(7). Change the status
Submit data: ver = 1.1 & cmd = change_stat & seq = Mark & uin = QQ number & St = Status Code
Status Code: 10 is online, 20 is offline, 30 is busy, 40 is invisible, and others are regarded as illegal
Return: ver = 1.1 & cmd = change_stat & seq = Mark & uin = QQ number & res = 0 & (SUCCESS)
Ver = 1.1 & cmd = change_stat & seq = Mark & uin = QQ number & res = 3 (failed, cause unknown, response time 20 s, may be caused by too frequent status changes)
Ver = 1.1 & cmd = change_stat & seq = Mark & uin = QQ No. & res = 20 (incorrect logon)
NULL (uin is a character, and ST is invalid)
Note: If you change a friend, a system message will be sent to all friends, whose content is the status code. If you are invisible, the status code sent is 20, indicating that you are offline.
Similarly, when your friends change the status, you will also receive a system message.
(9). Get the message
Submit data: ver = 1.1 & cmd = getmsgex & seq = Mark & uin = QQ number
Return: ver = 1.1 & cmd = getmsgex & seq = Mark & uin = QQ number & res = 0 & Mn = 4 & mt = 99,99, 99,9, & UN = 36791785,99833581, 99833581,106814, & Mg = 20, 30, 10, hi, (Mn indicates the number of information. The values of MT, UN, and Mg are separated by ",", indicating the message type, Sender number, and message content respectively)
Ver = 1.1 & cmd = getmsgex & seq = Mark & uin = QQ number & res = 0 & Mn = 0 & mt = & UN = & Mg = (indicating no information)
Ver = 1.1 & cmd = getmsgex & seq = Mark & uin = QQ number & res = 20 (incorrect logon)
NULL (uin is a character)
Note: About MT:
9 indicates the user message, 99 indicates the system message, 2 indicates the request information, 3 indicates the authentication, and 4 indicates the user is rejected.
About Mg:
When MT = 9, Mg indicates the message content sent by the user.
When MT = 99,
Mg = 10 (qq_status_online) indicates that the peer is online.
Mg = 20 (qq_status_offline) indicates that the other party is offline
Mg = 30 (qq_status_busy) indicates that the other party is busy.
When MT = 2, Mg is the information the other party requests for your verification
When MT = 3, it indicates that the other party has passed your verification.
When MT = 4, Mg rejects you
(10). Send messages
Submit data: ver = 1.1 & cmd = cltmsg & seq = Mark & uin = QQ number & UN = other party's QQ number & Mg = content sent
Return: ver = 1.1 & cmd = cltmsg & seq = Mark & uin = QQ number & res = 0 & (if the message is sent successfully, the recipient may not be able to receive the message)
Ver = 1.1 & cmd = cltmsg & seq = Mark & uin = QQ number & res = 3 (sending too fast)
Ver = 1.1 & cmd = cltmsg & seq = Mark & uin = QQ number & res = 20 (incorrect login)
NULL (uin, UN is a character, Mg contains non-UTF-8 characters)
Note: 1. When you send a message, the recipient may not be able to see the message in the following cases (in fact, you have received the message and QQ does not prompt:
You two are strangers, and the other party hasn't spoken to you.
You are in his stranger list, and he hasn't spoken to you (not verified)
2. When you send messages too quickly, the system will send you a penalty, Res = 3, corresponding time 20 s
3. When I send a message containing lowercase letter H, the server may return null
(11). logout
Submit data: ver = 1.1 & cmd = logout & seq = Mark & uin = QQ number
Return: ver = 1.1 & cmd = logout & seq = Mark & uin = QQ number & res = 0 (successful, it seems to be always successful, whether you log in or not)
NULL (uin is a character)