pidgin.next.minor: 490036a7: Patch from Stefan Ott to add the account...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Jan 8 23:45:42 EST 2011


----------------------------------------------------------------------
Revision: 490036a7b4ce807cb851ded91af7d959fe1c029e
Parent:   7b0fb4f2e8b153a4459630e96103b68c07cc5c11
Author:   rekkanoryo at pidgin.im
Date:     01/08/11 23:40:07
Branch:   im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/490036a7b4ce807cb851ded91af7d959fe1c029e

Changelog: 

Patch from Stefan Ott to add the account-authorization-requested-with-message
signal, which can be useful to plugins.  Fixes #8690.  I also slipped in some
ChangeLog.API tweaks.

Changes against parent 7b0fb4f2e8b153a4459630e96103b68c07cc5c11

  patched  ChangeLog.API
  patched  doc/account-signals.dox
  patched  libpurple/account.c
  patched  libpurple/account.h
  patched  libpurple/signals.c
  patched  libpurple/signals.h

-------------- next part --------------
============================================================
--- libpurple/account.c	fc325241ba835c68c655ad8fff1f3e9e5ac39033
+++ libpurple/account.c	45bda46b184aff23682d6880c95063dc43ead7a3
@@ -1441,6 +1441,27 @@ purple_account_request_authorization(Pur
 		return NULL;
 	}
 
+	plugin_return = GPOINTER_TO_INT(
+			purple_signal_emit_return_1(
+				purple_accounts_get_handle(),
+				"account-authorization-requested-with-message",
+				account, remote_user, message
+			));
+
+	switch (plugin_return)
+	{
+		case PURPLE_ACCOUNT_RESPONSE_IGNORE:
+			return NULL;
+		case PURPLE_ACCOUNT_RESPONSE_ACCEPT:
+			if (auth_cb != NULL)
+				auth_cb(user_data);
+			return NULL;
+		case PURPLE_ACCOUNT_RESPONSE_DENY:
+			if (deny_cb != NULL)
+				deny_cb(user_data);
+			return NULL;
+	}
+
 	if (ui_ops != NULL && ui_ops->request_authorize != NULL) {
 		info            = g_new0(PurpleAccountRequestInfo, 1);
 		info->type      = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION;
@@ -3046,6 +3067,13 @@ purple_accounts_init(void)
 										PURPLE_SUBTYPE_ACCOUNT),
 						purple_value_new(PURPLE_TYPE_STRING));
 
