# HG changeset patch # User Sadrul Habib Chowdhury # Date 1180041316 0 # Node ID 319bcb73eb4e53ba3480d8954e132e064594b053 # Parent 5241d388f463997d8582fd1d0e574c8ee8bd9cba Use utility functions to get user info. Closes #964. diff -r 5241d388f463 -r 319bcb73eb4e ChangeLog.API --- a/ChangeLog.API Thu May 24 20:35:07 2007 +0000 +++ b/ChangeLog.API Thu May 24 21:15:16 2007 +0000 @@ -4,6 +4,8 @@ Added: * purple_conversation_get_extended_menu * purple_conversation_do_command + * pidgin_retrieve_user_info, shows immediate feedback when getting + information about a user. Changed: * pidgin_separator returns the separator added to the menu. @@ -11,6 +13,9 @@ Signals - Added: (See the Doxygen docs for details on all signals.) * "conversation-extended-menu" + Finch - Added: + * finch_retrieve_user_info + version 2.0.0 (5/3/2007): Please note all functions, defines, and data structures have been re-namespaced to match the new names of Pidgin, Finch, and libpurple. diff -r 5241d388f463 -r 319bcb73eb4e finch/gntblist.c --- a/finch/gntblist.c Thu May 24 20:35:07 2007 +0000 +++ b/finch/gntblist.c Thu May 24 21:15:16 2007 +0000 @@ -824,17 +824,20 @@ PURPLE_CALLBACK(finch_add_group), group); } +void finch_retrieve_user_info(PurpleConnection *conn, const char *name) +{ + PurpleNotifyUserInfo *info = purple_notify_user_info_new(); + purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); + purple_notify_userinfo(conn, name, info, NULL, NULL); + purple_notify_user_info_destroy(info); + + serv_get_info(conn, name); +} + static void finch_blist_get_buddy_info_cb(PurpleBuddy *buddy, PurpleBlistNode *selected) { - /* Add a userinfo with a "Retrieving information", which will later be updated - * when the server finally returns the information. */ - PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); - purple_notify_userinfo(buddy->account->gc, purple_buddy_get_name(buddy), info, NULL, NULL); - purple_notify_user_info_destroy(info); - - serv_get_info(buddy->account->gc, purple_buddy_get_name(buddy)); + finch_retrieve_user_info(buddy->account->gc, purple_buddy_get_name(buddy)); } static void diff -r 5241d388f463 -r 319bcb73eb4e finch/gntblist.h --- a/finch/gntblist.h Thu May 24 20:35:07 2007 +0000 +++ b/finch/gntblist.h Thu May 24 21:15:16 2007 +0000 @@ -90,6 +90,14 @@ */ void finch_blist_set_size(int width, int height); +/** + * Get information about a user. Show immediate feedback. + * + * @param conn The connection to get information fro + * @param name The user to get information about. + */ +void finch_retrieve_user_info(PurpleConnection *conn, const char *name); + /*@}*/ #endif diff -r 5241d388f463 -r 319bcb73eb4e finch/gntconv.c --- a/finch/gntconv.c Thu May 24 20:35:07 2007 +0000 +++ b/finch/gntconv.c Thu May 24 21:15:16 2007 +0000 @@ -313,12 +313,7 @@ get_info_cb(GntMenuItem *item, gpointer ggconv) { FinchConv *ggc = ggconv; - PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); - purple_notify_userinfo(ggc->active_conv->account->gc, purple_conversation_get_name(ggc->active_conv), info, NULL, NULL); - purple_notify_user_info_destroy(info); - - serv_get_info(purple_conversation_get_gc(ggc->active_conv), + finch_retrieve_user_info(purple_conversation_get_gc(ggc->active_conv), purple_conversation_get_name(ggc->active_conv)); } diff -r 5241d388f463 -r 319bcb73eb4e pidgin/gtkblist.c --- a/pidgin/gtkblist.c Thu May 24 20:35:07 2007 +0000 +++ b/pidgin/gtkblist.c Thu May 24 21:15:16 2007 +0000 @@ -274,12 +274,7 @@ static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b) { - PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); - purple_notify_userinfo(b->account->gc, purple_buddy_get_name(b), info, NULL, NULL); - purple_notify_user_info_destroy(info); - - serv_get_info(b->account->gc, b->name); + pidgin_retrieve_user_info(b->account->gc, purple_buddy_get_name(b)); } static void gtk_blist_menu_im_cb(GtkWidget *w, PurpleBuddy *b) @@ -1147,7 +1142,8 @@ } static gboolean -gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) { +gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) +{ PurpleBlistNode *node; GValue val; GtkTreeIter iter; @@ -1174,7 +1170,7 @@ return FALSE; } if(buddy) - serv_get_info(buddy->account->gc, buddy->name); + pidgin_retrieve_user_info(buddy->account->gc, buddy->name); } else if (event->keyval == GDK_F2) { gtk_blist_menu_alias_cb(tv, node); } @@ -1428,7 +1424,7 @@ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl && prpl_info->get_info) - serv_get_info(b->account->gc, b->name); + pidgin_retrieve_user_info(b->account->gc, b->name); handled = TRUE; } diff -r 5241d388f463 -r 319bcb73eb4e pidgin/gtkconv.c --- a/pidgin/gtkconv.c Thu May 24 20:35:07 2007 +0000 +++ b/pidgin/gtkconv.c Thu May 24 21:15:16 2007 +0000 @@ -673,14 +673,8 @@ PurpleConversation *conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); - purple_notify_userinfo(conv->account->gc, purple_conversation_get_name(conv), info, NULL, NULL); - purple_notify_user_info_destroy(info); - - serv_get_info(purple_conversation_get_gc(conv), + pidgin_retrieve_user_info(purple_conversation_get_gc(conv), purple_conversation_get_name(conv)); - gtk_widget_grab_focus(gtkconv->entry); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* Get info of the person currently selected in the GtkTreeView */ diff -r 5241d388f463 -r 319bcb73eb4e pidgin/gtkdialogs.c --- a/pidgin/gtkdialogs.c Thu May 24 20:35:07 2007 +0000 +++ b/pidgin/gtkdialogs.c Thu May 24 21:15:16 2007 +0000 @@ -823,7 +823,7 @@ found = pidgin_dialogs_ee(username); if (!found && username != NULL && *username != '\0' && account != NULL) - serv_get_info(purple_account_get_connection(account), username); + pidgin_retrieve_user_info(purple_account_get_connection(account), username); g_free(username); } diff -r 5241d388f463 -r 319bcb73eb4e pidgin/gtkutils.c --- a/pidgin/gtkutils.c Thu May 24 20:35:07 2007 +0000 +++ b/pidgin/gtkutils.c Thu May 24 21:15:16 2007 +0000 @@ -947,6 +947,15 @@ g_free(filename); } +void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name) +{ + PurpleNotifyUserInfo *info = purple_notify_user_info_new(); + purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); + purple_notify_userinfo(conn, name, info, NULL, NULL); + purple_notify_user_info_destroy(info); + serv_get_info(conn, name); +} + gboolean pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, PurpleAccount **ret_account, char **ret_protocol, diff -r 5241d388f463 -r 319bcb73eb4e pidgin/gtkutils.h --- a/pidgin/gtkutils.h Thu May 24 20:35:07 2007 +0000 +++ b/pidgin/gtkutils.h Thu May 24 21:15:16 2007 +0000 @@ -309,6 +309,14 @@ void pidgin_load_accels(void); /** + * Get information about a user. Show immediate feedback. + * + * @param conn The connection to get information from. + * @param name The user to get information about. + */ +void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name); + +/** * Parses an application/x-im-contact MIME message and returns the * data inside. *