pidgin/gtkconv.c

branch
soc.2013.gobjectification
changeset 34728
8efd73063ecf
parent 34709
3484aac07f02
child 34739
7d507b8b9f92
equal deleted inserted replaced
34727:579e9a8dbd5f 34728:8efd73063ecf
247 { 247 {
248 PurpleAccount *account = purple_conversation_get_account(conv); 248 PurpleAccount *account = purple_conversation_get_account(conv);
249 PurpleBListNode *node = NULL; 249 PurpleBListNode *node = NULL;
250 250
251 if (PURPLE_IS_IM_CONVERSATION(conv)) { 251 if (PURPLE_IS_IM_CONVERSATION(conv)) {
252 node = PURPLE_BLIST_NODE(purple_find_buddy(account, purple_conversation_get_name(conv))); 252 node = PURPLE_BLIST_NODE(purple_blist_find_buddy(account, purple_conversation_get_name(conv)));
253 node = node ? node->parent : NULL; 253 node = node ? node->parent : NULL;
254 } else { 254 } else {
255 node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, purple_conversation_get_name(conv))); 255 node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, purple_conversation_get_name(conv)));
256 } 256 }
257 257
692 name = purple_conversation_get_name(conv); 692 name = purple_conversation_get_name(conv);
693 693
694 if (PURPLE_IS_IM_CONVERSATION(conv)) { 694 if (PURPLE_IS_IM_CONVERSATION(conv)) {
695 PurpleBuddy *b; 695 PurpleBuddy *b;
696 696
697 b = purple_find_buddy(account, name); 697 b = purple_blist_find_buddy(account, name);
698 if (b != NULL) 698 if (b != NULL)
699 pidgin_dialogs_remove_buddy(b); 699 pidgin_dialogs_remove_buddy(b);
700 else if (account != NULL && purple_account_is_connected(account)) 700 else if (account != NULL && purple_account_is_connected(account))
701 purple_blist_request_add_buddy(account, (char *)name, NULL, NULL); 701 purple_blist_request_add_buddy(account, (char *)name, NULL, NULL);
702 } else { 702 } else {
1087 menu_save_as_cb(GtkAction *action, gpointer data) 1087 menu_save_as_cb(GtkAction *action, gpointer data)
1088 { 1088 {
1089 PidginWindow *win = data; 1089 PidginWindow *win = data;
1090 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); 1090 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
1091 PurpleAccount *account = purple_conversation_get_account(conv); 1091 PurpleAccount *account = purple_conversation_get_account(conv);
1092 PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); 1092 PurpleBuddy *buddy = purple_blist_find_buddy(account, purple_conversation_get_name(conv));
1093 const char *name; 1093 const char *name;
1094 gchar *buf; 1094 gchar *buf;
1095 gchar *c; 1095 gchar *c;
1096 1096
1097 if (buddy != NULL) 1097 if (buddy != NULL)
1135 pidgin_set_cursor(win->window, GDK_WATCH); 1135 pidgin_set_cursor(win->window, GDK_WATCH);
1136 1136
1137 name = purple_conversation_get_name(conv); 1137 name = purple_conversation_get_name(conv);
1138 account = purple_conversation_get_account(conv); 1138 account = purple_conversation_get_account(conv);
1139 1139
1140 buddies = purple_find_buddies(account, name); 1140 buddies = purple_blist_find_buddies(account, name);
1141 for (cur = buddies; cur != NULL; cur = cur->next) 1141 for (cur = buddies; cur != NULL; cur = cur->next)
1142 { 1142 {
1143 PurpleBListNode *node = cur->data; 1143 PurpleBListNode *node = cur->data;
1144 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) 1144 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
1145 { 1145 {
1274 name = purple_conversation_get_name(conv); 1274 name = purple_conversation_get_name(conv);
1275 1275
1276 if (PURPLE_IS_IM_CONVERSATION(conv)) { 1276 if (PURPLE_IS_IM_CONVERSATION(conv)) {
1277 PurpleBuddy *b; 1277 PurpleBuddy *b;
1278 1278
1279 b = purple_find_buddy(account, name); 1279 b = purple_blist_find_buddy(account, name);
1280 if (b != NULL) 1280 if (b != NULL)
1281 pidgin_dialogs_alias_buddy(b); 1281 pidgin_dialogs_alias_buddy(b);
1282 } else { 1282 } else {
1283 PurpleChat *c; 1283 PurpleChat *c;
1284 1284
1566 PurpleBuddy *b; 1566 PurpleBuddy *b;
1567 char *name; 1567 char *name;
1568 1568
1569 account = purple_conversation_get_account(conv); 1569 account = purple_conversation_get_account(conv);
1570 name = g_object_get_data(G_OBJECT(w), "user_data"); 1570 name = g_object_get_data(G_OBJECT(w), "user_data");
1571 b = purple_find_buddy(account, name); 1571 b = purple_blist_find_buddy(account, name);
1572 1572
1573 if (b != NULL) 1573 if (b != NULL)
1574 pidgin_dialogs_remove_buddy(b); 1574 pidgin_dialogs_remove_buddy(b);
1575 else if (account != NULL && purple_account_is_connected(account)) 1575 else if (account != NULL && purple_account_is_connected(account))
1576 purple_blist_request_add_buddy(account, name, NULL, NULL); 1576 purple_blist_request_add_buddy(account, name, NULL, NULL);
1710 else 1710 else
1711 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1711 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1712 } 1712 }
1713 1713
1714 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { 1714 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
1715 if ((buddy = purple_find_buddy(account, who)) != NULL) 1715 if ((buddy = purple_blist_find_buddy(account, who)) != NULL)
1716 button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, 1716 button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE,
1717 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); 1717 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
1718 else 1718 else
1719 button = pidgin_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD, 1719 button = pidgin_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD,
1720 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); 1720 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
2485 g_return_val_if_fail(account != NULL, NULL); 2485 g_return_val_if_fail(account != NULL, NULL);
2486 g_return_val_if_fail(name != NULL, NULL); 2486 g_return_val_if_fail(name != NULL, NULL);
2487 2487
2488 /* Use the buddy icon, if possible */ 2488 /* Use the buddy icon, if possible */
2489 if (PURPLE_IS_IM_CONVERSATION(conv)) { 2489 if (PURPLE_IS_IM_CONVERSATION(conv)) {
2490 PurpleBuddy *b = purple_find_buddy(account, name); 2490 PurpleBuddy *b = purple_blist_find_buddy(account, name);
2491 if (b != NULL) { 2491 if (b != NULL) {
2492 PurplePresence *p; 2492 PurplePresence *p;
2493 p = purple_buddy_get_presence(b); 2493 p = purple_buddy_get_presence(b);
2494 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY)) 2494 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
2495 return away_list; 2495 return away_list;
2521 /* Use the buddy icon, if possible */ 2521 /* Use the buddy icon, if possible */
2522 if (PURPLE_IS_IM_CONVERSATION(conv)) { 2522 if (PURPLE_IS_IM_CONVERSATION(conv)) {
2523 const char *name = NULL; 2523 const char *name = NULL;
2524 PurpleBuddy *b; 2524 PurpleBuddy *b;
2525 name = purple_conversation_get_name(conv); 2525 name = purple_conversation_get_name(conv);
2526 b = purple_find_buddy(account, name); 2526 b = purple_blist_find_buddy(account, name);
2527 if (b != NULL) { 2527 if (b != NULL) {
2528 PurplePresence *p = purple_buddy_get_presence(b); 2528 PurplePresence *p = purple_buddy_get_presence(b);
2529 PurpleStatus *active = purple_presence_get_active_status(p); 2529 PurpleStatus *active = purple_presence_get_active_status(p);
2530 PurpleStatusType *type = purple_status_get_type(active); 2530 PurpleStatusType *type = purple_status_get_type(active);
2531 PurpleStatusPrimitive prim = purple_status_type_get_primitive(type); 2531 PurpleStatusPrimitive prim = purple_status_type_get_primitive(type);
2558 g_return_val_if_fail(account != NULL, NULL); 2558 g_return_val_if_fail(account != NULL, NULL);
2559 g_return_val_if_fail(name != NULL, NULL); 2559 g_return_val_if_fail(name != NULL, NULL);
2560 2560
2561 /* Use the buddy icon, if possible */ 2561 /* Use the buddy icon, if possible */
2562 if (PURPLE_IS_IM_CONVERSATION(conv)) { 2562 if (PURPLE_IS_IM_CONVERSATION(conv)) {
2563 PurpleBuddy *b = purple_find_buddy(account, name); 2563 PurpleBuddy *b = purple_blist_find_buddy(account, name);
2564 if (b != NULL) { 2564 if (b != NULL) {
2565 /* I hate this hack. It fixes a bug where the pending message icon 2565 /* I hate this hack. It fixes a bug where the pending message icon
2566 * displays in the conv tab even though it shouldn't. 2566 * displays in the conv tab even though it shouldn't.
2567 * A better solution would be great. */ 2567 * A better solution would be great. */
2568 if (ops && ops->update) 2568 if (ops && ops->update)
2602 return; 2602 return;
2603 2603
2604 status = infopane_status = pidgin_conv_get_icon_stock(conv); 2604 status = infopane_status = pidgin_conv_get_icon_stock(conv);
2605 2605
2606 if (PURPLE_IS_IM_CONVERSATION(conv)) { 2606 if (PURPLE_IS_IM_CONVERSATION(conv)) {
2607 PurpleBuddy *b = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); 2607 PurpleBuddy *b = purple_blist_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
2608 if (b) 2608 if (b)
2609 emblem = pidgin_blist_get_emblem((PurpleBListNode*)b); 2609 emblem = pidgin_blist_get_emblem((PurpleBListNode*)b);
2610 } 2610 }
2611 2611
2612 g_return_if_fail(status != NULL); 2612 g_return_if_fail(status != NULL);
2808 PidginConversation *gtkconv = data; 2808 PidginConversation *gtkconv = data;
2809 PurpleConversation *conv = gtkconv->active_conv; 2809 PurpleConversation *conv = gtkconv->active_conv;
2810 PurpleAccount *account = purple_conversation_get_account(conv); 2810 PurpleAccount *account = purple_conversation_get_account(conv);
2811 2811
2812 name = purple_conversation_get_name(conv); 2812 name = purple_conversation_get_name(conv);
2813 buddy = purple_find_buddy(account, name); 2813 buddy = purple_blist_find_buddy(account, name);
2814 if (!buddy) { 2814 if (!buddy) {
2815 purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n"); 2815 purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n");
2816 return; 2816 return;
2817 } 2817 }
2818 contact = purple_buddy_get_contact(buddy); 2818 contact = purple_buddy_get_contact(buddy);
2845 } 2845 }
2846 2846
2847 gtk_widget_set_size_request(gtkconv->u.im->icon_container, -1, size); 2847 gtk_widget_set_size_request(gtkconv->u.im->icon_container, -1, size);
2848 pidgin_conv_update_buddy_icon(PURPLE_IM_CONVERSATION(conv)); 2848 pidgin_conv_update_buddy_icon(PURPLE_IM_CONVERSATION(conv));
2849 2849
2850 buddies = purple_find_buddies(purple_conversation_get_account(conv), 2850 buddies = purple_blist_find_buddies(purple_conversation_get_account(conv),
2851 purple_conversation_get_name(conv)); 2851 purple_conversation_get_name(conv));
2852 for (; buddies; buddies = g_slist_delete_link(buddies, buddies)) { 2852 for (; buddies; buddies = g_slist_delete_link(buddies, buddies)) {
2853 PurpleBuddy *buddy = buddies->data; 2853 PurpleBuddy *buddy = buddies->data;
2854 PurpleContact *contact = purple_buddy_get_contact(buddy); 2854 PurpleContact *contact = purple_buddy_get_contact(buddy);
2855 purple_blist_node_set_int((PurpleBListNode*)contact, "pidgin-infopane-iconsize", size); 2855 purple_blist_node_set_int((PurpleBListNode*)contact, "pidgin-infopane-iconsize", size);
2865 PurpleContact *contact; 2865 PurpleContact *contact;
2866 PurpleConversation *conv = gtkconv->active_conv; 2866 PurpleConversation *conv = gtkconv->active_conv;
2867 2867
2868 account = purple_conversation_get_account(conv); 2868 account = purple_conversation_get_account(conv);
2869 name = purple_conversation_get_name(conv); 2869 name = purple_conversation_get_name(conv);
2870 buddy = purple_find_buddy(account, name); 2870 buddy = purple_blist_find_buddy(account, name);
2871 if (!buddy) { 2871 if (!buddy) {
2872 return; 2872 return;
2873 } 2873 }
2874 contact = purple_buddy_get_contact(buddy); 2874 contact = purple_buddy_get_contact(buddy);
2875 2875
2967 G_CALLBACK(change_size_cb), gtkconv, 2967 G_CALLBACK(change_size_cb), gtkconv,
2968 0, 0, NULL); 2968 0, 0, NULL);
2969 2969
2970 /* Is there a custom icon for this person? */ 2970 /* Is there a custom icon for this person? */
2971 conv = gtkconv->active_conv; 2971 conv = gtkconv->active_conv;
2972 buddy = purple_find_buddy(purple_conversation_get_account(conv), 2972 buddy = purple_blist_find_buddy(purple_conversation_get_account(conv),
2973 purple_conversation_get_name(conv)); 2973 purple_conversation_get_name(conv));
2974 if (buddy) 2974 if (buddy)
2975 { 2975 {
2976 PurpleContact *contact = purple_buddy_get_contact(buddy); 2976 PurpleContact *contact = purple_buddy_get_contact(buddy);
2977 if (contact && purple_buddy_icons_node_has_custom_icon((PurpleBListNode*)contact)) 2977 if (contact && purple_buddy_icons_node_has_custom_icon((PurpleBListNode*)contact))
3292 } 3292 }
3293 } else { 3293 } else {
3294 if (!purple_account_is_connected(account)) 3294 if (!purple_account_is_connected(account))
3295 return FALSE; 3295 return FALSE;
3296 3296
3297 buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); 3297 buddy = purple_blist_find_buddy(account, purple_conversation_get_name(conv));
3298 if (!buddy && gtkconv->webview) { 3298 if (!buddy && gtkconv->webview) {
3299 buddy = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy"); 3299 buddy = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy");
3300 3300
3301 if (!buddy) { 3301 if (!buddy) {
3302 buddy = purple_buddy_new(account, purple_conversation_get_name(conv), NULL); 3302 buddy = purple_buddy_new(account, purple_conversation_get_name(conv), NULL);
3873 return FALSE; 3873 return FALSE;
3874 3874
3875 if (win->menu.send_to == NULL) 3875 if (win->menu.send_to == NULL)
3876 return FALSE; 3876 return FALSE;
3877 3877
3878 if (!(b = purple_find_buddy(account, purple_conversation_get_name(conv)))) 3878 if (!(b = purple_blist_find_buddy(account, purple_conversation_get_name(conv))))
3879 return FALSE; 3879 return FALSE;
3880 3880
3881 gtk_widget_show(win->menu.send_to); 3881 gtk_widget_show(win->menu.send_to);
3882 3882
3883 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to)); 3883 menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to));
3889 GtkWidget *item = child->data; 3889 GtkWidget *item = child->data;
3890 PurpleBuddy *item_buddy; 3890 PurpleBuddy *item_buddy;
3891 PurpleAccount *item_account = g_object_get_data(G_OBJECT(item), "purple_account"); 3891 PurpleAccount *item_account = g_object_get_data(G_OBJECT(item), "purple_account");
3892 gchar *buddy_name = g_object_get_data(G_OBJECT(item), 3892 gchar *buddy_name = g_object_get_data(G_OBJECT(item),
3893 "purple_buddy_name"); 3893 "purple_buddy_name");
3894 item_buddy = purple_find_buddy(item_account, buddy_name); 3894 item_buddy = purple_blist_find_buddy(item_account, buddy_name);
3895 3895
3896 if (b == item_buddy) { 3896 if (b == item_buddy) {
3897 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); 3897 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
3898 g_list_free(child); 3898 g_list_free(child);
3899 break; 3899 break;
4033 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu); 4033 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu);
4034 4034
4035 gtk_widget_show(menu); 4035 gtk_widget_show(menu);
4036 4036
4037 if (PURPLE_IS_IM_CONVERSATION(gtkconv->active_conv)) { 4037 if (PURPLE_IS_IM_CONVERSATION(gtkconv->active_conv)) {
4038 buds = purple_find_buddies(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv)); 4038 buds = purple_blist_find_buddies(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv));
4039 4039
4040 if (buds == NULL) 4040 if (buds == NULL)
4041 { 4041 {
4042 /* The user isn't on the buddy list. So we don't create any sendto menu. */ 4042 /* The user isn't on the buddy list. So we don't create any sendto menu. */
4043 } 4043 }
4573 PurpleBuddy *buddy2; 4573 PurpleBuddy *buddy2;
4574 4574
4575 if (strcmp(purple_chat_conversation_get_nick(chat), purple_normalize(account, name))) { 4575 if (strcmp(purple_chat_conversation_get_nick(chat), purple_normalize(account, name))) {
4576 /* This user is not me, so look into updating the alias. */ 4576 /* This user is not me, so look into updating the alias. */
4577 4577
4578 if ((buddy2 = purple_find_buddy(account, name)) != NULL) { 4578 if ((buddy2 = purple_blist_find_buddy(account, name)) != NULL) {
4579 alias = purple_buddy_get_contact_alias(buddy2); 4579 alias = purple_buddy_get_contact_alias(buddy2);
4580 } 4580 }
4581 4581
4582 tmp = g_utf8_casefold(alias, -1); 4582 tmp = g_utf8_casefold(alias, -1);
4583 alias_key = g_utf8_collate_key(tmp, -1); 4583 alias_key = g_utf8_collate_key(tmp, -1);
4707 { 4707 {
4708 if (!PURPLE_IS_BUDDY(node)) 4708 if (!PURPLE_IS_BUDDY(node))
4709 return; 4709 return;
4710 4710
4711 /* If there's another buddy for the same "dude" on the list, do nothing. */ 4711 /* If there's another buddy for the same "dude" on the list, do nothing. */
4712 if (purple_find_buddy(purple_buddy_get_account(PURPLE_BUDDY(node)), 4712 if (purple_blist_find_buddy(purple_buddy_get_account(PURPLE_BUDDY(node)),
4713 purple_buddy_get_name(PURPLE_BUDDY(node))) != NULL) 4713 purple_buddy_get_name(PURPLE_BUDDY(node))) != NULL)
4714 return; 4714 return;
4715 4715
4716 buddy_cb_common(PURPLE_BUDDY(node), chat, FALSE); 4716 buddy_cb_common(PURPLE_BUDDY(node), chat, FALSE);
4717 } 4717 }
4886 return FALSE; 4886 return FALSE;
4887 4887
4888 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); 4888 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
4889 4889
4890 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account))); 4890 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account)));
4891 node = (PurpleBListNode*)(purple_find_buddy(purple_conversation_get_account(conv), who)); 4891 node = (PurpleBListNode*)(purple_blist_find_buddy(purple_conversation_get_account(conv), who));
4892 if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) 4892 if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME))
4893 pidgin_blist_draw_tooltip(node, gtkconv->infopane); 4893 pidgin_blist_draw_tooltip(node, gtkconv->infopane);
4894 4894
4895 g_free(who); 4895 g_free(who);
4896 return FALSE; 4896 return FALSE;
5005 if (PURPLE_IS_CHAT_CONVERSATION(conv)) { 5005 if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
5006 node = (PurpleBListNode*)(purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv))); 5006 node = (PurpleBListNode*)(purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv)));
5007 if (!node) 5007 if (!node)
5008 node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); 5008 node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat");
5009 } else { 5009 } else {
5010 node = (PurpleBListNode*)(purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv))); 5010 node = (PurpleBListNode*)(purple_blist_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)));
5011 #if 0 5011 #if 0
5012 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */ 5012 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
5013 if (!node) 5013 if (!node)
5014 node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy"); 5014 node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy");
5015 #endif 5015 #endif
5114 replace = purple_account_get_private_alias(account); 5114 replace = purple_account_get_private_alias(account);
5115 if (replace == NULL) 5115 if (replace == NULL)
5116 replace = purple_account_get_username(account); 5116 replace = purple_account_get_username(account);
5117 5117
5118 } else if (g_str_has_prefix(cur, "%destinationName%")) { 5118 } else if (g_str_has_prefix(cur, "%destinationName%")) {
5119 PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); 5119 PurpleBuddy *buddy = purple_blist_find_buddy(account, purple_conversation_get_name(conv));
5120 if (buddy) { 5120 if (buddy) {
5121 replace = purple_buddy_get_alias(buddy); 5121 replace = purple_buddy_get_alias(buddy);
5122 } else { 5122 } else {
5123 replace = purple_conversation_get_name(conv); 5123 replace = purple_conversation_get_name(conv);
5124 } 5124 }
5377 gtk_widget_show(sizing_vbox); 5377 gtk_widget_show(sizing_vbox);
5378 } 5378 }
5379 else { 5379 else {
5380 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0); 5380 gtkconv->u.im->icon_container = gtk_vbox_new(FALSE, 0);
5381 5381
5382 if ((buddy = purple_find_buddy(purple_conversation_get_account(conv), 5382 if ((buddy = purple_blist_find_buddy(purple_conversation_get_account(conv),
5383 purple_conversation_get_name(conv))) != NULL) { 5383 purple_conversation_get_name(conv))) != NULL) {
5384 PurpleContact *contact = purple_buddy_get_contact(buddy); 5384 PurpleContact *contact = purple_buddy_get_contact(buddy);
5385 if (contact) { 5385 if (contact) {
5386 buddyicon_size = purple_blist_node_get_int((PurpleBListNode*)contact, "pidgin-infopane-iconsize"); 5386 buddyicon_size = purple_blist_node_get_int((PurpleBListNode*)contact, "pidgin-infopane-iconsize");
5387 } 5387 }
5634 5634
5635 5635
5636 static PidginConversation * 5636 static PidginConversation *
5637 pidgin_conv_find_gtkconv(PurpleConversation * conv) 5637 pidgin_conv_find_gtkconv(PurpleConversation * conv)
5638 { 5638 {
5639 PurpleBuddy *bud = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); 5639 PurpleBuddy *bud = purple_blist_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
5640 PurpleContact *c; 5640 PurpleContact *c;
5641 PurpleBListNode *cn, *bn; 5641 PurpleBListNode *cn, *bn;
5642 5642
5643 if (!bud) 5643 if (!bud)
5644 return NULL; 5644 return NULL;
6135 NULL); 6135 NULL);
6136 else 6136 else
6137 buddytag = gtk_text_buffer_create_tag( 6137 buddytag = gtk_text_buffer_create_tag(
6138 buffer, str, 6138 buffer, str,
6139 "foreground-gdk", get_nick_color(gtkconv, who), 6139 "foreground-gdk", get_nick_color(gtkconv, who),
6140 "weight", purple_find_buddy(purple_conversation_get_account(conv), who) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, 6140 "weight", purple_blist_find_buddy(purple_conversation_get_account(conv), who) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
6141 NULL); 6141 NULL);
6142 6142
6143 g_object_set_data(G_OBJECT(buddytag), "cursor", ""); 6143 g_object_set_data(G_OBJECT(buddytag), "cursor", "");
6144 g_signal_connect(G_OBJECT(buddytag), "event", 6144 g_signal_connect(G_OBJECT(buddytag), "event",
6145 G_CALLBACK(buddytag_event), conv); 6145 G_CALLBACK(buddytag_event), conv);
7173 } else { 7173 } else {
7174 gtk_action_set_visible(win->menu.block, FALSE); 7174 gtk_action_set_visible(win->menu.block, FALSE);
7175 gtk_action_set_visible(win->menu.unblock, TRUE); 7175 gtk_action_set_visible(win->menu.unblock, TRUE);
7176 } 7176 }
7177 7177
7178 if (purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { 7178 if (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) == NULL) {
7179 gtk_action_set_visible(win->menu.add, TRUE); 7179 gtk_action_set_visible(win->menu.add, TRUE);
7180 gtk_action_set_visible(win->menu.remove, FALSE); 7180 gtk_action_set_visible(win->menu.remove, FALSE);
7181 } else { 7181 } else {
7182 gtk_action_set_visible(win->menu.remove, TRUE); 7182 gtk_action_set_visible(win->menu.remove, TRUE);
7183 gtk_action_set_visible(win->menu.add, FALSE); 7183 gtk_action_set_visible(win->menu.add, FALSE);
7274 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || 7274 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file ||
7275 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); 7275 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv)))));
7276 gtk_action_set_sensitive(win->menu.get_attention, (prpl_info->send_attention != NULL)); 7276 gtk_action_set_sensitive(win->menu.get_attention, (prpl_info->send_attention != NULL));
7277 gtk_action_set_sensitive(win->menu.alias, 7277 gtk_action_set_sensitive(win->menu.alias,
7278 (account != NULL) && 7278 (account != NULL) &&
7279 (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); 7279 (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) != NULL));
7280 } 7280 }
7281 else 7281 else
7282 { 7282 {
7283 gtk_action_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); 7283 gtk_action_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL));
7284 gtk_action_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); 7284 gtk_action_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL));
7312 { 7312 {
7313 GList *l = NULL; 7313 GList *l = NULL;
7314 if (PURPLE_IS_IM_CONVERSATION(conv) && 7314 if (PURPLE_IS_IM_CONVERSATION(conv) &&
7315 (gtkconv->u.im->anim)) 7315 (gtkconv->u.im->anim))
7316 { 7316 {
7317 PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); 7317 PurpleBuddy *buddy = purple_blist_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
7318 window_icon = 7318 window_icon =
7319 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); 7319 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
7320 7320
7321 if (buddy && !PURPLE_IS_BUDDY_ONLINE(buddy)) 7321 if (buddy && !PURPLE_IS_BUDDY_ONLINE(buddy))
7322 gdk_pixbuf_saturate_and_pixelate(window_icon, window_icon, 0.0, FALSE); 7322 gdk_pixbuf_saturate_and_pixelate(window_icon, window_icon, 0.0, FALSE);
7415 title = g_strdup_printf("(%s)", purple_conversation_get_title(conv)); 7415 title = g_strdup_printf("(%s)", purple_conversation_get_title(conv));
7416 else 7416 else
7417 title = g_strdup(purple_conversation_get_title(conv)); 7417 title = g_strdup(purple_conversation_get_title(conv));
7418 7418
7419 if (PURPLE_IS_IM_CONVERSATION(conv)) { 7419 if (PURPLE_IS_IM_CONVERSATION(conv)) {
7420 buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); 7420 buddy = purple_blist_find_buddy(account, purple_conversation_get_name(conv));
7421 if (buddy) { 7421 if (buddy) {
7422 markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE); 7422 markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE);
7423 } else { 7423 } else {
7424 markup = title; 7424 markup = title;
7425 } 7425 }
7690 return; 7690 return;
7691 7691
7692 if (purple_conversation_get_connection(conv) == NULL) 7692 if (purple_conversation_get_connection(conv) == NULL)
7693 return; 7693 return;
7694 7694
7695 buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); 7695 buddy = purple_blist_find_buddy(account, purple_conversation_get_name(conv));
7696 if (buddy) 7696 if (buddy)
7697 { 7697 {
7698 PurpleContact *contact = purple_buddy_get_contact(buddy); 7698 PurpleContact *contact = purple_buddy_get_contact(buddy);
7699 if (contact) { 7699 if (contact) {
7700 custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBListNode*)contact); 7700 custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBListNode*)contact);
9740 account = purple_conversation_get_account(conv); 9740 account = purple_conversation_get_account(conv);
9741 name = purple_conversation_get_name(conv); 9741 name = purple_conversation_get_name(conv);
9742 9742
9743 if (PURPLE_IS_IM_CONVERSATION(conv)) { 9743 if (PURPLE_IS_IM_CONVERSATION(conv)) {
9744 PurpleBuddy *buddy; 9744 PurpleBuddy *buddy;
9745 buddy = purple_find_buddy(account, name); 9745 buddy = purple_blist_find_buddy(account, name);
9746 if (buddy != NULL) { 9746 if (buddy != NULL) {
9747 purple_blist_alias_buddy(buddy, gtk_entry_get_text(entry)); 9747 purple_buddy_set_local_alias(buddy, gtk_entry_get_text(entry));
9748 } 9748 }
9749 serv_alias_buddy(buddy); 9749 serv_alias_buddy(buddy);
9750 } else { 9750 } else {
9751 gtk_entry_set_text(GTK_ENTRY(gtkconv->u.chat->topic_text), gtk_entry_get_text(entry)); 9751 gtk_entry_set_text(GTK_ENTRY(gtkconv->u.chat->topic_text), gtk_entry_get_text(entry));
9752 topic_callback(NULL, gtkconv); 9752 topic_callback(NULL, gtkconv);
9770 /* Do not allow aliasing someone on a disconnected account. */ 9770 /* Do not allow aliasing someone on a disconnected account. */
9771 return FALSE; 9771 return FALSE;
9772 } 9772 }
9773 9773
9774 if (PURPLE_IS_IM_CONVERSATION(conv)) { 9774 if (PURPLE_IS_IM_CONVERSATION(conv)) {
9775 PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv)); 9775 PurpleBuddy *buddy = purple_blist_find_buddy(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv));
9776 if (!buddy) 9776 if (!buddy)
9777 /* This buddy isn't in your buddy list, so we can't alias him */ 9777 /* This buddy isn't in your buddy list, so we can't alias him */
9778 return FALSE; 9778 return FALSE;
9779 9779
9780 text = purple_buddy_get_contact_alias(buddy); 9780 text = purple_buddy_get_contact_alias(buddy);
10784 PurpleGroup *group = NULL; 10784 PurpleGroup *group = NULL;
10785 10785
10786 if (PURPLE_IS_IM_CONVERSATION(conv->active_conv)) { 10786 if (PURPLE_IS_IM_CONVERSATION(conv->active_conv)) {
10787 PurpleBuddy *buddy; 10787 PurpleBuddy *buddy;
10788 10788
10789 buddy = purple_find_buddy(purple_conversation_get_account(conv->active_conv), 10789 buddy = purple_blist_find_buddy(purple_conversation_get_account(conv->active_conv),
10790 purple_conversation_get_name(conv->active_conv)); 10790 purple_conversation_get_name(conv->active_conv));
10791 10791
10792 if (buddy != NULL) 10792 if (buddy != NULL)
10793 group = purple_buddy_get_group(buddy); 10793 group = purple_buddy_get_group(buddy);
10794 10794

mercurial