+	purple_signal_register(handle, "account-authorization-requested-with-message",
+						purple_marshal_INT__POINTER_POINTER_POINTER,
+						purple_value_new(PURPLE_TYPE_INT), 3,
+						purple_value_new(PURPLE_TYPE_SUBTYPE,
+										PURPLE_SUBTYPE_ACCOUNT),
+						purple_value_new(PURPLE_TYPE_STRING),
+						purple_value_new(PURPLE_TYPE_STRING));
 	purple_signal_register(handle, "account-authorization-denied",
 						purple_marshal_VOID__POINTER_POINTER, NULL, 2,
 						purple_value_new(PURPLE_TYPE_SUBTYPE,
============================================================
--- libpurple/account.h	7a5280dd166fe18d8674819f38bb21cff6603c94
+++ libpurple/account.h	3743247032c341ceb4ddfa1af1acbe06aae108d4
@@ -59,6 +59,16 @@ typedef enum
 	PURPLE_ACCOUNT_REQUEST_AUTHORIZATION = 0 /* Account authorization request */
 } PurpleAccountRequestType;
 
+/**
+ * Account request response types
+ */
+typedef enum
+{
+	PURPLE_ACCOUNT_RESPONSE_IGNORE = -2,
+	PURPLE_ACCOUNT_RESPONSE_DENY = -1,
+	PURPLE_ACCOUNT_RESPONSE_PASS = 0,
+	PURPLE_ACCOUNT_RESPONSE_ACCEPT = 1
+} PurpleAccountRequestResponse;
 
 /**  Account UI operations, used to notify the user of status changes and when
  *   buddies add this account to their buddy lists.
============================================================
--- libpurple/signals.c	be5e86f2a278e717e7988b33967f3eda2950fa0d
+++ libpurple/signals.c	8d02037a6c2156f4a5e1b9b385f6136523f937da
@@ -818,6 +818,21 @@ purple_marshal_INT__POINTER_POINTER(Purp
 		*return_val = GINT_TO_POINTER(ret_val);
 }
 
+	void
+purple_marshal_INT__POINTER_POINTER_POINTER(
+		PurpleCallback cb, va_list args, void *data, void **return_val)
+{
+	gint ret_val;
+	void *arg1 = va_arg(args, void *);
+	void *arg2 = va_arg(args, void *);
+	void *arg3 = va_arg(args, void *);
+
+	ret_val = ((gint (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data);
+
+	if (return_val != NULL)
+		*return_val = GINT_TO_POINTER(ret_val);
+}
+
 void
 purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER(
 		PurpleCallback cb, va_list args, void *data, void **return_val)
============================================================
--- libpurple/signals.h	ea6e3f00018c125e2d80df2ffd7245343808ef21
+++ libpurple/signals.h	4cb0cf1b95e0df574d71f483d56383fc0648ee95
@@ -330,6 +330,8 @@ void purple_marshal_INT__POINTER_POINTER
 		PurpleCallback cb, va_list args, void *data, void **return_val);
 void purple_marshal_INT__POINTER_POINTER(
 		PurpleCallback cb, va_list args, void *data, void **return_val);
+void purple_marshal_INT__POINTER_POINTER_POINTER(
+		PurpleCallback cb, va_list args, void *data, void **return_val);
 void purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER(
 		PurpleCallback cb, va_list args, void *data, void **return_val);
 
============================================================
--- doc/account-signals.dox	237592d9ef1adb82ff1a881fb64c3f82e6d62ede
+++ doc/account-signals.dox	fbbda66b6dee3f472ede95693a40404d5d6bcad1
@@ -14,6 +14,7 @@
   @signal account-actions-changed
   @signal account-alias-changed
   @signal account-authorization-requested
+  @signal account-authorization-requested-with-message
   @signal account-authorization-denied
   @signal account-authorization-granted
   @signal account-error-changed
@@ -158,6 +159,23 @@ int (*account_authorization_requested)(P
   @since 2.3.0
  @endsignaldef
 
+ @signaldef account-authorization-requested-with-message
+  @signalproto
+int (*account_authorization_requested)(PurpleAccount *account, const char *user, const char *message);
+  @endsignalproto
+  @signaldesc
+   Emitted when a user requests authorization.
+  @param account The account.
+  @param user    The name of the user requesting authorization.
+  @param message The authorization request message
+  @return PURPLE_ACCOUNT_RESPONSE_IGNORE to silently ignore the request,
+          PURPLE_ACCOUNT_RESPONSE_DENY to block the request (the sender might
+          get informed, PURPLE_ACCOUNT_RESPONSE_ACCEPT if the request should be
+          granted. If PURPLE_ACCOUNT_RESPONSE_PASS is returned, then the user
+          will be prompted with the request.
+  @since 2.8.0
+ @endsignaldef
+
  @signaldef account-authorization-denied
   @signalproto
 void (*account_authorization_denied)(PurpleAccount *account, const char *user);
============================================================
--- ChangeLog.API	fa536d28b58828f2726d591ad92b84696fd8f4d6
+++ ChangeLog.API	1be7120f814480d34f360708470ccf5e1beff19d
@@ -3,11 +3,13 @@ version 2.8.0 (??/??/????):
 version 2.8.0 (??/??/????):
 	libpurple:
 		Added:
+		* account-authorization-requested-with-message signal (Stefan Ott)
+		  (#8690)
 		* purple_notify_user_info_add_pair_plaintext
 		* purple_media_get_active_local_candidates
 		* purple_media_get_active_remote_candidates
-		* purple_media_manager_get_video_caps (Jakub Adam)
-		* purple_media_manager_set_video_caps (Jakub Adam)
+		* purple_media_manager_get_video_caps (Jakub Adam) (#13095)
+		* purple_media_manager_set_video_caps (Jakub Adam) (#13095)
 
 	Pidgin:
 		Added:


More information about the Commits mailing list