Mercurial > pidgin
changeset 23362:30b5f145a0f7
merge of 'ba3f5db0711c5a3b7c5b5510df2e5e3ae5adbbc3'
and 'dab5669243bb3c1e57f6a22b430a4804cb65e582'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sat, 14 Jun 2008 00:59:35 +0000 |
parents | da78db9f188f (diff) bc3ecda40397 (current diff) |
children | 576528012cce |
files | libpurple/protocols/jabber/libxmpp.c |
diffstat | 6 files changed, 55 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Sat Jun 14 00:59:09 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Jun 14 00:59:35 2008 +0000 @@ -1793,22 +1793,6 @@ } } -void jabber_buddy_get_info_chat(PurpleConnection *gc, int id, - const char *resource) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat = jabber_chat_find_by_id(js, id); - char *full_jid; - - if(!chat) - return; - - full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, resource); - jabber_buddy_get_info_for_jid(js, full_jid); - g_free(full_jid); -} - - static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, gboolean invisible) {
--- a/libpurple/protocols/jabber/buddy.h Sat Jun 14 00:59:09 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.h Sat Jun 14 00:59:35 2008 +0000 @@ -96,8 +96,6 @@ void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource); const char *jabber_buddy_get_status_msg(JabberBuddy *jb); void jabber_buddy_get_info(PurpleConnection *gc, const char *who); -void jabber_buddy_get_info_chat(PurpleConnection *gc, int id, - const char *resource); GList *jabber_blist_node_menu(PurpleBlistNode *node);
--- a/libpurple/protocols/jabber/chat.c Sat Jun 14 00:59:09 2008 +0000 +++ b/libpurple/protocols/jabber/chat.c Sat Jun 14 00:59:35 2008 +0000 @@ -342,12 +342,18 @@ { JabberStream *js = gc->proto_data; JabberChat *chat; + JabberChatMember *jcm; chat = jabber_chat_find_by_id(js, id); if(!chat) return NULL; + jcm = g_hash_table_lookup(chat->members, who); + if (jcm != NULL && jcm->jid) + return g_strdup(jcm->jid); + + return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); }
--- a/libpurple/protocols/jabber/libxmpp.c Sat Jun 14 00:59:09 2008 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Sat Jun 14 00:59:35 2008 +0000 @@ -89,7 +89,7 @@ jabber_message_send_chat, /* chat_send */ jabber_keepalive, /* keepalive */ jabber_register_account, /* register_user */ - jabber_buddy_get_info_chat, /* get_cb_info */ + NULL, /* get_cb_info */ NULL, /* get_cb_away */ jabber_roster_alias_change, /* alias_buddy */ jabber_roster_group_change, /* group_buddy */
--- a/pidgin/gtkconv.c Sat Jun 14 00:59:09 2008 +0000 +++ b/pidgin/gtkconv.c Sat Jun 14 00:59:35 2008 +0000 @@ -1481,7 +1481,7 @@ PurpleAccount *account; PurpleConnection *gc; PurplePluginProtocolInfo *prpl_info = NULL; - char *real_who; + gchar *real_who = NULL; account = purple_conversation_get_account(conv); g_return_if_fail(account != NULL); @@ -1494,13 +1494,11 @@ if (prpl_info && prpl_info->get_cb_real_name) real_who = prpl_info->get_cb_real_name(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); - else - real_who = g_strdup(who); - - if(!real_who) + + if(!who && !real_who) return; - pidgin_dialogs_im_with_user(account, real_who); + pidgin_dialogs_im_with_user(account, real_who ? real_who : who); g_free(real_who); } @@ -1539,11 +1537,22 @@ static void menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) { + PurplePluginProtocolInfo *prpl_info; PurpleConversation *conv = gtkconv->active_conv; const char *who = g_object_get_data(G_OBJECT(w), "user_data"); PurpleConnection *gc = purple_conversation_get_gc(conv); - - serv_send_file(gc, who, NULL); + gchar *real_who = NULL; + + g_return_if_fail(gc != NULL); + + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + + if (prpl_info && prpl_info->get_cb_real_name) + real_who = prpl_info->get_cb_real_name(gc, + purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); + + serv_send_file(gc, real_who ? real_who : who, NULL); + g_free(real_who); } static void @@ -1659,23 +1668,34 @@ if (gc == NULL) gtk_widget_set_sensitive(button, FALSE); - - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); + else + g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); if (prpl_info && prpl_info->send_file) { + gboolean can_receive_file = TRUE; + button = pidgin_new_item_from_stock(menu, _("Send File"), PIDGIN_STOCK_TOOLBAR_SEND_FILE, G_CALLBACK(menu_chat_send_file_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); - if (gc == NULL || prpl_info == NULL || - !(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) - { + if (gc == NULL || prpl_info == NULL) + can_receive_file = FALSE; + else { + gchar *real_who = NULL; + if (prpl_info->get_cb_real_name) + real_who = prpl_info->get_cb_real_name(gc, + purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); + if (!(!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, real_who ? real_who : who))) + can_receive_file = FALSE; + g_free(real_who); + } + + if (!can_receive_file) gtk_widget_set_sensitive(button, FALSE); - } - - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); + else + g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } @@ -1688,8 +1708,8 @@ if (gc == NULL) gtk_widget_set_sensitive(button, FALSE); - - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); + else + g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } if (prpl_info && (prpl_info->get_info || prpl_info->get_cb_info)) { @@ -1698,8 +1718,8 @@ if (gc == NULL) gtk_widget_set_sensitive(button, FALSE); - - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); + else + g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } if (prpl_info && prpl_info->get_cb_away) { @@ -1708,8 +1728,8 @@ if (gc == NULL) gtk_widget_set_sensitive(button, FALSE); - - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); + else + g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { @@ -1722,8 +1742,8 @@ if (gc == NULL) gtk_widget_set_sensitive(button, FALSE); - - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); + else + g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } button = pidgin_new_item_from_stock(menu, _("Last said"), GTK_STOCK_INDEX,
--- a/pidgin/gtkutils.c Sat Jun 14 00:59:09 2008 +0000 +++ b/pidgin/gtkutils.c Sat Jun 14 00:59:35 2008 +0000 @@ -1001,13 +1001,14 @@ } prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl); + if (prpl_info != NULL && prpl_info->get_cb_real_name) + who = prpl_info->get_cb_real_name(conn, chat, name); if (prpl_info == NULL || prpl_info->get_cb_info == NULL) { - pidgin_retrieve_user_info(conn, name); + pidgin_retrieve_user_info(conn, who ? who : name); + g_free(who); return; } - if (prpl_info->get_cb_real_name) - who = prpl_info->get_cb_real_name(conn, chat, name); show_retrieveing_info(conn, who ? who : name); prpl_info->get_cb_info(conn, chat, name); g_free(who);