/pidgin/main: 0819d40769c8: Add a message to the authorization c...

Elliott Sales de Andrade qulogic at pidgin.im
Sun Jan 27 05:57:49 EST 2013


Changeset: 0819d40769c80b54965b2139f7e9757995360e6f
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-01-26 02:46 -0500
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/0819d40769c8

Description:

Add a message to the authorization callbacks.

diffstat:

 finch/gntaccount.c                        |   4 ++--
 libpurple/account.c                       |  12 ++++++------
 libpurple/account.h                       |   5 +++--
 libpurple/protocols/jabber/presence.c     |   4 ++--
 libpurple/protocols/msn/userlist.c        |   4 ++--
 libpurple/protocols/mxit/roster.c         |   4 ++--
 libpurple/protocols/oscar/authorization.c |  19 ++++---------------
 libpurple/protocols/yahoo/libymsg.c       |  25 ++++---------------------
 pidgin/gtkaccount.c                       |   4 ++--
 9 files changed, 27 insertions(+), 54 deletions(-)

diffs (290 lines):

diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -1036,7 +1036,7 @@ free_auth_and_add(auth_and_add *aa)
 static void
 authorize_and_add_cb(auth_and_add *aa)
 {
-	aa->auth_cb(aa->data);
+	aa->auth_cb(NULL, aa->data);
 	purple_blist_request_add_buddy(aa->account, aa->username,
 	 	                    NULL, aa->alias);
 }
@@ -1044,7 +1044,7 @@ authorize_and_add_cb(auth_and_add *aa)
 static void
 deny_no_add_cb(auth_and_add *aa)
 {
-	aa->deny_cb(aa->data);
+	aa->deny_cb(NULL, aa->data);
 }
 
 static void *
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -1378,14 +1378,14 @@ purple_account_request_close(void *ui_ha
 }
 
 static void
-request_auth_cb(void *data)
+request_auth_cb(const char *message, void *data)
 {
 	PurpleAccountRequestInfo *info = data;
 
 	handles = g_list_remove(handles, info);
 
 	if (info->auth_cb != NULL)
-		info->auth_cb(info->userdata);
+		info->auth_cb(message, info->userdata);
 
 	purple_signal_emit(purple_accounts_get_handle(),
 			"account-authorization-granted", info->account, info->user);
@@ -1394,14 +1394,14 @@ request_auth_cb(void *data)
 }
 
 static void
