Mercurial > pidgin.yaz
changeset 24960:df25f88ff22a
merge of '391fafa6e18ef27d4b95b4ba37421c35e08caa25'
and 'de9498ef83a6077f5f72e1e2f9edbffeb5b33008'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 14 Jan 2009 02:50:54 +0000 |
parents | 73e88188a7d4 (current diff) 051fe71c3d8f (diff) |
children | 23bb3a96d8ea ff5e2356683f 53e01bb40cff |
files | |
diffstat | 1 files changed, 29 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/gg/gg.c Tue Jan 13 23:13:32 2009 +0000 +++ b/libpurple/protocols/gg/gg.c Wed Jan 14 02:50:54 2009 +0000 @@ -755,18 +755,29 @@ /* ----- CONFERENCES ---------------------------------------------------- */ -static void ggp_callback_add_to_chat_ok(PurpleConnection *gc, PurpleRequestFields *fields) +static void ggp_callback_add_to_chat_ok(PurpleBuddy *buddy, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info; + PurpleConnection *conn; PurpleRequestField *field; - /* TODO: sel may be null. */ GList *sel; + conn = purple_account_get_connection(purple_buddy_get_account(buddy)); + + g_return_if_fail(conn != NULL); + + info = conn->proto_data; + field = purple_request_fields_get_field(fields, "name"); sel = purple_request_field_list_get_selected(field); - ggp_confer_participants_add_uin(gc, sel->data, info->tmp_buddy); - info->tmp_buddy = 0; + if (sel == NULL) { + purple_debug_error("gg", "No chat selected\n"); + return; + } + + ggp_confer_participants_add_uin(conn, sel->data, + ggp_str_to_uin(purple_buddy_get_name(buddy))); } static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) @@ -786,9 +797,6 @@ gc = purple_account_get_connection(purple_buddy_get_account(buddy)); info = gc->proto_data; - /* TODO: It tmp_buddy != 0 then stop! */ - info->tmp_buddy = ggp_str_to_uin(purple_buddy_get_name(buddy)); - fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); purple_request_fields_add_group(fields, group); @@ -796,8 +804,7 @@ field = purple_request_field_list_new("name", "Chat name"); for (l = info->chats; l != NULL; l = l->next) { GGPChat *chat = l->data; - purple_request_field_list_add(field, g_strdup(chat->name), - g_strdup(chat->name)); + purple_request_field_list_add(field, chat->name, chat->name); } purple_request_field_group_add_field(group, field); @@ -810,8 +817,8 @@ fields, _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); + purple_connection_get_account(gc), NULL, NULL, + buddy); g_free(msg); } @@ -1699,14 +1706,20 @@ { PurpleMenuAction *act; GList *m = NULL; + PurpleAccount *account; + GGPInfo *info; if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) return NULL; - act = purple_menu_action_new(_("Add to chat"), - PURPLE_CALLBACK(ggp_bmenu_add_to_chat), - NULL, NULL); - m = g_list_append(m, act); + account = purple_buddy_get_account((PurpleBuddy *) node); + info = purple_account_get_connection(account)->proto_data; + if (info->chats) { + act = purple_menu_action_new(_("Add to chat"), + PURPLE_CALLBACK(ggp_bmenu_add_to_chat), + NULL, NULL); + m = g_list_append(m, act); + } /* Using a blist node boolean here is also wrong. * Once the Block and Unblock actions are added to the core,