finch/gntblist.c

branch
soc.2013.gobjectification.plugins
changeset 36632
1f0650e7b1b5
parent 36626
18fc361b3704
child 36688
e49025233301
equal deleted inserted replaced
36631:972b9fbb3690 36632:1f0650e7b1b5
741 if (!group || !*group) 741 if (!group || !*group)
742 group = _("Chats"); 742 group = _("Chats");
743 743
744 gc = purple_account_get_connection(account); 744 gc = purple_account_get_connection(account);
745 protocol = purple_connection_get_protocol(gc); 745 protocol = purple_connection_get_protocol(gc);
746 if (protocol->chat_info_defaults != NULL) 746 hash = purple_protocol_iface_chat_info_defaults(protocol, gc, name);
747 hash = purple_protocol_iface_chat_info_defaults(protocol, gc, name);
748 747
749 chat = purple_chat_new(account, name, hash); 748 chat = purple_chat_new(account, name, hash);
750 749
751 if (chat != NULL) { 750 if (chat != NULL) {
752 if ((grp = purple_blist_find_group(group)) == NULL) { 751 if ((grp = purple_blist_find_group(group)) == NULL) {
1062 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) 1061 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node)
1063 { 1062 {
1064 GList *list; 1063 GList *list;
1065 PurpleProtocol *protocol = purple_connection_get_protocol(gc); 1064 PurpleProtocol *protocol = purple_connection_get_protocol(gc);
1066 1065
1067 if(!protocol || !protocol->blist_node_menu) 1066 if(!protocol || !PURPLE_PROTOCOL_IMPLEMENTS(protocol, blist_node_menu))
1068 return; 1067 return;
1069 1068
1070 for(list = purple_protocol_iface_blist_node_menu(protocol, node); list; 1069 for(list = purple_protocol_iface_blist_node_menu(protocol, node); list;
1071 list = g_list_delete_link(list, list)) 1070 list = g_list_delete_link(list, list))
1072 { 1071 {
1124 PurpleConnection *gc; 1123 PurpleConnection *gc;
1125 1124
1126 purple_request_fields_add_group(fields, group); 1125 purple_request_fields_add_group(fields, group);
1127 1126
1128 gc = purple_account_get_connection(purple_chat_get_account(chat)); 1127 gc = purple_account_get_connection(purple_chat_get_account(chat));
1129 parts = purple_connection_get_protocol(gc)->chat_info(gc); 1128 parts = purple_protocol_iface_chat_info(purple_connection_get_protocol(gc), gc);
1130 1129
1131 for (iter = parts; iter; iter = iter->next) { 1130 for (iter = parts; iter; iter = iter->next) {
1132 pce = iter->data; 1131 pce = iter->data;
1133 if (pce->is_int) { 1132 if (pce->is_int) {
1134 int val; 1133 int val;
1276 GntMenuItem *item; 1275 GntMenuItem *item;
1277 PurpleProtocol *protocol; 1276 PurpleProtocol *protocol;
1278 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); 1277 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
1279 1278
1280 protocol = purple_connection_get_protocol(gc); 1279 protocol = purple_connection_get_protocol(gc);
1281 if (protocol && protocol->get_info) 1280 if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, get_info))
1282 { 1281 {
1283 add_custom_action(menu, _("Get Info"), 1282 add_custom_action(menu, _("Get Info"),
1284 PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy); 1283 PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy);
1285 } 1284 }
1286 1285
1287 add_custom_action(menu, _("Add Buddy Pounce"), 1286 add_custom_action(menu, _("Add Buddy Pounce"),
1288 PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy); 1287 PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy);
1289 1288
1290 if (protocol && protocol->send_file) 1289 if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, send_file))
1291 { 1290 {
1292 if (!protocol->can_receive_file || 1291 if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, can_receive_file) ||
1293 purple_protocol_iface_can_receive_file(protocol, gc, purple_buddy_get_name(buddy))) 1292 purple_protocol_iface_can_receive_file(protocol, gc, purple_buddy_get_name(buddy)))
1294 add_custom_action(menu, _("Send File"), 1293 add_custom_action(menu, _("Send File"),
1295 PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy); 1294 PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy);
1296 } 1295 }
1297 1296
1414 PurpleChat *c = (PurpleChat*) node; 1413 PurpleChat *c = (PurpleChat*) node;
1415 PurpleProtocol *protocol = NULL; 1414 PurpleProtocol *protocol = NULL;
1416 type = PURPLE_LOG_CHAT; 1415 type = PURPLE_LOG_CHAT;
1417 account = purple_chat_get_account(c); 1416 account = purple_chat_get_account(c);
1418 protocol = purple_protocols_find(purple_account_get_protocol_id(account)); 1417 protocol = purple_protocols_find(purple_account_get_protocol_id(account));
1419 if (protocol && protocol->get_chat_name) { 1418 if (protocol) {
1420 name = purple_protocol_iface_get_chat_name(protocol, purple_chat_get_components(c)); 1419 name = purple_protocol_iface_get_chat_name(protocol, purple_chat_get_components(c));
1421 } 1420 }
1422 } else if (PURPLE_IS_CONTACT(node)) { 1421 } else if (PURPLE_IS_CONTACT(node)) {
1423 finch_log_show_contact((PurpleContact *)node); 1422 finch_log_show_contact((PurpleContact *)node);
1424 return; 1423 return;
1736 purple_account_get_protocol_name(account)); 1735 purple_account_get_protocol_name(account));
1737 purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp); 1736 purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp);
1738 g_free(tmp); 1737 g_free(tmp);
1739 1738
1740 protocol = purple_protocols_find(purple_account_get_protocol_id(account)); 1739 protocol = purple_protocols_find(purple_account_get_protocol_id(account));
1741 if (protocol && protocol->tooltip_text) { 1740 if (protocol) {
1742 purple_protocol_iface_tooltip_text(protocol, buddy, user_info, full); 1741 purple_protocol_iface_tooltip_text(protocol, buddy, user_info, full);
1743 } 1742 }
1744 1743
1745 if (purple_prefs_get_bool("/finch/blist/idletime")) { 1744 if (purple_prefs_get_bool("/finch/blist/idletime")) {
1746 PurplePresence *pre = purple_buddy_get_presence(buddy); 1745 PurplePresence *pre = purple_buddy_get_presence(buddy);
2611 2610
2612 if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc)) 2611 if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc))
2613 continue; 2612 continue;
2614 protocol = purple_connection_get_protocol(gc); 2613 protocol = purple_connection_get_protocol(gc);
2615 2614
2616 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, get_actions)) { 2615 if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, get_actions)) {
2617 item = gnt_menuitem_new(purple_account_get_username(account)); 2616 item = gnt_menuitem_new(purple_account_get_username(account));
2618 gnt_menu_add_item(GNT_MENU(sub), item); 2617 gnt_menu_add_item(GNT_MENU(sub), item);
2619 build_protocol_actions(item, protocol, gc); 2618 build_protocol_actions(item, protocol, gc);
2620 } 2619 }
2621 } 2620 }
2815 } 2814 }
2816 2815
2817 chat = purple_blist_find_chat(account, name); 2816 chat = purple_blist_find_chat(account, name);
2818 if (chat == NULL) { 2817 if (chat == NULL) {
2819 PurpleProtocol *protocol = purple_connection_get_protocol(gc); 2818 PurpleProtocol *protocol = purple_connection_get_protocol(gc);
2820 if (protocol->chat_info_defaults != NULL) 2819 hash = purple_protocol_iface_chat_info_defaults(protocol, gc, name);
2821 hash = purple_protocol_iface_chat_info_defaults(protocol, gc, name);
2822 } else { 2820 } else {
2823 hash = purple_chat_get_components(chat); 2821 hash = purple_chat_get_components(chat);
2824 } 2822 }
2825 serv_join_chat(gc, hash); 2823 serv_join_chat(gc, hash);
2826 if (chat == NULL && hash != NULL) 2824 if (chat == NULL && hash != NULL)

mercurial