Mercurial > pidgin
comparison libpurple/protocols/gg/gg.c @ 26054:d68924f1265f
propagate from branch 'im.pidgin.pidgin' (head 27a5e4c3bf4db89f9d87c37d7043c1f4dc68ed1f)
to branch 'im.pidgin.pidgin.vv' (head 2327fc75d25586f742fc4305b4dfc93a581c1e13)
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Mon, 19 Jan 2009 10:47:12 +0000 |
parents | adf153852bcf 051fe71c3d8f |
children | ff4212a5268f |
comparison
equal
deleted
inserted
replaced
26053:c334a9e17426 | 26054:d68924f1265f |
---|---|
753 ggp_token_request(gc, ggp_change_passwd_dialog); | 753 ggp_token_request(gc, ggp_change_passwd_dialog); |
754 } | 754 } |
755 | 755 |
756 /* ----- CONFERENCES ---------------------------------------------------- */ | 756 /* ----- CONFERENCES ---------------------------------------------------- */ |
757 | 757 |
758 static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) | 758 static void ggp_callback_add_to_chat_ok(PurpleBuddy *buddy, PurpleRequestFields *fields) |
759 { | 759 { |
760 GGPInfo *info = gc->proto_data; | 760 GGPInfo *info; |
761 PurpleConnection *conn; | |
761 PurpleRequestField *field; | 762 PurpleRequestField *field; |
762 /* TODO: sel may be null. */ | |
763 GList *sel; | 763 GList *sel; |
764 | |
765 conn = purple_account_get_connection(purple_buddy_get_account(buddy)); | |
766 | |
767 g_return_if_fail(conn != NULL); | |
768 | |
769 info = conn->proto_data; | |
764 | 770 |
765 field = purple_request_fields_get_field(fields, "name"); | 771 field = purple_request_fields_get_field(fields, "name"); |
766 sel = purple_request_field_list_get_selected(field); | 772 sel = purple_request_field_list_get_selected(field); |
767 | 773 |
768 ggp_confer_participants_add_uin(gc, sel->data, info->tmp_buddy); | 774 if (sel == NULL) { |
769 info->tmp_buddy = 0; | 775 purple_debug_error("gg", "No chat selected\n"); |
776 return; | |
777 } | |
778 | |
779 ggp_confer_participants_add_uin(conn, sel->data, | |
780 ggp_str_to_uin(purple_buddy_get_name(buddy))); | |
770 } | 781 } |
771 | 782 |
772 static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) | 783 static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) |
773 { | 784 { |
774 PurpleBuddy *buddy; | 785 PurpleBuddy *buddy; |
784 | 795 |
785 buddy = (PurpleBuddy *)node; | 796 buddy = (PurpleBuddy *)node; |
786 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); | 797 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
787 info = gc->proto_data; | 798 info = gc->proto_data; |
788 | 799 |
789 /* TODO: It tmp_buddy != 0 then stop! */ | |
790 info->tmp_buddy = ggp_str_to_uin(purple_buddy_get_name(buddy)); | |
791 | |
792 fields = purple_request_fields_new(); | 800 fields = purple_request_fields_new(); |
793 group = purple_request_field_group_new(NULL); | 801 group = purple_request_field_group_new(NULL); |
794 purple_request_fields_add_group(fields, group); | 802 purple_request_fields_add_group(fields, group); |
795 | 803 |
796 field = purple_request_field_list_new("name", "Chat name"); | 804 field = purple_request_field_list_new("name", "Chat name"); |
797 for (l = info->chats; l != NULL; l = l->next) { | 805 for (l = info->chats; l != NULL; l = l->next) { |
798 GGPChat *chat = l->data; | 806 GGPChat *chat = l->data; |
799 purple_request_field_list_add(field, g_strdup(chat->name), | 807 purple_request_field_list_add(field, chat->name, chat->name); |
800 g_strdup(chat->name)); | |
801 } | 808 } |
802 purple_request_field_group_add_field(group, field); | 809 purple_request_field_group_add_field(group, field); |
803 | 810 |
804 msg = g_strdup_printf(_("Select a chat for buddy: %s"), | 811 msg = g_strdup_printf(_("Select a chat for buddy: %s"), |
805 purple_buddy_get_alias(buddy)); | 812 purple_buddy_get_alias(buddy)); |
808 _("Add to chat..."), | 815 _("Add to chat..."), |
809 msg, | 816 msg, |
810 fields, | 817 fields, |
811 _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), | 818 _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), |
812 _("Cancel"), NULL, | 819 _("Cancel"), NULL, |
813 purple_connection_get_account(gc), NULL, NULL, | 820 purple_connection_get_account(gc), NULL, NULL, |
814 gc); | 821 buddy); |
815 g_free(msg); | 822 g_free(msg); |
816 } | 823 } |
817 | 824 |
818 /* ----- BLOCK BUDDIES -------------------------------------------------- */ | 825 /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
819 | 826 |
1697 | 1704 |
1698 static GList *ggp_blist_node_menu(PurpleBlistNode *node) | 1705 static GList *ggp_blist_node_menu(PurpleBlistNode *node) |
1699 { | 1706 { |
1700 PurpleMenuAction *act; | 1707 PurpleMenuAction *act; |
1701 GList *m = NULL; | 1708 GList *m = NULL; |
1709 PurpleAccount *account; | |
1710 GGPInfo *info; | |
1702 | 1711 |
1703 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) | 1712 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
1704 return NULL; | 1713 return NULL; |
1705 | 1714 |
1706 act = purple_menu_action_new(_("Add to chat"), | 1715 account = purple_buddy_get_account((PurpleBuddy *) node); |
1707 PURPLE_CALLBACK(ggp_bmenu_add_to_chat), | 1716 info = purple_account_get_connection(account)->proto_data; |
1708 NULL, NULL); | 1717 if (info->chats) { |
1709 m = g_list_append(m, act); | 1718 act = purple_menu_action_new(_("Add to chat"), |
1719 PURPLE_CALLBACK(ggp_bmenu_add_to_chat), | |
1720 NULL, NULL); | |
1721 m = g_list_append(m, act); | |
1722 } | |
1710 | 1723 |
1711 /* Using a blist node boolean here is also wrong. | 1724 /* Using a blist node boolean here is also wrong. |
1712 * Once the Block and Unblock actions are added to the core, | 1725 * Once the Block and Unblock actions are added to the core, |
1713 * this will have to go. -- rlaager */ | 1726 * this will have to go. -- rlaager */ |
1714 if (purple_blist_node_get_bool(node, "blocked")) { | 1727 if (purple_blist_node_get_bool(node, "blocked")) { |