• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

icons/H03-May-2022-

ui/H23-Dec-2021-2,5632,056

READMEH A D23-Dec-20215.7 KiB14295

crypt.cppH A D23-Dec-20212.2 KiB7942

crypt.hH A D23-Dec-20211.3 KiB4211

evautil.cppH A D23-Dec-20215.8 KiB276237

kopete_qq.desktopH A D23-Dec-20214.6 KiB130129

libeva.cppH A D23-Dec-20219.4 KiB355284

libeva.hH A D23-Dec-202113.6 KiB490374

md5.cH A D23-Dec-202110.8 KiB391276

md5.hH A D23-Dec-20212.9 KiB9432

qqaccount.cppH A D23-Dec-202114 KiB473348

qqaccount.hH A D23-Dec-20215.1 KiB17380

qqaddcontactpage.cppH A D23-Dec-20211.8 KiB7147

qqaddcontactpage.hH A D23-Dec-20211.5 KiB5118

qqchatsession.cppH A D23-Dec-202116.5 KiB508365

qqchatsession.hH A D23-Dec-20214.9 KiB18076

qqchatui.rcH A D23-Dec-2021314 1813

qqcontact.cppH A D23-Dec-202113.9 KiB479287

qqcontact.hH A D23-Dec-20215 KiB19687

qqnotifysocket.cppH A D23-Dec-202113.4 KiB462327

qqnotifysocket.hH A D23-Dec-20214.5 KiB15557

qqprotocol.cppH A D23-Dec-20214.6 KiB12585

qqprotocol.hH A D23-Dec-20213.7 KiB11455

qqsocket.cppH A D23-Dec-20217.8 KiB307207

qqsocket.hH A D23-Dec-20214.4 KiB17958

README

1=============
2Introduction
3=============
4
5QQ protocol plugin aims to develop the a compaticable protocol for Tencent's QQ client, which is common used among teenager and students in China based on reverse-engineering work, (Eva and OpenQ).
6
7QQ supports three network transportation: UDP, TCP and HTTP to meet different working environment. The official client prefers UDP to relieve the burdent of the server. HTTP is specially designed for mobile user with wap data plan. This approach takes TCP, so we don't need to maintain the pool of incoming, outgoing message any longer.
8
9==========
10Protocol
11==========
12
13The protocol details are encapsulated in Eva namespace.(libeva.h, libeva.cpp). As far as I know, there is another gtkmm based project is in the progress in the community. To reuse the wheel, libeva depends on STL only[1]. A QByteArray alternative, Eva::ByteArray is developed as the default container. If the client need a specific QQ packet, just call the corresponding libeva function.
14
15The state machine of QQ is maintained in QQNotifySocket, in fact it is stateless, when the incoming packet arrives, QQNotifySocket::handleIncomingPacket get the last request from the header, and drive actions regardless the context.
16
17Here is the detail of the communication,
18
19Login
20=======
21
22The client request a login token from the server first, which is 16 byte key used to identify the login procedure. QQ account encrypt the password with MD5 twice to generate the 16 byte passwordKey, then use this key to encrypt the 16 byte zero-filled array as the header. The login text then append some magic number, the login token and eventually encrypted with 16 byte 0x01 initKey.
23
24There are 3 returned value from the server, success, failure and redirect. Redirect package includes another destination server IP:Port, so as for the workload balance. The returned package also includes a sessionKey, which is used as encrypt/decrypt the following conversation.
25
26Then we need to require another key, transferKey. Was Tencent once a vault manufacturer before she went to IT? This key is used to identify a text message/file transfer converation.
27
28End of the Login.
29
30Update Myself
31==============
32
33We need to fetch the meta data stored in the server and update the properites when we logged in. This is ContactInfo packet.
34-- Still working on this
35
36List the Buddies
37=================
38
39QQ supports two kinds of lists. List online buddies and list all budies. The returned result is a brief of ContactInfo packet.
40QQ also supports GroupInfo and GroupNames functions. The former is the contactId-GroupId table, the latter is the name of ordered groups.
41
42Finding contacts
43==========
44
45Teenagers and students are QQ's main target market, they still believe cyber love, they would like to find some stranger to talk, then start an affair. The exposed meta data is essentail to narrow the search process, please check contactDetailIndex to find out the full list of meta data:
46		"qqId",
47		"nickName",
48		"country",
49		"state",
50		"zipcode",
51		"address",
52		"phone",
53		"age",
54		"gender",
55		"name",
56		... ...
57
58The contact data is serialized in QQContact, inspired by MSNContact:
59AccountId, ContactId -- account/contact pair is a unique identification.
60Meta data -- include all QQ specific information
61Group list -- TBD
62
63
64Find user supports to find a user via: QQ number or browse the online user.
65
66TBD
67
68Conversation
69=============
70
71This is the fundamental functionality of QQ. QQ suppors offline IM.
72
73There are two types of conversation:
741 to 1 talk, aka Conversation mode; more than 2 contacts are invovled in, Conference mode. The system assign an unique identification for the latter talk, which can be regardes as the ID of chatSession. To mimic the behavior, the conversation mode is assigned "m_qqId:contactId" as the chatSession ID. This is reasonable since there is only one conversation between two QQ account if any at all the time.
75
76In fact, there is another service for the premium user, you know what premium means, right, it is called Qun in Chinese, here is named Special Interest Group, SIP. It can be regarded as the named conference mode compared to the previous one.
77
78QQ also support voice/video conversation.
79
80By all means, these are not implemented yet right now, current implementation just works for the text message in conversation mode.
81
82
83Text Message
84=============
85
86QQ's text message use its own customized, the whold paragraph can be rendered with different fonts and colors as a whole. You can also embed some emotion picture inside it. The extra format information is tailed after the original text message.
87
88When a client receives a text message, it needs to send a receipt to the server to indicate this message has been accepted.
89
90Heartbeat
91==========
92
93We also need to send heartbeat packet to the server to indicate we are still alive.
94
95
96
97
98=========
99Appendix
100=========
101
102UDP server listens on port 8000, available servers include:
103-------------------------------
104URL: sz.tencent.com
105URL:sz2.tencent.com
106URL:sz3.tencent.com
107URL:sz4.tencent.com
108URL:sz5.tencent.com
109URL:sz6.tencent.com
110URL:sz7.tencent.com
111URL:sz8.tencent.com
112URL:sz9.tencent.com
113IP: 202.96.170.164
114
115
116TCP server listens on port 80, available servers include:
117--------------------------------
118URL: tcpconn.tencent.com
119URL:tcpconn2.tencent.com
120URL:tcpconn3.tencent.com
121URL:tcpconn4.tencent.com
122URL:tcpconn5.tencent.com
123URL:tcpconn6.tencent.com
124
125HTTP server listens on port 443, available servers are unknown.
126
127
128==========
129Reference
130==========
131
132[1] libeva is named after Eva project, since it is almost a re-writen Eva library.
133
134======
135NOTE
136======
137Rename CGT to  GroupInfo
138Rename cgts to groupInfos
139Add contactDetail skeleton.
140Rename userInfo to contactInfo, but still using UserInfo as the command. Shall we use Eva::Command::ContactInfo instead?
141
142