| 725 PurpleChat *chat; |
725 PurpleChat *chat; |
| 726 PurpleGroup *grp; |
726 PurpleGroup *grp; |
| 727 GHashTable *hash = NULL; |
727 GHashTable *hash = NULL; |
| 728 PurpleConnection *gc; |
728 PurpleConnection *gc; |
| 729 gboolean autojoin; |
729 gboolean autojoin; |
| 730 PurplePluginProtocolInfo *prpl_info; |
730 PurpleProtocol *protocol; |
| 731 |
731 |
| 732 account = purple_request_fields_get_account(allfields, "account"); |
732 account = purple_request_fields_get_account(allfields, "account"); |
| 733 name = purple_request_fields_get_string(allfields, "name"); |
733 name = purple_request_fields_get_string(allfields, "name"); |
| 734 alias = purple_request_fields_get_string(allfields, "alias"); |
734 alias = purple_request_fields_get_string(allfields, "alias"); |
| 735 group = purple_request_fields_get_string(allfields, "group"); |
735 group = purple_request_fields_get_string(allfields, "group"); |
| 740 |
740 |
| 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 prpl_info = purple_connection_get_protocol_info(gc); |
745 protocol = purple_connection_get_protocol_info(gc); |
| 746 if (prpl_info->chat_info_defaults != NULL) |
746 if (protocol->chat_info_defaults != NULL) |
| 747 hash = prpl_info->chat_info_defaults(gc, name); |
747 hash = protocol->chat_info_defaults(gc, name); |
| 748 |
748 |
| 749 chat = purple_chat_new(account, name, hash); |
749 chat = purple_chat_new(account, name, hash); |
| 750 |
750 |
| 751 if (chat != NULL) { |
751 if (chat != NULL) { |
| 752 if ((grp = purple_blist_find_group(group)) == NULL) { |
752 if ((grp = purple_blist_find_group(group)) == NULL) { |
| 1060 |
1060 |
| 1061 static void |
1061 static void |
| 1062 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) |
1062 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) |
| 1063 { |
1063 { |
| 1064 GList *list; |
1064 GList *list; |
| 1065 PurplePluginProtocolInfo *prpl_info = purple_connection_get_protocol_info(gc); |
1065 PurpleProtocol *protocol = purple_connection_get_protocol_info(gc); |
| 1066 |
1066 |
| 1067 if(!prpl_info || !prpl_info->blist_node_menu) |
1067 if(!protocol || !protocol->blist_node_menu) |
| 1068 return; |
1068 return; |
| 1069 |
1069 |
| 1070 for(list = prpl_info->blist_node_menu(node); list; |
1070 for(list = protocol->blist_node_menu(node); list; |
| 1071 list = g_list_delete_link(list, list)) |
1071 list = g_list_delete_link(list, list)) |
| 1072 { |
1072 { |
| 1073 PurpleMenuAction *act = (PurpleMenuAction *) list->data; |
1073 PurpleMenuAction *act = (PurpleMenuAction *) list->data; |
| 1074 if (!act) |
1074 if (!act) |
| 1075 continue; |
1075 continue; |
| 1272 create_buddy_menu(GntMenu *menu, PurpleBuddy *buddy) |
1272 create_buddy_menu(GntMenu *menu, PurpleBuddy *buddy) |
| 1273 { |
1273 { |
| 1274 PurpleAccount *account; |
1274 PurpleAccount *account; |
| 1275 gboolean permitted; |
1275 gboolean permitted; |
| 1276 GntMenuItem *item; |
1276 GntMenuItem *item; |
| 1277 PurplePluginProtocolInfo *prpl_info; |
1277 PurpleProtocol *protocol; |
| 1278 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
1278 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
| 1279 |
1279 |
| 1280 prpl_info = purple_connection_get_protocol_info(gc); |
1280 protocol = purple_connection_get_protocol_info(gc); |
| 1281 if (prpl_info && prpl_info->get_info) |
1281 if (protocol && protocol->get_info) |
| 1282 { |
1282 { |
| 1283 add_custom_action(menu, _("Get Info"), |
1283 add_custom_action(menu, _("Get Info"), |
| 1284 PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy); |
1284 PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy); |
| 1285 } |
1285 } |
| 1286 |
1286 |
| 1287 add_custom_action(menu, _("Add Buddy Pounce"), |
1287 add_custom_action(menu, _("Add Buddy Pounce"), |
| 1288 PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy); |
1288 PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy); |
| 1289 |
1289 |
| 1290 if (prpl_info && prpl_info->send_file) |
1290 if (protocol && protocol->send_file) |
| 1291 { |
1291 { |
| 1292 if (!prpl_info->can_receive_file || |
1292 if (!protocol->can_receive_file || |
| 1293 prpl_info->can_receive_file(gc, purple_buddy_get_name(buddy))) |
1293 protocol->can_receive_file(gc, purple_buddy_get_name(buddy))) |
| 1294 add_custom_action(menu, _("Send File"), |
1294 add_custom_action(menu, _("Send File"), |
| 1295 PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy); |
1295 PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy); |
| 1296 } |
1296 } |
| 1297 |
1297 |
| 1298 account = purple_buddy_get_account(buddy); |
1298 account = purple_buddy_get_account(buddy); |
| 1410 type = PURPLE_LOG_IM; |
1410 type = PURPLE_LOG_IM; |
| 1411 name = g_strdup(purple_buddy_get_name(b)); |
1411 name = g_strdup(purple_buddy_get_name(b)); |
| 1412 account = purple_buddy_get_account(b); |
1412 account = purple_buddy_get_account(b); |
| 1413 } else if (PURPLE_IS_CHAT(node)) { |
1413 } else if (PURPLE_IS_CHAT(node)) { |
| 1414 PurpleChat *c = (PurpleChat*) node; |
1414 PurpleChat *c = (PurpleChat*) node; |
| 1415 PurplePluginProtocolInfo *prpl_info = NULL; |
1415 PurpleProtocol *protocol = NULL; |
| 1416 type = PURPLE_LOG_CHAT; |
1416 type = PURPLE_LOG_CHAT; |
| 1417 account = purple_chat_get_account(c); |
1417 account = purple_chat_get_account(c); |
| 1418 prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
1418 protocol = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
| 1419 if (prpl_info && prpl_info->get_chat_name) { |
1419 if (protocol && protocol->get_chat_name) { |
| 1420 name = prpl_info->get_chat_name(purple_chat_get_components(c)); |
1420 name = protocol->get_chat_name(purple_chat_get_components(c)); |
| 1421 } |
1421 } |
| 1422 } else if (PURPLE_IS_CONTACT(node)) { |
1422 } else if (PURPLE_IS_CONTACT(node)) { |
| 1423 finch_log_show_contact((PurpleContact *)node); |
1423 finch_log_show_contact((PurpleContact *)node); |
| 1424 return; |
1424 return; |
| 1425 } else { |
1425 } else { |
| 1713 } |
1713 } |
| 1714 |
1714 |
| 1715 static void |
1715 static void |
| 1716 tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) |
1716 tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) |
| 1717 { |
1717 { |
| 1718 PurplePluginProtocolInfo *prpl_info; |
1718 PurpleProtocol *protocol; |
| 1719 PurpleAccount *account; |
1719 PurpleAccount *account; |
| 1720 PurpleNotifyUserInfo *user_info; |
1720 PurpleNotifyUserInfo *user_info; |
| 1721 PurplePresence *presence; |
1721 PurplePresence *presence; |
| 1722 const char *alias = purple_buddy_get_alias(buddy); |
1722 const char *alias = purple_buddy_get_alias(buddy); |
| 1723 char *tmp, *strip; |
1723 char *tmp, *strip; |
| 1735 purple_account_get_username(account), |
1735 purple_account_get_username(account), |
| 1736 purple_account_get_protocol_name(account)); |
1736 purple_account_get_protocol_name(account)); |
| 1737 purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp); |
1737 purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp); |
| 1738 g_free(tmp); |
1738 g_free(tmp); |
| 1739 |
1739 |
| 1740 prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
1740 protocol = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
| 1741 if (prpl_info && prpl_info->tooltip_text) { |
1741 if (protocol && protocol->tooltip_text) { |
| 1742 prpl_info->tooltip_text(buddy, user_info, full); |
1742 protocol->tooltip_text(buddy, user_info, full); |
| 1743 } |
1743 } |
| 1744 |
1744 |
| 1745 if (purple_prefs_get_bool("/finch/blist/idletime")) { |
1745 if (purple_prefs_get_bool("/finch/blist/idletime")) { |
| 1746 PurplePresence *pre = purple_buddy_get_presence(buddy); |
1746 PurplePresence *pre = purple_buddy_get_presence(buddy); |
| 1747 if (purple_presence_is_idle(pre)) { |
1747 if (purple_presence_is_idle(pre)) { |
| 2484 if (action && action->callback) |
2484 if (action && action->callback) |
| 2485 action->callback(action); |
2485 action->callback(action); |
| 2486 } |
2486 } |
| 2487 |
2487 |
| 2488 static void |
2488 static void |
| 2489 build_protocol_actions(GntMenuItem *item, PurplePluginProtocolInfo *prpl_info, |
2489 build_protocol_actions(GntMenuItem *item, PurpleProtocol *protocol, |
| 2490 PurpleConnection *gc) |
2490 PurpleConnection *gc) |
| 2491 { |
2491 { |
| 2492 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
2492 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); |
| 2493 GList *actions; |
2493 GList *actions; |
| 2494 GntMenuItem *menuitem; |
2494 GntMenuItem *menuitem; |
| 2495 |
2495 |
| 2496 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
2496 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); |
| 2497 for (actions = prpl_info->get_actions(gc); actions; |
2497 for (actions = protocol->get_actions(gc); actions; |
| 2498 actions = g_list_delete_link(actions, actions)) { |
2498 actions = g_list_delete_link(actions, actions)) { |
| 2499 if (actions->data) { |
2499 if (actions->data) { |
| 2500 PurpleProtocolAction *action = actions->data; |
2500 PurpleProtocolAction *action = actions->data; |
| 2501 action->connection = gc; |
2501 action->connection = gc; |
| 2502 menuitem = gnt_menuitem_new(action->label); |
2502 menuitem = gnt_menuitem_new(action->label); |
| 2605 |
2605 |
| 2606 for (iter = purple_accounts_get_all_active(); iter; |
2606 for (iter = purple_accounts_get_all_active(); iter; |
| 2607 iter = g_list_delete_link(iter, iter)) { |
2607 iter = g_list_delete_link(iter, iter)) { |
| 2608 PurpleAccount *account = iter->data; |
2608 PurpleAccount *account = iter->data; |
| 2609 PurpleConnection *gc = purple_account_get_connection(account); |
2609 PurpleConnection *gc = purple_account_get_connection(account); |
| 2610 PurplePluginProtocolInfo *prpl_info; |
2610 PurpleProtocol *protocol; |
| 2611 |
2611 |
| 2612 if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc)) |
2612 if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc)) |
| 2613 continue; |
2613 continue; |
| 2614 prpl_info = purple_connection_get_protocol_info(gc); |
2614 protocol = purple_connection_get_protocol_info(gc); |
| 2615 |
2615 |
| 2616 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_actions)) { |
2616 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, get_actions)) { |
| 2617 item = gnt_menuitem_new(purple_account_get_username(account)); |
2617 item = gnt_menuitem_new(purple_account_get_username(account)); |
| 2618 gnt_menu_add_item(GNT_MENU(sub), item); |
2618 gnt_menu_add_item(GNT_MENU(sub), item); |
| 2619 build_protocol_actions(item, prpl_info, gc); |
2619 build_protocol_actions(item, protocol, gc); |
| 2620 } |
2620 } |
| 2621 } |
2621 } |
| 2622 } |
2622 } |
| 2623 |
2623 |
| 2624 static void |
2624 static void |
| 2814 purple_conversation_present(PURPLE_CONVERSATION(conv)); |
2814 purple_conversation_present(PURPLE_CONVERSATION(conv)); |
| 2815 } |
2815 } |
| 2816 |
2816 |
| 2817 chat = purple_blist_find_chat(account, name); |
2817 chat = purple_blist_find_chat(account, name); |
| 2818 if (chat == NULL) { |
2818 if (chat == NULL) { |
| 2819 PurplePluginProtocolInfo *prpl_info = purple_connection_get_protocol_info(gc); |
2819 PurpleProtocol *protocol = purple_connection_get_protocol_info(gc); |
| 2820 if (prpl_info->chat_info_defaults != NULL) |
2820 if (protocol->chat_info_defaults != NULL) |
| 2821 hash = prpl_info->chat_info_defaults(gc, name); |
2821 hash = protocol->chat_info_defaults(gc, name); |
| 2822 } else { |
2822 } else { |
| 2823 hash = purple_chat_get_components(chat); |
2823 hash = purple_chat_get_components(chat); |
| 2824 } |
2824 } |
| 2825 serv_join_chat(gc, hash); |
2825 serv_join_chat(gc, hash); |
| 2826 if (chat == NULL && hash != NULL) |
2826 if (chat == NULL && hash != NULL) |