Mercurial > pidgin.yaz
comparison libpurple/protocols/null/nullprpl.c @ 32767:2ec94166be43
On the way to hiding the PurpleConnection struct.
* Added purple_connection_get_flags() and purple_connection_set_flags()
* Use purple_connection_ accessor functions.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 18 Oct 2011 18:47:48 +0000 |
parents | f75041cb3fec |
children |
comparison
equal
deleted
inserted
replaced
32766:ea2b621fd3ba | 32767:2ec94166be43 |
---|---|
111 | 111 |
112 static void call_if_nullprpl(gpointer data, gpointer userdata) { | 112 static void call_if_nullprpl(gpointer data, gpointer userdata) { |
113 PurpleConnection *gc = (PurpleConnection *)(data); | 113 PurpleConnection *gc = (PurpleConnection *)(data); |
114 GcFuncData *gcfdata = (GcFuncData *)userdata; | 114 GcFuncData *gcfdata = (GcFuncData *)userdata; |
115 | 115 |
116 if (!strcmp(purple_account_get_protocol_id(gc->account), NULLPRPL_ID)) | 116 if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), NULLPRPL_ID)) |
117 gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); | 117 gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); |
118 } | 118 } |
119 | 119 |
120 static void foreach_nullprpl_gc(GcFunc fn, PurpleConnection *from, | 120 static void foreach_nullprpl_gc(GcFunc fn, PurpleConnection *from, |
121 gpointer userdata) { | 121 gpointer userdata) { |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 static void discover_status(PurpleConnection *from, PurpleConnection *to, | 161 static void discover_status(PurpleConnection *from, PurpleConnection *to, |
162 gpointer userdata) { | 162 gpointer userdata) { |
163 const char *from_username = purple_account_get_username(from->account); | 163 const char *from_username = purple_account_get_username(purple_connection_get_account(from)); |
164 const char *to_username = purple_account_get_username(to->account); | 164 const char *to_username = purple_account_get_username(purple_connection_get_account(to)); |
165 | 165 |
166 if (purple_find_buddy(from->account, to_username)) { | 166 if (purple_find_buddy(purple_connection_get_account(from), to_username)) { |
167 PurpleStatus *status = purple_account_get_active_status(to->account); | 167 PurpleStatus *status = purple_account_get_active_status(purple_connection_get_account(to)); |
168 const char *status_id = purple_status_get_id(status); | 168 const char *status_id = purple_status_get_id(status); |
169 const char *message = purple_status_get_attr_string(status, "message"); | 169 const char *message = purple_status_get_attr_string(status, "message"); |
170 | 170 |
171 if (!strcmp(status_id, NULL_STATUS_ONLINE) || | 171 if (!strcmp(status_id, NULL_STATUS_ONLINE) || |
172 !strcmp(status_id, NULL_STATUS_AWAY) || | 172 !strcmp(status_id, NULL_STATUS_AWAY) || |
173 !strcmp(status_id, NULL_STATUS_OFFLINE)) { | 173 !strcmp(status_id, NULL_STATUS_OFFLINE)) { |
174 purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", | 174 purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", |
175 from_username, to_username, status_id, message); | 175 from_username, to_username, status_id, message); |
176 purple_prpl_got_user_status(from->account, to_username, status_id, | 176 purple_prpl_got_user_status(purple_connection_get_account(from), to_username, status_id, |
177 (message) ? "message" : NULL, message, NULL); | 177 (message) ? "message" : NULL, message, NULL); |
178 } else { | 178 } else { |
179 purple_debug_error("nullprpl", | 179 purple_debug_error("nullprpl", |
180 "%s's buddy %s has an unknown status: %s, %s", | 180 "%s's buddy %s has an unknown status: %s, %s", |
181 from_username, to_username, status_id, message); | 181 from_username, to_username, status_id, message); |
184 } | 184 } |
185 | 185 |
186 static void report_status_change(PurpleConnection *from, PurpleConnection *to, | 186 static void report_status_change(PurpleConnection *from, PurpleConnection *to, |
187 gpointer userdata) { | 187 gpointer userdata) { |
188 purple_debug_info("nullprpl", "notifying %s that %s changed status\n", | 188 purple_debug_info("nullprpl", "notifying %s that %s changed status\n", |
189 purple_account_get_username(to->account), purple_account_get_username(from->account)); | 189 purple_account_get_username(purple_connection_get_account(to)), purple_account_get_username(purple_connection_get_account(from))); |
190 discover_status(to, from, NULL); | 190 discover_status(to, from, NULL); |
191 } | 191 } |
192 | 192 |
193 | 193 |
194 /* | 194 /* |
263 purple_notify_user_info_add_pair_html(info, purple_status_get_name(status), | 263 purple_notify_user_info_add_pair_html(info, purple_status_get_name(status), |
264 msg); | 264 msg); |
265 g_free(msg); | 265 g_free(msg); |
266 | 266 |
267 if (full) { | 267 if (full) { |
268 const char *user_info = purple_account_get_user_info(gc->account); | 268 const char *user_info = purple_account_get_user_info(purple_connection_get_account(gc)); |
269 if (user_info) | 269 if (user_info) |
270 /* TODO: Check whether it's correct to call add_pair_html, | 270 /* TODO: Check whether it's correct to call add_pair_html, |
271 or if we should be using add_pair_plaintext */ | 271 or if we should be using add_pair_plaintext */ |
272 purple_notify_user_info_add_pair_html(info, _("User info"), user_info); | 272 purple_notify_user_info_add_pair_html(info, _("User info"), user_info); |
273 } | 273 } |
411 } | 411 } |
412 | 412 |
413 static int nullprpl_send_im(PurpleConnection *gc, const char *who, | 413 static int nullprpl_send_im(PurpleConnection *gc, const char *who, |
414 const char *message, PurpleMessageFlags flags) | 414 const char *message, PurpleMessageFlags flags) |
415 { | 415 { |
416 const char *from_username = purple_account_get_username(gc->account); | 416 const char *from_username = purple_account_get_username(purple_connection_get_account(gc)); |
417 PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) | 417 PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) |
418 | PURPLE_MESSAGE_RECV); | 418 | PURPLE_MESSAGE_RECV); |
419 PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); | 419 PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); |
420 PurpleConnection *to; | 420 PurpleConnection *to; |
421 | 421 |
422 purple_debug_info("nullprpl", "sending message from %s to %s: %s\n", | 422 purple_debug_info("nullprpl", "sending message from %s to %s: %s\n", |
423 from_username, who, message); | 423 from_username, who, message); |
424 | 424 |
425 /* is the sender blocked by the recipient's privacy settings? */ | 425 /* is the sender blocked by the recipient's privacy settings? */ |
426 if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(gc->account))) { | 426 if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(purple_connection_get_account(gc)))) { |
427 char *msg = g_strdup_printf( | 427 char *msg = g_strdup_printf( |
428 _("Your message was blocked by %s's privacy settings."), who); | 428 _("Your message was blocked by %s's privacy settings."), who); |
429 purple_debug_info("nullprpl", | 429 purple_debug_info("nullprpl", |
430 "discarding; %s is blocked by %s's privacy settings\n", | 430 "discarding; %s is blocked by %s's privacy settings\n", |
431 from_username, who); | 431 from_username, who); |
432 purple_conv_present_error(who, gc->account, msg); | 432 purple_conv_present_error(who, purple_connection_get_account(gc), msg); |
433 g_free(msg); | 433 g_free(msg); |
434 return 0; | 434 return 0; |
435 } | 435 } |
436 | 436 |
437 /* is the recipient online? */ | 437 /* is the recipient online? */ |
459 return 1; | 459 return 1; |
460 } | 460 } |
461 | 461 |
462 static void nullprpl_set_info(PurpleConnection *gc, const char *info) { | 462 static void nullprpl_set_info(PurpleConnection *gc, const char *info) { |
463 purple_debug_info("nullprpl", "setting %s's user info to %s\n", | 463 purple_debug_info("nullprpl", "setting %s's user info to %s\n", |
464 purple_account_get_username(gc->account), info); | 464 purple_account_get_username(purple_connection_get_account(gc)), info); |
465 } | 465 } |
466 | 466 |
467 static const char *typing_state_to_string(PurpleTypingState typing) { | 467 static const char *typing_state_to_string(PurpleTypingState typing) { |
468 switch (typing) { | 468 switch (typing) { |
469 case PURPLE_NOT_TYPING: return "is not typing"; | 469 case PURPLE_NOT_TYPING: return "is not typing"; |
473 } | 473 } |
474 } | 474 } |
475 | 475 |
476 static void notify_typing(PurpleConnection *from, PurpleConnection *to, | 476 static void notify_typing(PurpleConnection *from, PurpleConnection *to, |
477 gpointer typing) { | 477 gpointer typing) { |
478 const char *from_username = purple_account_get_username(from->account); | 478 const char *from_username = purple_account_get_username(purple_connection_get_account(from)); |
479 const char *action = typing_state_to_string((PurpleTypingState)typing); | 479 const char *action = typing_state_to_string((PurpleTypingState)typing); |
480 purple_debug_info("nullprpl", "notifying %s that %s %s\n", | 480 purple_debug_info("nullprpl", "notifying %s that %s %s\n", |
481 purple_account_get_username(to->account), from_username, action); | 481 purple_account_get_username(purple_connection_get_account(to)), from_username, action); |
482 | 482 |
483 serv_got_typing(to, | 483 serv_got_typing(to, |
484 from_username, | 484 from_username, |
485 0, /* if non-zero, a timeout in seconds after which to | 485 0, /* if non-zero, a timeout in seconds after which to |
486 * reset the typing status to PURPLE_NOT_TYPING */ | 486 * reset the typing status to PURPLE_NOT_TYPING */ |
487 (PurpleTypingState)typing); | 487 (PurpleTypingState)typing); |
488 } | 488 } |
489 | 489 |
490 static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, | 490 static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, |
491 PurpleTypingState typing) { | 491 PurpleTypingState typing) { |
492 purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(gc->account), | 492 purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(purple_connection_get_account(gc)), |
493 typing_state_to_string(typing)); | 493 typing_state_to_string(typing)); |
494 foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); | 494 foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); |
495 return 0; | 495 return 0; |
496 } | 496 } |
497 | 497 |
499 const char *body; | 499 const char *body; |
500 PurpleNotifyUserInfo *info = purple_notify_user_info_new(); | 500 PurpleNotifyUserInfo *info = purple_notify_user_info_new(); |
501 PurpleAccount *acct; | 501 PurpleAccount *acct; |
502 | 502 |
503 purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, | 503 purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, |
504 purple_account_get_username(gc->account)); | 504 purple_account_get_username(purple_connection_get_account(gc))); |
505 | 505 |
506 if (!get_nullprpl_gc(username)) { | 506 if (!get_nullprpl_gc(username)) { |
507 char *msg = g_strdup_printf(_("%s is not logged in."), username); | 507 char *msg = g_strdup_printf(_("%s is not logged in."), username); |
508 purple_notify_error(gc, _("User Info"), _("User info not available. "), msg); | 508 purple_notify_error(gc, _("User Info"), _("User info not available. "), msg); |
509 g_free(msg); | 509 g_free(msg); |
536 } | 536 } |
537 | 537 |
538 static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { | 538 static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { |
539 purple_debug_info("nullprpl", | 539 purple_debug_info("nullprpl", |
540 "purple reports that %s has been idle for %d seconds\n", | 540 "purple reports that %s has been idle for %d seconds\n", |
541 purple_account_get_username(gc->account), idletime); | 541 purple_account_get_username(purple_connection_get_account(gc)), idletime); |
542 } | 542 } |
543 | 543 |
544 static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, | 544 static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, |
545 const char *new_pass) { | 545 const char *new_pass) { |
546 purple_debug_info("nullprpl", "%s wants to change their password\n", | 546 purple_debug_info("nullprpl", "%s wants to change their password\n", |
547 purple_account_get_username(gc->account)); | 547 purple_account_get_username(purple_connection_get_account(gc))); |
548 } | 548 } |
549 | 549 |
550 static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, | 550 static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
551 PurpleGroup *group, const char *message) | 551 PurpleGroup *group, const char *message) |
552 { | 552 { |
553 const char *username = purple_account_get_username(gc->account); | 553 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
554 PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); | 554 PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); |
555 | 555 |
556 purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, | 556 purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, |
557 username); | 557 username); |
558 | 558 |
559 if (buddy_gc) { | 559 if (buddy_gc) { |
560 PurpleAccount *buddy_acct = buddy_gc->account; | 560 PurpleAccount *buddy_acct = purple_connection_get_account(buddy_gc); |
561 | 561 |
562 discover_status(gc, buddy_gc, NULL); | 562 discover_status(gc, buddy_gc, NULL); |
563 | 563 |
564 if (purple_find_buddy(buddy_acct, username)) { | 564 if (purple_find_buddy(buddy_acct, username)) { |
565 purple_debug_info("nullprpl", "%s is already on %s's buddy list\n", | 565 purple_debug_info("nullprpl", "%s is already on %s's buddy list\n", |
592 | 592 |
593 static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, | 593 static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
594 PurpleGroup *group) | 594 PurpleGroup *group) |
595 { | 595 { |
596 purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", | 596 purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", |
597 buddy->name, purple_account_get_username(gc->account)); | 597 buddy->name, purple_account_get_username(purple_connection_get_account(gc))); |
598 } | 598 } |
599 | 599 |
600 static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, | 600 static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, |
601 GList *groups) { | 601 GList *groups) { |
602 GList *buddy = buddies; | 602 GList *buddy = buddies; |
618 * purple_privacy_check(), from privacy.h), to determine whether messages are | 618 * purple_privacy_check(), from privacy.h), to determine whether messages are |
619 * allowed or blocked. | 619 * allowed or blocked. |
620 */ | 620 */ |
621 static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { | 621 static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { |
622 purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", | 622 purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", |
623 purple_account_get_username(gc->account), name); | 623 purple_account_get_username(purple_connection_get_account(gc)), name); |
624 } | 624 } |
625 | 625 |
626 static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { | 626 static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { |
627 purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", | 627 purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", |
628 purple_account_get_username(gc->account), name); | 628 purple_account_get_username(purple_connection_get_account(gc)), name); |
629 } | 629 } |
630 | 630 |
631 static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { | 631 static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { |
632 purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", | 632 purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", |
633 purple_account_get_username(gc->account), name); | 633 purple_account_get_username(purple_connection_get_account(gc)), name); |
634 } | 634 } |
635 | 635 |
636 static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { | 636 static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { |
637 purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", | 637 purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", |
638 purple_account_get_username(gc->account), name); | 638 purple_account_get_username(purple_connection_get_account(gc)), name); |
639 } | 639 } |
640 | 640 |
641 static void nullprpl_set_permit_deny(PurpleConnection *gc) { | 641 static void nullprpl_set_permit_deny(PurpleConnection *gc) { |
642 /* this is for synchronizing the local black/whitelist with the server. | 642 /* this is for synchronizing the local black/whitelist with the server. |
643 * for nullprpl, it's a noop. | 643 * for nullprpl, it's a noop. |
666 FALSE); /* show a join message */ | 666 FALSE); /* show a join message */ |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { | 670 static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { |
671 const char *username = purple_account_get_username(gc->account); | 671 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
672 const char *room = g_hash_table_lookup(components, "room"); | 672 const char *room = g_hash_table_lookup(components, "room"); |
673 int chat_id = g_str_hash(room); | 673 int chat_id = g_str_hash(room); |
674 purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); | 674 purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); |
675 | 675 |
676 if (!purple_find_chat(gc, chat_id)) { | 676 if (!purple_find_chat(gc, chat_id)) { |
690 } | 690 } |
691 | 691 |
692 static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { | 692 static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { |
693 const char *invited_by = g_hash_table_lookup(components, "invited_by"); | 693 const char *invited_by = g_hash_table_lookup(components, "invited_by"); |
694 const char *room = g_hash_table_lookup(components, "room"); | 694 const char *room = g_hash_table_lookup(components, "room"); |
695 const char *username = purple_account_get_username(gc->account); | 695 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
696 PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); | 696 PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); |
697 char *message = g_strdup_printf( | 697 char *message = g_strdup_printf( |
698 "%s %s %s.", | 698 "%s %s %s.", |
699 username, | 699 username, |
700 _("has rejected your invitation to join the chat room"), | 700 _("has rejected your invitation to join the chat room"), |
717 return g_strdup(room); | 717 return g_strdup(room); |
718 } | 718 } |
719 | 719 |
720 static void nullprpl_chat_invite(PurpleConnection *gc, int id, | 720 static void nullprpl_chat_invite(PurpleConnection *gc, int id, |
721 const char *message, const char *who) { | 721 const char *message, const char *who) { |
722 const char *username = purple_account_get_username(gc->account); | 722 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
723 PurpleConversation *conv = purple_find_chat(gc, id); | 723 PurpleConversation *conv = purple_find_chat(gc, id); |
724 const char *room = purple_conversation_get_name(conv); | 724 const char *room = purple_conversation_get_name(conv); |
725 PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); | 725 PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); |
726 | 726 |
727 purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", | 727 purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", |
760 } | 760 } |
761 | 761 |
762 static void nullprpl_chat_leave(PurpleConnection *gc, int id) { | 762 static void nullprpl_chat_leave(PurpleConnection *gc, int id) { |
763 PurpleConversation *conv = purple_find_chat(gc, id); | 763 PurpleConversation *conv = purple_find_chat(gc, id); |
764 purple_debug_info("nullprpl", "%s is leaving chat room %s\n", | 764 purple_debug_info("nullprpl", "%s is leaving chat room %s\n", |
765 purple_account_get_username(gc->account), purple_conversation_get_name(conv)); | 765 purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv)); |
766 | 766 |
767 /* tell everyone that we left */ | 767 /* tell everyone that we left */ |
768 foreach_gc_in_chat(left_chat_room, gc, id, NULL); | 768 foreach_gc_in_chat(left_chat_room, gc, id, NULL); |
769 } | 769 } |
770 | 770 |
819 } | 819 } |
820 } | 820 } |
821 | 821 |
822 static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, | 822 static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, |
823 const char *message) { | 823 const char *message) { |
824 const char *username = purple_account_get_username(gc->account); | 824 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
825 PurpleConversation *conv = purple_find_chat(gc, id); | 825 PurpleConversation *conv = purple_find_chat(gc, id); |
826 purple_debug_info("nullprpl", | 826 purple_debug_info("nullprpl", |
827 "%s receives whisper from %s in chat room %s: %s\n", | 827 "%s receives whisper from %s in chat room %s: %s\n", |
828 username, who, purple_conversation_get_name(conv), message); | 828 username, who, purple_conversation_get_name(conv), message); |
829 | 829 |
844 time(NULL)); | 844 time(NULL)); |
845 } | 845 } |
846 | 846 |
847 static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, | 847 static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, |
848 PurpleMessageFlags flags) { | 848 PurpleMessageFlags flags) { |
849 const char *username = purple_account_get_username(gc->account); | 849 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
850 PurpleConversation *conv = purple_find_chat(gc, id); | 850 PurpleConversation *conv = purple_find_chat(gc, id); |
851 | 851 |
852 if (conv) { | 852 if (conv) { |
853 purple_debug_info("nullprpl", | 853 purple_debug_info("nullprpl", |
854 "%s is sending message to chat room %s: %s\n", username, | 854 "%s is sending message to chat room %s: %s\n", username, |
873 | 873 |
874 static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { | 874 static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { |
875 PurpleConversation *conv = purple_find_chat(gc, id); | 875 PurpleConversation *conv = purple_find_chat(gc, id); |
876 purple_debug_info("nullprpl", | 876 purple_debug_info("nullprpl", |
877 "retrieving %s's info for %s in chat room %s\n", who, | 877 "retrieving %s's info for %s in chat room %s\n", who, |
878 purple_account_get_username(gc->account), purple_conversation_get_name(conv)); | 878 purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv)); |
879 | 879 |
880 nullprpl_get_info(gc, who); | 880 nullprpl_get_info(gc, who); |
881 } | 881 } |
882 | 882 |
883 static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, | 883 static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, |
884 const char *alias) { | 884 const char *alias) { |
885 purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", | 885 purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", |
886 purple_account_get_username(gc->account), who, alias); | 886 purple_account_get_username(purple_connection_get_account(gc)), who, alias); |
887 } | 887 } |
888 | 888 |
889 static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, | 889 static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, |
890 const char *old_group, | 890 const char *old_group, |
891 const char *new_group) { | 891 const char *new_group) { |
892 purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", | 892 purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", |
893 purple_account_get_username(gc->account), who, old_group, new_group); | 893 purple_account_get_username(purple_connection_get_account(gc)), who, old_group, new_group); |
894 } | 894 } |
895 | 895 |
896 static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, | 896 static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, |
897 PurpleGroup *group, GList *moved_buddies) { | 897 PurpleGroup *group, GList *moved_buddies) { |
898 purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", | 898 purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", |
899 purple_account_get_username(gc->account), old_name, group->name); | 899 purple_account_get_username(purple_connection_get_account(gc)), old_name, group->name); |
900 } | 900 } |
901 | 901 |
902 static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { | 902 static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { |
903 purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", | 903 purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", |
904 purple_account_get_username(gc->account), who); | 904 purple_account_get_username(purple_connection_get_account(gc)), who); |
905 } | 905 } |
906 | 906 |
907 /* normalize a username (e.g. remove whitespace, add default domain, etc.) | 907 /* normalize a username (e.g. remove whitespace, add default domain, etc.) |
908 * for nullprpl, this is a noop. | 908 * for nullprpl, this is a noop. |
909 */ | 909 */ |
913 } | 913 } |
914 | 914 |
915 static void nullprpl_set_buddy_icon(PurpleConnection *gc, | 915 static void nullprpl_set_buddy_icon(PurpleConnection *gc, |
916 PurpleStoredImage *img) { | 916 PurpleStoredImage *img) { |
917 purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", | 917 purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", |
918 purple_account_get_username(gc->account), | 918 purple_account_get_username(purple_connection_get_account(gc)), |
919 img ? purple_imgstore_get_filename(img) : "(null)"); | 919 img ? purple_imgstore_get_filename(img) : "(null)"); |
920 } | 920 } |
921 | 921 |
922 static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { | 922 static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { |
923 purple_debug_info("nullprpl", "%s has removed group %s\n", | 923 purple_debug_info("nullprpl", "%s has removed group %s\n", |
924 purple_account_get_username(gc->account), group->name); | 924 purple_account_get_username(purple_connection_get_account(gc)), group->name); |
925 } | 925 } |
926 | 926 |
927 | 927 |
928 static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, | 928 static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, |
929 int id, const char *room, gpointer userdata) { | 929 int id, const char *room, gpointer userdata) { |
952 | 952 |
953 if (!chat) | 953 if (!chat) |
954 return; | 954 return; |
955 | 955 |
956 purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", | 956 purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", |
957 purple_account_get_username(gc->account), purple_conversation_get_name(conv), topic); | 957 purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv), topic); |
958 | 958 |
959 last_topic = purple_conv_chat_get_topic(chat); | 959 last_topic = purple_conv_chat_get_topic(chat); |
960 if ((!topic && !last_topic) || | 960 if ((!topic && !last_topic) || |
961 (topic && last_topic && !strcmp(topic, last_topic))) | 961 (topic && last_topic && !strcmp(topic, last_topic))) |
962 return; /* topic is unchanged, this is a noop */ | 962 return; /* topic is unchanged, this is a noop */ |
968 purple_roomlist_set_in_progress((PurpleRoomlist *)roomlist, FALSE); | 968 purple_roomlist_set_in_progress((PurpleRoomlist *)roomlist, FALSE); |
969 return FALSE; | 969 return FALSE; |
970 } | 970 } |
971 | 971 |
972 static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { | 972 static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { |
973 const char *username = purple_account_get_username(gc->account); | 973 const char *username = purple_account_get_username(purple_connection_get_account(gc)); |
974 PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); | 974 PurpleRoomlist *roomlist = purple_roomlist_new(purple_connection_get_account(gc)); |
975 GList *fields = NULL; | 975 GList *fields = NULL; |
976 PurpleRoomlistField *field; | 976 PurpleRoomlistField *field; |
977 GList *chats; | 977 GList *chats; |
978 GList *seen_ids = NULL; | 978 GList *seen_ids = NULL; |
979 | 979 |