-request_deny_cb(void *data)
+request_deny_cb(const char *message, void *data)
 {
 	PurpleAccountRequestInfo *info = data;
 
 	handles = g_list_remove(handles, info);
 
 	if (info->deny_cb != NULL)
-		info->deny_cb(info->userdata);
+		info->deny_cb(message, info->userdata);
 
 	purple_signal_emit(purple_accounts_get_handle(),
 			"account-authorization-denied", info->account, info->user);
@@ -1436,11 +1436,11 @@ purple_account_request_authorization(Pur
 			return NULL;
 		case PURPLE_ACCOUNT_RESPONSE_ACCEPT:
 			if (auth_cb != NULL)
-				auth_cb(user_data);
+				auth_cb(NULL, user_data);
 			return NULL;
 		case PURPLE_ACCOUNT_RESPONSE_DENY:
 			if (deny_cb != NULL)
-				deny_cb(user_data);
+				deny_cb(NULL, user_data);
 			return NULL;
 	}
 
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -36,7 +36,7 @@ typedef struct _PurpleAccountUiOps Purpl
 typedef struct _PurpleAccount      PurpleAccount;
 
 typedef gboolean (*PurpleFilterAccountFunc)(PurpleAccount *account);
-typedef void (*PurpleAccountRequestAuthorizationCb)(void *);
+typedef void (*PurpleAccountRequestAuthorizationCb)(const char *, void *);
 typedef void (*PurpleAccountRegistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data);
 typedef void (*PurpleAccountUnregistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data);
 typedef void (*PurpleSetPublicAliasSuccessCallback)(PurpleAccount *account, const char *new_alias);
@@ -97,7 +97,8 @@ struct _PurpleAccountUiOps
 
 	/** Prompt for authorization when someone adds this account to their buddy
 	 * list.  To authorize them to see this account's presence, call \a
-	 * authorize_cb (\a user_data); otherwise call \a deny_cb (\a user_data);
+	 * authorize_cb (\a message, \a user_data); otherwise call
+	 * \a deny_cb (\a message, \a user_data);
 	 * @return a UI-specific handle, as passed to #close_account_request.
 	 */
 	void *(*request_authorize)(PurpleAccount *account,
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -384,7 +384,7 @@ struct _jabber_add_permit {
 	char *who;
 };
 
-static void authorize_add_cb(gpointer data)
+static void authorize_add_cb(const char *message, gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
 	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
@@ -394,7 +394,7 @@ static void authorize_add_cb(gpointer da
 	g_free(jap);
 }
 
-static void deny_add_cb(gpointer data)
+static void deny_add_cb(const char *message, gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
 	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
diff --git a/libpurple/protocols/msn/userlist.c b/libpurple/protocols/msn/userlist.c
--- a/libpurple/protocols/msn/userlist.c
+++ b/libpurple/protocols/msn/userlist.c
@@ -46,7 +46,7 @@ typedef struct
  * Callbacks
  **************************************************************************/
 static void
-msn_accept_add_cb(gpointer data)
+msn_accept_add_cb(const char *message, gpointer data)
 {
 	MsnPermitAdd *pa = data;
 
@@ -71,7 +71,7 @@ msn_accept_add_cb(gpointer data)
 }
 
 static void
-msn_cancel_add_cb(gpointer data)
+msn_cancel_add_cb(const char *message, gpointer data)
 {
 	MsnPermitAdd *pa = data;
 
diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c
--- a/libpurple/protocols/mxit/roster.c
+++ b/libpurple/protocols/mxit/roster.c
@@ -583,7 +583,7 @@ void mxit_update_blist( struct MXitSessi
  *
  *  @param user_data	Object associated with the invite
  */
-static void mxit_cb_buddy_auth( gpointer user_data )
+static void mxit_cb_buddy_auth( const char *message, gpointer user_data )
 {
 	struct contact_invite*	invite	= (struct contact_invite*) user_data;
 
@@ -612,7 +612,7 @@ static void mxit_cb_buddy_auth( gpointer
  *
  *  @param user_data	Object associated with the invite
  */
-static void mxit_cb_buddy_deny( gpointer user_data )
+static void mxit_cb_buddy_deny( const char *message, gpointer user_data )
 {
 	struct contact_invite*	invite	= (struct contact_invite*) user_data;
 
diff --git a/libpurple/protocols/oscar/authorization.c b/libpurple/protocols/oscar/authorization.c
--- a/libpurple/protocols/oscar/authorization.c
+++ b/libpurple/protocols/oscar/authorization.c
@@ -67,7 +67,7 @@ oscar_auth_sendrequest(PurpleConnection 
 }
 
 static void
-oscar_auth_grant(gpointer cbdata)
+oscar_auth_grant(const char *message, gpointer cbdata)
 {
 	struct name_data *data = cbdata;
 	PurpleConnection *gc = data->gc;
@@ -79,8 +79,9 @@ oscar_auth_grant(gpointer cbdata)
 }
 
 static void
-oscar_auth_dontgrant(struct name_data *data, char *msg)
+oscar_auth_dontgrant(const char *msg, gpointer cbdata)
 {
+	struct name_data *data = cbdata;
 	PurpleConnection *gc = data->gc;
 	OscarData *od = purple_connection_get_protocol_data(gc);
 
@@ -89,18 +90,6 @@ oscar_auth_dontgrant(struct name_data *d
 	oscar_free_name_data(data);
 }
 
-static void
-oscar_auth_dontgrant_msgprompt(gpointer cbdata)
-{
-	struct name_data *data = cbdata;
-	purple_request_input(data->gc, NULL, _("Authorization Denied Message:"),
-					   NULL, _("No reason given."), TRUE, FALSE, NULL,
-					   _("_OK"), G_CALLBACK(oscar_auth_dontgrant),
-					   _("_Cancel"), G_CALLBACK(oscar_free_name_data),
-					   purple_connection_get_account(data->gc), data->name, NULL,
-					   data);
-}
-
 void
 oscar_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored)
 {
@@ -127,5 +116,5 @@ oscar_auth_recvrequest(PurpleConnection 
 
 	purple_account_request_authorization(account, data->name, NULL, data->nick,
 		reason, purple_find_buddy(account, data->name) != NULL,
-		oscar_auth_grant, oscar_auth_dontgrant_msgprompt, data);
+		oscar_auth_grant, oscar_auth_dontgrant, data);
 }
diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c
--- a/libpurple/protocols/yahoo/libymsg.c
+++ b/libpurple/protocols/yahoo/libymsg.c
@@ -1197,7 +1197,7 @@ struct yahoo_add_request {
 };
 
 static void
-yahoo_buddy_add_authorize_cb(gpointer data)
+yahoo_buddy_add_authorize_cb(const char *message, gpointer data)
 {
 	struct yahoo_add_request *add_req = data;
 	struct yahoo_packet *pkt;
@@ -1230,7 +1230,7 @@ yahoo_buddy_add_authorize_cb(gpointer da
 }
 
 static void
-yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg)
+yahoo_buddy_add_deny_cb(const char *msg, struct yahoo_add_request *add_req)
 {
 	YahooData *yd = purple_connection_get_protocol_data(add_req->gc);
 	struct yahoo_packet *pkt;
@@ -1274,23 +1274,6 @@ yahoo_buddy_add_deny_cb(struct yahoo_add
 	g_free(add_req);
 }
 
-static void
-yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg)
-{
-	yahoo_buddy_add_deny_cb(add_req, NULL);
-}
-
-static void
-yahoo_buddy_add_deny_reason_cb(gpointer data) {
-	struct yahoo_add_request *add_req = data;
-	purple_request_input(add_req->gc, NULL, _("Authorization denied message:"),
-			NULL, _("No reason given."), TRUE, FALSE, NULL,
-			_("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb),
-			_("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb),
-			purple_connection_get_account(add_req->gc), add_req->who, NULL,
-			add_req);
-}
-
 static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason)
 {
 	char *notify_msg;
@@ -1453,7 +1436,7 @@ static void yahoo_buddy_auth_req_15(Purp
 					alias, dec_msg,
 					purple_find_buddy(account, add_req->who) != NULL,
 					yahoo_buddy_add_authorize_cb,
-					yahoo_buddy_add_deny_reason_cb,
+					yahoo_buddy_add_deny_cb,
 					add_req);
 			g_free(alias);
 			g_free(dec_msg);
@@ -1518,7 +1501,7 @@ static void yahoo_buddy_added_us(PurpleC
 				NULL, dec_msg,
 				purple_find_buddy(account,add_req->who) != NULL,
 						yahoo_buddy_add_authorize_cb,
-						yahoo_buddy_add_deny_reason_cb, add_req);
+						yahoo_buddy_add_deny_cb, add_req);
 		g_free(dec_msg);
 	} else {
 		g_free(add_req->id);
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -2585,7 +2585,7 @@ free_auth_request(struct auth_request *a
 static void
 authorize_and_add_cb(struct auth_request *ar)
 {
-	ar->auth_cb(ar->data);
+	ar->auth_cb(NULL, ar->data);
 	if (ar->add_buddy_after_auth) {
 		purple_blist_request_add_buddy(ar->account, ar->username, NULL, ar->alias);
 	}
@@ -2594,7 +2594,7 @@ authorize_and_add_cb(struct auth_request
 static void
 deny_no_add_cb(struct auth_request *ar)
 {
-	ar->deny_cb(ar->data);
+	ar->deny_cb(NULL, ar->data);
 }
 
 static gboolean



More information about the Commits mailing list