# HG changeset patch # User Sadrul Habib Chowdhury # Date 1180166884 0 # Node ID 464840043c66f74f11b4f5e844295c029f4cdf46 # Parent e83972691531d0ed44d656d925c26d6fb0cc4317 Show information about the user requesting authorization. diff -r e83972691531 -r 464840043c66 finch/gntaccount.c --- a/finch/gntaccount.c Fri May 25 22:45:43 2007 +0000 +++ b/finch/gntaccount.c Sat May 26 08:08:04 2007 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ #include #include "gntaccount.h" +#include "gntblist.h" #include "finch.h" #include @@ -850,25 +852,25 @@ } auth_and_add; static void -authorize_and_add_cb(auth_and_add *aa) +free_auth_and_add(auth_and_add *aa) { - aa->auth_cb(aa->data); - purple_blist_request_add_buddy(aa->account, aa->username, - NULL, aa->alias); - g_free(aa->username); g_free(aa->alias); g_free(aa); } static void +authorize_and_add_cb(auth_and_add *aa) +{ + aa->auth_cb(aa->data); + purple_blist_request_add_buddy(aa->account, aa->username, + NULL, aa->alias); +} + +static void deny_no_add_cb(auth_and_add *aa) { aa->deny_cb(aa->data); - - g_free(aa->username); - g_free(aa->alias); - g_free(aa); } static void * @@ -898,18 +900,37 @@ (message != NULL ? message : "")); if (!on_list) { auth_and_add *aa = g_new(auth_and_add, 1); + GntWidget *widget; aa->auth_cb = (PurpleAccountRequestAuthorizationCb)auth_cb; aa->deny_cb = (PurpleAccountRequestAuthorizationCb)deny_cb; aa->data = user_data; aa->username = g_strdup(remote_user); aa->alias = g_strdup(alias); aa->account = account; - uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, + + uihandle = gnt_vwindow_new(FALSE); + gnt_box_set_title(GNT_BOX(uihandle), _("Authorize buddy?")); + gnt_box_set_pad(GNT_BOX(uihandle), 0); + + widget = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, PURPLE_DEFAULT_ACTION_NONE, account, remote_user, NULL, aa, 2, _("Authorize"), authorize_and_add_cb, _("Deny"), deny_no_add_cb); + gnt_screen_release(widget); + gnt_box_set_toplevel(GNT_BOX(widget), FALSE); + gnt_box_add_widget(GNT_BOX(uihandle), widget); + + gnt_box_add_widget(GNT_BOX(uihandle), gnt_hline_new()); + + widget = finch_retrieve_user_info(account->gc, remote_user); + gnt_box_set_toplevel(GNT_BOX(widget), FALSE); + gnt_screen_release(widget); + gnt_box_add_widget(GNT_BOX(uihandle), widget); + gnt_widget_show(uihandle); + + g_signal_connect_swapped(G_OBJECT(uihandle), "destroy", G_CALLBACK(free_auth_and_add), aa); } else { uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL, PURPLE_DEFAULT_ACTION_NONE, diff -r e83972691531 -r 464840043c66 finch/gntblist.c --- a/finch/gntblist.c Fri May 25 22:45:43 2007 +0000 +++ b/finch/gntblist.c Sat May 26 08:08:04 2007 +0000 @@ -824,14 +824,16 @@ PURPLE_CALLBACK(finch_add_group), group); } -void finch_retrieve_user_info(PurpleConnection *conn, const char *name) +gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name) { PurpleNotifyUserInfo *info = purple_notify_user_info_new(); + gpointer uihandle; purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); - purple_notify_userinfo(conn, name, info, NULL, NULL); + uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL); purple_notify_user_info_destroy(info); serv_get_info(conn, name); + return uihandle; } static void diff -r e83972691531 -r 464840043c66 finch/gntblist.h --- a/finch/gntblist.h Fri May 25 22:45:43 2007 +0000 +++ b/finch/gntblist.h Sat May 26 08:08:04 2007 +0000 @@ -95,8 +95,10 @@ * * @param conn The connection to get information fro * @param name The user to get information about. + * + * @return Returns the ui-handle for the userinfo notification. */ -void finch_retrieve_user_info(PurpleConnection *conn, const char *name); +gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name); /*@}*/ diff -r e83972691531 -r 464840043c66 finch/gntnotify.c --- a/finch/gntnotify.c Fri May 25 22:45:43 2007 +0000 +++ b/finch/gntnotify.c Sat May 26 08:08:04 2007 +0000 @@ -268,11 +268,11 @@ char *strip = purple_markup_strip_html(info); int tvw, tvh, width, height, ntvw, ntvh; + while (GNT_WIDGET(ui_handle)->parent) + ui_handle = GNT_WIDGET(ui_handle)->parent; gnt_widget_get_size(GNT_WIDGET(ui_handle), &width, &height); gnt_widget_get_size(GNT_WIDGET(msg), &tvw, &tvh); - /* Ideally, I would replace the information in "info". But replacing tagged text is a - * bit nasty right now. So clear the view and add the new stuff instead. */ gnt_text_view_clear(msg); gnt_text_view_append_text_with_flags(msg, strip, GNT_TEXT_FLAG_NORMAL); gnt_text_view_scroll(msg, 0); @@ -280,7 +280,7 @@ ntvw += 3; ntvh++; - gnt_screen_resize_widget(GNT_WIDGET(ui_handle), width + (ntvw - tvw), height + (ntvh - tvh)); + gnt_screen_resize_widget(GNT_WIDGET(ui_handle), width + MAX(0, ntvw - tvw), height + MAX(0, ntvh - tvh)); g_free(strip); g_free(key); } else {