Mercurial > pidgin
annotate libgaim/protocols/qq/qq.c @ 14857:d134995c9ffa
[gaim-migrate @ 17626]
Mark a string for translation.
Fixes SF Bug #1586953
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 30 Oct 2006 04:39:11 +0000 |
parents | a33d179d5508 |
children | c039c920e11c |
rev | line source |
---|---|
14192 | 1 /** |
2 * @file qq.c The QQ2003C protocol plugin | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2004 Puzzlebird | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 | |
23 #include "internal.h" | |
24 | |
25 #ifdef _WIN32 | |
26 #define random rand | |
27 #endif | |
28 | |
29 #include "accountopt.h" | |
30 #include "debug.h" | |
31 #include "notify.h" | |
32 #include "prefs.h" | |
33 #include "prpl.h" | |
34 #include "request.h" | |
35 #include "roomlist.h" | |
36 #include "server.h" | |
37 #include "util.h" | |
38 | |
39 #include "buddy_info.h" | |
40 #include "buddy_opt.h" | |
41 #include "buddy_status.h" | |
42 #include "char_conv.h" | |
14237 | 43 #include "crypt.h" |
14192 | 44 #include "group.h" |
45 #include "group_find.h" | |
46 #include "group_im.h" | |
47 #include "group_info.h" | |
48 #include "group_join.h" | |
49 #include "group_opt.h" | |
50 #include "header_info.h" | |
51 #include "im.h" | |
52 #include "keep_alive.h" | |
53 #include "login_logout.h" | |
54 #include "packet_parse.h" | |
55 #include "qq.h" | |
56 #include "qq_proxy.h" | |
57 #include "send_core.h" | |
58 #include "send_file.h" | |
59 #include "utils.h" | |
60 #include "version.h" | |
61 | |
62 #define OPENQ_AUTHOR "Puzzlebird" | |
63 #define OPENQ_WEBSITE "http://openq.sourceforge.net" | |
64 #define QQ_TCP_QUERY_PORT "8000" | |
65 #define QQ_UDP_PORT "8000" | |
66 | |
67 const gchar *udp_server_list[] = { | |
14195 | 68 "sz.tencent.com", |
69 "sz2.tencent.com", | |
70 "sz3.tencent.com", | |
71 "sz4.tencent.com", | |
72 "sz5.tencent.com", | |
73 "sz6.tencent.com", | |
74 "sz7.tencent.com", | |
75 "sz8.tencent.com", | |
76 "sz9.tencent.com" | |
14192 | 77 }; |
78 const gint udp_server_amount = (sizeof(udp_server_list) / sizeof(udp_server_list[0])); | |
79 | |
80 | |
81 const gchar *tcp_server_list[] = { | |
14195 | 82 "tcpconn.tencent.com", |
83 "tcpconn2.tencent.com", | |
84 "tcpconn3.tencent.com", | |
85 "tcpconn4.tencent.com", | |
86 "tcpconn5.tencent.com", | |
87 "tcpconn6.tencent.com" | |
14192 | 88 }; |
89 const gint tcp_server_amount = (sizeof(tcp_server_list) / sizeof(tcp_server_list[0])); | |
90 | |
91 static void _qq_login(GaimAccount *account) | |
92 { | |
93 const gchar *qq_server, *qq_port; | |
94 qq_data *qd; | |
95 GaimConnection *gc; | |
96 GaimPresence *presence; | |
14318 | 97 gboolean use_tcp; |
14192 | 98 |
99 g_return_if_fail(account != NULL); | |
100 | |
101 gc = gaim_account_get_connection(account); | |
102 g_return_if_fail(gc != NULL); | |
103 | |
104 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_AUTO_RESP; | |
105 | |
106 qd = g_new0(qq_data, 1); | |
14195 | 107 qd->gc = gc; |
14192 | 108 gc->proto_data = qd; |
109 | |
110 qq_server = gaim_account_get_string(account, "server", NULL); | |
111 qq_port = gaim_account_get_string(account, "port", NULL); | |
112 use_tcp = gaim_account_get_bool(account, "use_tcp", FALSE); | |
113 presence = gaim_account_get_presence(account); | |
114 | |
115 qd->use_tcp = use_tcp; | |
116 | |
14318 | 117 if(gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_INVISIBLE)) { |
14192 | 118 qd->login_mode = QQ_LOGIN_MODE_HIDDEN; |
14318 | 119 } else if(gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_AWAY) |
120 || gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_EXTENDED_AWAY)) { | |
121 qd->login_mode = QQ_LOGIN_MODE_AWAY; | |
14192 | 122 } else { |
123 qd->login_mode = QQ_LOGIN_MODE_NORMAL; | |
124 } | |
125 | |
126 if (qq_server == NULL || strlen(qq_server) == 0) | |
127 qq_server = use_tcp ? | |
14195 | 128 tcp_server_list[random() % tcp_server_amount] : |
129 udp_server_list[random() % udp_server_amount]; | |
14192 | 130 |
131 if (qq_port == NULL || strtol(qq_port, NULL, 10) == 0) | |
132 qq_port = use_tcp ? QQ_TCP_QUERY_PORT : QQ_UDP_PORT; | |
133 | |
134 gaim_connection_update_progress(gc, _("Connecting"), 0, QQ_CONNECT_STEPS); | |
14195 | 135 |
14192 | 136 if (qq_connect(account, qq_server, strtol(qq_port, NULL, 10), use_tcp, FALSE) < 0) |
137 gaim_connection_error(gc, _("Unable to connect.")); | |
138 } | |
139 | |
140 /* directly goes for qq_disconnect */ | |
141 static void _qq_close(GaimConnection *gc) | |
142 { | |
143 g_return_if_fail(gc != NULL); | |
144 qq_disconnect(gc); | |
145 } | |
146 | |
147 /* returns the icon name for a buddy or protocol */ | |
148 static const gchar *_qq_list_icon(GaimAccount *a, GaimBuddy *b) | |
149 { | |
150 gchar *filename; | |
151 qq_buddy *q_bud; | |
152 | |
153 /* do not use g_return_val_if_fail, as it is not assertion */ | |
154 if (b == NULL || b->proto_data == NULL) | |
155 return "qq"; | |
14404 | 156 |
14192 | 157 q_bud = (qq_buddy *) b->proto_data; |
14265 | 158 filename = get_icon_name(q_bud->icon / 3 + 1); |
14192 | 159 |
160 return filename; | |
161 } | |
162 | |
163 | |
164 /* a short status text beside buddy icon*/ | |
165 static gchar *_qq_status_text(GaimBuddy *b) | |
166 { | |
167 qq_buddy *q_bud; | |
168 GString *status; | |
169 | |
170 q_bud = (qq_buddy *) b->proto_data; | |
171 if (q_bud == NULL) | |
172 return NULL; | |
173 | |
174 status = g_string_new(""); | |
175 | |
176 switch(q_bud->status) { | |
177 case QQ_BUDDY_OFFLINE: | |
14268 | 178 g_string_append(status, "Offline"); |
14192 | 179 break; |
180 case QQ_BUDDY_ONLINE_NORMAL: | |
181 return NULL; | |
182 break; | |
14268 | 183 /* TODO What does this status mean? Labelling it as offline... */ |
14192 | 184 case QQ_BUDDY_ONLINE_OFFLINE: |
14268 | 185 g_string_append(status, "Offline"); |
14192 | 186 break; |
187 case QQ_BUDDY_ONLINE_AWAY: | |
188 g_string_append(status, "Away"); | |
189 break; | |
190 case QQ_BUDDY_ONLINE_INVISIBLE: | |
191 g_string_append(status, "Invisible"); | |
192 break; | |
193 default: | |
194 g_string_printf(status, "Unknown-%d", q_bud->status); | |
195 } | |
196 | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
197 return g_string_free(status, FALSE); |
14192 | 198 } |
199 | |
200 | |
201 /* a floating text when mouse is on the icon, show connection status here */ | |
202 static void _qq_tooltip_text(GaimBuddy *b, GString *tooltip, gboolean full) | |
203 { | |
204 qq_buddy *q_bud; | |
205 gchar *ip_str; | |
206 | |
207 g_return_if_fail(b != NULL); | |
208 | |
209 q_bud = (qq_buddy *) b->proto_data; | |
14268 | 210 g_return_if_fail(q_bud != NULL); |
14192 | 211 |
212 if (GAIM_BUDDY_IS_ONLINE(b) && q_bud != NULL) | |
213 { | |
214 ip_str = gen_ip_str(q_bud->ip); | |
215 if (strlen(ip_str) != 0) { | |
216 g_string_append_printf(tooltip, "\n<b>%s Address:</b> %s:%d", | |
217 (q_bud->comm_flag & QQ_COMM_FLAG_TCP_MODE) | |
218 ? "TCP" : "UDP", ip_str, q_bud->port); | |
219 } | |
220 g_free(ip_str); | |
221 g_string_append_printf(tooltip, "\n<b>Age:</b> %d", q_bud->age); | |
222 switch (q_bud->gender) { | |
223 case QQ_BUDDY_GENDER_GG: | |
14268 | 224 g_string_append(tooltip, "\n<b>Gender:</b> Male"); |
14192 | 225 break; |
226 case QQ_BUDDY_GENDER_MM: | |
14268 | 227 g_string_append(tooltip, "\n<b>Gender:</b> Female"); |
14192 | 228 break; |
229 case QQ_BUDDY_GENDER_UNKNOWN: | |
14268 | 230 g_string_append(tooltip, "\n<b>Gender:</b> Unknown"); |
14192 | 231 break; |
232 default: | |
233 g_string_append_printf(tooltip, "\n<b>Gender:</b> ERROR(%d)", q_bud->gender); | |
14268 | 234 } |
235 /* For debugging */ | |
236 /* | |
14192 | 237 g_string_append_printf(tooltip, "\n<b>Flag:</b> %01x", q_bud->flag1); |
238 g_string_append_printf(tooltip, "\n<b>CommFlag:</b> %01x", q_bud->comm_flag); | |
239 g_string_append_printf(tooltip, "\n<b>Client:</b> %04x", q_bud->client_version); | |
14268 | 240 */ |
14192 | 241 } |
242 } | |
243 | |
244 /* we can show tiny icons on the four corners of buddy icon, */ | |
245 static void _qq_list_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne) | |
246 { | |
247 /* each char ** are refering to filename in pixmaps/gaim/status/default/ *png */ | |
248 | |
249 qq_buddy *q_bud = b->proto_data; | |
250 const char *emblems[4] = { NULL, NULL, NULL, NULL }; | |
14265 | 251 int i = 1; |
14192 | 252 |
253 if (q_bud == NULL) { | |
254 emblems[0] = "offline"; | |
255 } else { | |
14265 | 256 /* TODO the wireless icon is a bit too big to look good with QQ faces */ |
14318 | 257 if (q_bud->status == QQ_BUDDY_ONLINE_AWAY) |
14265 | 258 emblems[i++] = "away"; |
14192 | 259 if (q_bud->comm_flag & QQ_COMM_FLAG_QQ_MEMBER) |
260 emblems[i++] = "qq_member"; | |
261 if (q_bud->comm_flag & QQ_COMM_FLAG_BIND_MOBILE) | |
262 emblems[i++] = "wireless"; | |
263 if (q_bud->comm_flag & QQ_COMM_FLAG_VIDEO) | |
14265 | 264 emblems[i%4] = "video"; |
14192 | 265 |
266 } | |
267 | |
268 *se = emblems[0]; | |
269 *sw = emblems[1]; | |
270 *nw = emblems[2]; | |
271 *ne = emblems[3]; | |
272 | |
273 return; | |
274 } | |
275 | |
276 /* QQ away status (used to initiate QQ away packet) */ | |
277 static GList *_qq_away_states(GaimAccount *ga) | |
278 { | |
279 GaimStatusType *status; | |
280 GList *types = NULL; | |
281 | |
282 status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, | |
283 "available", _("QQ: Available"), FALSE, TRUE, FALSE); | |
284 types = g_list_append(types, status); | |
285 | |
286 status = gaim_status_type_new_full(GAIM_STATUS_AWAY, | |
287 "away", _("QQ: Away"), FALSE, TRUE, FALSE); | |
288 types = g_list_append(types, status); | |
289 | |
290 status = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE, | |
291 "invisible", _("QQ: Invisible"), FALSE, TRUE, FALSE); | |
292 types = g_list_append(types, status); | |
293 | |
294 status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, | |
295 "offline", _("QQ: Offline"), FALSE, TRUE, FALSE); | |
296 types = g_list_append(types, status); | |
297 | |
298 return types; | |
299 } | |
300 | |
301 /* initiate QQ away with proper change_status packet */ | |
302 static void _qq_set_away(GaimAccount *account, GaimStatus *status) | |
303 { | |
304 GaimConnection *gc = gaim_account_get_connection(account); | |
305 | |
306 qq_send_packet_change_status(gc); | |
307 } | |
308 | |
309 /* IMPORTANT: GaimConvImFlags -> GaimMessageFlags */ | |
310 /* send an instant msg to a buddy */ | |
311 static gint _qq_send_im(GaimConnection *gc, const gchar *who, const gchar *message, GaimMessageFlags flags) | |
312 { | |
313 gint type, to_uid; | |
314 gchar *msg, *msg_with_qq_smiley; | |
315 qq_data *qd; | |
316 | |
14629 | 317 g_return_val_if_fail(who != NULL, -1); |
14192 | 318 |
319 qd = (qq_data *) gc->proto_data; | |
320 | |
321 g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG); | |
322 | |
323 type = (flags == GAIM_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT); | |
324 to_uid = gaim_name_to_uid(who); | |
325 | |
326 /* if msg is to myself, bypass the network */ | |
327 if (to_uid == qd->uid) { | |
328 serv_got_im(gc, who, message, flags, time(NULL)); | |
329 } else { | |
330 msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT); | |
331 msg_with_qq_smiley = gaim_smiley_to_qq(msg); | |
332 qq_send_packet_im(gc, to_uid, msg_with_qq_smiley, type); | |
333 g_free(msg); | |
334 g_free(msg_with_qq_smiley); | |
335 } | |
336 | |
337 return 1; | |
338 } | |
339 | |
340 /* send a chat msg to a QQ Qun */ | |
341 static int _qq_chat_send(GaimConnection *gc, int channel, const char *message, GaimMessageFlags flags) | |
342 { | |
343 gchar *msg, *msg_with_qq_smiley; | |
344 qq_group *group; | |
345 | |
14629 | 346 g_return_val_if_fail(message != NULL, -1); |
14192 | 347 g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG); |
348 | |
349 group = qq_group_find_by_channel(gc, channel); | |
350 g_return_val_if_fail(group != NULL, -1); | |
351 | |
352 msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT); | |
353 msg_with_qq_smiley = gaim_smiley_to_qq(msg); | |
354 qq_send_packet_group_im(gc, group, msg_with_qq_smiley); | |
355 g_free(msg); | |
356 g_free(msg_with_qq_smiley); | |
357 | |
358 return 1; | |
359 } | |
360 | |
361 /* send packet to get who's detailed information */ | |
362 static void _qq_get_info(GaimConnection *gc, const gchar *who) | |
363 { | |
364 guint32 uid; | |
365 qq_data *qd; | |
366 | |
367 qd = gc->proto_data; | |
368 uid = gaim_name_to_uid(who); | |
369 | |
370 if (uid <= 0) { | |
371 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Not valid QQid: %s\n", who); | |
14319 | 372 gaim_notify_error(gc, NULL, _("Invalid name"), NULL); |
14192 | 373 return; |
374 } | |
375 | |
376 qq_send_packet_get_info(gc, uid, TRUE); | |
377 } | |
378 | |
379 /* get my own information */ | |
380 static void _qq_menu_modify_my_info(GaimPluginAction *action) | |
381 { | |
382 GaimConnection *gc = (GaimConnection *) action->context; | |
383 qq_data *qd; | |
384 | |
385 qd = (qq_data *) gc->proto_data; | |
386 qq_prepare_modify_info(gc); | |
387 } | |
388 | |
14265 | 389 static void _qq_change_face_cb(GaimConnection *gc, GaimRequestFields *fields) |
390 { | |
391 qq_data *qd; | |
392 GaimRequestField *field; | |
393 gint suffix; | |
394 | |
395 qd = (qq_data *) gc->proto_data; | |
396 | |
397 field = gaim_request_fields_get_field(fields, "face_num"); | |
14318 | 398 suffix = get_icon_offset(gc); |
14265 | 399 qd->my_icon = gaim_request_field_choice_get_value(field) * 3 + suffix; |
400 qd->modifying_face = TRUE; | |
401 qq_send_packet_get_info(gc, qd->uid, FALSE); | |
402 } | |
403 | |
404 static void _qq_add_face_choice(GaimRequestFieldGroup *group, gint face_num) | |
405 { | |
406 GaimRequestField *field; | |
407 struct stat img_stat; | |
408 FILE *file; | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
409 gchar *filename, *img_data; |
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
410 gchar face[15]; |
14265 | 411 gint size; |
412 | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
413 g_snprintf(face, sizeof(face), "qq_%i.png", face_num); |
14286 | 414 filename = g_build_filename(DATADIR, "pixmaps", |
14265 | 415 "gaim","status","default", face, NULL); |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
416 g_snprintf(face, sizeof(face), "%i", face_num); |
14265 | 417 file = g_fopen(filename, "rb"); |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
418 if (file && fstat(fileno(file), &img_stat) == 0) { |
14265 | 419 img_data = g_malloc(img_stat.st_size); |
420 size = fread(img_data, 1, img_stat.st_size, file); | |
421 | |
422 field = gaim_request_field_image_new(face, face, img_data, size); | |
423 gaim_request_field_group_add_field(group, field); | |
424 | |
425 g_free(img_data); | |
426 fclose(file); | |
427 } | |
428 } | |
429 | |
14268 | 430 /* Change your status icon (face) */ |
14265 | 431 static void _qq_menu_change_face(GaimPluginAction *action) |
432 { | |
433 GaimConnection *gc = (GaimConnection *) action->context; | |
434 qq_data *qd = (qq_data *) gc->proto_data; | |
435 GaimRequestFields *fields; | |
436 GaimRequestFieldGroup *group; | |
437 GaimRequestField *field; | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
438 gchar label[15]; |
14265 | 439 gint i; |
440 | |
441 fields = gaim_request_fields_new(); | |
442 group = gaim_request_field_group_new(_("Selection")); | |
443 gaim_request_fields_add_group(fields, group); | |
444 field = gaim_request_field_choice_new("face_num", | |
445 _("Select a number"), qd->my_icon / 3); | |
446 for(i = 1; i <= QQ_FACES; i++) { | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
447 g_snprintf(label, sizeof(label), "%i", i); |
14265 | 448 gaim_request_field_choice_add(field, label); |
449 } | |
450 gaim_request_field_group_add_field(group, field); | |
451 group = gaim_request_field_group_new(_("Faces")); | |
452 gaim_request_fields_add_group(fields, group); | |
453 for(i = 1; i <= QQ_FACES; i++) | |
454 _qq_add_face_choice(group, i); | |
455 | |
456 gaim_request_fields(gc, _("Change Your QQ Face"), | |
457 _("Change Face"), NULL, fields, | |
458 _("Update"), G_CALLBACK(_qq_change_face_cb), | |
459 _("Cancel"), NULL, | |
460 gc); | |
461 } | |
462 | |
14192 | 463 static void _qq_menu_change_password(GaimPluginAction *action) |
464 { | |
465 gaim_notify_uri(NULL, "https://password.qq.com"); | |
466 } | |
467 | |
468 /* remove a buddy from my list and remove myself from his list */ | |
469 /* TODO: re-enable this | |
470 static void _qq_menu_block_buddy(GaimBlistNode * node) | |
471 { | |
472 guint32 uid; | |
473 gc_and_uid *g; | |
474 GaimBuddy *buddy; | |
475 GaimConnection *gc; | |
476 // const gchar *who = param_who; gfhuang | |
477 const gchar *who; | |
478 | |
479 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | |
480 | |
481 buddy = (GaimBuddy *) node; | |
482 gc = gaim_account_get_connection(buddy->account); | |
483 who = buddy->name; | |
14629 | 484 g_return_if_fail(who != NULL); |
14192 | 485 |
486 uid = gaim_name_to_uid(who); | |
487 g_return_if_fail(uid > 0); | |
488 | |
489 g = g_new0(gc_and_uid, 1); | |
490 g->gc = gc; | |
491 g->uid = uid; | |
492 | |
493 gaim_request_action(gc, _("Block Buddy"), | |
494 _("Are you sure to block this buddy?"), NULL, | |
495 1, g, 2, | |
496 _("Cancel"), | |
497 G_CALLBACK(qq_do_nothing_with_gc_and_uid), | |
498 _("Block"), G_CALLBACK(qq_block_buddy_with_gc_and_uid)); | |
499 } | |
500 */ | |
501 | |
502 /* show a brief summary of what we get from login packet */ | |
503 static void _qq_menu_show_login_info(GaimPluginAction *action) | |
504 { | |
505 GaimConnection *gc = (GaimConnection *) action->context; | |
506 qq_data *qd; | |
507 GString *info; | |
508 | |
509 qd = (qq_data *) gc->proto_data; | |
510 info = g_string_new("<html><body>\n"); | |
511 | |
512 g_string_append_printf(info, _("<b>Current Online</b>: %d<br>\n"), qd->all_online); | |
513 g_string_append_printf(info, _("<b>Last Refresh</b>: %s<br>\n"), ctime(&qd->last_get_online)); | |
514 | |
515 g_string_append(info, "<hr>\n"); | |
516 | |
517 g_string_append_printf(info, _("<b>Connection Mode</b>: %s<br>\n"), qd->use_tcp ? "TCP" : "UDP"); | |
518 g_string_append_printf(info, _("<b>Server IP</b>: %s: %d<br>\n"), qd->server_ip, qd->server_port); | |
519 g_string_append_printf(info, _("<b>My Public IP</b>: %s<br>\n"), qd->my_ip); | |
520 | |
521 g_string_append(info, "<hr>\n"); | |
14857
d134995c9ffa
[gaim-migrate @ 17626]
Richard Laager <rlaager@wiktel.com>
parents:
14790
diff
changeset
|
522 g_string_append(info, _("<i>Information below may not be accurate</i><br>\n")); |
14192 | 523 |
524 g_string_append_printf(info, _("<b>Login Time</b>: %s<br>\n"), ctime(&qd->login_time)); | |
525 g_string_append_printf(info, _("<b>Last Login IP</b>: %s<br>\n"), qd->last_login_ip); | |
526 g_string_append_printf(info, _("<b>Last Login Time</b>: %s\n"), ctime(&qd->last_login_time)); | |
527 | |
528 g_string_append(info, "</body></html>"); | |
529 | |
530 gaim_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL); | |
531 | |
532 g_string_free(info, TRUE); | |
533 } | |
534 | |
14242 | 535 /* |
14192 | 536 static void _qq_menu_search_or_add_permanent_group(GaimPluginAction *action) |
537 { | |
538 gaim_roomlist_show_with_account(NULL); | |
539 } | |
14242 | 540 */ |
14192 | 541 |
542 /* | |
543 static void _qq_menu_create_permanent_group(GaimPluginAction * action) | |
544 { | |
545 GaimConnection *gc = (GaimConnection *) action->context; | |
546 gaim_request_input(gc, _("Create QQ Qun"), | |
547 _("Input Qun name here"), | |
548 _("Only QQ member can create permanent Qun"), | |
549 "OpenQ", FALSE, FALSE, NULL, | |
550 _("Create"), G_CALLBACK(qq_group_create_with_name), _("Cancel"), NULL, gc); | |
551 } | |
552 */ | |
553 | |
554 static void _qq_menu_unsubscribe_group(GaimBlistNode * node) | |
555 { | |
556 GaimChat *chat = (GaimChat *)node; | |
557 GaimConnection *gc = gaim_account_get_connection(chat->account); | |
558 GHashTable *components = chat -> components; | |
559 | |
560 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node)); | |
561 | |
14629 | 562 g_return_if_fail(components != NULL); |
14192 | 563 qq_group_exit(gc, components); |
564 } | |
565 | |
14404 | 566 /* |
14192 | 567 static void _qq_menu_manage_group(GaimBlistNode * node) |
568 { | |
569 GaimChat *chat = (GaimChat *)node; | |
570 GaimConnection *gc = gaim_account_get_connection(chat->account); | |
571 GHashTable *components = chat -> components; | |
572 | |
573 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node)); | |
574 | |
14629 | 575 g_return_if_fail(components != NULL); |
14192 | 576 qq_group_manage_group(gc, components); |
577 } | |
578 */ | |
579 | |
580 /* TODO: re-enable this | |
581 static void _qq_menu_send_file(GaimBlistNode * node, gpointer ignored) | |
582 { | |
583 GaimBuddy *buddy; | |
584 GaimConnection *gc; | |
585 qq_buddy *q_bud; | |
586 | |
587 g_return_if_fail (GAIM_BLIST_NODE_IS_BUDDY (node)); | |
588 buddy = (GaimBuddy *) node; | |
589 q_bud = (qq_buddy *) buddy->proto_data; | |
590 // if (is_online (q_bud->status)) { | |
591 gc = gaim_account_get_connection (buddy->account); | |
592 g_return_if_fail (gc != NULL && gc->proto_data != NULL); | |
593 qq_send_file(gc, buddy->name, NULL); | |
594 // } | |
595 } | |
596 */ | |
597 | |
14237 | 598 /* attempt to output the value and byte length of a given field */ |
599 /* | |
14192 | 600 static gboolean _qq_parse_custom_packet_field(GaimRequestFields *fields, |
14237 | 601 const gchar *id, guint8 **value, gint *len, gboolean allow_null) |
14192 | 602 { |
603 GaimRequestField *field; | |
604 const gchar *str; | |
14237 | 605 gint i; |
14192 | 606 gboolean success; |
607 | |
608 success = FALSE; | |
609 field = gaim_request_fields_get_field(fields, id); | |
610 str = gaim_request_field_string_get_value(field); | |
14237 | 611 if (!str && allow_null) { |
612 return TRUE; | |
613 } else if (str) { | |
14192 | 614 success = TRUE; |
615 if (strcmp(id, "uid") != 0) { | |
14237 | 616 *value = hex_str_to_bytes(str, len); |
617 if (!*value) | |
14192 | 618 success = FALSE; |
619 } else { | |
620 for (i = 0; i < strlen(str); i++) { | |
621 if (!g_ascii_isdigit(str[i])) { | |
622 success = FALSE; | |
623 break; | |
624 } | |
625 } | |
626 if (success) { | |
627 *(guint32 *) value = strtoul(str, NULL, 10); | |
628 if (errno == ERANGE) | |
629 success = FALSE; | |
630 } | |
631 } | |
632 } | |
633 if (!success) | |
634 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid entry: %s\n", id); | |
635 return success; | |
636 } | |
14237 | 637 */ |
14192 | 638 |
14237 | 639 /* attempt to output the field values and body length */ |
640 /* | |
14192 | 641 static gboolean _qq_parse_custom_packet_fields(GaimRequestFields *fields, |
642 guint8 **client, guint8 **cmd, guint8 **seq, guint32 *uid, | |
14237 | 643 guint8 **body, guint8 **key, gint *body_len) |
14192 | 644 { |
14237 | 645 gint len; |
14192 | 646 gboolean success; |
647 | |
14237 | 648 success = FALSE; |
649 *client = *cmd = *seq = *body = *key = NULL; | |
650 *uid = *body_len = 0; | |
651 if ((_qq_parse_custom_packet_field(fields, "client", client, &len, FALSE) | |
652 && len == 2 | |
653 && _qq_parse_custom_packet_field(fields, "cmd", cmd, &len, FALSE) | |
654 && len == 2 | |
655 && _qq_parse_custom_packet_field(fields, "uid", (guint8 **) uid, &len, FALSE) | |
656 && _qq_parse_custom_packet_field(fields, "seq", seq, &len, FALSE) | |
657 && len == 2 | |
658 && _qq_parse_custom_packet_field(fields, "body", body, body_len, TRUE))) { | |
659 if (*body_len > MAX_PACKET_SIZE / 8) { | |
660 g_free(*client); | |
661 g_free(*cmd); | |
662 g_free(*seq); | |
663 g_free(*body); | |
664 return FALSE; | |
665 } | |
666 if (!gaim_request_fields_get_bool(fields, "encrypt")) | |
667 return TRUE; | |
668 else | |
669 success = _qq_parse_custom_packet_field(fields, | |
670 "key", key, &len, FALSE) | |
671 && len == 16 | |
672 && *body_len > 0; | |
673 } | |
674 if (!success) { | |
14192 | 675 if (*client) |
676 g_free(*client); | |
677 if (*cmd) | |
678 g_free(*cmd); | |
679 if (*seq) | |
680 g_free(*seq); | |
14237 | 681 if (*key) |
682 g_free(*key); | |
683 return FALSE; | |
14192 | 684 } |
14237 | 685 return TRUE; |
14192 | 686 } |
14237 | 687 */ |
14192 | 688 |
14237 | 689 /* parses the request fields and attempts to send the packet */ |
690 /* | |
14192 | 691 static void _qq_send_custom_packet_cb(GaimConnection *gc, GaimRequestFields *fields) |
692 { | |
693 guint32 uid; | |
14237 | 694 guint8 *buf, *client, *cmd, *seq, *body, *encr_body, *key, *cursor; |
695 gint bytes, len, encr_len; | |
14192 | 696 qq_data *qd; |
697 gboolean success; | |
698 | |
699 qd = (qq_data *) gc->proto_data; | |
700 | |
701 success = _qq_parse_custom_packet_fields(fields, &client, &cmd, | |
14237 | 702 &seq, &uid, &body, &key, &len); |
14192 | 703 if (!success) { |
14237 | 704 gaim_notify_error(gc, _("Error"), _("Invalid entry"), NULL); |
14192 | 705 return; |
706 } | |
707 | |
708 bytes = 0; | |
709 buf = g_newa(guint8, MAX_PACKET_SIZE); | |
710 cursor = buf; | |
14237 | 711 */ |
14192 | 712 /* QQ TCP packet has two bytes in the beginning to define packet length |
713 * so I leave room here for size */ | |
14237 | 714 /* |
14192 | 715 if (qd->use_tcp) |
716 bytes += create_packet_w(buf, &cursor, 0x0000); | |
717 bytes += create_packet_b(buf, &cursor, QQ_PACKET_TAG); | |
718 bytes += create_packet_w(buf, &cursor, *(guint16 *) client); | |
719 bytes += create_packet_w(buf, &cursor, *(guint16 *) cmd); | |
720 bytes += create_packet_w(buf, &cursor, *(guint16 *) seq); | |
721 bytes += create_packet_dw(buf, &cursor, uid); | |
722 if (body) { | |
14237 | 723 if (gaim_request_fields_get_bool(fields, "encrypt")) { |
724 if (gaim_request_fields_get_bool(fields, "prepend")) | |
725 bytes += create_packet_data(buf, &cursor, key, 16); | |
726 encr_body = g_newa(guint8, MAX_PACKET_SIZE); | |
727 qq_crypt(ENCRYPT, body, len, key, encr_body, &encr_len); | |
728 bytes += create_packet_data(buf, &cursor, encr_body, encr_len); | |
729 g_free(key); | |
730 } else { | |
731 bytes += create_packet_data(buf, &cursor, body, len); | |
732 } | |
733 | |
14192 | 734 g_free(body); |
735 } | |
736 bytes += create_packet_b(buf, &cursor, QQ_PACKET_TAIL); | |
737 | |
738 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Custom packet of length %i\n", bytes); | |
739 _qq_show_packet("Outgoing custom packet", buf, bytes); | |
740 | |
741 _qq_send_packet(gc, buf, bytes, *(guint16 *) cmd); | |
742 g_free(client); | |
743 g_free(cmd); | |
744 g_free(seq); | |
745 } | |
14237 | 746 */ |
14192 | 747 |
748 /* send a custom packet to the server - for protocol testing */ | |
14237 | 749 /* |
14192 | 750 static void _qq_menu_send_custom_packet(GaimPluginAction *action) |
751 { | |
752 GaimConnection *gc; | |
753 GaimRequestFields *fields; | |
754 GaimRequestFieldGroup *group; | |
755 GaimRequestField *field; | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
756 gchar tmp[15]; |
14192 | 757 qq_data *qd; |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
758 |
14192 | 759 gc = (GaimConnection *) action->context; |
760 qd = (qq_data *) gc->proto_data; | |
761 | |
762 fields = gaim_request_fields_new(); | |
14237 | 763 group = gaim_request_field_group_new(_("Basic Elements")); |
14192 | 764 gaim_request_fields_add_group(fields, group); |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
765 g_snprintf(tmp, sizeof(tmp), "%04X", QQ_CLIENT); |
14192 | 766 field = gaim_request_field_string_new("client", _("Client (hex)"), tmp, FALSE); |
767 gaim_request_field_group_add_field(group, field); | |
768 field = gaim_request_field_string_new("cmd", _("Command (hex)"), "0000", FALSE); | |
769 gaim_request_field_group_add_field(group, field); | |
770 field = gaim_request_field_string_new("seq", _("Sequence (hex)"), "0000", FALSE); | |
771 gaim_request_field_group_add_field(group, field); | |
14497
ae0f94b7f396
[gaim-migrate @ 17216]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14404
diff
changeset
|
772 g_snprintf(tmp, sizeof(tmp), "%u", qd->uid); |
14192 | 773 field = gaim_request_field_string_new("uid", _("QQ Number (decimal)"), tmp, FALSE); |
774 gaim_request_field_group_add_field(group, field); | |
14237 | 775 field = gaim_request_field_string_new("body", _("Body (hex)"), NULL, TRUE); |
776 gaim_request_field_group_add_field(group, field); | |
777 group = gaim_request_field_group_new(_("Encryption")); | |
778 gaim_request_fields_add_group(fields, group); | |
779 field = gaim_request_field_bool_new("encrypt", _("Encrypt Packet Body"), FALSE); | |
14192 | 780 gaim_request_field_group_add_field(group, field); |
14237 | 781 field = gaim_request_field_bool_new("prepend", _("Prepend Key to Body"), FALSE); |
782 gaim_request_field_group_add_field(group, field); | |
783 field = gaim_request_field_string_new("key", _("Encryption Key (hex)"), NULL, FALSE); | |
784 gaim_request_field_group_add_field(group, field); | |
785 | |
14192 | 786 |
787 gaim_request_fields(gc, _("Send a custom packet"), | |
788 _("Send a custom packet"), NULL, fields, | |
789 _("Send"), G_CALLBACK(_qq_send_custom_packet_cb), | |
790 _("Cancel"), NULL, | |
791 gc); | |
792 } | |
14237 | 793 */ |
14192 | 794 |
795 /* protocol related menus */ | |
796 static GList *_qq_actions(GaimPlugin *plugin, gpointer context) | |
797 { | |
798 GList *m; | |
799 GaimPluginAction *act; | |
800 | |
801 m = NULL; | |
802 act = gaim_plugin_action_new(_("Modify My Information"), _qq_menu_modify_my_info); | |
803 m = g_list_append(m, act); | |
804 | |
14265 | 805 act = gaim_plugin_action_new(_("Change My Face"), _qq_menu_change_face); |
806 m = g_list_append(m, act); | |
807 | |
14192 | 808 act = gaim_plugin_action_new(_("Change Password"), _qq_menu_change_password); |
809 m = g_list_append(m, act); | |
810 | |
811 act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info); | |
812 m = g_list_append(m, act); | |
813 | |
14237 | 814 /* |
14192 | 815 act = gaim_plugin_action_new(_("Send Custom Packet"), _qq_menu_send_custom_packet); |
816 m = g_list_append(m, act); | |
14237 | 817 */ |
14192 | 818 |
819 /* | |
820 act = gaim_plugin_action_new(_("Qun: Search a permanent Qun"), _qq_menu_search_or_add_permanent_group); | |
821 m = g_list_append(m, act); | |
822 | |
823 act = gaim_plugin_action_new(_("Qun: Create a permanent Qun"), _qq_menu_create_permanent_group); | |
824 m = g_list_append(m, act); | |
825 */ | |
826 | |
827 return m; | |
828 } | |
829 | |
830 /* chat-related (QQ Qun) menu shown up with right-click */ | |
831 static GList *_qq_chat_menu(GaimBlistNode *node) | |
832 { | |
833 GList *m; | |
834 GaimMenuAction *act; | |
835 | |
836 m = NULL; | |
837 act = gaim_menu_action_new(_("Exit this QQ Qun"), GAIM_CALLBACK(_qq_menu_unsubscribe_group), NULL, NULL); | |
838 m = g_list_append(m, act); | |
839 | |
14404 | 840 /* TODO: enable this |
14192 | 841 act = gaim_menu_action_new(_("Show Details"), GAIM_CALLBACK(_qq_menu_manage_group), NULL, NULL); |
842 m = g_list_append(m, act); | |
14404 | 843 */ |
14192 | 844 |
845 return m; | |
846 } | |
14404 | 847 |
14192 | 848 /* buddy-related menu shown up with right-click */ |
849 static GList *_qq_buddy_menu(GaimBlistNode * node) | |
850 { | |
851 GList *m; | |
852 | |
853 if(GAIM_BLIST_NODE_IS_CHAT(node)) | |
854 return _qq_chat_menu(node); | |
855 | |
856 m = NULL; | |
14404 | 857 return m; |
858 } | |
859 | |
14192 | 860 /* TODO : not working, temp commented out by gfhuang |
861 | |
862 act = gaim_menu_action_new(_("Block this buddy"), GAIM_CALLBACK(_qq_menu_block_buddy), NULL, NULL); //add NULL by gfhuang | |
863 m = g_list_append(m, act); | |
864 // if (q_bud && is_online(q_bud->status)) { | |
865 act = gaim_menu_action_new(_("Send File"), GAIM_CALLBACK(_qq_menu_send_file), NULL, NULL); //add NULL by gfhuang | |
866 m = g_list_append(m, act); | |
867 // } | |
868 */ | |
869 /* | |
870 return m; | |
871 } | |
872 */ | |
873 | |
874 | |
875 static void _qq_keep_alive(GaimConnection *gc) | |
876 { | |
877 qq_group *group; | |
878 qq_data *qd; | |
879 GList *list; | |
880 | |
881 if (NULL == (qd = (qq_data *) gc->proto_data)) | |
882 return; | |
883 | |
884 list = qd->groups; | |
885 while (list != NULL) { | |
886 group = (qq_group *) list->data; | |
887 if (group->my_status == QQ_GROUP_MEMBER_STATUS_IS_MEMBER || | |
888 group->my_status == QQ_GROUP_MEMBER_STATUS_IS_ADMIN) | |
889 /* no need to get info time and time again, online members enough */ | |
14404 | 890 qq_send_cmd_group_get_online_members(gc, group); |
14192 | 891 |
892 list = list->next; | |
893 } | |
894 | |
895 qq_send_packet_keep_alive(gc); | |
896 | |
897 } | |
898 | |
899 /* convert chat nickname to qq-uid to get this buddy info */ | |
900 /* who is the nickname of buddy in QQ chat-room (Qun) */ | |
901 static void _qq_get_chat_buddy_info(GaimConnection *gc, gint channel, const gchar *who) | |
902 { | |
903 gchar *gaim_name; | |
14629 | 904 g_return_if_fail(who != NULL); |
14192 | 905 |
14404 | 906 gaim_name = chat_name_to_gaim_name(who); |
14192 | 907 if (gaim_name != NULL) |
908 _qq_get_info(gc, gaim_name); | |
909 } | |
910 | |
911 /* convert chat nickname to qq-uid to invite individual IM to buddy */ | |
912 /* who is the nickname of buddy in QQ chat-room (Qun) */ | |
913 static gchar *_qq_get_chat_buddy_real_name(GaimConnection *gc, gint channel, const gchar *who) | |
914 { | |
14629 | 915 g_return_val_if_fail(who != NULL, NULL); |
14404 | 916 return chat_name_to_gaim_name(who); |
14192 | 917 } |
918 | |
919 void qq_function_not_implemented(GaimConnection *gc) | |
920 { | |
921 gaim_notify_warning(gc, NULL, | |
922 _("This function has not be implemented yet"), _("Please wait for new version")); | |
923 } | |
924 | |
925 GaimPlugin *my_protocol = NULL; | |
926 static GaimPluginProtocolInfo prpl_info = { | |
927 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_USE_POINTSIZE, | |
928 NULL, /* user_splits */ | |
929 NULL, /* protocol_options */ | |
930 NO_BUDDY_ICONS, /* icon_spec */ | |
931 _qq_list_icon, /* list_icon */ | |
932 _qq_list_emblems, /* list_emblems */ | |
933 _qq_status_text, /* status_text */ | |
934 _qq_tooltip_text, /* tooltip_text */ | |
935 _qq_away_states, /* away_states */ | |
14404 | 936 _qq_buddy_menu, /* blist_node_menu */ |
937 qq_chat_info, /* chat_info */ | |
938 qq_chat_info_defaults, /* chat_info_defaults */ | |
14192 | 939 _qq_login, /* login */ |
940 _qq_close, /* close */ | |
941 _qq_send_im, /* send_im */ | |
942 NULL, /* set_info */ | |
943 NULL, /* send_typing */ | |
944 _qq_get_info, /* get_info */ | |
945 _qq_set_away, /* set_away */ | |
946 NULL, /* set_idle */ | |
947 NULL, /* change_passwd */ | |
948 qq_add_buddy, /* add_buddy */ | |
949 NULL, /* add_buddies */ | |
950 qq_remove_buddy, /* remove_buddy */ | |
951 NULL, /* remove_buddies */ | |
952 NULL, /* add_permit */ | |
953 NULL, /* add_deny */ | |
954 NULL, /* rem_permit */ | |
955 NULL, /* rem_deny */ | |
956 NULL, /* set_permit_deny */ | |
957 qq_group_join, /* join_chat */ | |
958 NULL, /* reject chat invite */ | |
959 NULL, /* get_chat_name */ | |
960 NULL, /* chat_invite */ | |
961 NULL, /* chat_leave */ | |
962 NULL, /* chat_whisper */ | |
963 _qq_chat_send, /* chat_send */ | |
964 _qq_keep_alive, /* keepalive */ | |
965 NULL, /* register_user */ | |
966 _qq_get_chat_buddy_info, /* get_cb_info */ | |
967 NULL, /* get_cb_away */ | |
968 NULL, /* alias_buddy */ | |
969 NULL, /* group_buddy */ | |
970 NULL, /* rename_group */ | |
971 NULL, /* buddy_free */ | |
972 NULL, /* convo_closed */ | |
973 NULL, /* normalize */ | |
974 NULL, /* set_buddy_icon */ | |
975 NULL, /* remove_group */ | |
976 _qq_get_chat_buddy_real_name, /* get_cb_real_name */ | |
977 NULL, /* set_chat_topic */ | |
978 NULL, /* find_blist_chat */ | |
979 qq_roomlist_get_list, /* roomlist_get_list */ | |
980 qq_roomlist_cancel, /* roomlist_cancel */ | |
981 NULL, /* roomlist_expand_category */ | |
982 NULL, /* can_receive_file */ | |
983 qq_send_file, /* send_file */ | |
984 NULL, /* new xfer */ | |
985 NULL, /* offline_message */ | |
986 NULL, /* GaimWhiteboardPrplOps */ | |
14542 | 987 NULL, /* send_raw */ |
14192 | 988 }; |
989 | |
990 static GaimPluginInfo info = { | |
991 GAIM_PLUGIN_MAGIC, | |
992 GAIM_MAJOR_VERSION, | |
993 GAIM_MINOR_VERSION, | |
994 GAIM_PLUGIN_PROTOCOL, /**< type */ | |
995 NULL, /**< ui_requirement */ | |
996 0, /**< flags */ | |
997 NULL, /**< dependencies */ | |
998 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
999 | |
1000 "prpl-qq", /**< id */ | |
1001 "QQ", /**< name */ | |
1002 VERSION, /**< version */ | |
1003 /** summary */ | |
1004 N_("QQ Protocol Plugin"), | |
1005 /** description */ | |
1006 N_("QQ Protocol Plugin"), | |
1007 OPENQ_AUTHOR, /**< author */ | |
1008 OPENQ_WEBSITE, /**< homepage */ | |
1009 | |
1010 NULL, /**< load */ | |
1011 NULL, /**< unload */ | |
1012 NULL, /**< destroy */ | |
1013 | |
1014 NULL, /**< ui_info */ | |
1015 &prpl_info, /**< extra_info */ | |
14404 | 1016 NULL, /**< prefs_info */ |
14192 | 1017 _qq_actions |
1018 }; | |
1019 | |
1020 | |
1021 static void init_plugin(GaimPlugin *plugin) | |
1022 { | |
1023 GaimAccountOption *option; | |
1024 | |
1025 option = gaim_account_option_bool_new(_("Login in TCP"), "use_tcp", FALSE); | |
1026 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1027 | |
1028 option = gaim_account_option_bool_new(_("Login Hidden"), "hidden", FALSE); | |
1029 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | |
1030 | |
14790
a33d179d5508
[gaim-migrate @ 17555]
Richard Laager <rlaager@wiktel.com>
parents:
14629
diff
changeset
|
1031 option = gaim_account_option_string_new(_("Server"), "server", NULL); |
14192 | 1032 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
1033 | |
14790
a33d179d5508
[gaim-migrate @ 17555]
Richard Laager <rlaager@wiktel.com>
parents:
14629
diff
changeset
|
1034 option = gaim_account_option_string_new(_("Port"), "port", NULL); |
14192 | 1035 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
1036 | |
1037 my_protocol = plugin; | |
1038 | |
1039 gaim_prefs_add_none("/plugins/prpl/qq"); | |
1040 gaim_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE); | |
1041 gaim_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE); | |
1042 gaim_prefs_add_bool("/plugins/prpl/qq/prompt_for_missing_packet", TRUE); | |
1043 gaim_prefs_add_bool("/plugins/prpl/qq/prompt_group_msg_on_recv", TRUE); | |
1044 } | |
1045 | |
1046 GAIM_INIT_PLUGIN(qq, init_plugin, info); |