annotate libgaim/protocols/qq/qq.c @ 15123:c8957b9c6202

[gaim-migrate @ 17909] fix 1586525 committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 07 Dec 2006 05:57:53 +0000
parents 2c93b0620065
children e952a5fc97b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
1 /**
15025
c039c920e11c [gaim-migrate @ 17807]
Mark Huetsch <markhuetsch>
parents: 14857
diff changeset
2 * @file qq.c
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
3 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
4 * gaim
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
5 *
15025
c039c920e11c [gaim-migrate @ 17807]
Mark Huetsch <markhuetsch>
parents: 14857
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
c039c920e11c [gaim-migrate @ 17807]
Mark Huetsch <markhuetsch>
parents: 14857
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
c039c920e11c [gaim-migrate @ 17807]
Mark Huetsch <markhuetsch>
parents: 14857
diff changeset
8 * source distribution.
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
9 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
13 * (at your option) any later version.
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
14 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
18 * GNU General Public License for more details.
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
19 *
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
23 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
24
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
25 #include "internal.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
26
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
27 #ifdef _WIN32
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
28 #define random rand
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
29 #endif
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
30
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
31 #include "accountopt.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
32 #include "debug.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
33 #include "notify.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
34 #include "prefs.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
35 #include "prpl.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
36 #include "request.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
37 #include "roomlist.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
38 #include "server.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
39 #include "util.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
40
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
41 #include "buddy_info.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
42 #include "buddy_opt.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
43 #include "buddy_status.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
44 #include "char_conv.h"
14237
7cf90e0b6180 [gaim-migrate @ 16919]
Mark Huetsch <markhuetsch>
parents: 14195
diff changeset
45 #include "crypt.h"
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
46 #include "group.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
47 #include "group_find.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
48 #include "group_im.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
49 #include "group_info.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
50 #include "group_join.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
51 #include "group_opt.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
52 #include "header_info.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
53 #include "im.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
54 #include "keep_alive.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
55 #include "login_logout.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
56 #include "packet_parse.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
57 #include "qq.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
58 #include "qq_proxy.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
59 #include "send_core.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
60 #include "send_file.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
61 #include "utils.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
62 #include "version.h"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
63
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
64 #define OPENQ_AUTHOR "Puzzlebird"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
65 #define OPENQ_WEBSITE "http://openq.sourceforge.net"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
66 #define QQ_TCP_QUERY_PORT "8000"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
67 #define QQ_UDP_PORT "8000"
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
68
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
69 const gchar *udp_server_list[] = {
14195
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
70 "sz.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
71 "sz2.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
72 "sz3.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
73 "sz4.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
74 "sz5.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
75 "sz6.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
76 "sz7.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
77 "sz8.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
78 "sz9.tencent.com"
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
79 };
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
80 const gint udp_server_amount = (sizeof(udp_server_list) / sizeof(udp_server_list[0]));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
81
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
82
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
83 const gchar *tcp_server_list[] = {
14195
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
84 "tcpconn.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
85 "tcpconn2.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
86 "tcpconn3.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
87 "tcpconn4.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
88 "tcpconn5.tencent.com",
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
89 "tcpconn6.tencent.com"
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
90 };
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
91 const gint tcp_server_amount = (sizeof(tcp_server_list) / sizeof(tcp_server_list[0]));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
92
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
93 static void _qq_login(GaimAccount *account)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
94 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
95 const gchar *qq_server, *qq_port;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
96 qq_data *qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
97 GaimConnection *gc;
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
98 GaimPresence *presence;
14318
437ce90442cf [gaim-migrate @ 17011]
Mark Huetsch <markhuetsch>
parents: 14286
diff changeset
99 gboolean use_tcp;
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
100
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
101 g_return_if_fail(account != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
102
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
103 gc = gaim_account_get_connection(account);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
104 g_return_if_fail(gc != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
105
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
106 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_AUTO_RESP;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
107
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
108 qd = g_new0(qq_data, 1);
14195
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
109 qd->gc = gc;
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
110 gc->proto_data = qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
111
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
112 qq_server = gaim_account_get_string(account, "server", NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
113 qq_port = gaim_account_get_string(account, "port", NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
114 use_tcp = gaim_account_get_bool(account, "use_tcp", FALSE);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
115 presence = gaim_account_get_presence(account);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
116
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
117 qd->use_tcp = use_tcp;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
118
14318
437ce90442cf [gaim-migrate @ 17011]
Mark Huetsch <markhuetsch>
parents: 14286
diff changeset
119 if(gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_INVISIBLE)) {
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
120 qd->login_mode = QQ_LOGIN_MODE_HIDDEN;
14318
437ce90442cf [gaim-migrate @ 17011]
Mark Huetsch <markhuetsch>
parents: 14286
diff changeset
121 } else if(gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_AWAY)
437ce90442cf [gaim-migrate @ 17011]
Mark Huetsch <markhuetsch>
parents: 14286
diff changeset
122 || gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_EXTENDED_AWAY)) {
437ce90442cf [gaim-migrate @ 17011]
Mark Huetsch <markhuetsch>
parents: 14286
diff changeset
123 qd->login_mode = QQ_LOGIN_MODE_AWAY;
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
124 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
125 qd->login_mode = QQ_LOGIN_MODE_NORMAL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
126 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
127
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
128 if (qq_server == NULL || strlen(qq_server) == 0)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
129 qq_server = use_tcp ?
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
130 tcp_server_list[random() % tcp_server_amount] :
14195
902c3aa4950a [gaim-migrate @ 16867]
Mark Huetsch <markhuetsch>
parents: 14192
diff changeset
131 udp_server_list[random() % udp_server_amount];
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
132
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
133 if (qq_port == NULL || strtol(qq_port, NULL, 10) == 0)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
134 qq_port = use_tcp ? QQ_TCP_QUERY_PORT : QQ_UDP_PORT;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
135
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
136 gaim_connection_update_progress(gc, _("Connecting"), 0, QQ_CONNECT_STEPS);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
137
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
138 if (qq_connect(account, qq_server, strtol(qq_port, NULL, 10), use_tcp, FALSE) < 0)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
139 gaim_connection_error(gc, _("Unable to connect."));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
140 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
141
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
142 /* directly goes for qq_disconnect */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
143 static void _qq_close(GaimConnection *gc)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
144 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
145 g_return_if_fail(gc != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
146 qq_disconnect(gc);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
147 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
148
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
149 /* returns the icon name for a buddy or protocol */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
150 static const gchar *_qq_list_icon(GaimAccount *a, GaimBuddy *b)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
151 {
15071
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
152 return "qq";
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
153 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
154
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
155
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
156 /* a short status text beside buddy icon*/
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
157 static gchar *_qq_status_text(GaimBuddy *b)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
158 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
159 qq_buddy *q_bud;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
160 GString *status;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
161
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
162 q_bud = (qq_buddy *) b->proto_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
163 if (q_bud == NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
164 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
165
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
166 status = g_string_new("");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
167
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
168 switch(q_bud->status) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
169 case QQ_BUDDY_OFFLINE:
14268
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
170 g_string_append(status, "Offline");
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
171 break;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
172 case QQ_BUDDY_ONLINE_NORMAL:
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
173 return NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
174 break;
14268
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
175 /* TODO What does this status mean? Labelling it as offline... */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
176 case QQ_BUDDY_ONLINE_OFFLINE:
14268
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
177 g_string_append(status, "Offline");
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
178 break;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
179 case QQ_BUDDY_ONLINE_AWAY:
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
180 g_string_append(status, "Away");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
181 break;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
182 case QQ_BUDDY_ONLINE_INVISIBLE:
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
183 g_string_append(status, "Invisible");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
184 break;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
185 default:
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
186 g_string_printf(status, "Unknown-%d", q_bud->status);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
187 }
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
188
14497
ae0f94b7f396 [gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14404
diff changeset
189 return g_string_free(status, FALSE);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
190 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
191
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
193 /* a floating text when mouse is on the icon, show connection status here */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
194 static void _qq_tooltip_text(GaimBuddy *b, GString *tooltip, gboolean full)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
195 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
196 qq_buddy *q_bud;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
197 gchar *ip_str;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
198
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
199 g_return_if_fail(b != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
200
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
201 q_bud = (qq_buddy *) b->proto_data;
14268
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
202 g_return_if_fail(q_bud != NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
203
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
204 if (GAIM_BUDDY_IS_ONLINE(b) && q_bud != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
205 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
206 ip_str = gen_ip_str(q_bud->ip);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
207 if (strlen(ip_str) != 0) {
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
208 g_string_append_printf(tooltip, "\n<b>%s Address:</b> %s:%d",
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
209 (q_bud->comm_flag & QQ_COMM_FLAG_TCP_MODE)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
210 ? "TCP" : "UDP", ip_str, q_bud->port);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
211 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
212 g_free(ip_str);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
213 g_string_append_printf(tooltip, "\n<b>Age:</b> %d", q_bud->age);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
214 switch (q_bud->gender) {
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
215 case QQ_BUDDY_GENDER_GG:
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
216 g_string_append(tooltip, "\n<b>Gender:</b> Male");
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
217 break;
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
218 case QQ_BUDDY_GENDER_MM:
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
219 g_string_append(tooltip, "\n<b>Gender:</b> Female");
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
220 break;
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
221 case QQ_BUDDY_GENDER_UNKNOWN:
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
222 g_string_append(tooltip, "\n<b>Gender:</b> Unknown");
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
223 break;
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
224 default:
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
225 g_string_append_printf(tooltip, "\n<b>Gender:</b> ERROR(%d)", q_bud->gender);
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
226 }
14268
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
227 /* For debugging */
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
228 /*
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
229 g_string_append_printf(tooltip, "\n<b>Flag:</b> %01x", q_bud->flag1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
230 g_string_append_printf(tooltip, "\n<b>CommFlag:</b> %01x", q_bud->comm_flag);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
231 g_string_append_printf(tooltip, "\n<b>Client:</b> %04x", q_bud->client_version);
14268
e6892c0050ad [gaim-migrate @ 16950]
Mark Huetsch <markhuetsch>
parents: 14265
diff changeset
232 */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
233 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
234 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
235
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
236 /* we can show tiny icons on the four corners of buddy icon, */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
237 static void _qq_list_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
238 {
15071
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
239 /* each char** are refering to a filename in pixmaps/gaim/status/default/ */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
240
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
241 qq_buddy *q_bud = b->proto_data;
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
242 const char *emblems[4] = { NULL, NULL, NULL, NULL };
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
243 int i = 1;
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
244
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
245 if (q_bud == NULL) {
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
246 emblems[0] = "offline";
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
247 } else {
14318
437ce90442cf [gaim-migrate @ 17011]
Mark Huetsch <markhuetsch>
parents: 14286
diff changeset
248 if (q_bud->status == QQ_BUDDY_ONLINE_AWAY)
14265
584cbd1628d0 [gaim-migrate @ 16947]
Mark Huetsch <markhuetsch>
parents: 14242
diff changeset
249 emblems[i++] = "away";
15072
322d6b5472a4 [gaim-migrate @ 17856]
Mark Huetsch <markhuetsch>
parents: 15071
diff changeset
250 /*
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
251 if (q_bud->comm_flag & QQ_COMM_FLAG_QQ_MEMBER)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
252 emblems[i++] = "qq_member";
15072
322d6b5472a4 [gaim-migrate @ 17856]
Mark Huetsch <markhuetsch>
parents: 15071
diff changeset
253 */
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
254 if (q_bud->comm_flag & QQ_COMM_FLAG_BIND_MOBILE)
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
255 emblems[i++] = "wireless";
15072
322d6b5472a4 [gaim-migrate @ 17856]
Mark Huetsch <markhuetsch>
parents: 15071
diff changeset
256 /*
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
257 if (q_bud->comm_flag & QQ_COMM_FLAG_VIDEO)
14265
584cbd1628d0 [gaim-migrate @ 16947]
Mark Huetsch <markhuetsch>
parents: 14242
diff changeset
258 emblems[i%4] = "video";
15072
322d6b5472a4 [gaim-migrate @ 17856]
Mark Huetsch <markhuetsch>
parents: 15071
diff changeset
259 */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
260
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
261 }
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
262
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
263 *se = emblems[0];
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
264 *sw = emblems[1];
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
265 *nw = emblems[2];
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
266 *ne = emblems[3];
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
267
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
268 return;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
269 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
270
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
271 /* QQ away status (used to initiate QQ away packet) */
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
272 static GList *_qq_away_states(GaimAccount *ga)
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
273 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
274 GaimStatusType *status;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
275 GList *types = NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
276
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
277 status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
278 "available", _("QQ: Available"), FALSE, TRUE, FALSE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
279 types = g_list_append(types, status);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
280
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
281 status = gaim_status_type_new_full(GAIM_STATUS_AWAY,
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
282 "away", _("QQ: Away"), FALSE, TRUE, FALSE);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
283 types = g_list_append(types, status);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
284
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
285 status = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE,
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
286 "invisible", _("QQ: Invisible"), FALSE, TRUE, FALSE);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
287 types = g_list_append(types, status);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
288
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
289 status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
290 "offline", _("QQ: Offline"), FALSE, TRUE, FALSE);
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
291 types = g_list_append(types, status);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
292
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
293 return types;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
294 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
295
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
296 /* initiate QQ away with proper change_status packet */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
297 static void _qq_set_away(GaimAccount *account, GaimStatus *status)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
298 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
299 GaimConnection *gc = gaim_account_get_connection(account);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
300
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
301 qq_send_packet_change_status(gc);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
302 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
303
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
304 /* IMPORTANT: GaimConvImFlags -> GaimMessageFlags */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
305 /* send an instant msg to a buddy */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
306 static gint _qq_send_im(GaimConnection *gc, const gchar *who, const gchar *message, GaimMessageFlags flags)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
307 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
308 gint type, to_uid;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
309 gchar *msg, *msg_with_qq_smiley;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
310 qq_data *qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
311
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
312 g_return_val_if_fail(who != NULL, -1);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
313
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
314 qd = (qq_data *) gc->proto_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
315
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
316 g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
317
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
318 type = (flags == GAIM_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
319 to_uid = gaim_name_to_uid(who);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
320
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
321 /* if msg is to myself, bypass the network */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
322 if (to_uid == qd->uid) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
323 serv_got_im(gc, who, message, flags, time(NULL));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
324 } else {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
325 msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
326 msg_with_qq_smiley = gaim_smiley_to_qq(msg);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
327 qq_send_packet_im(gc, to_uid, msg_with_qq_smiley, type);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
328 g_free(msg);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
329 g_free(msg_with_qq_smiley);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
330 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
331
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
332 return 1;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
333 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
334
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
335 /* send a chat msg to a QQ Qun */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
336 static int _qq_chat_send(GaimConnection *gc, int channel, const char *message, GaimMessageFlags flags)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
337 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
338 gchar *msg, *msg_with_qq_smiley;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
339 qq_group *group;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
340
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
341 g_return_val_if_fail(message != NULL, -1);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
342 g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
343
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
344 group = qq_group_find_by_channel(gc, channel);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
345 g_return_val_if_fail(group != NULL, -1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
346
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
347 msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
348 msg_with_qq_smiley = gaim_smiley_to_qq(msg);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
349 qq_send_packet_group_im(gc, group, msg_with_qq_smiley);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
350 g_free(msg);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
351 g_free(msg_with_qq_smiley);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
352
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
353 return 1;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
354 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
355
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
356 /* send packet to get who's detailed information */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
357 static void _qq_get_info(GaimConnection *gc, const gchar *who)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
358 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
359 guint32 uid;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
360 qq_data *qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
361
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
362 qd = gc->proto_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
363 uid = gaim_name_to_uid(who);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
364
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
365 if (uid <= 0) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
366 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Not valid QQid: %s\n", who);
14319
69f594f56de5 [gaim-migrate @ 17012]
Mark Huetsch <markhuetsch>
parents: 14318
diff changeset
367 gaim_notify_error(gc, NULL, _("Invalid name"), NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
368 return;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
369 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
370
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
371 qq_send_packet_get_info(gc, uid, TRUE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
372 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
373
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
374 /* get my own information */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
375 static void _qq_menu_modify_my_info(GaimPluginAction *action)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
376 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
377 GaimConnection *gc = (GaimConnection *) action->context;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
378 qq_data *qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
379
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
380 qd = (qq_data *) gc->proto_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
381 qq_prepare_modify_info(gc);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
382 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
383
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
384 static void _qq_menu_change_password(GaimPluginAction *action)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
385 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
386 gaim_notify_uri(NULL, "https://password.qq.com");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
387 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
388
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
389 /* remove a buddy from my list and remove myself from his list */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
390 /* TODO: re-enable this
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
391 static void _qq_menu_block_buddy(GaimBlistNode * node)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
392 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
393 guint32 uid;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
394 gc_and_uid *g;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
395 GaimBuddy *buddy;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
396 GaimConnection *gc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
397 // const gchar *who = param_who; gfhuang
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
398 const gchar *who;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
399
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
400 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
401
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
402 buddy = (GaimBuddy *) node;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
403 gc = gaim_account_get_connection(buddy->account);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
404 who = buddy->name;
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
405 g_return_if_fail(who != NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
406
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
407 uid = gaim_name_to_uid(who);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
408 g_return_if_fail(uid > 0);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
409
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
410 g = g_new0(gc_and_uid, 1);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
411 g->gc = gc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
412 g->uid = uid;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
413
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
414 gaim_request_action(gc, _("Block Buddy"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
415 _("Are you sure to block this buddy?"), NULL,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
416 1, g, 2,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
417 _("Cancel"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
418 G_CALLBACK(qq_do_nothing_with_gc_and_uid),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
419 _("Block"), G_CALLBACK(qq_block_buddy_with_gc_and_uid));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
420 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
421 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
422
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
423 /* show a brief summary of what we get from login packet */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
424 static void _qq_menu_show_login_info(GaimPluginAction *action)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
425 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
426 GaimConnection *gc = (GaimConnection *) action->context;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
427 qq_data *qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
428 GString *info;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
429
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
430 qd = (qq_data *) gc->proto_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
431 info = g_string_new("<html><body>\n");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
432
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
433 g_string_append_printf(info, _("<b>Current Online</b>: %d<br>\n"), qd->all_online);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
434 g_string_append_printf(info, _("<b>Last Refresh</b>: %s<br>\n"), ctime(&qd->last_get_online));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
435
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
436 g_string_append(info, "<hr>\n");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
437
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
438 g_string_append_printf(info, _("<b>Connection Mode</b>: %s<br>\n"), qd->use_tcp ? "TCP" : "UDP");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
439 g_string_append_printf(info, _("<b>Server IP</b>: %s: %d<br>\n"), qd->server_ip, qd->server_port);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
440 g_string_append_printf(info, _("<b>My Public IP</b>: %s<br>\n"), qd->my_ip);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
441
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
442 g_string_append(info, "<hr>\n");
15071
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
443 g_string_append(info, "<i>Information below may not be accurate</i><br>\n");
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
444
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
445 g_string_append_printf(info, _("<b>Login Time</b>: %s<br>\n"), ctime(&qd->login_time));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
446 g_string_append_printf(info, _("<b>Last Login IP</b>: %s<br>\n"), qd->last_login_ip);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
447 g_string_append_printf(info, _("<b>Last Login Time</b>: %s\n"), ctime(&qd->last_login_time));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
448
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
449 g_string_append(info, "</body></html>");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
450
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
451 gaim_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
452
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
453 g_string_free(info, TRUE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
454 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
455
14242
85f3808ca472 [gaim-migrate @ 16924]
Mark Huetsch <markhuetsch>
parents: 14237
diff changeset
456 /*
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
457 static void _qq_menu_search_or_add_permanent_group(GaimPluginAction *action)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
458 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
459 gaim_roomlist_show_with_account(NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
460 }
14242
85f3808ca472 [gaim-migrate @ 16924]
Mark Huetsch <markhuetsch>
parents: 14237
diff changeset
461 */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
462
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
463 /*
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
464 static void _qq_menu_create_permanent_group(GaimPluginAction * action)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
465 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
466 GaimConnection *gc = (GaimConnection *) action->context;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
467 gaim_request_input(gc, _("Create QQ Qun"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
468 _("Input Qun name here"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
469 _("Only QQ member can create permanent Qun"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
470 "OpenQ", FALSE, FALSE, NULL,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
471 _("Create"), G_CALLBACK(qq_group_create_with_name), _("Cancel"), NULL, gc);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
472 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
473 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
474
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
475 static void _qq_menu_unsubscribe_group(GaimBlistNode * node)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
476 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
477 GaimChat *chat = (GaimChat *)node;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
478 GaimConnection *gc = gaim_account_get_connection(chat->account);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
479 GHashTable *components = chat -> components;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
480
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
481 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
482
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
483 g_return_if_fail(components != NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
484 qq_group_exit(gc, components);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
485 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
486
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
487 /*
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
488 static void _qq_menu_manage_group(GaimBlistNode * node)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
489 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
490 GaimChat *chat = (GaimChat *)node;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
491 GaimConnection *gc = gaim_account_get_connection(chat->account);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
492 GHashTable *components = chat -> components;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
493
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
494 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
495
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
496 g_return_if_fail(components != NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
497 qq_group_manage_group(gc, components);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
498 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
499 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
500
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
501 /* TODO: re-enable this
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
502 static void _qq_menu_send_file(GaimBlistNode * node, gpointer ignored)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
503 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
504 GaimBuddy *buddy;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
505 GaimConnection *gc;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
506 qq_buddy *q_bud;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
507
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
508 g_return_if_fail (GAIM_BLIST_NODE_IS_BUDDY (node));
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
509 buddy = (GaimBuddy *) node;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
510 q_bud = (qq_buddy *) buddy->proto_data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
511 // if (is_online (q_bud->status)) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
512 gc = gaim_account_get_connection (buddy->account);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
513 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
514 qq_send_file(gc, buddy->name, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
515 // }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
516 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
517 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
518
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
519 /* protocol related menus */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
520 static GList *_qq_actions(GaimPlugin *plugin, gpointer context)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
521 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
522 GList *m;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
523 GaimPluginAction *act;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
524
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
525 m = NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
526 act = gaim_plugin_action_new(_("Modify My Information"), _qq_menu_modify_my_info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
527 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
528
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
529 act = gaim_plugin_action_new(_("Change Password"), _qq_menu_change_password);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
530 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
531
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
532 act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
533 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
534
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
535 /*
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
536 act = gaim_plugin_action_new(_("Qun: Search a permanent Qun"), _qq_menu_search_or_add_permanent_group);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
537 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
538
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
539 act = gaim_plugin_action_new(_("Qun: Create a permanent Qun"), _qq_menu_create_permanent_group);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
540 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
541 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
542
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
543 return m;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
544 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
545
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
546 /* chat-related (QQ Qun) menu shown up with right-click */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
547 static GList *_qq_chat_menu(GaimBlistNode *node)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
548 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
549 GList *m;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
550 GaimMenuAction *act;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
551
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
552 m = NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
553 act = gaim_menu_action_new(_("Exit this QQ Qun"), GAIM_CALLBACK(_qq_menu_unsubscribe_group), NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
554 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
555
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
556 /* TODO: enable this
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
557 act = gaim_menu_action_new(_("Show Details"), GAIM_CALLBACK(_qq_menu_manage_group), NULL, NULL);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
558 m = g_list_append(m, act);
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
559 */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
560
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
561 return m;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
562 }
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
563
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
564 /* buddy-related menu shown up with right-click */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
565 static GList *_qq_buddy_menu(GaimBlistNode * node)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
566 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
567 GList *m;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
568
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
569 if(GAIM_BLIST_NODE_IS_CHAT(node))
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
570 return _qq_chat_menu(node);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
571
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
572 m = NULL;
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
573 return m;
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
574 }
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
575
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
576 /* TODO : not working, temp commented out by gfhuang
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
577
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
578 act = gaim_menu_action_new(_("Block this buddy"), GAIM_CALLBACK(_qq_menu_block_buddy), NULL, NULL); //add NULL by gfhuang
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
579 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
580 // if (q_bud && is_online(q_bud->status)) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
581 act = gaim_menu_action_new(_("Send File"), GAIM_CALLBACK(_qq_menu_send_file), NULL, NULL); //add NULL by gfhuang
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
582 m = g_list_append(m, act);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
583 // }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
584 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
585 /*
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
586 return m;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
587 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
588 */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
589
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
590
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
591 static void _qq_keep_alive(GaimConnection *gc)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
592 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
593 qq_group *group;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
594 qq_data *qd;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
595 GList *list;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
596
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
597 if (NULL == (qd = (qq_data *) gc->proto_data))
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
598 return;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
599
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
600 list = qd->groups;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
601 while (list != NULL) {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
602 group = (qq_group *) list->data;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
603 if (group->my_status == QQ_GROUP_MEMBER_STATUS_IS_MEMBER ||
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
604 group->my_status == QQ_GROUP_MEMBER_STATUS_IS_ADMIN)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
605 /* no need to get info time and time again, online members enough */
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
606 qq_send_cmd_group_get_online_members(gc, group);
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
607
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
608 list = list->next;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
609 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
610
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
611 qq_send_packet_keep_alive(gc);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
612
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
613 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
614
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
615 /* convert chat nickname to qq-uid to get this buddy info */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
616 /* who is the nickname of buddy in QQ chat-room (Qun) */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
617 static void _qq_get_chat_buddy_info(GaimConnection *gc, gint channel, const gchar *who)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
618 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
619 gchar *gaim_name;
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
620 g_return_if_fail(who != NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
621
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
622 gaim_name = chat_name_to_gaim_name(who);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
623 if (gaim_name != NULL)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
624 _qq_get_info(gc, gaim_name);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
625 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
626
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
627 /* convert chat nickname to qq-uid to invite individual IM to buddy */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
628 /* who is the nickname of buddy in QQ chat-room (Qun) */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
629 static gchar *_qq_get_chat_buddy_real_name(GaimConnection *gc, gint channel, const gchar *who)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
630 {
14629
6b8bc59414f0 [gaim-migrate @ 17375]
Mark Huetsch <markhuetsch>
parents: 14542
diff changeset
631 g_return_val_if_fail(who != NULL, NULL);
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
632 return chat_name_to_gaim_name(who);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
633 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
634
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
635 GaimPlugin *my_protocol = NULL;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
636 static GaimPluginProtocolInfo prpl_info = {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
637 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_USE_POINTSIZE,
15071
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
638 NULL, /* user_splits */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
639 NULL, /* protocol_options */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
640 {"png", 96, 96, 96, 96, GAIM_ICON_SCALE_SEND}, /* icon_spec */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
641 _qq_list_icon, /* list_icon */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
642 _qq_list_emblems, /* list_emblems */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
643 _qq_status_text, /* status_text */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
644 _qq_tooltip_text, /* tooltip_text */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
645 _qq_away_states, /* away_states */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
646 _qq_buddy_menu, /* blist_node_menu */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
647 qq_chat_info, /* chat_info */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
648 qq_chat_info_defaults, /* chat_info_defaults */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
649 _qq_login, /* login */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
650 _qq_close, /* close */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
651 _qq_send_im, /* send_im */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
652 NULL, /* set_info */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
653 NULL, /* send_typing */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
654 _qq_get_info, /* get_info */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
655 _qq_set_away, /* set_away */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
656 NULL, /* set_idle */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
657 NULL, /* change_passwd */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
658 qq_add_buddy, /* add_buddy */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
659 NULL, /* add_buddies */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
660 qq_remove_buddy, /* remove_buddy */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
661 NULL, /* remove_buddies */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
662 NULL, /* add_permit */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
663 NULL, /* add_deny */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
664 NULL, /* rem_permit */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
665 NULL, /* rem_deny */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
666 NULL, /* set_permit_deny */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
667 qq_group_join, /* join_chat */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
668 NULL, /* reject chat invite */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
669 NULL, /* get_chat_name */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
670 NULL, /* chat_invite */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
671 NULL, /* chat_leave */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
672 NULL, /* chat_whisper */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
673 _qq_chat_send, /* chat_send */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
674 _qq_keep_alive, /* keepalive */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
675 NULL, /* register_user */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
676 _qq_get_chat_buddy_info, /* get_cb_info */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
677 NULL, /* get_cb_away */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
678 NULL, /* alias_buddy */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
679 NULL, /* group_buddy */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
680 NULL, /* rename_group */
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
681 NULL, /* buddy_free */
15071
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
682 NULL, /* convo_closed */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
683 NULL, /* normalize */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
684 qq_set_my_buddy_icon, /* set_buddy_icon */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
685 NULL, /* remove_group */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
686 _qq_get_chat_buddy_real_name, /* get_cb_real_name */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
687 NULL, /* set_chat_topic */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
688 NULL, /* find_blist_chat */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
689 qq_roomlist_get_list, /* roomlist_get_list */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
690 qq_roomlist_cancel, /* roomlist_cancel */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
691 NULL, /* roomlist_expand_category */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
692 NULL, /* can_receive_file */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
693 qq_send_file, /* send_file */
15075
2c93b0620065 [gaim-migrate @ 17859]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15072
diff changeset
694 NULL, /* new xfer */
15071
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
695 NULL, /* offline_message */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
696 NULL, /* GaimWhiteboardPrplOps */
902f3621aa13 [gaim-migrate @ 17855]
Mark Huetsch <markhuetsch>
parents: 15025
diff changeset
697 NULL, /* send_raw */
15123
c8957b9c6202 [gaim-migrate @ 17909]
Nathan Walp <nwalp@pidgin.im>
parents: 15075
diff changeset
698 NULL, /* roomlist_room_serialize */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
699 };
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
700
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
701 static GaimPluginInfo info = {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
702 GAIM_PLUGIN_MAGIC,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
703 GAIM_MAJOR_VERSION,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
704 GAIM_MINOR_VERSION,
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
705 GAIM_PLUGIN_PROTOCOL, /**< type */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
706 NULL, /**< ui_requirement */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
707 0, /**< flags */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
708 NULL, /**< dependencies */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
709 GAIM_PRIORITY_DEFAULT, /**< priority */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
710
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
711 "prpl-qq", /**< id */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
712 "QQ", /**< name */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
713 VERSION, /**< version */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
714 /** summary */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
715 N_("QQ Protocol Plugin"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
716 /** description */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
717 N_("QQ Protocol Plugin"),
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
718 OPENQ_AUTHOR, /**< author */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
719 OPENQ_WEBSITE, /**< homepage */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
720
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
721 NULL, /**< load */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
722 NULL, /**< unload */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
723 NULL, /**< destroy */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
724
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
725 NULL, /**< ui_info */
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
726 &prpl_info, /**< extra_info */
14404
8ff8f1c897b5 [gaim-migrate @ 17112]
Mark Huetsch <markhuetsch>
parents: 14320
diff changeset
727 NULL, /**< prefs_info */
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
728 _qq_actions
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
729 };
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
730
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
731
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
732 static void init_plugin(GaimPlugin *plugin)
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
733 {
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
734 GaimAccountOption *option;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
735
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
736 option = gaim_account_option_bool_new(_("Login in TCP"), "use_tcp", FALSE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
737 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
738
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
739 option = gaim_account_option_bool_new(_("Login Hidden"), "hidden", FALSE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
740 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
741
14790
a33d179d5508 [gaim-migrate @ 17555]
Richard Laager <rlaager@wiktel.com>
parents: 14629
diff changeset
742 option = gaim_account_option_string_new(_("Server"), "server", NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
743 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
744
14790
a33d179d5508 [gaim-migrate @ 17555]
Richard Laager <rlaager@wiktel.com>
parents: 14629
diff changeset
745 option = gaim_account_option_string_new(_("Port"), "port", NULL);
14192
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
746 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
747
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
748 my_protocol = plugin;
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
749
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
750 gaim_prefs_add_none("/plugins/prpl/qq");
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
751 gaim_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
752 gaim_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
753 gaim_prefs_add_bool("/plugins/prpl/qq/prompt_for_missing_packet", TRUE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
754 gaim_prefs_add_bool("/plugins/prpl/qq/prompt_group_msg_on_recv", TRUE);
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
755 }
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
756
60b1bc8dbf37 [gaim-migrate @ 16863]
Evan Schoenberg <evan.s@dreskin.net>
parents:
diff changeset
757 GAIM_INIT_PLUGIN(qq, init_plugin, info);