Back to Blog

QQ Communication Protocol

#QQ#Communication#Delphi#Server#CMD#HTTPServer

QQ Communication Protocol

The QQ Communication Protocol is an essential framework for understanding how the QQ messaging service operates. This blog post will delve into the structure of the protocol, detailing its components, message types, and how they facilitate communication between users and servers. By the end, readers will have a clearer understanding of the protocol's functionality and its implementation in programming environments.

Protocol Structure

The QQ protocol is structured as follows:

  • Message Header (T): The initial part of the message that contains metadata.
  • Sender (T): Identifies the source of the message.
  • Receiver (T): Identifies the intended recipient of the message.
  • Message Type (T): Specifies the type of message being sent.
  • Message Length (L): Indicates the size of the message content.
  • Message Content: The actual data being transmitted.

The sender and receiver are represented by specific identifiers within the system:

  • OICQ Server: 0x01
  • Fax Server: 0x02
  • WEB Server: 0x03
  • Print Server: 0x04
  • Chat Server: 0x05
  • OICQ User: 0x0A

The communication protocol identifier for OICQ User to OICQ Server is represented as (0x81 + 0x0A + 0x01).

Message Types and Descriptions

The protocol defines various message types, each with specific content and purposes. Below are some key message types:

Message TypeMessage ContentMessage Description
0x01Nickname (S) + Portrait (M) + User Password (S) + Gender (T) + Age (T) + Real Name (S) + Country/Region (T) + Province (T) + City (S) + Address (S) + Zip Code (S) + Education (T) + Graduated School (S) + Occupation (T) + Phone (S) + Pager (S) + Email (S) + Hobbies (S) + Description (S) + Authentication (T)New user registration; authentication is used when someone wants to add the user as a friend.
0x02Service Number (L) + Password (S) + Registration Method (T)Old user registration; methods are 0 for normal, 1 for invisible.
0x03Service Number (L) + Other Service Number (L) + Content (S)Send a message to someone.
0x04Service Number (L) + Group Number (L) + Content (S)Broadcast message; group number 0 is for all.
0x05Service Number (L) + Friend Service Number (L)View friend profile.
0x06Service Number (L) + Group Name (S)Add a group.
0x07Service Number (L) + Group Number (T) + Group Name (S)Modify group name.
0x08Service Number (L) + Group Number (T)Delete group.
0x09Service Number (L) + Number of People to Move (T) + {Friend Service Number (L) + Destination Group Number (T)}Move group members.
0x0AService Number (L) + Starting Number (L) + Return Count (T) + Search Flag (T)Check who is online; search flag 1 for smaller, 2 for larger.
0x0BService Number (L) + SQL Statement (S)Custom search.
0x0CService Number (L) + Friend Service Number (L)Add friend.
0x0DService Number (L) + Friend Service Number (L) + Reason for Joining (S)Request to add friend.
0x0EService Number (L) + Friend Service Number (L)Delete friend.
0x10Service Number (L) + Display Mode (T)Change display mode (1 for online, 2 for hidden, 3 for do not disturb, 4 for offline).
0x11Service Number (L) + Monitor Service Number (L)Monitor someone's conversation.
0x12Service Number (L) + Nickname (S) + Portrait (M) + User Password (S) + Gender (T) + Age (T) + Real Name (S) + Country/Region (T) + Province (T) + City (S) + Address (S) + Zip Code (S) + Education (T) + Graduated School (S) + Occupation (T) + Phone (S) + Pager (S) + Email (S) + Hobbies (S) + Description (S) + Authentication (T)Change user information.
0x13Service Number (L) + Friend Service Number (L) + File Name (S) + File Length (L)Request to send a file.
0x14Service Number (L) + Friend Service Number (L) + Allow/Deny (T)Respond to file transfer request.
0x15Service Number (L) + Friend Service Number (L) + File Content (B)Send file.
0x16Service Number (L)Connection test message.
0x17Service Number (L) + Friend Service Number (L) + Agree Flag (T)Respond to friend request; 0 for deny, 1 for agree.

Conclusion

The QQ Communication Protocol is a complex yet fascinating system that enables various types of interactions among users and servers. Understanding its structure and message types is crucial for developers looking to create applications that leverage QQ's capabilities. By implementing the outlined message types and structures, developers can effectively communicate with the QQ service, enhancing user experiences and functionalities.