Mercurial > pidgin.yaz
comparison pidgin/gtkblist.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 0f94ec89f0bc 03efb97b552b |
children |
comparison
equal
deleted
inserted
replaced
32692:0f94ec89f0bc | 32827:4a34689eeb33 |
---|---|
346 | 346 |
347 } | 347 } |
348 | 348 |
349 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat) | 349 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat) |
350 { | 350 { |
351 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", | 351 purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin", |
352 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); | 352 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); |
353 } | 353 } |
354 | 354 |
355 static void gtk_blist_menu_persistent_cb(GtkWidget *w, PurpleChat *chat) | 355 static void gtk_blist_menu_persistent_cb(GtkWidget *w, PurpleChat *chat) |
356 { | 356 { |
357 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", | 357 purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-persistent", |
358 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); | 358 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); |
359 } | 359 } |
360 | 360 |
361 static PurpleConversation * | 361 static PurpleConversation * |
362 find_conversation_with_buddy(PurpleBuddy *buddy) | 362 find_conversation_with_buddy(PurpleBuddy *buddy) |
919 } | 919 } |
920 | 920 |
921 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), GTK_RESPONSE_OK, sensitive); | 921 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), GTK_RESPONSE_OK, sensitive); |
922 | 922 |
923 gc = purple_account_get_connection(data->rq_data.account); | 923 gc = purple_account_get_connection(data->rq_data.account); |
924 prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; | 924 prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL; |
925 sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL); | 925 sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL); |
926 | 926 |
927 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), 1, sensitive); | 927 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), 1, sensitive); |
928 } | 928 } |
929 | 929 |
943 PurplePluginProtocolInfo *prpl_info = NULL; | 943 PurplePluginProtocolInfo *prpl_info = NULL; |
944 | 944 |
945 if (gc == NULL) | 945 if (gc == NULL) |
946 return FALSE; | 946 return FALSE; |
947 | 947 |
948 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | 948 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
949 | 949 |
950 return (prpl_info->chat_info != NULL); | 950 return (prpl_info->chat_info != NULL); |
951 } | 951 } |
952 | 952 |
953 gboolean | 953 gboolean |
1033 | 1033 |
1034 static void | 1034 static void |
1035 rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) | 1035 rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) |
1036 { | 1036 { |
1037 PurpleConnection *gc; | 1037 PurpleConnection *gc; |
1038 PurplePluginProtocolInfo *prpl_info; | |
1038 GList *list = NULL, *tmp; | 1039 GList *list = NULL, *tmp; |
1039 GHashTable *defaults = NULL; | 1040 GHashTable *defaults = NULL; |
1040 struct proto_chat_entry *pce; | 1041 struct proto_chat_entry *pce; |
1041 gboolean focus = TRUE; | 1042 gboolean focus = TRUE; |
1042 | 1043 |
1043 g_return_if_fail(data->rq_data.account != NULL); | 1044 g_return_if_fail(data->rq_data.account != NULL); |
1044 | 1045 |
1045 gc = purple_account_get_connection(data->rq_data.account); | 1046 gc = purple_account_get_connection(data->rq_data.account); |
1047 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); | |
1046 | 1048 |
1047 gtk_container_foreach(GTK_CONTAINER(data->rq_data.vbox), (GtkCallback)gtk_widget_destroy, NULL); | 1049 gtk_container_foreach(GTK_CONTAINER(data->rq_data.vbox), (GtkCallback)gtk_widget_destroy, NULL); |
1048 | 1050 |
1049 g_list_free(data->entries); | 1051 g_list_free(data->entries); |
1050 data->entries = NULL; | 1052 data->entries = NULL; |
1051 | 1053 |
1052 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) | 1054 if (prpl_info->chat_info != NULL) |
1053 list = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc); | 1055 list = prpl_info->chat_info(gc); |
1054 | 1056 |
1055 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) | 1057 if (prpl_info->chat_info_defaults != NULL) |
1056 defaults = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, default_chat_name); | 1058 defaults = prpl_info->chat_info_defaults(gc, default_chat_name); |
1057 | 1059 |
1058 for (tmp = list; tmp; tmp = tmp->next) | 1060 for (tmp = list; tmp; tmp = tmp->next) |
1059 { | 1061 { |
1060 GtkWidget *input; | 1062 GtkWidget *input; |
1061 | 1063 |
1414 void | 1416 void |
1415 pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc, | 1417 pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc, |
1416 PurpleBlistNode *node) | 1418 PurpleBlistNode *node) |
1417 { | 1419 { |
1418 GList *l, *ll; | 1420 GList *l, *ll; |
1419 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | 1421 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
1420 | 1422 |
1421 if(!prpl_info || !prpl_info->blist_node_menu) | 1423 if(!prpl_info || !prpl_info->blist_node_menu) |
1422 return; | 1424 return; |
1423 | 1425 |
1424 for(l = ll = prpl_info->blist_node_menu(node); l; l = l->next) { | 1426 for(l = ll = prpl_info->blist_node_menu(node); l; l = l->next) { |
1522 | 1524 |
1523 #endif | 1525 #endif |
1524 | 1526 |
1525 if (prpl_info && prpl_info->send_file) { | 1527 if (prpl_info && prpl_info->send_file) { |
1526 if (!prpl_info->can_receive_file || | 1528 if (!prpl_info->can_receive_file || |
1527 prpl_info->can_receive_file(buddy->account->gc, buddy->name)) | 1529 prpl_info->can_receive_file(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy))) |
1528 { | 1530 { |
1529 pidgin_new_item_from_stock(menu, _("_Send File..."), | 1531 pidgin_new_item_from_stock(menu, _("_Send File..."), |
1530 PIDGIN_STOCK_TOOLBAR_SEND_FILE, | 1532 PIDGIN_STOCK_TOOLBAR_SEND_FILE, |
1531 G_CALLBACK(gtk_blist_menu_send_file_cb), | 1533 G_CALLBACK(gtk_blist_menu_send_file_cb), |
1532 buddy, 0, 0, NULL); | 1534 buddy, 0, 0, NULL); |
1550 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); | 1552 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); |
1551 pidgin_new_item_from_stock(menu, show_offline ? _("Hide When Offline") : _("Show When Offline"), | 1553 pidgin_new_item_from_stock(menu, show_offline ? _("Hide When Offline") : _("Show When Offline"), |
1552 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); | 1554 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); |
1553 } | 1555 } |
1554 | 1556 |
1555 pidgin_append_blist_node_proto_menu(menu, buddy->account->gc, node); | 1557 pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_buddy_get_account(buddy)), node); |
1556 pidgin_append_blist_node_extended_menu(menu, node); | 1558 pidgin_append_blist_node_extended_menu(menu, node); |
1557 | 1559 |
1558 if (!contact_expanded && contact != NULL) | 1560 if (!contact_expanded && contact != NULL) |
1559 pidgin_append_blist_node_move_to_menu(menu, (PurpleBlistNode *)contact); | 1561 pidgin_append_blist_node_move_to_menu(menu, PURPLE_BLIST_NODE(contact)); |
1560 | 1562 |
1561 if (node->parent && node->parent->child->next && | 1563 if (node->parent && node->parent->child->next && |
1562 !sub && !contact_expanded) { | 1564 !sub && !contact_expanded) { |
1563 pidgin_separator(menu); | 1565 pidgin_separator(menu); |
1564 pidgin_append_blist_node_privacy_menu(menu, node); | 1566 pidgin_append_blist_node_privacy_menu(menu, node); |
1603 buddy = (PurpleBuddy*)node; | 1605 buddy = (PurpleBuddy*)node; |
1604 } else { | 1606 } else { |
1605 return FALSE; | 1607 return FALSE; |
1606 } | 1608 } |
1607 if(buddy) | 1609 if(buddy) |
1608 pidgin_retrieve_user_info(buddy->account->gc, buddy->name); | 1610 pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy)); |
1609 } else { | 1611 } else { |
1610 switch (event->keyval) { | 1612 switch (event->keyval) { |
1611 case GDK_F2: | 1613 case GDK_F2: |
1612 gtk_blist_menu_alias_cb(tv, node); | 1614 gtk_blist_menu_alias_cb(tv, node); |
1613 break; | 1615 break; |
1756 pidgin_new_check_item(menu, _("Persistent"), | 1758 pidgin_new_check_item(menu, _("Persistent"), |
1757 G_CALLBACK(gtk_blist_menu_persistent_cb), node, persistent); | 1759 G_CALLBACK(gtk_blist_menu_persistent_cb), node, persistent); |
1758 pidgin_new_item_from_stock(menu, _("View _Log"), NULL, | 1760 pidgin_new_item_from_stock(menu, _("View _Log"), NULL, |
1759 G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL); | 1761 G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL); |
1760 | 1762 |
1761 pidgin_append_blist_node_proto_menu(menu, c->account->gc, node); | 1763 pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_chat_get_account(c)), node); |
1762 pidgin_append_blist_node_extended_menu(menu, node); | 1764 pidgin_append_blist_node_extended_menu(menu, node); |
1763 | 1765 |
1764 pidgin_separator(menu); | 1766 pidgin_separator(menu); |
1765 | 1767 |
1766 pidgin_new_item_from_stock(menu, _("_Edit Settings..."), NULL, | 1768 pidgin_new_item_from_stock(menu, _("_Edit Settings..."), NULL, |
1806 } | 1808 } |
1807 | 1809 |
1808 static GtkWidget * | 1810 static GtkWidget * |
1809 create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) | 1811 create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) |
1810 { | 1812 { |
1811 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; | 1813 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
1812 GtkWidget *menu; | 1814 GtkWidget *menu; |
1813 GtkWidget *menuitem; | 1815 GtkWidget *menuitem; |
1814 gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); | 1816 gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); |
1815 | 1817 |
1816 menu = gtk_menu_new(); | 1818 menu = gtk_menu_new(); |
1841 GtkWidget *submenu; | 1843 GtkWidget *submenu; |
1842 GtkWidget *image; | 1844 GtkWidget *image; |
1843 | 1845 |
1844 if(buddy == b) | 1846 if(buddy == b) |
1845 continue; | 1847 continue; |
1846 if(!buddy->account->gc) | 1848 if(!purple_account_get_connection(purple_buddy_get_account(buddy))) |
1847 continue; | 1849 continue; |
1848 if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy)) | 1850 if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy)) |
1849 continue; | 1851 continue; |
1850 | 1852 |
1851 menuitem = gtk_image_menu_item_new_with_label(buddy->name); | 1853 menuitem = gtk_image_menu_item_new_with_label(purple_buddy_get_name(buddy)); |
1852 buf = pidgin_create_prpl_icon(buddy->account,PIDGIN_PRPL_ICON_SMALL); | 1854 buf = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL); |
1853 image = gtk_image_new_from_pixbuf(buf); | 1855 image = gtk_image_new_from_pixbuf(buf); |
1854 g_object_unref(G_OBJECT(buf)); | 1856 g_object_unref(G_OBJECT(buf)); |
1855 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), | 1857 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), |
1856 image); | 1858 image); |
1857 gtk_widget_show(image); | 1859 gtk_widget_show(image); |
1874 GtkMenuPositionFunc func, | 1876 GtkMenuPositionFunc func, |
1875 GtkWidget *tv, | 1877 GtkWidget *tv, |
1876 guint button, | 1878 guint button, |
1877 guint32 time) | 1879 guint32 time) |
1878 { | 1880 { |
1879 struct _pidgin_blist_node *gtknode; | 1881 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
1880 GtkWidget *menu = NULL; | 1882 GtkWidget *menu = NULL; |
1881 gboolean handled = FALSE; | 1883 gboolean handled = FALSE; |
1882 | |
1883 gtknode = (struct _pidgin_blist_node *)node->ui_data; | |
1884 | 1884 |
1885 /* Create a menu based on the thing we right-clicked on */ | 1885 /* Create a menu based on the thing we right-clicked on */ |
1886 if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | 1886 if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
1887 PurpleGroup *g = (PurpleGroup *)node; | 1887 PurpleGroup *g = (PurpleGroup *)node; |
1888 | 1888 |
1941 /* Here we figure out which node was clicked */ | 1941 /* Here we figure out which node was clicked */ |
1942 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL)) | 1942 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL)) |
1943 return FALSE; | 1943 return FALSE; |
1944 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); | 1944 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); |
1945 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); | 1945 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); |
1946 gtknode = (struct _pidgin_blist_node *)node->ui_data; | 1946 gtknode = purple_blist_node_get_ui_data(node); |
1947 | 1947 |
1948 /* Right click draws a context menu */ | 1948 /* Right click draws a context menu */ |
1949 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) { | 1949 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) { |
1950 handled = pidgin_blist_show_context_menu(node, NULL, tv, 3, event->time); | 1950 handled = pidgin_blist_show_context_menu(node, NULL, tv, 3, event->time); |
1951 | 1951 |
1965 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) | 1965 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) |
1966 b = purple_contact_get_priority_buddy((PurpleContact*)node); | 1966 b = purple_contact_get_priority_buddy((PurpleContact*)node); |
1967 else | 1967 else |
1968 b = (PurpleBuddy *)node; | 1968 b = (PurpleBuddy *)node; |
1969 | 1969 |
1970 prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); | 1970 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); |
1971 if (prpl != NULL) | 1971 if (prpl != NULL) |
1972 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 1972 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
1973 | 1973 |
1974 if (prpl && prpl_info->get_info) | 1974 if (prpl && prpl_info->get_info) |
1975 pidgin_retrieve_user_info(b->account->gc, b->name); | 1975 pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(b)), purple_buddy_get_name(b)); |
1976 handled = TRUE; | 1976 handled = TRUE; |
1977 } | 1977 } |
1978 | 1978 |
1979 #if (1) | 1979 #if (1) |
1980 /* | 1980 /* |
2114 if (account != NULL) | 2114 if (account != NULL) |
2115 { | 2115 { |
2116 for (l = list; l != NULL; l = l->next) | 2116 for (l = list; l != NULL; l = l->next) |
2117 { | 2117 { |
2118 purple_blist_request_add_buddy(account, l->data, | 2118 purple_blist_request_add_buddy(account, l->data, |
2119 (group ? group->name : NULL), | 2119 (group ? purple_group_get_name(group) : NULL), |
2120 alias); | 2120 alias); |
2121 } | 2121 } |
2122 } | 2122 } |
2123 | 2123 |
2124 g_list_foreach(list, (GFunc)g_free, NULL); | 2124 g_list_foreach(list, (GFunc)g_free, NULL); |
2295 else | 2295 else |
2296 { | 2296 { |
2297 buddy = (PurpleBuddy *)node; | 2297 buddy = (PurpleBuddy *)node; |
2298 } | 2298 } |
2299 | 2299 |
2300 gc = purple_account_get_connection(buddy->account); | 2300 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
2301 | 2301 |
2302 if (gc == NULL) | 2302 if (gc == NULL) |
2303 { | 2303 { |
2304 gtk_tree_path_free(sourcerow); | 2304 gtk_tree_path_free(sourcerow); |
2305 return; | 2305 return; |
2306 } | 2306 } |
2307 | 2307 |
2308 protocol = | 2308 protocol = |
2309 PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account, | 2309 PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(purple_buddy_get_account(buddy), |
2310 buddy); | 2310 buddy); |
2311 | 2311 |
2312 str = g_string_new(NULL); | 2312 str = g_string_new(NULL); |
2313 g_string_printf(str, | 2313 g_string_printf(str, |
2314 "MIME-Version: 1.0\r\n" | 2314 "MIME-Version: 1.0\r\n" |
2315 "Content-Type: application/x-im-contact\r\n" | 2315 "Content-Type: application/x-im-contact\r\n" |
2316 "X-IM-Protocol: %s\r\n" | 2316 "X-IM-Protocol: %s\r\n" |
2317 "X-IM-Username: %s\r\n", | 2317 "X-IM-Username: %s\r\n", |
2318 protocol, | 2318 protocol, |
2319 buddy->name); | 2319 purple_buddy_get_name(buddy)); |
2320 | 2320 |
2321 if (buddy->alias != NULL) | 2321 if (purple_buddy_get_local_buddy_alias(buddy) != NULL) |
2322 { | 2322 { |
2323 g_string_append_printf(str, | 2323 g_string_append_printf(str, |
2324 "X-IM-Alias: %s\r\n", | 2324 "X-IM-Alias: %s\r\n", |
2325 buddy->alias); | 2325 purple_buddy_get_local_buddy_alias(buddy)); |
2326 } | 2326 } |
2327 | 2327 |
2328 g_string_append(str, "\r\n"); | 2328 g_string_append(str, "\r\n"); |
2329 | 2329 |
2330 gtk_selection_data_set(data, | 2330 gtk_selection_data_set(data, |
2359 | 2359 |
2360 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), | 2360 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), |
2361 &iter, path); | 2361 &iter, path); |
2362 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), | 2362 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), |
2363 &iter, NODE_COLUMN, &node, -1); | 2363 &iter, NODE_COLUMN, &node, -1); |
2364 gtknode = node->ui_data; | 2364 gtknode = purple_blist_node_get_ui_data(node); |
2365 | 2365 |
2366 if (PURPLE_BLIST_NODE_IS_CONTACT(n)) { | 2366 if (PURPLE_BLIST_NODE_IS_CONTACT(n)) { |
2367 PurpleContact *c = (PurpleContact*)n; | 2367 PurpleContact *c = (PurpleContact*)n; |
2368 if (PURPLE_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) { | 2368 if (PURPLE_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) { |
2369 purple_blist_merge_contact(c, node); | 2369 purple_blist_merge_contact(c, node); |
2536 "can add that buddy."), NULL); | 2536 "can add that buddy."), NULL); |
2537 } | 2537 } |
2538 else | 2538 else |
2539 { | 2539 { |
2540 purple_blist_request_add_buddy(account, username, | 2540 purple_blist_request_add_buddy(account, username, |
2541 (group ? group->name : NULL), | 2541 (group ? purple_group_get_name(group) : NULL), |
2542 alias); | 2542 alias); |
2543 } | 2543 } |
2544 } | 2544 } |
2545 | 2545 |
2546 g_free(username); | 2546 g_free(username); |
2603 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), | 2603 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), |
2604 &iter, NODE_COLUMN, &node, -1); | 2604 &iter, NODE_COLUMN, &node, -1); |
2605 | 2605 |
2606 if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 2606 if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
2607 PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); | 2607 PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); |
2608 pidgin_dnd_file_manage(sd, b->account, b->name); | 2608 pidgin_dnd_file_manage(sd, purple_buddy_get_account(b), purple_buddy_get_name(b)); |
2609 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | 2609 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
2610 } else { | 2610 } else { |
2611 gtk_drag_finish(dc, FALSE, FALSE, t); | 2611 gtk_drag_finish(dc, FALSE, FALSE, t); |
2612 } | 2612 } |
2613 } | 2613 } |
2676 | 2676 |
2677 if (buddy) { | 2677 if (buddy) { |
2678 account = purple_buddy_get_account(buddy); | 2678 account = purple_buddy_get_account(buddy); |
2679 } | 2679 } |
2680 | 2680 |
2681 if(account && account->gc) { | 2681 if(account && purple_account_get_connection(account)) { |
2682 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | 2682 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account))); |
2683 } | 2683 } |
2684 | 2684 |
2685 #if 0 | 2685 #if 0 |
2686 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")) | 2686 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")) |
2687 return NULL; | 2687 return NULL; |
2690 /* If we have a contact then this is either a contact or a buddy and | 2690 /* If we have a contact then this is either a contact or a buddy and |
2691 * we want to fetch the custom icon for the contact. If we don't have | 2691 * we want to fetch the custom icon for the contact. If we don't have |
2692 * a contact then this is a group or some other type of node and we | 2692 * a contact then this is a group or some other type of node and we |
2693 * want to use that directly. */ | 2693 * want to use that directly. */ |
2694 if (contact) { | 2694 if (contact) { |
2695 custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); | 2695 custom_img = purple_buddy_icons_node_find_custom_icon(PURPLE_BLIST_NODE(contact)); |
2696 } else { | 2696 } else { |
2697 custom_img = purple_buddy_icons_node_find_custom_icon(node); | 2697 custom_img = purple_buddy_icons_node_find_custom_icon(node); |
2698 } | 2698 } |
2699 | 2699 |
2700 if (custom_img) { | 2700 if (custom_img) { |
2703 } | 2703 } |
2704 | 2704 |
2705 if (data == NULL) { | 2705 if (data == NULL) { |
2706 if (buddy) { | 2706 if (buddy) { |
2707 /* Not sure I like this...*/ | 2707 /* Not sure I like this...*/ |
2708 if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name))) | 2708 if (!(icon = purple_buddy_icons_find(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)))) |
2709 return NULL; | 2709 return NULL; |
2710 data = purple_buddy_icon_get_data(icon, &len); | 2710 data = purple_buddy_icon_get_data(icon, &len); |
2711 } | 2711 } |
2712 | 2712 |
2713 if(data == NULL) | 2713 if(data == NULL) |
2873 struct tooltip_data *td = g_new0(struct tooltip_data, 1); | 2873 struct tooltip_data *td = g_new0(struct tooltip_data, 1); |
2874 PurpleAccount *account = NULL; | 2874 PurpleAccount *account = NULL; |
2875 char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL; | 2875 char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL; |
2876 | 2876 |
2877 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 2877 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
2878 account = ((PurpleBuddy*)(node))->account; | 2878 account = purple_buddy_get_account((PurpleBuddy*)(node)); |
2879 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | 2879 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
2880 account = ((PurpleChat*)(node))->account; | 2880 account = purple_chat_get_account((PurpleChat*)(node)); |
2881 } | 2881 } |
2882 | 2882 |
2883 td->padding = TOOLTIP_BORDER; | 2883 td->padding = TOOLTIP_BORDER; |
2884 td->status_icon = pidgin_blist_get_status_icon(node, PIDGIN_STATUS_ICON_LARGE); | 2884 td->status_icon = pidgin_blist_get_status_icon(node, PIDGIN_STATUS_ICON_LARGE); |
2885 td->avatar = pidgin_blist_get_buddy_icon(node, !full, FALSE); | 2885 td->avatar = pidgin_blist_get_buddy_icon(node, !full, FALSE); |
3175 if(!PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 3175 if(!PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
3176 gtk_tree_path_free(path); | 3176 gtk_tree_path_free(path); |
3177 return FALSE; | 3177 return FALSE; |
3178 } | 3178 } |
3179 | 3179 |
3180 gtknode = node->ui_data; | 3180 gtknode = purple_blist_node_get_ui_data(node); |
3181 | 3181 |
3182 if (!gtknode->contact_expanded) { | 3182 if (!gtknode->contact_expanded) { |
3183 GtkTreeIter i; | 3183 GtkTreeIter i; |
3184 | 3184 |
3185 pidgin_blist_expand_contact_cb(NULL, node); | 3185 pidgin_blist_expand_contact_cb(NULL, node); |
3204 struct _pidgin_blist_node *gtknode; | 3204 struct _pidgin_blist_node *gtknode; |
3205 | 3205 |
3206 if(!buddy) | 3206 if(!buddy) |
3207 return FALSE; | 3207 return FALSE; |
3208 | 3208 |
3209 gtknode = ((PurpleBlistNode*)buddy)->ui_data; | 3209 gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); |
3210 | 3210 |
3211 return (purple_account_is_connected(buddy->account) && | 3211 return (purple_account_is_connected(purple_buddy_get_account(buddy)) && |
3212 (purple_presence_is_online(buddy->presence) || | 3212 (purple_presence_is_online(purple_buddy_get_presence(buddy)) || |
3213 (gtknode && gtknode->recent_signonoff) || | 3213 (gtknode && gtknode->recent_signonoff) || |
3214 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || | 3214 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || |
3215 purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"))); | 3215 purple_blist_node_get_bool(PURPLE_BLIST_NODE(buddy), "show_offline"))); |
3216 } | 3216 } |
3217 | 3217 |
3218 void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget) | 3218 void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget) |
3219 { | 3219 { |
3220 pidgin_tooltip_show(widget, node, pidgin_blist_create_tooltip_for_node, pidgin_blist_paint_tip); | 3220 pidgin_tooltip_show(widget, node, pidgin_blist_create_tooltip_for_node, pidgin_blist_paint_tip); |
3385 | 3385 |
3386 if (gc) { | 3386 if (gc) { |
3387 const char *text; | 3387 const char *text; |
3388 PurpleAccount *account = purple_connection_get_account(gc); | 3388 PurpleAccount *account = purple_connection_get_account(gc); |
3389 | 3389 |
3390 if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { | 3390 if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { |
3391 PurpleRequestField *text_field; | 3391 PurpleRequestField *text_field; |
3392 text_field = purple_request_fields_get_field(fields, "text"); | 3392 text_field = purple_request_fields_get_field(fields, "text"); |
3393 text = purple_request_field_string_get_value(text_field); | 3393 text = purple_request_field_string_get_value(text_field); |
3394 } else { | 3394 } else { |
3395 text = NULL; | 3395 text = NULL; |
3401 | 3401 |
3402 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { | 3402 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { |
3403 PurpleAccount *account = (PurpleAccount *) accounts->data; | 3403 PurpleAccount *account = (PurpleAccount *) accounts->data; |
3404 PurpleConnection *gc = purple_account_get_connection(account); | 3404 PurpleConnection *gc = purple_account_get_connection(account); |
3405 | 3405 |
3406 if (gc && gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { | 3406 if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS)) { |
3407 update_status_with_mood(account, mood, NULL); | 3407 update_status_with_mood(account, mood, NULL); |
3408 } | 3408 } |
3409 } | 3409 } |
3410 } | 3410 } |
3411 } | 3411 } |
3436 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { | 3436 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { |
3437 PurpleAccount *account = (PurpleAccount *) accounts->data; | 3437 PurpleAccount *account = (PurpleAccount *) accounts->data; |
3438 if (purple_account_is_connected(account)) { | 3438 if (purple_account_is_connected(account)) { |
3439 PurpleConnection *gc = purple_account_get_connection(account); | 3439 PurpleConnection *gc = purple_account_get_connection(account); |
3440 | 3440 |
3441 if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { | 3441 if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS) { |
3442 PurplePluginProtocolInfo *prpl_info = | 3442 PurplePluginProtocolInfo *prpl_info = |
3443 PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | 3443 PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
3444 PurpleMood *mood = NULL; | 3444 PurpleMood *mood = NULL; |
3445 | 3445 |
3446 /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't | 3446 /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't |
3447 * have get_moods, so using PURPLE_PROTOCOL_PLUGIN_HAS_FUNC isn't necessary | 3447 * have get_moods, so using PURPLE_PROTOCOL_PLUGIN_HAS_FUNC isn't necessary |
3448 * here */ | 3448 * here */ |
3496 | 3496 |
3497 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { | 3497 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) { |
3498 PurpleAccount *account = (PurpleAccount *) accounts->data; | 3498 PurpleAccount *account = (PurpleAccount *) accounts->data; |
3499 | 3499 |
3500 if (purple_account_is_connected(account) && | 3500 if (purple_account_is_connected(account) && |
3501 (purple_account_get_connection(account)->flags & | 3501 (purple_connection_get_flags(purple_account_get_connection(account)) & |
3502 PURPLE_CONNECTION_SUPPORT_MOODS)) { | 3502 PURPLE_CONNECTION_SUPPORT_MOODS)) { |
3503 PurplePresence *presence = purple_account_get_presence(account); | 3503 PurplePresence *presence = purple_account_get_presence(account); |
3504 PurpleStatus *status = purple_presence_get_status(presence, "mood"); | 3504 PurpleStatus *status = purple_presence_get_status(presence, "mood"); |
3505 const gchar *curr_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); | 3505 const gchar *curr_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); |
3506 | 3506 |
3531 | 3531 |
3532 if (account) { | 3532 if (account) { |
3533 PurplePresence *presence = purple_account_get_presence(account); | 3533 PurplePresence *presence = purple_account_get_presence(account); |
3534 PurpleStatus *status = purple_presence_get_status(presence, "mood"); | 3534 PurpleStatus *status = purple_presence_get_status(presence, "mood"); |
3535 gc = purple_account_get_connection(account); | 3535 gc = purple_account_get_connection(account); |
3536 g_return_if_fail(gc->prpl != NULL); | 3536 g_return_if_fail(purple_connection_get_prpl(gc) != NULL); |
3537 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | 3537 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
3538 current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); | 3538 current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); |
3539 } else { | 3539 } else { |
3540 current_mood = get_global_mood_status(); | 3540 current_mood = get_global_mood_status(); |
3541 } | 3541 } |
3542 | 3542 |
3571 purple_request_field_group_add_field(g, f); | 3571 purple_request_field_group_add_field(g, f); |
3572 | 3572 |
3573 purple_request_fields_add_group(fields, g); | 3573 purple_request_fields_add_group(fields, g); |
3574 | 3574 |
3575 /* if the connection allows setting a mood message */ | 3575 /* if the connection allows setting a mood message */ |
3576 if (gc && (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) { | 3576 if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) { |
3577 g = purple_request_field_group_new(NULL); | 3577 g = purple_request_field_group_new(NULL); |
3578 f = purple_request_field_string_new("text", | 3578 f = purple_request_field_string_new("text", |
3579 _("Message (optional)"), NULL, FALSE); | 3579 _("Message (optional)"), NULL, FALSE); |
3580 purple_request_field_group_add_field(g, f); | 3580 purple_request_field_group_add_field(g, f); |
3581 purple_request_fields_add_group(fields, g); | 3581 purple_request_fields_add_group(fields, g); |
3676 GList *connections; | 3676 GList *connections; |
3677 GList *cur; | 3677 GList *cur; |
3678 struct proto_chat_entry *pce; | 3678 struct proto_chat_entry *pce; |
3679 char *name, *value; | 3679 char *name, *value; |
3680 PurpleConversation *conv; | 3680 PurpleConversation *conv; |
3681 PidginBlistNode *bnode = node->ui_data; | 3681 PidginBlistNode *bnode = purple_blist_node_get_ui_data(node); |
3682 | 3682 |
3683 chat = (PurpleChat *)node; | 3683 chat = (PurpleChat *)node; |
3684 prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account)); | 3684 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_chat_get_account(chat))); |
3685 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 3685 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
3686 | 3686 |
3687 connections = purple_connections_get_all(); | 3687 connections = purple_connections_get_all(); |
3688 if (connections && connections->next) | 3688 if (connections && connections->next) |
3689 { | 3689 { |
3690 tmp = g_markup_escape_text(chat->account->username, -1); | 3690 tmp = g_markup_escape_text(purple_account_get_username(purple_chat_get_account(chat)), -1); |
3691 g_string_append_printf(str, _("<b>Account:</b> %s"), tmp); | 3691 g_string_append_printf(str, _("<b>Account:</b> %s"), tmp); |
3692 g_free(tmp); | 3692 g_free(tmp); |
3693 } | 3693 } |
3694 | 3694 |
3695 if (bnode && bnode->conv.conv) { | 3695 if (bnode && bnode->conv.conv) { |
3696 conv = bnode->conv.conv; | 3696 conv = bnode->conv.conv; |
3697 } else { | 3697 } else { |
3698 char *chat_name; | 3698 char *chat_name; |
3699 if (prpl_info && prpl_info->get_chat_name) | 3699 if (prpl_info && prpl_info->get_chat_name) |
3700 chat_name = prpl_info->get_chat_name(chat->components); | 3700 chat_name = prpl_info->get_chat_name(purple_chat_get_components(chat)); |
3701 else | 3701 else |
3702 chat_name = g_strdup(purple_chat_get_name(chat)); | 3702 chat_name = g_strdup(purple_chat_get_name(chat)); |
3703 | 3703 |
3704 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name, | 3704 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name, |
3705 chat->account); | 3705 purple_chat_get_account(chat)); |
3706 g_free(chat_name); | 3706 g_free(chat_name); |
3707 } | 3707 } |
3708 | 3708 |
3709 if (conv && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { | 3709 if (conv && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { |
3710 g_string_append_printf(str, _("\n<b>Occupants:</b> %d"), | 3710 g_string_append_printf(str, _("\n<b>Occupants:</b> %d"), |
3717 g_free(topic); | 3717 g_free(topic); |
3718 } | 3718 } |
3719 } | 3719 } |
3720 | 3720 |
3721 if (prpl_info && prpl_info->chat_info != NULL) | 3721 if (prpl_info && prpl_info->chat_info != NULL) |
3722 cur = prpl_info->chat_info(chat->account->gc); | 3722 cur = prpl_info->chat_info(purple_account_get_connection(purple_chat_get_account(chat))); |
3723 else | 3723 else |
3724 cur = NULL; | 3724 cur = NULL; |
3725 | 3725 |
3726 while (cur != NULL) | 3726 while (cur != NULL) |
3727 { | 3727 { |
3728 pce = cur->data; | 3728 pce = cur->data; |
3729 | 3729 |
3730 if (!pce->secret && (!pce->required && | 3730 if (!pce->secret && (!pce->required && |
3731 g_hash_table_lookup(chat->components, pce->identifier) == NULL)) | 3731 g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier) == NULL)) |
3732 { | 3732 { |
3733 tmp = purple_text_strip_mnemonic(pce->label); | 3733 tmp = purple_text_strip_mnemonic(pce->label); |
3734 name = g_markup_escape_text(tmp, -1); | 3734 name = g_markup_escape_text(tmp, -1); |
3735 g_free(tmp); | 3735 g_free(tmp); |
3736 value = g_markup_escape_text(g_hash_table_lookup( | 3736 value = g_markup_escape_text(g_hash_table_lookup( |
3737 chat->components, pce->identifier), -1); | 3737 purple_chat_get_components(chat), pce->identifier), -1); |
3738 g_string_append_printf(str, "\n<b>%s</b> %s", | 3738 g_string_append_printf(str, "\n<b>%s</b> %s", |
3739 name ? name : "", | 3739 name ? name : "", |
3740 value ? value : ""); | 3740 value ? value : ""); |
3741 g_free(name); | 3741 g_free(name); |
3742 g_free(value); | 3742 g_free(value); |
3768 { | 3768 { |
3769 b = (PurpleBuddy *)node; | 3769 b = (PurpleBuddy *)node; |
3770 c = purple_buddy_get_contact(b); | 3770 c = purple_buddy_get_contact(b); |
3771 } | 3771 } |
3772 | 3772 |
3773 prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); | 3773 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); |
3774 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 3774 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
3775 | 3775 |
3776 presence = purple_buddy_get_presence(b); | 3776 presence = purple_buddy_get_presence(b); |
3777 user_info = purple_notify_user_info_new(); | 3777 user_info = purple_notify_user_info_new(); |
3778 | 3778 |
3785 } | 3785 } |
3786 | 3786 |
3787 /* Alias */ | 3787 /* Alias */ |
3788 /* If there's not a contact alias, the node is being displayed with | 3788 /* If there's not a contact alias, the node is being displayed with |
3789 * this alias, so there's no point in showing it in the tooltip. */ | 3789 * this alias, so there's no point in showing it in the tooltip. */ |
3790 if (full && c && b->alias != NULL && b->alias[0] != '\0' && | 3790 if (full && c && purple_buddy_get_local_buddy_alias(b) != NULL && purple_buddy_get_local_buddy_alias(b)[0] != '\0' && |
3791 (c->alias != NULL && c->alias[0] != '\0') && | 3791 (c->alias != NULL && c->alias[0] != '\0') && |
3792 strcmp(c->alias, b->alias) != 0) | 3792 strcmp(c->alias, purple_buddy_get_local_buddy_alias(b)) != 0) |
3793 { | 3793 { |
3794 purple_notify_user_info_add_pair_plaintext(user_info, | 3794 purple_notify_user_info_add_pair_plaintext(user_info, |
3795 _("Buddy Alias"), b->alias); | 3795 _("Buddy Alias"), purple_buddy_get_local_buddy_alias(b)); |
3796 } | 3796 } |
3797 | 3797 |
3798 /* Nickname/Server Alias */ | 3798 /* Nickname/Server Alias */ |
3799 /* I'd like to only show this if there's a contact or buddy | 3799 /* I'd like to only show this if there's a contact or buddy |
3800 * alias, but many people on MSN set long nicknames, which | 3800 * alias, but many people on MSN set long nicknames, which |
3801 * get ellipsized, so the only way to see the whole thing is | 3801 * get ellipsized, so the only way to see the whole thing is |
3802 * to look at the tooltip. */ | 3802 * to look at the tooltip. */ |
3803 if (full && b->server_alias != NULL && b->server_alias[0] != '\0') | 3803 if (full && purple_buddy_get_server_alias(b)) |
3804 { | 3804 { |
3805 purple_notify_user_info_add_pair_plaintext(user_info, | 3805 purple_notify_user_info_add_pair_plaintext(user_info, |
3806 _("Nickname"), b->server_alias); | 3806 _("Nickname"), purple_buddy_get_server_alias(b)); |
3807 } | 3807 } |
3808 | 3808 |
3809 /* Logged In */ | 3809 /* Logged In */ |
3810 signon = purple_presence_get_login_time(presence); | 3810 signon = purple_presence_get_login_time(presence); |
3811 if (full && PURPLE_BUDDY_IS_ONLINE(b) && signon > 0) | 3811 if (full && PURPLE_BUDDY_IS_ONLINE(b) && signon > 0) |
3836 } | 3836 } |
3837 | 3837 |
3838 /* Last Seen */ | 3838 /* Last Seen */ |
3839 if (full && c && !PURPLE_BUDDY_IS_ONLINE(b)) | 3839 if (full && c && !PURPLE_BUDDY_IS_ONLINE(b)) |
3840 { | 3840 { |
3841 struct _pidgin_blist_node *gtknode = ((PurpleBlistNode *)c)->ui_data; | 3841 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(c)); |
3842 PurpleBlistNode *bnode; | 3842 PurpleBlistNode *bnode; |
3843 int lastseen = 0; | 3843 int lastseen = 0; |
3844 | 3844 |
3845 if (gtknode && (!gtknode->contact_expanded || PURPLE_BLIST_NODE_IS_CONTACT(node))) | 3845 if (gtknode && (!gtknode->contact_expanded || PURPLE_BLIST_NODE_IS_CONTACT(node))) |
3846 { | 3846 { |
3876 * FIXME: Alternatively, why not have the core do all of them? --rlaager */ | 3876 * FIXME: Alternatively, why not have the core do all of them? --rlaager */ |
3877 if (!PURPLE_BUDDY_IS_ONLINE(b)) { | 3877 if (!PURPLE_BUDDY_IS_ONLINE(b)) { |
3878 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline")); | 3878 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline")); |
3879 } | 3879 } |
3880 | 3880 |
3881 if (purple_account_is_connected(b->account) && | 3881 if (purple_account_is_connected(purple_buddy_get_account(b)) && |
3882 prpl_info && prpl_info->tooltip_text) | 3882 prpl_info && prpl_info->tooltip_text) |
3883 { | 3883 { |
3884 /* Additional text from the PRPL */ | 3884 /* Additional text from the PRPL */ |
3885 prpl_info->tooltip_text(b, user_info, full); | 3885 prpl_info->tooltip_text(b, user_info, full); |
3886 } | 3886 } |
3887 | 3887 |
3888 /* These are Easter Eggs. Patches to remove them will be rejected. */ | 3888 /* These are Easter Eggs. Patches to remove them will be rejected. */ |
3889 if (!g_ascii_strcasecmp(b->name, "robflynn")) | 3889 if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "robflynn")) |
3890 purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky")); | 3890 purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky")); |
3891 if (!g_ascii_strcasecmp(b->name, "seanegn")) | 3891 if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "seanegn")) |
3892 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome")); | 3892 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome")); |
3893 if (!g_ascii_strcasecmp(b->name, "chipx86")) | 3893 if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "chipx86")) |
3894 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'")); | 3894 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'")); |
3895 | 3895 |
3896 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); | 3896 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); |
3897 g_string_append(str, tmp); | 3897 g_string_append(str, tmp); |
3898 g_free(tmp); | 3898 g_free(tmp); |
3965 | 3965 |
3966 GdkPixbuf * | 3966 GdkPixbuf * |
3967 pidgin_blist_get_emblem(PurpleBlistNode *node) | 3967 pidgin_blist_get_emblem(PurpleBlistNode *node) |
3968 { | 3968 { |
3969 PurpleBuddy *buddy = NULL; | 3969 PurpleBuddy *buddy = NULL; |
3970 struct _pidgin_blist_node *gtknode = node->ui_data; | 3970 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
3971 PurplePlugin *prpl; | 3971 PurplePlugin *prpl; |
3972 PurplePluginProtocolInfo *prpl_info; | 3972 PurplePluginProtocolInfo *prpl_info; |
3973 const char *name = NULL; | 3973 const char *name = NULL; |
3974 char *filename, *path; | 3974 char *filename, *path; |
3975 PurplePresence *p = NULL; | 3975 PurplePresence *p = NULL; |
3988 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", | 3988 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", |
3989 "small", "mobile.png", NULL); | 3989 "small", "mobile.png", NULL); |
3990 return _pidgin_blist_get_cached_emblem(path); | 3990 return _pidgin_blist_get_cached_emblem(path); |
3991 } | 3991 } |
3992 | 3992 |
3993 if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded) { | 3993 if (((struct _pidgin_blist_node*)purple_blist_node_get_ui_data(node->parent))->contact_expanded) { |
3994 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) | 3994 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) |
3995 return NULL; | 3995 return NULL; |
3996 return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL); | 3996 return pidgin_create_prpl_icon(purple_buddy_get_account((PurpleBuddy*)node), PIDGIN_PRPL_ICON_SMALL); |
3997 } | 3997 } |
3998 } else { | 3998 } else { |
3999 return NULL; | 3999 return NULL; |
4000 } | 4000 } |
4001 | 4001 |
4002 g_return_val_if_fail(buddy != NULL, NULL); | 4002 g_return_val_if_fail(buddy != NULL, NULL); |
4003 | 4003 |
4004 if (!purple_privacy_check(buddy->account, purple_buddy_get_name(buddy))) { | 4004 if (!purple_privacy_check(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) { |
4005 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL); | 4005 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL); |
4006 return _pidgin_blist_get_cached_emblem(path); | 4006 return _pidgin_blist_get_cached_emblem(path); |
4007 } | 4007 } |
4008 | 4008 |
4009 /* If we came through the contact code flow above, we didn't need | 4009 /* If we came through the contact code flow above, we didn't need |
4035 /* This emblem comes from the small emoticon set now, to reduce duplication. */ | 4035 /* This emblem comes from the small emoticon set now, to reduce duplication. */ |
4036 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", "small", "music.png", NULL); | 4036 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", "small", "music.png", NULL); |
4037 return _pidgin_blist_get_cached_emblem(path); | 4037 return _pidgin_blist_get_cached_emblem(path); |
4038 } | 4038 } |
4039 | 4039 |
4040 prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); | 4040 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(buddy))); |
4041 if (!prpl) | 4041 if (!prpl) |
4042 return NULL; | 4042 return NULL; |
4043 | 4043 |
4044 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 4044 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
4045 if (prpl_info && prpl_info->list_emblem) | 4045 if (prpl_info && prpl_info->list_emblem) |
4072 GdkPixbuf * | 4072 GdkPixbuf * |
4073 pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) | 4073 pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) |
4074 { | 4074 { |
4075 GdkPixbuf *ret; | 4075 GdkPixbuf *ret; |
4076 const char *icon = NULL; | 4076 const char *icon = NULL; |
4077 struct _pidgin_blist_node *gtknode = node->ui_data; | 4077 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
4078 struct _pidgin_blist_node *gtkbuddynode = NULL; | 4078 struct _pidgin_blist_node *gtkbuddynode = NULL; |
4079 PurpleBuddy *buddy = NULL; | 4079 PurpleBuddy *buddy = NULL; |
4080 PurpleChat *chat = NULL; | 4080 PurpleChat *chat = NULL; |
4081 GtkIconSize icon_size = gtk_icon_size_from_name((size == PIDGIN_STATUS_ICON_LARGE) ? PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL : | 4081 GtkIconSize icon_size = gtk_icon_size_from_name((size == PIDGIN_STATUS_ICON_LARGE) ? PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL : |
4082 PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC); | 4082 PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC); |
4083 | 4083 |
4084 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 4084 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
4085 if(!gtknode->contact_expanded) { | 4085 if(!gtknode->contact_expanded) { |
4086 buddy = purple_contact_get_priority_buddy((PurpleContact*)node); | 4086 buddy = purple_contact_get_priority_buddy((PurpleContact*)node); |
4087 if (buddy != NULL) | 4087 if (buddy != NULL) |
4088 gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data; | 4088 gtkbuddynode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); |
4089 } | 4089 } |
4090 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 4090 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
4091 buddy = (PurpleBuddy*)node; | 4091 buddy = (PurpleBuddy*)node; |
4092 gtkbuddynode = node->ui_data; | 4092 gtkbuddynode = purple_blist_node_get_ui_data(node); |
4093 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { | 4093 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { |
4094 chat = (PurpleChat*)node; | 4094 chat = (PurpleChat*)node; |
4095 } else { | 4095 } else { |
4096 return NULL; | 4096 return NULL; |
4097 } | 4097 } |
4099 if(buddy || chat) { | 4099 if(buddy || chat) { |
4100 PurpleAccount *account; | 4100 PurpleAccount *account; |
4101 PurplePlugin *prpl; | 4101 PurplePlugin *prpl; |
4102 | 4102 |
4103 if(buddy) | 4103 if(buddy) |
4104 account = buddy->account; | 4104 account = purple_buddy_get_account(buddy); |
4105 else | 4105 else |
4106 account = chat->account; | 4106 account = purple_chat_get_account(chat); |
4107 | 4107 |
4108 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); | 4108 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
4109 if(!prpl) | 4109 if(!prpl) |
4110 return NULL; | 4110 return NULL; |
4111 } | 4111 } |
4116 gboolean trans; | 4116 gboolean trans; |
4117 | 4117 |
4118 if(conv != NULL) { | 4118 if(conv != NULL) { |
4119 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 4119 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
4120 if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) { | 4120 if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) { |
4121 PidginBlistNode *ui = buddy->node.ui_data; | 4121 PidginBlistNode *ui = purple_blist_node_get_ui_data(&(buddy->node)); |
4122 if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)) | 4122 if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)) |
4123 return gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), | 4123 return gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), |
4124 PIDGIN_STOCK_STATUS_MESSAGE, icon_size, "GtkTreeView"); | 4124 PIDGIN_STOCK_STATUS_MESSAGE, icon_size, "GtkTreeView"); |
4125 } | 4125 } |
4126 } | 4126 } |
4200 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); | 4200 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); |
4201 PidginThemeFont *statusfont = NULL, *namefont = NULL; | 4201 PidginThemeFont *statusfont = NULL, *namefont = NULL; |
4202 PidginBlistTheme *theme; | 4202 PidginBlistTheme *theme; |
4203 | 4203 |
4204 if (conv != NULL) { | 4204 if (conv != NULL) { |
4205 PidginBlistNode *ui = b->node.ui_data; | 4205 PidginBlistNode *ui = purple_blist_node_get_ui_data(&(b->node)); |
4206 if (ui) { | 4206 if (ui) { |
4207 if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE) | 4207 if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE) |
4208 hidden_conv = TRUE; | 4208 hidden_conv = TRUE; |
4209 } else { | 4209 } else { |
4210 if (PIDGIN_CONVERSATION(conv) == NULL) | 4210 if (PIDGIN_CONVERSATION(conv) == NULL) |
4234 | 4234 |
4235 /* Name is all that is needed */ | 4235 /* Name is all that is needed */ |
4236 if (!aliased || biglist) { | 4236 if (!aliased || biglist) { |
4237 | 4237 |
4238 /* Status Info */ | 4238 /* Status Info */ |
4239 prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); | 4239 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); |
4240 | 4240 |
4241 if (prpl != NULL) | 4241 if (prpl != NULL) |
4242 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 4242 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
4243 | 4243 |
4244 if (prpl_info && prpl_info->status_text && b->account->gc) { | 4244 if (prpl_info && prpl_info->status_text && purple_account_get_connection(purple_buddy_get_account(b))) { |
4245 char *tmp = prpl_info->status_text(b); | 4245 char *tmp = prpl_info->status_text(b); |
4246 const char *end; | 4246 const char *end; |
4247 | 4247 |
4248 if(tmp && !g_utf8_validate(tmp, -1, &end)) { | 4248 if(tmp && !g_utf8_validate(tmp, -1, &end)) { |
4249 char *new = g_strndup(tmp, | 4249 char *new = g_strndup(tmp, |
4434 | 4434 |
4435 buddy = purple_contact_get_priority_buddy((PurpleContact*)cnode); | 4435 buddy = purple_contact_get_priority_buddy((PurpleContact*)cnode); |
4436 | 4436 |
4437 if (buddy && | 4437 if (buddy && |
4438 purple_presence_is_idle(purple_buddy_get_presence(buddy))) | 4438 purple_presence_is_idle(purple_buddy_get_presence(buddy))) |
4439 pidgin_blist_update_contact(list, (PurpleBlistNode*)buddy); | 4439 pidgin_blist_update_contact(list, PURPLE_BLIST_NODE(buddy)); |
4440 } | 4440 } |
4441 } | 4441 } |
4442 } | 4442 } |
4443 | 4443 |
4444 /* keep on going */ | 4444 /* keep on going */ |
4445 return TRUE; | 4445 return TRUE; |
4446 } | 4446 } |
4447 | 4447 |
4448 static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update) | 4448 static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update) |
4449 { | 4449 { |
4450 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; | 4450 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
4451 GtkTreeIter iter; | 4451 GtkTreeIter iter; |
4452 | 4452 |
4453 if (!gtknode || !gtknode->row || !gtkblist) | 4453 if (!gtknode || !gtknode->row || !gtkblist) |
4454 return; | 4454 return; |
4455 | 4455 |
4594 | 4594 |
4595 static void | 4595 static void |
4596 conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, | 4596 conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, |
4597 PidginBuddyList *gtkblist) | 4597 PidginBuddyList *gtkblist) |
4598 { | 4598 { |
4599 PurpleAccount *account = purple_conversation_get_account(conv); | |
4599 GList *convs = NULL; | 4600 GList *convs = NULL; |
4600 GList *ims, *chats; | 4601 GList *ims, *chats; |
4601 GList *l = NULL; | 4602 GList *l = NULL; |
4602 | 4603 |
4603 if (type != PURPLE_CONV_UPDATE_UNSEEN) | 4604 if (type != PURPLE_CONV_UPDATE_UNSEEN) |
4604 return; | 4605 return; |
4605 | 4606 |
4606 if(conv->account != NULL && conv->name != NULL) { | 4607 if(account != NULL && purple_conversation_get_name(conv) != NULL) { |
4607 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); | 4608 PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); |
4608 if(buddy != NULL) | 4609 if(buddy != NULL) |
4609 pidgin_blist_update_buddy(NULL, (PurpleBlistNode *)buddy, TRUE); | 4610 pidgin_blist_update_buddy(NULL, PURPLE_BLIST_NODE(buddy), TRUE); |
4610 } | 4611 } |
4611 | 4612 |
4612 if (gtkblist->menutrayicon) { | 4613 if (gtkblist->menutrayicon) { |
4613 gtk_widget_destroy(gtkblist->menutrayicon); | 4614 gtk_widget_destroy(gtkblist->menutrayicon); |
4614 gtkblist->menutrayicon = NULL; | 4615 gtkblist->menutrayicon = NULL; |
4684 | 4685 |
4685 static void | 4686 static void |
4686 written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message, | 4687 written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message, |
4687 PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node) | 4688 PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node) |
4688 { | 4689 { |
4689 PidginBlistNode *ui = node->ui_data; | 4690 PidginBlistNode *ui = purple_blist_node_get_ui_data(node); |
4690 if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) || | 4691 if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) || |
4691 !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) | 4692 !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) |
4692 return; | 4693 return; |
4693 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; | 4694 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; |
4694 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT | 4695 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT |
4700 } | 4701 } |
4701 | 4702 |
4702 static void | 4703 static void |
4703 displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) | 4704 displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) |
4704 { | 4705 { |
4705 PidginBlistNode *ui = node->ui_data; | 4706 PidginBlistNode *ui = purple_blist_node_get_ui_data(node); |
4706 if (ui->conv.conv != gtkconv->active_conv) | 4707 if (ui->conv.conv != gtkconv->active_conv) |
4707 return; | 4708 return; |
4708 ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE | | 4709 ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE | |
4709 PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK); | 4710 PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK); |
4710 pidgin_blist_update(purple_get_blist(), node); | 4711 pidgin_blist_update(purple_get_blist(), node); |
4711 } | 4712 } |
4712 | 4713 |
4713 static void | 4714 static void |
4714 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) | 4715 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) |
4715 { | 4716 { |
4716 switch (conv->type) { | 4717 PurpleAccount *account = purple_conversation_get_account(conv); |
4718 | |
4719 switch (purple_conversation_get_type(conv)) { | |
4717 case PURPLE_CONV_TYPE_IM: | 4720 case PURPLE_CONV_TYPE_IM: |
4718 { | 4721 { |
4719 GSList *buddies = purple_find_buddies(conv->account, conv->name); | 4722 GSList *buddies = purple_find_buddies(account, purple_conversation_get_name(conv)); |
4720 while (buddies) { | 4723 while (buddies) { |
4721 PurpleBlistNode *buddy = buddies->data; | 4724 PurpleBlistNode *buddy = buddies->data; |
4722 struct _pidgin_blist_node *ui = buddy->ui_data; | 4725 struct _pidgin_blist_node *ui = purple_blist_node_get_ui_data(buddy); |
4723 buddies = g_slist_delete_link(buddies, buddies); | 4726 buddies = g_slist_delete_link(buddies, buddies); |
4724 if (!ui) | 4727 if (!ui) |
4725 continue; | 4728 continue; |
4726 ui->conv.conv = conv; | 4729 ui->conv.conv = conv; |
4727 ui->conv.flags = 0; | 4730 ui->conv.flags = 0; |
4735 } | 4738 } |
4736 } | 4739 } |
4737 break; | 4740 break; |
4738 case PURPLE_CONV_TYPE_CHAT: | 4741 case PURPLE_CONV_TYPE_CHAT: |
4739 { | 4742 { |
4740 PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name); | 4743 PurpleChat *chat = purple_blist_find_chat(account, purple_conversation_get_name(conv)); |
4741 struct _pidgin_blist_node *ui; | 4744 struct _pidgin_blist_node *ui; |
4742 if (!chat) | 4745 if (!chat) |
4743 break; | 4746 break; |
4744 ui = chat->node.ui_data; | 4747 ui = purple_blist_node_get_ui_data(&(chat->node)); |
4745 if (!ui) | 4748 if (!ui) |
4746 break; | 4749 break; |
4747 ui->conv.conv = conv; | 4750 ui->conv.conv = conv; |
4748 ui->conv.flags = 0; | 4751 ui->conv.flags = 0; |
4749 ui->conv.last_message = 0; | 4752 ui->conv.last_message = 0; |
4774 blist->ui_data = gtkblist; | 4777 blist->ui_data = gtkblist; |
4775 } | 4778 } |
4776 | 4779 |
4777 static void pidgin_blist_new_node(PurpleBlistNode *node) | 4780 static void pidgin_blist_new_node(PurpleBlistNode *node) |
4778 { | 4781 { |
4779 node->ui_data = g_new0(struct _pidgin_blist_node, 1); | 4782 purple_blist_node_set_ui_data(node, g_new0(struct _pidgin_blist_node, 1)); |
4780 } | 4783 } |
4781 | 4784 |
4782 gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node) | 4785 gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node) |
4783 { | 4786 { |
4784 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 4787 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
4787 return FALSE; | 4790 return FALSE; |
4788 } | 4791 } |
4789 | 4792 |
4790 g_return_val_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node), FALSE); | 4793 g_return_val_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node), FALSE); |
4791 | 4794 |
4792 return ((struct _pidgin_blist_node *)node->ui_data)->contact_expanded; | 4795 return ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node))->contact_expanded; |
4793 } | 4796 } |
4794 | 4797 |
4795 enum { | 4798 enum { |
4796 DRAG_BUDDY, | 4799 DRAG_BUDDY, |
4797 DRAG_ROW, | 4800 DRAG_ROW, |
4843 if (node) | 4846 if (node) |
4844 { | 4847 { |
4845 struct _pidgin_blist_node *gtknode; | 4848 struct _pidgin_blist_node *gtknode; |
4846 GtkTreePath *path; | 4849 GtkTreePath *path; |
4847 | 4850 |
4848 gtknode = node->ui_data; | 4851 gtknode = purple_blist_node_get_ui_data(node); |
4849 if (gtknode && gtknode->row) | 4852 if (gtknode && gtknode->row) |
4850 { | 4853 { |
4851 path = gtk_tree_row_reference_get_path(gtknode->row); | 4854 path = gtk_tree_row_reference_get_path(gtknode->row); |
4852 gtk_tree_selection_select_path(sel, path); | 4855 gtk_tree_selection_select_path(sel, path); |
4853 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0); | 4856 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0); |
6129 | 6132 |
6130 gtkblist->refresh_timer = purple_timeout_add_seconds(30,(GSourceFunc)pidgin_blist_refresh_timer, blist); | 6133 gtkblist->refresh_timer = purple_timeout_add_seconds(30,(GSourceFunc)pidgin_blist_refresh_timer, blist); |
6131 } | 6134 } |
6132 | 6135 |
6133 static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { | 6136 static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { |
6134 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; | 6137 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
6135 GtkTreePath *path; | 6138 GtkTreePath *path; |
6136 | 6139 |
6137 if (!gtknode) { | 6140 if (!gtknode) { |
6138 return FALSE; | 6141 return FALSE; |
6139 } | 6142 } |
6158 return TRUE; | 6161 return TRUE; |
6159 } | 6162 } |
6160 | 6163 |
6161 static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node) | 6164 static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node) |
6162 { | 6165 { |
6163 struct _pidgin_blist_node *gtknode = node->ui_data; | 6166 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
6164 | 6167 |
6165 purple_request_close_with_handle(node); | 6168 purple_request_close_with_handle(node); |
6166 | 6169 |
6167 pidgin_blist_hide_node(list, node, TRUE); | 6170 pidgin_blist_hide_node(list, node, TRUE); |
6168 | 6171 |
6180 | 6183 |
6181 if(gtknode) { | 6184 if(gtknode) { |
6182 if(gtknode->recent_signonoff_timer > 0) | 6185 if(gtknode->recent_signonoff_timer > 0) |
6183 purple_timeout_remove(gtknode->recent_signonoff_timer); | 6186 purple_timeout_remove(gtknode->recent_signonoff_timer); |
6184 | 6187 |
6185 purple_signals_disconnect_by_handle(node->ui_data); | 6188 purple_signals_disconnect_by_handle(gtknode); |
6186 g_free(node->ui_data); | 6189 g_free(gtknode); |
6187 node->ui_data = NULL; | 6190 purple_blist_node_set_ui_data(node, NULL); |
6188 } | 6191 } |
6189 } | 6192 } |
6190 | 6193 |
6191 static gboolean do_selection_changed(PurpleBlistNode *new_selection) | 6194 static gboolean do_selection_changed(PurpleBlistNode *new_selection) |
6192 { | 6195 { |
6227 } | 6230 } |
6228 | 6231 |
6229 static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter) | 6232 static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter) |
6230 { | 6233 { |
6231 GtkTreeIter parent_iter, cur, *curptr = NULL; | 6234 GtkTreeIter parent_iter, cur, *curptr = NULL; |
6232 struct _pidgin_blist_node *gtknode = node->ui_data; | 6235 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); |
6233 GtkTreePath *newpath; | 6236 GtkTreePath *newpath; |
6234 | 6237 |
6235 if(!iter) | 6238 if(!iter) |
6236 return FALSE; | 6239 return FALSE; |
6237 | 6240 |
6249 | 6252 |
6250 if(gtknode != NULL) { | 6253 if(gtknode != NULL) { |
6251 gtk_tree_row_reference_free(gtknode->row); | 6254 gtk_tree_row_reference_free(gtknode->row); |
6252 } else { | 6255 } else { |
6253 pidgin_blist_new_node(node); | 6256 pidgin_blist_new_node(node); |
6254 gtknode = (struct _pidgin_blist_node *)node->ui_data; | 6257 gtknode = purple_blist_node_get_ui_data(node); |
6255 } | 6258 } |
6256 | 6259 |
6257 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), | 6260 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), |
6258 iter); | 6261 iter); |
6259 gtknode->row = | 6262 gtknode->row = |
6267 NODE_COLUMN, node, | 6270 NODE_COLUMN, node, |
6268 -1); | 6271 -1); |
6269 | 6272 |
6270 if(node->parent) { | 6273 if(node->parent) { |
6271 GtkTreePath *expand = NULL; | 6274 GtkTreePath *expand = NULL; |
6272 struct _pidgin_blist_node *gtkparentnode = node->parent->ui_data; | 6275 struct _pidgin_blist_node *gtkparentnode = purple_blist_node_get_ui_data(node->parent); |
6273 | 6276 |
6274 if(PURPLE_BLIST_NODE_IS_GROUP(node->parent)) { | 6277 if(PURPLE_BLIST_NODE_IS_GROUP(node->parent)) { |
6275 if(!purple_blist_node_get_bool(node->parent, "collapsed")) | 6278 if(!purple_blist_node_get_bool(node->parent, "collapsed")) |
6276 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter); | 6279 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter); |
6277 } else if(PURPLE_BLIST_NODE_IS_CONTACT(node->parent) && | 6280 } else if(PURPLE_BLIST_NODE_IS_CONTACT(node->parent) && |
6289 | 6292 |
6290 static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group) | 6293 static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group) |
6291 { | 6294 { |
6292 PurpleBlistNode *gnode, *cnode, *bnode; | 6295 PurpleBlistNode *gnode, *cnode, *bnode; |
6293 | 6296 |
6294 gnode = (PurpleBlistNode *)group; | 6297 gnode = PURPLE_BLIST_NODE(group); |
6295 for(cnode = gnode->child; cnode; cnode = cnode->next) { | 6298 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
6296 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { | 6299 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { |
6297 for(bnode = cnode->child; bnode; bnode = bnode->next) { | 6300 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
6298 PurpleBuddy *buddy = (PurpleBuddy *)bnode; | 6301 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
6299 if (purple_account_is_connected(buddy->account) && | 6302 if (purple_account_is_connected(purple_buddy_get_account(buddy)) && |
6300 purple_blist_node_get_bool(bnode, "show_offline")) | 6303 purple_blist_node_get_bool(bnode, "show_offline")) |
6301 return TRUE; | 6304 return TRUE; |
6302 } | 6305 } |
6303 } | 6306 } |
6304 } | 6307 } |
6434 | 6437 |
6435 | 6438 |
6436 text_color = selected ? NULL : theme_font_get_color_default(pair, NULL); | 6439 text_color = selected ? NULL : theme_font_get_color_default(pair, NULL); |
6437 text_font = theme_font_get_face_default(pair, ""); | 6440 text_font = theme_font_get_face_default(pair, ""); |
6438 | 6441 |
6439 esc = g_markup_escape_text(group->name, -1); | 6442 esc = g_markup_escape_text(purple_group_get_name(group), -1); |
6440 if (text_color) { | 6443 if (text_color) { |
6441 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s%s%s</span>", | 6444 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s%s%s</span>", |
6442 text_color, text_font, | 6445 text_color, text_font, |
6443 esc ? esc : "", | 6446 esc ? esc : "", |
6444 !expanded ? " <span weight='light'>(</span>" : "", | 6447 !expanded ? " <span weight='light'>(</span>" : "", |
6461 PurplePresence *presence = purple_buddy_get_presence(buddy); | 6464 PurplePresence *presence = purple_buddy_get_presence(buddy); |
6462 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; | 6465 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; |
6463 GdkColor *color = NULL; | 6466 GdkColor *color = NULL; |
6464 char *mark; | 6467 char *mark; |
6465 char *idle = NULL; | 6468 char *idle = NULL; |
6466 gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; | 6469 gboolean expanded = ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node->parent))->contact_expanded; |
6467 gboolean selected = (gtkblist->selected_node == node); | 6470 gboolean selected = (gtkblist->selected_node == node); |
6468 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); | 6471 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); |
6469 PidginBlistTheme *theme; | 6472 PidginBlistTheme *theme; |
6470 | 6473 |
6471 if (editing_blist) | 6474 if (editing_blist) |
6472 return; | 6475 return; |
6473 | 6476 |
6474 status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, | 6477 status = pidgin_blist_get_status_icon(PURPLE_BLIST_NODE(buddy), |
6475 biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); | 6478 biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); |
6476 | 6479 |
6477 /* Speed it up if we don't want buddy icons. */ | 6480 /* Speed it up if we don't want buddy icons. */ |
6478 if(biglist) | 6481 if(biglist) |
6479 avatar = pidgin_blist_get_buddy_icon((PurpleBlistNode *)buddy, TRUE, TRUE); | 6482 avatar = pidgin_blist_get_buddy_icon(PURPLE_BLIST_NODE(buddy), TRUE, TRUE); |
6480 else | 6483 else |
6481 avatar = NULL; | 6484 avatar = NULL; |
6482 | 6485 |
6483 if (!avatar) { | 6486 if (!avatar) { |
6484 g_object_ref(G_OBJECT(gtkblist->empty_avatar)); | 6487 g_object_ref(G_OBJECT(gtkblist->empty_avatar)); |
6485 avatar = gtkblist->empty_avatar; | 6488 avatar = gtkblist->empty_avatar; |
6486 } else if ((!PURPLE_BUDDY_IS_ONLINE(buddy) || purple_presence_is_idle(presence))) { | 6489 } else if ((!PURPLE_BUDDY_IS_ONLINE(buddy) || purple_presence_is_idle(presence))) { |
6487 do_alphashift(avatar, 77); | 6490 do_alphashift(avatar, 77); |
6488 } | 6491 } |
6489 | 6492 |
6490 emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy); | 6493 emblem = pidgin_blist_get_emblem(PURPLE_BLIST_NODE(buddy)); |
6491 mark = pidgin_blist_get_name_markup(buddy, selected, TRUE); | 6494 mark = pidgin_blist_get_name_markup(buddy, selected, TRUE); |
6492 | 6495 |
6493 theme = pidgin_blist_get_theme(); | 6496 theme = pidgin_blist_get_theme(); |
6494 | 6497 |
6495 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time") && | 6498 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time") && |
6526 ihrs, imin); | 6529 ihrs, imin); |
6527 } | 6530 } |
6528 } | 6531 } |
6529 } | 6532 } |
6530 | 6533 |
6531 prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL); | 6534 prpl_icon = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL); |
6532 | 6535 |
6533 if (theme != NULL) | 6536 if (theme != NULL) |
6534 color = pidgin_blist_theme_get_contact_color(theme); | 6537 color = pidgin_blist_theme_get_contact_color(theme); |
6535 | 6538 |
6536 gtk_tree_store_set(gtkblist->treemodel, iter, | 6539 gtk_tree_store_set(gtkblist->treemodel, iter, |
6597 GtkTreeIter iter; | 6600 GtkTreeIter iter; |
6598 | 6601 |
6599 if(!insert_node(list, cnode, &iter)) | 6602 if(!insert_node(list, cnode, &iter)) |
6600 return; | 6603 return; |
6601 | 6604 |
6602 gtknode = (struct _pidgin_blist_node *)cnode->ui_data; | 6605 gtknode = purple_blist_node_get_ui_data(cnode); |
6603 | 6606 |
6604 if(gtknode->contact_expanded) { | 6607 if(gtknode->contact_expanded) { |
6605 GdkPixbuf *status; | 6608 GdkPixbuf *status; |
6606 gchar *mark, *tmp; | 6609 gchar *mark, *tmp; |
6607 const gchar *fg_color, *font; | 6610 const gchar *fg_color, *font; |
6674 buddy = (PurpleBuddy*)node; | 6677 buddy = (PurpleBuddy*)node; |
6675 | 6678 |
6676 /* First things first, update the contact */ | 6679 /* First things first, update the contact */ |
6677 pidgin_blist_update_contact(list, node); | 6680 pidgin_blist_update_contact(list, node); |
6678 | 6681 |
6679 gtkparentnode = (struct _pidgin_blist_node *)node->parent->ui_data; | 6682 gtkparentnode = purple_blist_node_get_ui_data(node->parent); |
6680 | 6683 |
6681 if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy)) | 6684 if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy)) |
6682 { | 6685 { |
6683 GtkTreeIter iter; | 6686 GtkTreeIter iter; |
6684 | 6687 |
6705 /* First things first, update the group */ | 6708 /* First things first, update the group */ |
6706 pidgin_blist_update_group(list, node->parent); | 6709 pidgin_blist_update_group(list, node->parent); |
6707 | 6710 |
6708 chat = (PurpleChat*)node; | 6711 chat = (PurpleChat*)node; |
6709 | 6712 |
6710 if(purple_account_is_connected(chat->account)) { | 6713 if(purple_account_is_connected(purple_chat_get_account(chat))) { |
6711 GtkTreeIter iter; | 6714 GtkTreeIter iter; |
6712 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; | 6715 GdkPixbuf *status, *avatar, *emblem, *prpl_icon; |
6713 const gchar *color, *font; | 6716 const gchar *color, *font; |
6714 gchar *mark, *tmp; | 6717 gchar *mark, *tmp; |
6715 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); | 6718 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); |
6724 gboolean nick_said = FALSE; | 6727 gboolean nick_said = FALSE; |
6725 | 6728 |
6726 if (!insert_node(list, node, &iter)) | 6729 if (!insert_node(list, node, &iter)) |
6727 return; | 6730 return; |
6728 | 6731 |
6729 ui = node->ui_data; | 6732 ui = purple_blist_node_get_ui_data(node); |
6730 conv = ui->conv.conv; | 6733 conv = ui->conv.conv; |
6731 if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) { | 6734 if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) { |
6732 hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE); | 6735 hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE); |
6733 nick_said = (ui->conv.flags & PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK); | 6736 nick_said = (ui->conv.flags & PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK); |
6734 } | 6737 } |
6769 font, hidden ? "bold" : "normal", mark); | 6772 font, hidden ? "bold" : "normal", mark); |
6770 } | 6773 } |
6771 g_free(mark); | 6774 g_free(mark); |
6772 mark = tmp; | 6775 mark = tmp; |
6773 | 6776 |
6774 prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); | 6777 prpl_icon = pidgin_create_prpl_icon(purple_chat_get_account(chat), PIDGIN_PRPL_ICON_SMALL); |
6775 | 6778 |
6776 if (theme != NULL) | 6779 if (theme != NULL) |
6777 bgcolor = pidgin_blist_theme_get_contact_color(theme); | 6780 bgcolor = pidgin_blist_theme_get_contact_color(theme); |
6778 | 6781 |
6779 gtk_tree_store_set(gtkblist->treemodel, &iter, | 6782 gtk_tree_store_set(gtkblist->treemodel, &iter, |
6810 if (list) | 6813 if (list) |
6811 gtkblist = PIDGIN_BLIST(list); | 6814 gtkblist = PIDGIN_BLIST(list); |
6812 if(!gtkblist || !gtkblist->treeview || !node) | 6815 if(!gtkblist || !gtkblist->treeview || !node) |
6813 return; | 6816 return; |
6814 | 6817 |
6815 if (node->ui_data == NULL) | 6818 if (purple_blist_node_get_ui_data(node) == NULL) |
6816 pidgin_blist_new_node(node); | 6819 pidgin_blist_new_node(node); |
6817 | 6820 |
6818 switch(node->type) { | 6821 switch (purple_blist_node_get_type(node)) { |
6819 case PURPLE_BLIST_GROUP_NODE: | 6822 case PURPLE_BLIST_GROUP_NODE: |
6820 pidgin_blist_update_group(list, node); | 6823 pidgin_blist_update_group(list, node); |
6821 break; | 6824 break; |
6822 case PURPLE_BLIST_CONTACT_NODE: | 6825 case PURPLE_BLIST_CONTACT_NODE: |
6823 pidgin_blist_update_contact(list, node); | 6826 pidgin_blist_update_contact(list, node); |
6908 | 6911 |
6909 static GList * | 6912 static GList * |
6910 groups_tree(void) | 6913 groups_tree(void) |
6911 { | 6914 { |
6912 static GList *list = NULL; | 6915 static GList *list = NULL; |
6913 char *tmp2; | |
6914 PurpleGroup *g; | 6916 PurpleGroup *g; |
6915 PurpleBlistNode *gnode; | 6917 PurpleBlistNode *gnode; |
6916 | 6918 |
6917 g_list_free(list); | 6919 g_list_free(list); |
6918 list = NULL; | 6920 list = NULL; |
6928 gnode = gnode->next) | 6930 gnode = gnode->next) |
6929 { | 6931 { |
6930 if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) | 6932 if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
6931 { | 6933 { |
6932 g = (PurpleGroup *)gnode; | 6934 g = (PurpleGroup *)gnode; |
6933 tmp2 = g->name; | 6935 list = g_list_append(list, (char *) purple_group_get_name(g)); |
6934 list = g_list_append(list, tmp2); | |
6935 } | 6936 } |
6936 } | 6937 } |
6937 } | 6938 } |
6938 | 6939 |
6939 return list; | 6940 return list; |
7016 | 7017 |
7017 purple_account_add_buddy(account, b, invite); | 7018 purple_account_add_buddy(account, b, invite); |
7018 | 7019 |
7019 /* Offer to merge people with the same alias. */ | 7020 /* Offer to merge people with the same alias. */ |
7020 if (whoalias != NULL && g != NULL) | 7021 if (whoalias != NULL && g != NULL) |
7021 gtk_blist_auto_personize((PurpleBlistNode *)g, whoalias); | 7022 gtk_blist_auto_personize(PURPLE_BLIST_NODE(g), whoalias); |
7022 | 7023 |
7023 /* | 7024 /* |
7024 * XXX | 7025 * XXX |
7025 * It really seems like it would be better if the call to | 7026 * It really seems like it would be better if the call to |
7026 * purple_account_add_buddy() and purple_conversation_update() were done in | 7027 * purple_account_add_buddy() and purple_conversation_update() were done in |
7164 } | 7165 } |
7165 | 7166 |
7166 purple_blist_add_chat(chat, group, NULL); | 7167 purple_blist_add_chat(chat, group, NULL); |
7167 | 7168 |
7168 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin))) | 7169 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin))) |
7169 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", TRUE); | 7170 purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin", TRUE); |
7170 | 7171 |
7171 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent))) | 7172 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent))) |
7172 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", TRUE); | 7173 purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-persistent", TRUE); |
7173 } | 7174 } |
7174 | 7175 |
7175 gtk_widget_destroy(data->chat_data.rq_data.window); | 7176 gtk_widget_destroy(data->chat_data.rq_data.window); |
7176 g_free(data->chat_data.default_chat_name); | 7177 g_free(data->chat_data.default_chat_name); |
7177 g_list_free(data->chat_data.entries); | 7178 g_list_free(data->chat_data.entries); |
7204 { | 7205 { |
7205 PidginAddChatData *data; | 7206 PidginAddChatData *data; |
7206 GList *l; | 7207 GList *l; |
7207 PurpleConnection *gc; | 7208 PurpleConnection *gc; |
7208 GtkBox *vbox; | 7209 GtkBox *vbox; |
7210 PurplePluginProtocolInfo *prpl_info = NULL; | |
7209 | 7211 |
7210 if (account != NULL) { | 7212 if (account != NULL) { |
7211 gc = purple_account_get_connection(account); | 7213 gc = purple_account_get_connection(account); |
7212 | 7214 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
7213 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) { | 7215 |
7216 if (prpl_info->join_chat == NULL) { | |
7214 purple_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL); | 7217 purple_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL); |
7215 return; | 7218 return; |
7216 } | 7219 } |
7217 } else { | 7220 } else { |
7218 /* Find an account with chat capabilities */ | 7221 /* Find an account with chat capabilities */ |
7219 for (l = purple_connections_get_all(); l != NULL; l = l->next) { | 7222 for (l = purple_connections_get_all(); l != NULL; l = l->next) { |
7220 gc = (PurpleConnection *)l->data; | 7223 gc = (PurpleConnection *)l->data; |
7221 | 7224 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
7222 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) { | 7225 |
7226 if (prpl_info->join_chat != NULL) { | |
7223 account = purple_connection_get_account(gc); | 7227 account = purple_connection_get_account(gc); |
7224 break; | 7228 break; |
7225 } | 7229 } |
7226 } | 7230 } |
7227 | 7231 |
7261 data->chat_data.rq_data.sg, data->alias_entry, | 7265 data->chat_data.rq_data.sg, data->alias_entry, |
7262 TRUE, NULL); | 7266 TRUE, NULL); |
7263 if (name != NULL) | 7267 if (name != NULL) |
7264 gtk_widget_grab_focus(data->alias_entry); | 7268 gtk_widget_grab_focus(data->alias_entry); |
7265 | 7269 |
7266 data->group_combo = pidgin_text_combo_box_entry_new(group ? group->name : NULL, groups_tree()); | 7270 data->group_combo = pidgin_text_combo_box_entry_new(group ? purple_group_get_name(group) : NULL, groups_tree()); |
7267 pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Group:"), | 7271 pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Group:"), |
7268 data->chat_data.rq_data.sg, data->group_combo, | 7272 data->chat_data.rq_data.sg, data->group_combo, |
7269 TRUE, NULL); | 7273 TRUE, NULL); |
7270 | 7274 |
7271 data->autojoin = gtk_check_button_new_with_mnemonic(_("Auto_join when account connects.")); | 7275 data->autojoin = gtk_check_button_new_with_mnemonic(_("Auto_join when account connects.")); |
7418 if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) | 7422 if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) |
7419 continue; | 7423 continue; |
7420 | 7424 |
7421 chat = (PurpleChat *)cnode; | 7425 chat = (PurpleChat *)cnode; |
7422 | 7426 |
7423 if(chat->account != account) | 7427 if(purple_chat_get_account(chat) != account) |
7424 continue; | 7428 continue; |
7425 | 7429 |
7426 if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin")) | 7430 if (purple_blist_node_get_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin")) |
7427 serv_join_chat(gc, chat->components); | 7431 serv_join_chat(gc, purple_chat_get_components(chat)); |
7428 } | 7432 } |
7429 } | 7433 } |
7430 | 7434 |
7431 /* Stop processing; we handled the autojoins. */ | 7435 /* Stop processing; we handled the autojoins. */ |
7432 return TRUE; | 7436 return TRUE; |
7439 return &handle; | 7443 return &handle; |
7440 } | 7444 } |
7441 | 7445 |
7442 static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy) | 7446 static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy) |
7443 { | 7447 { |
7444 struct _pidgin_blist_node *gtknode = ((PurpleBlistNode*)buddy)->ui_data; | 7448 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); |
7445 | 7449 |
7446 gtknode->recent_signonoff = FALSE; | 7450 gtknode->recent_signonoff = FALSE; |
7447 gtknode->recent_signonoff_timer = 0; | 7451 gtknode->recent_signonoff_timer = 0; |
7448 | 7452 |
7449 pidgin_blist_update(NULL, (PurpleBlistNode*)buddy); | 7453 pidgin_blist_update(NULL, PURPLE_BLIST_NODE(buddy)); |
7450 | 7454 |
7451 return FALSE; | 7455 return FALSE; |
7452 } | 7456 } |
7453 | 7457 |
7454 static void buddy_signonoff_cb(PurpleBuddy *buddy) | 7458 static void buddy_signonoff_cb(PurpleBuddy *buddy) |
7455 { | 7459 { |
7456 struct _pidgin_blist_node *gtknode; | 7460 struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); |
7457 | 7461 |
7458 if(!((PurpleBlistNode*)buddy)->ui_data) { | 7462 if(!gtknode) { |
7459 pidgin_blist_new_node((PurpleBlistNode*)buddy); | 7463 pidgin_blist_new_node(PURPLE_BLIST_NODE(buddy)); |
7460 } | 7464 } |
7461 | 7465 |
7462 gtknode = ((PurpleBlistNode*)buddy)->ui_data; | 7466 gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); |
7463 | 7467 |
7464 gtknode->recent_signonoff = TRUE; | 7468 gtknode->recent_signonoff = TRUE; |
7465 | 7469 |
7466 if(gtknode->recent_signonoff_timer > 0) | 7470 if(gtknode->recent_signonoff_timer > 0) |
7467 purple_timeout_remove(gtknode->recent_signonoff_timer); | 7471 purple_timeout_remove(gtknode->recent_signonoff_timer); |
7824 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 7828 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
7825 PurpleBlistNode *n; | 7829 PurpleBlistNode *n; |
7826 PurpleBuddy *buddy; | 7830 PurpleBuddy *buddy; |
7827 for (n = node->child; n; n = n->next) { | 7831 for (n = node->child; n; n = n->next) { |
7828 buddy = (PurpleBuddy*)n; | 7832 buddy = (PurpleBuddy*)n; |
7829 activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); | 7833 activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); |
7830 } | 7834 } |
7831 buddy_name = purple_contact_get_alias((PurpleContact*)node); | 7835 buddy_name = purple_contact_get_alias((PurpleContact*)node); |
7832 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { | 7836 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { |
7833 /* we don't have a reliable way of getting the log filename | 7837 /* we don't have a reliable way of getting the log filename |
7834 * from the chat info in the blist, yet */ | 7838 * from the chat info in the blist, yet */ |
7860 this_log_activity_score = 0; | 7864 this_log_activity_score = 0; |
7861 | 7865 |
7862 if(PURPLE_BLIST_NODE_IS_CONTACT(n)) { | 7866 if(PURPLE_BLIST_NODE_IS_CONTACT(n)) { |
7863 for (n2 = n->child; n2; n2 = n2->next) { | 7867 for (n2 = n->child; n2; n2 = n2->next) { |
7864 buddy = (PurpleBuddy*)n2; | 7868 buddy = (PurpleBuddy*)n2; |
7865 this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); | 7869 this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); |
7866 } | 7870 } |
7867 this_buddy_name = purple_contact_get_alias((PurpleContact*)n); | 7871 this_buddy_name = purple_contact_get_alias((PurpleContact*)n); |
7868 } else { | 7872 } else { |
7869 this_buddy_name = NULL; | 7873 this_buddy_name = NULL; |
7870 } | 7874 } |
8082 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); | 8086 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); |
8083 | 8087 |
8084 pidgin_separator(submenu); | 8088 pidgin_separator(submenu); |
8085 | 8089 |
8086 gc = purple_account_get_connection(account); | 8090 gc = purple_account_get_connection(account); |
8087 plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; | 8091 plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? purple_connection_get_prpl(gc) : NULL; |
8088 prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL; | 8092 prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL; |
8089 | 8093 |
8090 if (prpl_info && | 8094 if (prpl_info && |
8091 (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) || | 8095 (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) || |
8092 PURPLE_PLUGIN_HAS_ACTIONS(plugin))) { | 8096 PURPLE_PLUGIN_HAS_ACTIONS(plugin))) { |
8093 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) && | 8097 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) && |
8094 gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { | 8098 (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS)) { |
8095 | 8099 |
8096 if (purple_account_get_status(account, "mood")) { | 8100 if (purple_account_get_status(account, "mood")) { |
8097 menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood...")); | 8101 menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood...")); |
8098 g_signal_connect(G_OBJECT(menuitem), "activate", | 8102 g_signal_connect(G_OBJECT(menuitem), "activate", |
8099 G_CALLBACK(set_mood_cb), account); | 8103 G_CALLBACK(set_mood_cb), account); |