comparison pidgin/gtkblist.c @ 32809:76096c42f558

Use the PurpleChat accessor functions.
author andrew.victor@mxit.com
date Mon, 31 Oct 2011 19:21:14 +0000
parents 2fdc668362f0
children cd46874707b1
comparison
equal deleted inserted replaced
32808:2fdc668362f0 32809:76096c42f558
1753 pidgin_new_check_item(menu, _("Persistent"), 1753 pidgin_new_check_item(menu, _("Persistent"),
1754 G_CALLBACK(gtk_blist_menu_persistent_cb), node, persistent); 1754 G_CALLBACK(gtk_blist_menu_persistent_cb), node, persistent);
1755 pidgin_new_item_from_stock(menu, _("View _Log"), NULL, 1755 pidgin_new_item_from_stock(menu, _("View _Log"), NULL,
1756 G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL); 1756 G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL);
1757 1757
1758 pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(c->account), node); 1758 pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_chat_get_account(c)), node);
1759 pidgin_append_blist_node_extended_menu(menu, node); 1759 pidgin_append_blist_node_extended_menu(menu, node);
1760 1760
1761 pidgin_separator(menu); 1761 pidgin_separator(menu);
1762 1762
1763 pidgin_new_item_from_stock(menu, _("_Edit Settings..."), NULL, 1763 pidgin_new_item_from_stock(menu, _("_Edit Settings..."), NULL,
2872 char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL; 2872 char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL;
2873 2873
2874 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { 2874 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
2875 account = purple_buddy_get_account((PurpleBuddy*)(node)); 2875 account = purple_buddy_get_account((PurpleBuddy*)(node));
2876 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { 2876 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
2877 account = ((PurpleChat*)(node))->account; 2877 account = purple_chat_get_account((PurpleChat*)(node));
2878 } 2878 }
2879 2879
2880 td->padding = TOOLTIP_BORDER; 2880 td->padding = TOOLTIP_BORDER;
2881 td->status_icon = pidgin_blist_get_status_icon(node, PIDGIN_STATUS_ICON_LARGE); 2881 td->status_icon = pidgin_blist_get_status_icon(node, PIDGIN_STATUS_ICON_LARGE);
2882 td->avatar = pidgin_blist_get_buddy_icon(node, !full, FALSE); 2882 td->avatar = pidgin_blist_get_buddy_icon(node, !full, FALSE);
3675 char *name, *value; 3675 char *name, *value;
3676 PurpleConversation *conv; 3676 PurpleConversation *conv;
3677 PidginBlistNode *bnode = node->ui_data; 3677 PidginBlistNode *bnode = node->ui_data;
3678 3678
3679 chat = (PurpleChat *)node; 3679 chat = (PurpleChat *)node;
3680 prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account)); 3680 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_chat_get_account(chat)));
3681 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); 3681 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
3682 3682
3683 connections = purple_connections_get_all(); 3683 connections = purple_connections_get_all();
3684 if (connections && connections->next) 3684 if (connections && connections->next)
3685 { 3685 {
3686 tmp = g_markup_escape_text(purple_account_get_username(chat->account), -1); 3686 tmp = g_markup_escape_text(purple_account_get_username(purple_chat_get_account(chat)), -1);
3687 g_string_append_printf(str, _("<b>Account:</b> %s"), tmp); 3687 g_string_append_printf(str, _("<b>Account:</b> %s"), tmp);
3688 g_free(tmp); 3688 g_free(tmp);
3689 } 3689 }
3690 3690
3691 if (bnode && bnode->conv.conv) { 3691 if (bnode && bnode->conv.conv) {
3692 conv = bnode->conv.conv; 3692 conv = bnode->conv.conv;
3693 } else { 3693 } else {
3694 char *chat_name; 3694 char *chat_name;
3695 if (prpl_info && prpl_info->get_chat_name) 3695 if (prpl_info && prpl_info->get_chat_name)
3696 chat_name = prpl_info->get_chat_name(chat->components); 3696 chat_name = prpl_info->get_chat_name(purple_chat_get_components(chat));
3697 else 3697 else
3698 chat_name = g_strdup(purple_chat_get_name(chat)); 3698 chat_name = g_strdup(purple_chat_get_name(chat));
3699 3699
3700 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name, 3700 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name,
3701 chat->account); 3701 purple_chat_get_account(chat));
3702 g_free(chat_name); 3702 g_free(chat_name);
3703 } 3703 }
3704 3704
3705 if (conv && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { 3705 if (conv && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
3706 g_string_append_printf(str, _("\n<b>Occupants:</b> %d"), 3706 g_string_append_printf(str, _("\n<b>Occupants:</b> %d"),
3713 g_free(topic); 3713 g_free(topic);
3714 } 3714 }
3715 } 3715 }
3716 3716
3717 if (prpl_info && prpl_info->chat_info != NULL) 3717 if (prpl_info && prpl_info->chat_info != NULL)
3718 cur = prpl_info->chat_info(purple_account_get_connection(chat->account)); 3718 cur = prpl_info->chat_info(purple_account_get_connection(purple_chat_get_account(chat)));
3719 else 3719 else
3720 cur = NULL; 3720 cur = NULL;
3721 3721
3722 while (cur != NULL) 3722 while (cur != NULL)
3723 { 3723 {
3724 pce = cur->data; 3724 pce = cur->data;
3725 3725
3726 if (!pce->secret && (!pce->required && 3726 if (!pce->secret && (!pce->required &&
3727 g_hash_table_lookup(chat->components, pce->identifier) == NULL)) 3727 g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier) == NULL))
3728 { 3728 {
3729 tmp = purple_text_strip_mnemonic(pce->label); 3729 tmp = purple_text_strip_mnemonic(pce->label);
3730 name = g_markup_escape_text(tmp, -1); 3730 name = g_markup_escape_text(tmp, -1);
3731 g_free(tmp); 3731 g_free(tmp);
3732 value = g_markup_escape_text(g_hash_table_lookup( 3732 value = g_markup_escape_text(g_hash_table_lookup(
3733 chat->components, pce->identifier), -1); 3733 purple_chat_get_components(chat), pce->identifier), -1);
3734 g_string_append_printf(str, "\n<b>%s</b> %s", 3734 g_string_append_printf(str, "\n<b>%s</b> %s",
3735 name ? name : "", 3735 name ? name : "",
3736 value ? value : ""); 3736 value ? value : "");
3737 g_free(name); 3737 g_free(name);
3738 g_free(value); 3738 g_free(value);
4097 PurplePlugin *prpl; 4097 PurplePlugin *prpl;
4098 4098
4099 if(buddy) 4099 if(buddy)
4100 account = purple_buddy_get_account(buddy); 4100 account = purple_buddy_get_account(buddy);
4101 else 4101 else
4102 account = chat->account; 4102 account = purple_chat_get_account(chat);
4103 4103
4104 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); 4104 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
4105 if(!prpl) 4105 if(!prpl)
4106 return NULL; 4106 return NULL;
4107 } 4107 }
6704 /* First things first, update the group */ 6704 /* First things first, update the group */
6705 pidgin_blist_update_group(list, node->parent); 6705 pidgin_blist_update_group(list, node->parent);
6706 6706
6707 chat = (PurpleChat*)node; 6707 chat = (PurpleChat*)node;
6708 6708
6709 if(purple_account_is_connected(chat->account)) { 6709 if(purple_account_is_connected(purple_chat_get_account(chat))) {
6710 GtkTreeIter iter; 6710 GtkTreeIter iter;
6711 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; 6711 GdkPixbuf *status, *avatar, *emblem, *prpl_icon;
6712 const gchar *color, *font; 6712 const gchar *color, *font;
6713 gchar *mark, *tmp; 6713 gchar *mark, *tmp;
6714 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); 6714 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
6768 font, hidden ? "bold" : "normal", mark); 6768 font, hidden ? "bold" : "normal", mark);
6769 } 6769 }
6770 g_free(mark); 6770 g_free(mark);
6771 mark = tmp; 6771 mark = tmp;
6772 6772
6773 prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); 6773 prpl_icon = pidgin_create_prpl_icon(purple_chat_get_account(chat), PIDGIN_PRPL_ICON_SMALL);
6774 6774
6775 if (theme != NULL) 6775 if (theme != NULL)
6776 bgcolor = pidgin_blist_theme_get_contact_color(theme); 6776 bgcolor = pidgin_blist_theme_get_contact_color(theme);
6777 6777
6778 gtk_tree_store_set(gtkblist->treemodel, &iter, 6778 gtk_tree_store_set(gtkblist->treemodel, &iter,
7418 if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) 7418 if(!PURPLE_BLIST_NODE_IS_CHAT(cnode))
7419 continue; 7419 continue;
7420 7420
7421 chat = (PurpleChat *)cnode; 7421 chat = (PurpleChat *)cnode;
7422 7422
7423 if(chat->account != account) 7423 if(purple_chat_get_account(chat) != account)
7424 continue; 7424 continue;
7425 7425
7426 if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin")) 7426 if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin"))
7427 serv_join_chat(gc, chat->components); 7427 serv_join_chat(gc, purple_chat_get_components(chat));
7428 } 7428 }
7429 } 7429 }
7430 7430
7431 /* Stop processing; we handled the autojoins. */ 7431 /* Stop processing; we handled the autojoins. */
7432 return TRUE; 7432 return TRUE;