Mercurial > pidgin.yaz
comparison libpurple/protocols/gg/gg.c @ 24429:0d3af2ecf4ad
Kill off a bajillion comments that just needlessly duplicate function
signatures. I'm sure this will probably make someone angry, so I tried to
make this as easily disapproved as possible.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 23 Nov 2008 04:46:55 +0000 |
parents | 4d50b5d09d4a |
children | c83ee78ecbe7 |
comparison
equal
deleted
inserted
replaced
24428:4d50b5d09d4a | 24429:0d3af2ecf4ad |
---|---|
59 * | 59 * |
60 * @param account Account for which to set up the proxy. | 60 * @param account Account for which to set up the proxy. |
61 * | 61 * |
62 * @return Zero if proxy setup is valid, otherwise -1. | 62 * @return Zero if proxy setup is valid, otherwise -1. |
63 */ | 63 */ |
64 /* static int ggp_setup_proxy(PurpleAccount *account) {{{ */ | |
65 static int ggp_setup_proxy(PurpleAccount *account) | 64 static int ggp_setup_proxy(PurpleAccount *account) |
66 { | 65 { |
67 PurpleProxyInfo *gpi; | 66 PurpleProxyInfo *gpi; |
68 | 67 |
69 gpi = purple_proxy_get_setup(account); | 68 gpi = purple_proxy_get_setup(account); |
86 gg_proxy_enabled = 0; | 85 gg_proxy_enabled = 0; |
87 } | 86 } |
88 | 87 |
89 return 0; | 88 return 0; |
90 } | 89 } |
91 /* }}} */ | 90 |
92 | |
93 /* | |
94 */ | |
95 /* static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) {{{ */ | |
96 static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) | 91 static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) |
97 { | 92 { |
98 PurpleConnection *gc = _gc; | 93 PurpleConnection *gc = _gc; |
99 GGPInfo *info = gc->proto_data; | 94 GGPInfo *info = gc->proto_data; |
100 GGPToken *token = info->token; | 95 GGPToken *token = info->token; |
155 | 150 |
156 cb = token->cb; | 151 cb = token->cb; |
157 token->cb = NULL; | 152 token->cb = NULL; |
158 cb(gc); | 153 cb(gc); |
159 } | 154 } |
160 /* }}} */ | 155 |
161 | |
162 /* | |
163 */ | |
164 /* static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) {{{ */ | |
165 static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) | 156 static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) |
166 { | 157 { |
167 PurpleAccount *account; | 158 PurpleAccount *account; |
168 struct gg_http *req; | 159 struct gg_http *req; |
169 GGPInfo *info; | 160 GGPInfo *info; |
197 * Request buddylist from the server. | 188 * Request buddylist from the server. |
198 * Buddylist is received in the ggp_callback_recv(). | 189 * Buddylist is received in the ggp_callback_recv(). |
199 * | 190 * |
200 * @param Current action handler. | 191 * @param Current action handler. |
201 */ | 192 */ |
202 /* static void ggp_action_buddylist_get(PurplePluginAction *action) {{{ */ | |
203 static void ggp_action_buddylist_get(PurplePluginAction *action) | 193 static void ggp_action_buddylist_get(PurplePluginAction *action) |
204 { | 194 { |
205 PurpleConnection *gc = (PurpleConnection *)action->context; | 195 PurpleConnection *gc = (PurpleConnection *)action->context; |
206 GGPInfo *info = gc->proto_data; | 196 GGPInfo *info = gc->proto_data; |
207 | 197 |
208 purple_debug_info("gg", "Downloading...\n"); | 198 purple_debug_info("gg", "Downloading...\n"); |
209 | 199 |
210 gg_userlist_request(info->session, GG_USERLIST_GET, NULL); | 200 gg_userlist_request(info->session, GG_USERLIST_GET, NULL); |
211 } | 201 } |
212 /* }}} */ | |
213 | 202 |
214 /** | 203 /** |
215 * Upload the buddylist to the server. | 204 * Upload the buddylist to the server. |
216 * | 205 * |
217 * @param action Current action handler. | 206 * @param action Current action handler. |
218 */ | 207 */ |
219 /* static void ggp_action_buddylist_put(PurplePluginAction *action) {{{ */ | |
220 static void ggp_action_buddylist_put(PurplePluginAction *action) | 208 static void ggp_action_buddylist_put(PurplePluginAction *action) |
221 { | 209 { |
222 PurpleConnection *gc = (PurpleConnection *)action->context; | 210 PurpleConnection *gc = (PurpleConnection *)action->context; |
223 GGPInfo *info = gc->proto_data; | 211 GGPInfo *info = gc->proto_data; |
224 | 212 |
230 return; | 218 return; |
231 | 219 |
232 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist); | 220 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist); |
233 g_free(buddylist); | 221 g_free(buddylist); |
234 } | 222 } |
235 /* }}} */ | |
236 | 223 |
237 /** | 224 /** |
238 * Delete buddylist from the server. | 225 * Delete buddylist from the server. |
239 * | 226 * |
240 * @param action Current action handler. | 227 * @param action Current action handler. |
241 */ | 228 */ |
242 /* static void ggp_action_buddylist_delete(PurplePluginAction *action) {{{ */ | |
243 static void ggp_action_buddylist_delete(PurplePluginAction *action) | 229 static void ggp_action_buddylist_delete(PurplePluginAction *action) |
244 { | 230 { |
245 PurpleConnection *gc = (PurpleConnection *)action->context; | 231 PurpleConnection *gc = (PurpleConnection *)action->context; |
246 GGPInfo *info = gc->proto_data; | 232 GGPInfo *info = gc->proto_data; |
247 | 233 |
248 purple_debug_info("gg", "Deleting...\n"); | 234 purple_debug_info("gg", "Deleting...\n"); |
249 | 235 |
250 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL); | 236 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL); |
251 } | 237 } |
252 /* }}} */ | 238 |
253 | |
254 /* | |
255 */ | |
256 /* static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *file) {{{ */ | |
257 static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename) | 239 static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename) |
258 { | 240 { |
259 PurpleAccount *account = purple_connection_get_account(gc); | 241 PurpleAccount *account = purple_connection_get_account(gc); |
260 | 242 |
261 char *buddylist = ggp_buddylist_dump(account); | 243 char *buddylist = ggp_buddylist_dump(account); |
282 g_free(primary); | 264 g_free(primary); |
283 } | 265 } |
284 | 266 |
285 g_free(buddylist); | 267 g_free(buddylist); |
286 } | 268 } |
287 /* }}} */ | 269 |
288 | |
289 /* | |
290 */ | |
291 /* static void ggp_callback_buddylist_load_ok(PurpleConnection *gc, gchar *file) {{{ */ | |
292 static void ggp_callback_buddylist_load_ok(PurpleConnection *gc, gchar *file) | 270 static void ggp_callback_buddylist_load_ok(PurpleConnection *gc, gchar *file) |
293 { | 271 { |
294 PurpleAccount *account = purple_connection_get_account(gc); | 272 PurpleAccount *account = purple_connection_get_account(gc); |
295 GError *error = NULL; | 273 GError *error = NULL; |
296 char *buddylist = NULL; | 274 char *buddylist = NULL; |
332 purple_request_file(action, _("Save buddylist..."), NULL, TRUE, | 310 purple_request_file(action, _("Save buddylist..."), NULL, TRUE, |
333 G_CALLBACK(ggp_callback_buddylist_save_ok), NULL, | 311 G_CALLBACK(ggp_callback_buddylist_save_ok), NULL, |
334 purple_connection_get_account(gc), NULL, NULL, | 312 purple_connection_get_account(gc), NULL, NULL, |
335 gc); | 313 gc); |
336 } | 314 } |
337 /* }}} */ | 315 |
338 | |
339 /* | |
340 */ | |
341 /* static void ggp_action_buddylist_load(PurplePluginAction *action) {{{ */ | |
342 static void ggp_action_buddylist_load(PurplePluginAction *action) | 316 static void ggp_action_buddylist_load(PurplePluginAction *action) |
343 { | 317 { |
344 PurpleConnection *gc = (PurpleConnection *)action->context; | 318 PurpleConnection *gc = (PurpleConnection *)action->context; |
345 | 319 |
346 purple_request_file(action, _("Load buddylist from file..."), NULL, | 320 purple_request_file(action, _("Load buddylist from file..."), NULL, |
347 FALSE, | 321 FALSE, |
348 G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, | 322 G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, |
349 purple_connection_get_account(gc), NULL, NULL, | 323 purple_connection_get_account(gc), NULL, NULL, |
350 gc); | 324 gc); |
351 } | 325 } |
352 /* }}} */ | 326 |
353 | |
354 /* | |
355 */ | |
356 /* static void ggp_callback_register_account_ok(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */ | |
357 static void ggp_callback_register_account_ok(PurpleConnection *gc, | 327 static void ggp_callback_register_account_ok(PurpleConnection *gc, |
358 PurpleRequestFields *fields) | 328 PurpleRequestFields *fields) |
359 { | 329 { |
360 PurpleAccount *account; | 330 PurpleAccount *account; |
361 GGPInfo *info = gc->proto_data; | 331 GGPInfo *info = gc->proto_data; |
433 g_free(p2); | 403 g_free(p2); |
434 g_free(t); | 404 g_free(t); |
435 g_free(token->id); | 405 g_free(token->id); |
436 g_free(token); | 406 g_free(token); |
437 } | 407 } |
438 /* }}} */ | 408 |
439 | |
440 /* | |
441 */ | |
442 /* static void ggp_callback_register_account_cancel(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */ | |
443 static void ggp_callback_register_account_cancel(PurpleConnection *gc, | 409 static void ggp_callback_register_account_cancel(PurpleConnection *gc, |
444 PurpleRequestFields *fields) | 410 PurpleRequestFields *fields) |
445 { | 411 { |
446 GGPInfo *info = gc->proto_data; | 412 GGPInfo *info = gc->proto_data; |
447 GGPToken *token = info->token; | 413 GGPToken *token = info->token; |
451 g_free(token->id); | 417 g_free(token->id); |
452 g_free(token->data); | 418 g_free(token->data); |
453 g_free(token); | 419 g_free(token); |
454 | 420 |
455 } | 421 } |
456 /* }}} */ | 422 |
457 | |
458 /* | |
459 */ | |
460 /* static void ggp_register_user_dialog(PurpleConnection *gc) {{{ */ | |
461 static void ggp_register_user_dialog(PurpleConnection *gc) | 423 static void ggp_register_user_dialog(PurpleConnection *gc) |
462 { | 424 { |
463 PurpleAccount *account; | 425 PurpleAccount *account; |
464 PurpleRequestFields *fields; | 426 PurpleRequestFields *fields; |
465 PurpleRequestFieldGroup *group; | 427 PurpleRequestFieldGroup *group; |
508 _("OK"), G_CALLBACK(ggp_callback_register_account_ok), | 470 _("OK"), G_CALLBACK(ggp_callback_register_account_ok), |
509 _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel), | 471 _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel), |
510 purple_connection_get_account(gc), NULL, NULL, | 472 purple_connection_get_account(gc), NULL, NULL, |
511 gc); | 473 gc); |
512 } | 474 } |
513 /* }}} */ | |
514 | 475 |
515 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */ | 476 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */ |
516 | 477 |
517 /* | |
518 */ | |
519 /* static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) {{{ */ | |
520 static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) | 478 static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) |
521 { | 479 { |
522 GGPInfo *info = gc->proto_data; | 480 GGPInfo *info = gc->proto_data; |
523 GGPSearchForm *form = user_data; | 481 GGPSearchForm *form = user_data; |
524 guint32 seq; | 482 guint32 seq; |
531 | 489 |
532 seq = ggp_search_start(gc, form); | 490 seq = ggp_search_start(gc, form); |
533 ggp_search_add(info->searches, seq, form); | 491 ggp_search_add(info->searches, seq, form); |
534 purple_debug_info("gg", "ggp_callback_show_next(): Added seq %u", seq); | 492 purple_debug_info("gg", "ggp_callback_show_next(): Added seq %u", seq); |
535 } | 493 } |
536 /* }}} */ | 494 |
537 | |
538 /* | |
539 */ | |
540 /* static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data) {{{ */ | |
541 static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data) | 495 static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data) |
542 { | 496 { |
543 purple_blist_request_add_buddy(purple_connection_get_account(gc), | 497 purple_blist_request_add_buddy(purple_connection_get_account(gc), |
544 g_list_nth_data(row, 0), NULL, NULL); | 498 g_list_nth_data(row, 0), NULL, NULL); |
545 } | 499 } |
546 /* }}} */ | 500 |
547 | |
548 /* | |
549 */ | |
550 /* static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data) {{{ */ | |
551 static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data) | 501 static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data) |
552 { | 502 { |
553 PurpleAccount *account; | 503 PurpleAccount *account; |
554 PurpleConversation *conv; | 504 PurpleConversation *conv; |
555 char *name; | 505 char *name; |
558 | 508 |
559 name = g_list_nth_data(row, 0); | 509 name = g_list_nth_data(row, 0); |
560 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); | 510 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
561 purple_conversation_present(conv); | 511 purple_conversation_present(conv); |
562 } | 512 } |
563 /* }}} */ | 513 |
564 | |
565 /* | |
566 */ | |
567 /* static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */ | |
568 static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) | 514 static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) |
569 { | 515 { |
570 GGPInfo *info = gc->proto_data; | 516 GGPInfo *info = gc->proto_data; |
571 GGPSearchForm *form; | 517 GGPSearchForm *form; |
572 guint32 seq; | 518 guint32 seq; |
609 | 555 |
610 seq = ggp_search_start(gc, form); | 556 seq = ggp_search_start(gc, form); |
611 ggp_search_add(info->searches, seq, form); | 557 ggp_search_add(info->searches, seq, form); |
612 purple_debug_info("gg", "ggp_callback_find_buddies(): Added seq %u", seq); | 558 purple_debug_info("gg", "ggp_callback_find_buddies(): Added seq %u", seq); |
613 } | 559 } |
614 /* }}} */ | 560 |
615 | |
616 /* | |
617 */ | |
618 /* static void ggp_find_buddies(PurplePluginAction *action) {{{ */ | |
619 static void ggp_find_buddies(PurplePluginAction *action) | 561 static void ggp_find_buddies(PurplePluginAction *action) |
620 { | 562 { |
621 PurpleConnection *gc = (PurpleConnection *)action->context; | 563 PurpleConnection *gc = (PurpleConnection *)action->context; |
622 | 564 |
623 PurpleRequestFields *fields; | 565 PurpleRequestFields *fields; |
670 _("OK"), G_CALLBACK(ggp_callback_find_buddies), | 612 _("OK"), G_CALLBACK(ggp_callback_find_buddies), |
671 _("Cancel"), NULL, | 613 _("Cancel"), NULL, |
672 purple_connection_get_account(gc), NULL, NULL, | 614 purple_connection_get_account(gc), NULL, NULL, |
673 gc); | 615 gc); |
674 } | 616 } |
675 /* }}} */ | |
676 | 617 |
677 /* ----- CHANGE PASSWORD ------------------------------------------------ */ | 618 /* ----- CHANGE PASSWORD ------------------------------------------------ */ |
678 | 619 |
679 /* | |
680 */ | |
681 /* static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */ | |
682 static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) | 620 static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) |
683 { | 621 { |
684 PurpleAccount *account; | 622 PurpleAccount *account; |
685 GGPInfo *info = gc->proto_data; | 623 GGPInfo *info = gc->proto_data; |
686 struct gg_http *h; | 624 struct gg_http *h; |
748 g_free(t); | 686 g_free(t); |
749 g_free(info->token->id); | 687 g_free(info->token->id); |
750 g_free(info->token->data); | 688 g_free(info->token->data); |
751 g_free(info->token); | 689 g_free(info->token); |
752 } | 690 } |
753 /* }}} */ | 691 |
754 | |
755 /* | |
756 */ | |
757 /* static void ggp_change_passwd_dialog(PurpleConnection *gc) {{{ */ | |
758 static void ggp_change_passwd_dialog(PurpleConnection *gc) | 692 static void ggp_change_passwd_dialog(PurpleConnection *gc) |
759 { | 693 { |
760 PurpleRequestFields *fields; | 694 PurpleRequestFields *fields; |
761 PurpleRequestFieldGroup *group; | 695 PurpleRequestFieldGroup *group; |
762 PurpleRequestField *field; | 696 PurpleRequestField *field; |
809 purple_connection_get_account(gc), NULL, NULL, | 743 purple_connection_get_account(gc), NULL, NULL, |
810 gc); | 744 gc); |
811 | 745 |
812 g_free(msg); | 746 g_free(msg); |
813 } | 747 } |
814 /* }}} */ | 748 |
815 | |
816 /* | |
817 */ | |
818 /* static void ggp_change_passwd(PurplePluginAction *action) {{{ */ | |
819 static void ggp_change_passwd(PurplePluginAction *action) | 749 static void ggp_change_passwd(PurplePluginAction *action) |
820 { | 750 { |
821 PurpleConnection *gc = (PurpleConnection *)action->context; | 751 PurpleConnection *gc = (PurpleConnection *)action->context; |
822 | 752 |
823 ggp_token_request(gc, ggp_change_passwd_dialog); | 753 ggp_token_request(gc, ggp_change_passwd_dialog); |
824 } | 754 } |
825 /* }}} */ | |
826 | 755 |
827 /* ----- CONFERENCES ---------------------------------------------------- */ | 756 /* ----- CONFERENCES ---------------------------------------------------- */ |
828 | 757 |
829 /* | |
830 */ | |
831 /* static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) {{{ */ | |
832 static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) | 758 static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) |
833 { | 759 { |
834 GGPInfo *info = gc->proto_data; | 760 GGPInfo *info = gc->proto_data; |
835 PurpleRequestField *field; | 761 PurpleRequestField *field; |
836 /* TODO: sel may be null. */ | 762 /* TODO: sel may be null. */ |
840 sel = purple_request_field_list_get_selected(field); | 766 sel = purple_request_field_list_get_selected(field); |
841 | 767 |
842 ggp_confer_participants_add_uin(gc, sel->data, info->tmp_buddy); | 768 ggp_confer_participants_add_uin(gc, sel->data, info->tmp_buddy); |
843 info->tmp_buddy = 0; | 769 info->tmp_buddy = 0; |
844 } | 770 } |
845 /* }}} */ | 771 |
846 | |
847 /* | |
848 */ | |
849 /* static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) {{{ */ | |
850 static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) | 772 static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) |
851 { | 773 { |
852 PurpleBuddy *buddy; | 774 PurpleBuddy *buddy; |
853 PurpleConnection *gc; | 775 PurpleConnection *gc; |
854 GGPInfo *info; | 776 GGPInfo *info; |
890 _("Cancel"), NULL, | 812 _("Cancel"), NULL, |
891 purple_connection_get_account(gc), NULL, NULL, | 813 purple_connection_get_account(gc), NULL, NULL, |
892 gc); | 814 gc); |
893 g_free(msg); | 815 g_free(msg); |
894 } | 816 } |
895 /* }}} */ | |
896 | 817 |
897 /* ----- BLOCK BUDDIES -------------------------------------------------- */ | 818 /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
898 | 819 |
899 /* | |
900 */ | |
901 /* static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) {{{ */ | |
902 static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) | 820 static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) |
903 { | 821 { |
904 PurpleConnection *gc; | 822 PurpleConnection *gc; |
905 PurpleBuddy *buddy; | 823 PurpleBuddy *buddy; |
906 GGPInfo *info; | 824 GGPInfo *info; |
922 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); | 840 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); |
923 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); | 841 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); |
924 purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); | 842 purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); |
925 } | 843 } |
926 } | 844 } |
927 /* }}} */ | |
928 | 845 |
929 /* ---------------------------------------------------------------------- */ | 846 /* ---------------------------------------------------------------------- */ |
930 /* ----- INTERNAL CALLBACKS --------------------------------------------- */ | 847 /* ----- INTERNAL CALLBACKS --------------------------------------------- */ |
931 /* ---------------------------------------------------------------------- */ | 848 /* ---------------------------------------------------------------------- */ |
932 | 849 |
941 * @param gc PurpleConnection | 858 * @param gc PurpleConnection |
942 * @param uin UIN of the buddy. | 859 * @param uin UIN of the buddy. |
943 * @param status ID of the status. | 860 * @param status ID of the status. |
944 * @param descr Description. | 861 * @param descr Description. |
945 */ | 862 */ |
946 /* static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, int status, const char *descr) {{{ */ | |
947 static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, | 863 static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, |
948 int status, const char *descr) | 864 int status, const char *descr) |
949 { | 865 { |
950 gchar *from; | 866 gchar *from; |
951 const char *st; | 867 const char *st; |
981 purple_prpl_got_user_status(purple_connection_get_account(gc), | 897 purple_prpl_got_user_status(purple_connection_get_account(gc), |
982 from, st, "message", msg, NULL); | 898 from, st, "message", msg, NULL); |
983 g_free(from); | 899 g_free(from); |
984 g_free(msg); | 900 g_free(msg); |
985 } | 901 } |
986 /* }}} */ | 902 |
987 | |
988 /* | |
989 */ | |
990 /* static void ggp_sr_close_cb(gpointer user_data) {{{ */ | |
991 static void ggp_sr_close_cb(gpointer user_data) | 903 static void ggp_sr_close_cb(gpointer user_data) |
992 { | 904 { |
993 GGPSearchForm *form = user_data; | 905 GGPSearchForm *form = user_data; |
994 GGPInfo *info = form->user_data; | 906 GGPInfo *info = form->user_data; |
995 | 907 |
996 ggp_search_remove(info->searches, form->seq); | 908 ggp_search_remove(info->searches, form->seq); |
997 purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u", form->seq); | 909 purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u", form->seq); |
998 ggp_search_form_destroy(form); | 910 ggp_search_form_destroy(form); |
999 } | 911 } |
1000 /* }}} */ | |
1001 | 912 |
1002 /** | 913 /** |
1003 * Translate a status' ID to a more user-friendly name. | 914 * Translate a status' ID to a more user-friendly name. |
1004 * | 915 * |
1005 * @param id The ID of the status. | 916 * @param id The ID of the status. |
1006 * | 917 * |
1007 * @return The user-friendly name of the status. | 918 * @return The user-friendly name of the status. |
1008 */ | 919 */ |
1009 /* static const char *ggp_status_by_id(unsigned int id) {{{ */ | |
1010 static const char *ggp_status_by_id(unsigned int id) | 920 static const char *ggp_status_by_id(unsigned int id) |
1011 { | 921 { |
1012 const char *st; | 922 const char *st; |
1013 | 923 |
1014 purple_debug_info("gg", "ggp_status_by_id: %d\n", id); | 924 purple_debug_info("gg", "ggp_status_by_id: %d\n", id); |
1027 break; | 937 break; |
1028 } | 938 } |
1029 | 939 |
1030 return st; | 940 return st; |
1031 } | 941 } |
1032 /* }}} */ | 942 |
1033 | |
1034 /* | |
1035 */ | |
1036 /* static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, GGPSearchForm *form) {{{ */ | |
1037 static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, | 943 static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, |
1038 GGPSearchForm *form) | 944 GGPSearchForm *form) |
1039 { | 945 { |
1040 PurpleNotifyUserInfo *user_info; | 946 PurpleNotifyUserInfo *user_info; |
1041 PurpleBuddy *buddy; | 947 PurpleBuddy *buddy; |
1090 | 996 |
1091 purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form); | 997 purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form); |
1092 g_free(who); | 998 g_free(who); |
1093 purple_notify_user_info_destroy(user_info); | 999 purple_notify_user_info_destroy(user_info); |
1094 } | 1000 } |
1095 /* }}} */ | 1001 |
1096 | |
1097 /* | |
1098 */ | |
1099 /* static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, GGPSearchForm *form) {{{ */ | |
1100 static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, | 1002 static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, |
1101 GGPSearchForm *form) | 1003 GGPSearchForm *form) |
1102 { | 1004 { |
1103 PurpleNotifySearchResults *results; | 1005 PurpleNotifySearchResults *results; |
1104 PurpleNotifySearchColumn *column; | 1006 PurpleNotifySearchColumn *column; |
1194 form->window = h; | 1096 form->window = h; |
1195 } else { | 1097 } else { |
1196 purple_notify_searchresults_new_rows(gc, results, form->window); | 1098 purple_notify_searchresults_new_rows(gc, results, form->window); |
1197 } | 1099 } |
1198 } | 1100 } |
1199 /* }}} */ | 1101 |
1200 | |
1201 /* | |
1202 */ | |
1203 /* static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) {{{ */ | |
1204 static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) | 1102 static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) |
1205 { | 1103 { |
1206 GGPInfo *info = gc->proto_data; | 1104 GGPInfo *info = gc->proto_data; |
1207 GGPSearchForm *form; | 1105 GGPSearchForm *form; |
1208 int res_count; | 1106 int res_count; |
1237 default: | 1135 default: |
1238 purple_debug_warning("gg", "Unknown search_type!\n"); | 1136 purple_debug_warning("gg", "Unknown search_type!\n"); |
1239 break; | 1137 break; |
1240 } | 1138 } |
1241 } | 1139 } |
1242 /* }}} */ | 1140 |
1243 | |
1244 | |
1245 /* static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) {{{ */ | |
1246 static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) | 1141 static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) |
1247 { | 1142 { |
1248 gint imgid = 0; | 1143 gint imgid = 0; |
1249 GGPInfo *info = gc->proto_data; | 1144 GGPInfo *info = gc->proto_data; |
1250 GList *entry = g_list_first(info->pending_richtext_messages); | 1145 GList *entry = g_list_first(info->pending_richtext_messages); |
1280 } | 1175 } |
1281 g_free(handlerid); | 1176 g_free(handlerid); |
1282 | 1177 |
1283 return; | 1178 return; |
1284 } | 1179 } |
1285 /* }}} */ | |
1286 | 1180 |
1287 | 1181 |
1288 /** | 1182 /** |
1289 * Dispatch a message received from a buddy. | 1183 * Dispatch a message received from a buddy. |
1290 * | 1184 * |
1291 * @param gc PurpleConnection. | 1185 * @param gc PurpleConnection. |
1292 * @param ev Gadu-Gadu event structure. | 1186 * @param ev Gadu-Gadu event structure. |
1293 * | 1187 * |
1294 * Image receiving, some code borrowed from Kadu http://www.kadu.net | 1188 * Image receiving, some code borrowed from Kadu http://www.kadu.net |
1295 */ | 1189 */ |
1296 /* static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) {{{ */ | |
1297 static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) | 1190 static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) |
1298 { | 1191 { |
1299 GGPInfo *info = gc->proto_data; | 1192 GGPInfo *info = gc->proto_data; |
1300 PurpleConversation *conv; | 1193 PurpleConversation *conv; |
1301 gchar *from; | 1194 gchar *from; |
1311 g_free(tmp); | 1204 g_free(tmp); |
1312 | 1205 |
1313 /* We got richtext message */ | 1206 /* We got richtext message */ |
1314 if (ev->event.msg.formats_length) | 1207 if (ev->event.msg.formats_length) |
1315 { | 1208 { |
1316 gboolean got_image = FALSE, bold = FALSE, italic = FALSE, under= FALSE; | 1209 gboolean got_image = FALSE, bold = FALSE, italic = FALSE, under = FALSE; |
1317 char *cformats = (char *)ev->event.msg.formats; | 1210 char *cformats = (char *)ev->event.msg.formats; |
1318 char *cformats_end = cformats + ev->event.msg.formats_length; | 1211 char *cformats_end = cformats + ev->event.msg.formats_length; |
1319 gint increased_len = 0; | 1212 gint increased_len = 0; |
1320 struct gg_msg_richtext_format *actformat; | 1213 struct gg_msg_richtext_format *actformat; |
1321 struct gg_msg_richtext_image *actimage; | 1214 struct gg_msg_richtext_image *actimage; |
1447 g_free(buddy_name); | 1340 g_free(buddy_name); |
1448 } | 1341 } |
1449 g_free(msg); | 1342 g_free(msg); |
1450 g_free(from); | 1343 g_free(from); |
1451 } | 1344 } |
1452 /* }}} */ | 1345 |
1453 | |
1454 /* | |
1455 */ | |
1456 /* static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) {{{ */ | |
1457 static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) | 1346 static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) |
1458 { | 1347 { |
1459 GGPInfo *info = gc->proto_data; | 1348 GGPInfo *info = gc->proto_data; |
1460 PurpleStoredImage *image; | 1349 PurpleStoredImage *image; |
1461 gint imgid = (gint) g_hash_table_lookup(info->pending_images, &ev->event.image_request.crc32); | 1350 gint imgid = (gint) g_hash_table_lookup(info->pending_images, &ev->event.image_request.crc32); |
1476 purple_debug_error("gg", "ggp_send_image_handler: image imgid: %i, crc: %u in hash but not found in imgstore!\n", imgid, ev->event.image_request.crc32); | 1365 purple_debug_error("gg", "ggp_send_image_handler: image imgid: %i, crc: %u in hash but not found in imgstore!\n", imgid, ev->event.image_request.crc32); |
1477 } | 1366 } |
1478 g_hash_table_remove(info->pending_images, &ev->event.image_request.crc32); | 1367 g_hash_table_remove(info->pending_images, &ev->event.image_request.crc32); |
1479 } | 1368 } |
1480 } | 1369 } |
1481 /* }}} */ | 1370 |
1482 | |
1483 /* | |
1484 */ | |
1485 /* static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) {{{ */ | |
1486 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) | 1371 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) |
1487 { | 1372 { |
1488 PurpleConnection *gc = _gc; | 1373 PurpleConnection *gc = _gc; |
1489 GGPInfo *info = gc->proto_data; | 1374 GGPInfo *info = gc->proto_data; |
1490 struct gg_event *ev; | 1375 struct gg_event *ev; |
1608 break; | 1493 break; |
1609 } | 1494 } |
1610 | 1495 |
1611 gg_free_event(ev); | 1496 gg_free_event(ev); |
1612 } | 1497 } |
1613 /* }}} */ | 1498 |
1614 | |
1615 /* | |
1616 */ | |
1617 /* static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) {{{ */ | |
1618 static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) | 1499 static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) |
1619 { | 1500 { |
1620 PurpleConnection *gc = _gc; | 1501 PurpleConnection *gc = _gc; |
1621 GGPInfo *info; | 1502 GGPInfo *info; |
1622 struct gg_event *ev; | 1503 struct gg_event *ev; |
1701 break; | 1582 break; |
1702 } | 1583 } |
1703 | 1584 |
1704 gg_free_event(ev); | 1585 gg_free_event(ev); |
1705 } | 1586 } |
1706 /* }}} */ | |
1707 | 1587 |
1708 /* ---------------------------------------------------------------------- */ | 1588 /* ---------------------------------------------------------------------- */ |
1709 /* ----- PurplePluginProtocolInfo ----------------------------------------- */ | 1589 /* ----- PurplePluginProtocolInfo ----------------------------------------- */ |
1710 /* ---------------------------------------------------------------------- */ | 1590 /* ---------------------------------------------------------------------- */ |
1711 | 1591 |
1712 /* static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) {{{ */ | |
1713 static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) | 1592 static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) |
1714 { | 1593 { |
1715 return "gadu-gadu"; | 1594 return "gadu-gadu"; |
1716 } | 1595 } |
1717 /* }}} */ | 1596 |
1718 | |
1719 /* static char *ggp_status_text(PurpleBuddy *b) {{{ */ | |
1720 static char *ggp_status_text(PurpleBuddy *b) | 1597 static char *ggp_status_text(PurpleBuddy *b) |
1721 { | 1598 { |
1722 PurpleStatus *status; | 1599 PurpleStatus *status; |
1723 const char *msg; | 1600 const char *msg; |
1724 char *text; | 1601 char *text; |
1740 g_free(tmp); | 1617 g_free(tmp); |
1741 | 1618 |
1742 return text; | 1619 return text; |
1743 } | 1620 } |
1744 } | 1621 } |
1745 /* }}} */ | 1622 |
1746 | |
1747 /* static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) {{{ */ | |
1748 static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) | 1623 static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
1749 { | 1624 { |
1750 PurpleStatus *status; | 1625 PurpleStatus *status; |
1751 char *text, *tmp; | 1626 char *text, *tmp; |
1752 const char *msg, *name, *alias; | 1627 const char *msg, *name, *alias; |
1773 /* We don't want to duplicate 'Status: Offline'. */ | 1648 /* We don't want to duplicate 'Status: Offline'. */ |
1774 } else if (PURPLE_BUDDY_IS_ONLINE(b)) { | 1649 } else if (PURPLE_BUDDY_IS_ONLINE(b)) { |
1775 purple_notify_user_info_add_pair(user_info, _("Status"), name); | 1650 purple_notify_user_info_add_pair(user_info, _("Status"), name); |
1776 } | 1651 } |
1777 } | 1652 } |
1778 /* }}} */ | 1653 |
1779 | |
1780 /* static GList *ggp_status_types(PurpleAccount *account) {{{ */ | |
1781 static GList *ggp_status_types(PurpleAccount *account) | 1654 static GList *ggp_status_types(PurpleAccount *account) |
1782 { | 1655 { |
1783 PurpleStatusType *type; | 1656 PurpleStatusType *type; |
1784 GList *types = NULL; | 1657 GList *types = NULL; |
1785 | 1658 |
1819 NULL); | 1692 NULL); |
1820 types = g_list_append(types, type); | 1693 types = g_list_append(types, type); |
1821 | 1694 |
1822 return types; | 1695 return types; |
1823 } | 1696 } |
1824 /* }}} */ | 1697 |
1825 | |
1826 /* static GList *ggp_blist_node_menu(PurpleBlistNode *node) {{{ */ | |
1827 static GList *ggp_blist_node_menu(PurpleBlistNode *node) | 1698 static GList *ggp_blist_node_menu(PurpleBlistNode *node) |
1828 { | 1699 { |
1829 PurpleMenuAction *act; | 1700 PurpleMenuAction *act; |
1830 GList *m = NULL; | 1701 GList *m = NULL; |
1831 | 1702 |
1851 } | 1722 } |
1852 m = g_list_append(m, act); | 1723 m = g_list_append(m, act); |
1853 | 1724 |
1854 return m; | 1725 return m; |
1855 } | 1726 } |
1856 /* }}} */ | 1727 |
1857 | |
1858 /* static GList *ggp_chat_info(PurpleConnection *gc) {{{ */ | |
1859 static GList *ggp_chat_info(PurpleConnection *gc) | 1728 static GList *ggp_chat_info(PurpleConnection *gc) |
1860 { | 1729 { |
1861 GList *m = NULL; | 1730 GList *m = NULL; |
1862 struct proto_chat_entry *pce; | 1731 struct proto_chat_entry *pce; |
1863 | 1732 |
1867 pce->required = TRUE; | 1736 pce->required = TRUE; |
1868 m = g_list_append(m, pce); | 1737 m = g_list_append(m, pce); |
1869 | 1738 |
1870 return m; | 1739 return m; |
1871 } | 1740 } |
1872 /* }}} */ | 1741 |
1873 | |
1874 /* static void ggp_login(PurpleAccount *account) {{{ */ | |
1875 static void ggp_login(PurpleAccount *account) | 1742 static void ggp_login(PurpleAccount *account) |
1876 { | 1743 { |
1877 PurpleConnection *gc; | 1744 PurpleConnection *gc; |
1878 PurplePresence *presence; | 1745 PurplePresence *presence; |
1879 PurpleStatus *status; | 1746 PurpleStatus *status; |
1918 return; | 1785 return; |
1919 } | 1786 } |
1920 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, | 1787 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
1921 ggp_async_login_handler, gc); | 1788 ggp_async_login_handler, gc); |
1922 } | 1789 } |
1923 /* }}} */ | 1790 |
1924 | |
1925 /* static void ggp_close(PurpleConnection *gc) {{{ */ | |
1926 static void ggp_close(PurpleConnection *gc) | 1791 static void ggp_close(PurpleConnection *gc) |
1927 { | 1792 { |
1928 | 1793 |
1929 if (gc == NULL) { | 1794 if (gc == NULL) { |
1930 purple_debug_info("gg", "gc == NULL\n"); | 1795 purple_debug_info("gg", "gc == NULL\n"); |
1961 | 1826 |
1962 ggp_buddylist_offline(gc); | 1827 ggp_buddylist_offline(gc); |
1963 | 1828 |
1964 purple_debug_info("gg", "Connection closed.\n"); | 1829 purple_debug_info("gg", "Connection closed.\n"); |
1965 } | 1830 } |
1966 /* }}} */ | 1831 |
1967 | |
1968 /* static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, PurpleMessageFlags flags) {{{ */ | |
1969 static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, | 1832 static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, |
1970 PurpleMessageFlags flags) | 1833 PurpleMessageFlags flags) |
1971 { | 1834 { |
1972 GGPInfo *info = gc->proto_data; | 1835 GGPInfo *info = gc->proto_data; |
1973 char *tmp, *plain; | 1836 char *tmp, *plain; |
2080 g_free(plain); | 1943 g_free(plain); |
2081 g_free(tmp); | 1944 g_free(tmp); |
2082 | 1945 |
2083 return ret; | 1946 return ret; |
2084 } | 1947 } |
2085 /* }}} */ | 1948 |
2086 | |
2087 /* static void ggp_get_info(PurpleConnection *gc, const char *name) { {{{ */ | |
2088 static void ggp_get_info(PurpleConnection *gc, const char *name) | 1949 static void ggp_get_info(PurpleConnection *gc, const char *name) |
2089 { | 1950 { |
2090 GGPInfo *info = gc->proto_data; | 1951 GGPInfo *info = gc->proto_data; |
2091 GGPSearchForm *form; | 1952 GGPSearchForm *form; |
2092 guint32 seq; | 1953 guint32 seq; |
2100 | 1961 |
2101 seq = ggp_search_start(gc, form); | 1962 seq = ggp_search_start(gc, form); |
2102 ggp_search_add(info->searches, seq, form); | 1963 ggp_search_add(info->searches, seq, form); |
2103 purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq); | 1964 purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq); |
2104 } | 1965 } |
2105 /* }}} */ | 1966 |
2106 | |
2107 /* static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) {{{ */ | |
2108 static int ggp_to_gg_status(PurpleStatus *status, char **msg) | 1967 static int ggp_to_gg_status(PurpleStatus *status, char **msg) |
2109 { | 1968 { |
2110 const char *status_id = purple_status_get_id(status); | 1969 const char *status_id = purple_status_get_id(status); |
2111 int new_status, new_status_descr; | 1970 int new_status, new_status_descr; |
2112 const char *new_msg; | 1971 const char *new_msg; |
2147 } else { | 2006 } else { |
2148 *msg = NULL; | 2007 *msg = NULL; |
2149 return new_status; | 2008 return new_status; |
2150 } | 2009 } |
2151 } | 2010 } |
2152 /* }}} */ | 2011 |
2153 | |
2154 /* static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) {{{ */ | |
2155 static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) | 2012 static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) |
2156 { | 2013 { |
2157 PurpleConnection *gc; | 2014 PurpleConnection *gc; |
2158 GGPInfo *info; | 2015 GGPInfo *info; |
2159 int new_status; | 2016 int new_status; |
2175 } | 2032 } |
2176 | 2033 |
2177 ggp_status_fake_to_self(account); | 2034 ggp_status_fake_to_self(account); |
2178 | 2035 |
2179 } | 2036 } |
2180 /* }}} */ | 2037 |
2181 | |
2182 /* static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {{{ */ | |
2183 static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) | 2038 static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
2184 { | 2039 { |
2185 PurpleAccount *account; | 2040 PurpleAccount *account; |
2186 GGPInfo *info = gc->proto_data; | 2041 GGPInfo *info = gc->proto_data; |
2187 | 2042 |
2190 account = purple_connection_get_account(gc); | 2045 account = purple_connection_get_account(gc); |
2191 if (strcmp(purple_account_get_username(account), buddy->name) == 0) { | 2046 if (strcmp(purple_account_get_username(account), buddy->name) == 0) { |
2192 ggp_status_fake_to_self(account); | 2047 ggp_status_fake_to_self(account); |
2193 } | 2048 } |
2194 } | 2049 } |
2195 /* }}} */ | 2050 |
2196 | |
2197 /* static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {{{ */ | |
2198 static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, | 2051 static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
2199 PurpleGroup *group) | 2052 PurpleGroup *group) |
2200 { | 2053 { |
2201 GGPInfo *info = gc->proto_data; | 2054 GGPInfo *info = gc->proto_data; |
2202 | 2055 |
2203 gg_remove_notify(info->session, ggp_str_to_uin(buddy->name)); | 2056 gg_remove_notify(info->session, ggp_str_to_uin(buddy->name)); |
2204 } | 2057 } |
2205 /* }}} */ | 2058 |
2206 | |
2207 /* static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) {{{ */ | |
2208 static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) | 2059 static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) |
2209 { | 2060 { |
2210 GGPInfo *info = gc->proto_data; | 2061 GGPInfo *info = gc->proto_data; |
2211 GGPChat *chat; | 2062 GGPChat *chat; |
2212 char *chat_name; | 2063 char *chat_name; |
2235 conv = serv_got_joined_chat(gc, info->chats_count, chat_name); | 2086 conv = serv_got_joined_chat(gc, info->chats_count, chat_name); |
2236 purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), | 2087 purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), |
2237 purple_account_get_username(account), NULL, | 2088 purple_account_get_username(account), NULL, |
2238 PURPLE_CBFLAGS_NONE, TRUE); | 2089 PURPLE_CBFLAGS_NONE, TRUE); |
2239 } | 2090 } |
2240 /* }}} */ | 2091 |
2241 | |
2242 /* static char *ggp_get_chat_name(GHashTable *data) { {{{ */ | |
2243 static char *ggp_get_chat_name(GHashTable *data) { | 2092 static char *ggp_get_chat_name(GHashTable *data) { |
2244 return g_strdup(g_hash_table_lookup(data, "name")); | 2093 return g_strdup(g_hash_table_lookup(data, "name")); |
2245 } | 2094 } |
2246 /* }}} */ | 2095 |
2247 | |
2248 /* static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) {{{ */ | |
2249 static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) | 2096 static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
2250 { | 2097 { |
2251 PurpleConversation *conv; | 2098 PurpleConversation *conv; |
2252 GGPInfo *info = gc->proto_data; | 2099 GGPInfo *info = gc->proto_data; |
2253 GGPChat *chat = NULL; | 2100 GGPChat *chat = NULL; |
2295 purple_account_get_username(purple_connection_get_account(gc)), | 2142 purple_account_get_username(purple_connection_get_account(gc)), |
2296 flags, message, time(NULL)); | 2143 flags, message, time(NULL)); |
2297 | 2144 |
2298 return 0; | 2145 return 0; |
2299 } | 2146 } |
2300 /* }}} */ | 2147 |
2301 | |
2302 /* static void ggp_keepalive(PurpleConnection *gc) {{{ */ | |
2303 static void ggp_keepalive(PurpleConnection *gc) | 2148 static void ggp_keepalive(PurpleConnection *gc) |
2304 { | 2149 { |
2305 GGPInfo *info = gc->proto_data; | 2150 GGPInfo *info = gc->proto_data; |
2306 | 2151 |
2307 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ | 2152 /* purple_debug_info("gg", "Keeping connection alive....\n"); */ |
2312 purple_connection_error_reason (gc, | 2157 purple_connection_error_reason (gc, |
2313 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 2158 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
2314 _("Not connected to the server.")); | 2159 _("Not connected to the server.")); |
2315 } | 2160 } |
2316 } | 2161 } |
2317 /* }}} */ | 2162 |
2318 | |
2319 /* static void ggp_register_user(PurpleAccount *account) {{{ */ | |
2320 static void ggp_register_user(PurpleAccount *account) | 2163 static void ggp_register_user(PurpleAccount *account) |
2321 { | 2164 { |
2322 PurpleConnection *gc = purple_account_get_connection(account); | 2165 PurpleConnection *gc = purple_account_get_connection(account); |
2323 GGPInfo *info; | 2166 GGPInfo *info; |
2324 | 2167 |
2325 info = gc->proto_data = g_new0(GGPInfo, 1); | 2168 info = gc->proto_data = g_new0(GGPInfo, 1); |
2326 | 2169 |
2327 ggp_token_request(gc, ggp_register_user_dialog); | 2170 ggp_token_request(gc, ggp_register_user_dialog); |
2328 } | 2171 } |
2329 /* }}} */ | 2172 |
2330 | |
2331 /* static GList *ggp_actions(PurplePlugin *plugin, gpointer context) {{{ */ | |
2332 static GList *ggp_actions(PurplePlugin *plugin, gpointer context) | 2173 static GList *ggp_actions(PurplePlugin *plugin, gpointer context) |
2333 { | 2174 { |
2334 GList *m = NULL; | 2175 GList *m = NULL; |
2335 PurplePluginAction *act; | 2176 PurplePluginAction *act; |
2336 | 2177 |
2366 ggp_action_buddylist_load); | 2207 ggp_action_buddylist_load); |
2367 m = g_list_append(m, act); | 2208 m = g_list_append(m, act); |
2368 | 2209 |
2369 return m; | 2210 return m; |
2370 } | 2211 } |
2371 /* }}} */ | 2212 |
2372 | |
2373 /* static gboolean ggp_offline_message(const PurpleBuddy *buddy) {{{ */ | |
2374 static gboolean ggp_offline_message(const PurpleBuddy *buddy) | 2213 static gboolean ggp_offline_message(const PurpleBuddy *buddy) |
2375 { | 2214 { |
2376 return TRUE; | 2215 return TRUE; |
2377 } | 2216 } |
2378 /* }}} */ | 2217 |
2379 | |
2380 /* prpl_info setup {{{ */ | |
2381 static PurplePluginProtocolInfo prpl_info = | 2218 static PurplePluginProtocolInfo prpl_info = |
2382 { | 2219 { |
2383 OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, | 2220 OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, |
2384 NULL, /* user_splits */ | 2221 NULL, /* user_splits */ |
2385 NULL, /* protocol_options */ | 2222 NULL, /* protocol_options */ |
2448 NULL, | 2285 NULL, |
2449 NULL, | 2286 NULL, |
2450 sizeof(PurplePluginProtocolInfo), /* struct_size */ | 2287 sizeof(PurplePluginProtocolInfo), /* struct_size */ |
2451 NULL | 2288 NULL |
2452 }; | 2289 }; |
2453 /* }}} */ | 2290 |
2454 | |
2455 /* PurplePluginInfo setup {{{ */ | |
2456 static PurplePluginInfo info = { | 2291 static PurplePluginInfo info = { |
2457 PURPLE_PLUGIN_MAGIC, /* magic */ | 2292 PURPLE_PLUGIN_MAGIC, /* magic */ |
2458 PURPLE_MAJOR_VERSION, /* major_version */ | 2293 PURPLE_MAJOR_VERSION, /* major_version */ |
2459 PURPLE_MINOR_VERSION, /* minor_version */ | 2294 PURPLE_MINOR_VERSION, /* minor_version */ |
2460 PURPLE_PLUGIN_PROTOCOL, /* plugin type */ | 2295 PURPLE_PLUGIN_PROTOCOL, /* plugin type */ |
2461 NULL, /* ui_requirement */ | 2296 NULL, /* ui_requirement */ |
2462 0, /* flags */ | 2297 0, /* flags */ |
2463 NULL, /* dependencies */ | 2298 NULL, /* dependencies */ |
2464 PURPLE_PRIORITY_DEFAULT, /* priority */ | 2299 PURPLE_PRIORITY_DEFAULT, /* priority */ |
2465 | 2300 |
2466 "prpl-gg", /* id */ | 2301 "prpl-gg", /* id */ |
2467 "Gadu-Gadu", /* name */ | 2302 "Gadu-Gadu", /* name */ |
2468 DISPLAY_VERSION, /* version */ | 2303 DISPLAY_VERSION, /* version */ |
2469 | 2304 |
2470 N_("Gadu-Gadu Protocol Plugin"), /* summary */ | 2305 N_("Gadu-Gadu Protocol Plugin"), /* summary */ |
2471 N_("Polish popular IM"), /* description */ | 2306 N_("Polish popular IM"), /* description */ |
2472 "boler@sourceforge.net", /* author */ | 2307 "boler@sourceforge.net", /* author */ |
2473 PURPLE_WEBSITE, /* homepage */ | 2308 PURPLE_WEBSITE, /* homepage */ |
2474 | 2309 |
2475 NULL, /* load */ | 2310 NULL, /* load */ |
2476 NULL, /* unload */ | 2311 NULL, /* unload */ |
2477 NULL, /* destroy */ | 2312 NULL, /* destroy */ |
2478 | 2313 |
2479 NULL, /* ui_info */ | 2314 NULL, /* ui_info */ |
2480 &prpl_info, /* extra_info */ | 2315 &prpl_info, /* extra_info */ |
2481 NULL, /* prefs_info */ | 2316 NULL, /* prefs_info */ |
2482 ggp_actions, /* actions */ | 2317 ggp_actions, /* actions */ |
2483 | 2318 |
2484 /* padding */ | 2319 /* padding */ |
2485 NULL, | 2320 NULL, |
2486 NULL, | 2321 NULL, |
2487 NULL, | 2322 NULL, |
2488 NULL | 2323 NULL |
2489 }; | 2324 }; |
2490 /* }}} */ | 2325 |
2491 | |
2492 /* static void purple_gg_debug_handler(int level, const char * format, va_list args) {{{ */ | |
2493 static void purple_gg_debug_handler(int level, const char * format, va_list args) { | 2326 static void purple_gg_debug_handler(int level, const char * format, va_list args) { |
2494 PurpleDebugLevel purple_level; | 2327 PurpleDebugLevel purple_level; |
2495 char *msg = g_strdup_vprintf(format, args); | 2328 char *msg = g_strdup_vprintf(format, args); |
2496 | 2329 |
2497 /* This is pretty pointless since the GG_DEBUG levels don't correspond to | 2330 /* This is pretty pointless since the GG_DEBUG levels don't correspond to |
2510 } | 2343 } |
2511 | 2344 |
2512 purple_debug(purple_level, "gg", "%s", msg); | 2345 purple_debug(purple_level, "gg", "%s", msg); |
2513 g_free(msg); | 2346 g_free(msg); |
2514 } | 2347 } |
2515 /* }}} */ | 2348 |
2516 | |
2517 /* | |
2518 */ | |
2519 /* static void init_plugin(PurplePlugin *plugin) {{{ */ | |
2520 static void init_plugin(PurplePlugin *plugin) | 2349 static void init_plugin(PurplePlugin *plugin) |
2521 { | 2350 { |
2522 PurpleAccountOption *option; | 2351 PurpleAccountOption *option; |
2523 | 2352 |
2524 option = purple_account_option_string_new(_("Nickname"), | 2353 option = purple_account_option_string_new(_("Nickname"), |
2528 | 2357 |
2529 my_protocol = plugin; | 2358 my_protocol = plugin; |
2530 | 2359 |
2531 gg_debug_handler = purple_gg_debug_handler; | 2360 gg_debug_handler = purple_gg_debug_handler; |
2532 } | 2361 } |
2533 /* }}} */ | |
2534 | 2362 |
2535 PURPLE_INIT_PLUGIN(gg, init_plugin, info); | 2363 PURPLE_INIT_PLUGIN(gg, init_plugin, info); |
2536 | 2364 |
2537 /* vim: set ts=8 sts=0 sw=8 noet: */ | 2365 /* vim: set ts=8 sts=0 sw=8 noet: */ |