pidgin: 798f83c0: account: Add copies of connection signed...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Mon Apr 12 00:09:31 EDT 2010


-----------------------------------------------------------------
Revision: 798f83c08c517ab0e8bbd39b8d6654541ba66656
Ancestor: 40dca581f0e3d66f108176cb100ff915cfcf28a2
Author: yonas.yanfa at gmail.com
Date: 2010-04-12T03:55:07
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/798f83c08c517ab0e8bbd39b8d6654541ba66656

Modified files:
        COPYRIGHT ChangeLog.API libpurple/account.c

ChangeLog: 

account: Add copies of connection signed-(on|off) and connection-error.

These are useful for D-Bus, where a program has no ability to figure out
what account correlates to a signed-off or connection-error signal without
tracking (before-hand) the association with account and connection id 
(by the time the program tries to call purple_connection_get_account, the
gc is destroyed).  Fixes #11130.

Patch from Yonas Yanfa (I fixed a few issues and moved it all to account.c)

-------------- next part --------------
============================================================
--- COPYRIGHT	ce931300be3fdc9fb720d51b0fa5a22de4d63b55
+++ COPYRIGHT	fea48277ec2273255c1b3dde92b72e7240382dd2
@@ -546,6 +546,7 @@ Ma Xuan
 Justin Wood
 Ximian
 Ma Xuan
+Yonas Yanfa
 Jared Yanovich
 Timmy Yee
 Li Yuan
============================================================
--- ChangeLog.API	5ad213e1c28066ca0f3c73006af4a703ea87b387
+++ ChangeLog.API	0f5f0089ca95e07b311d9eef31188f0d40027843
@@ -3,6 +3,10 @@ version 2.7.0 (??/??/????):
 version 2.7.0 (??/??/????):
 	libpurple:
 		Added:
+		* Account signals (see account-signals.dox); useful for D-Bus
+		   * account-signed-on
+		   * account-signed-off
+		   * account-connection-error
 		* purple_account_get_name_for_display
 		* purple_buddy_get_media_caps
 		* purple_buddy_set_media_caps
============================================================
--- libpurple/account.c	fc6101405dcb2d2d858eb7b95e67075c6ffff291
+++ libpurple/account.c	0599960d2855dbaf4b6ad3b37bc030662591d222
@@ -2510,9 +2510,22 @@ signed_on_cb(PurpleConnection *gc,
 {
 	PurpleAccount *account = purple_connection_get_account(gc);
 	purple_account_clear_current_error(account);
+
+	purple_signal_emit(purple_accounts_get_handle(), "account-signed-on",
+	                   account);
 }
 
 static void
+signed_off_cb(PurpleConnection *gc,
+              gpointer unused)
+{
+	PurpleAccount *account = purple_connection_get_account(gc);
+
+	purple_signal_emit(purple_accounts_get_handle(), "account-signed-off",
+	                   account);
+}
+
+static void
 set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err)
 {
 	PurpleAccountPrivate *priv;
@@ -2560,6 +2573,9 @@ connection_error_cb(PurpleConnection *gc
 	err->description = g_strdup(description);
 
 	set_current_error(account, err);
+
+	purple_signal_emit(purple_accounts_get_handle(), "account-connection-error",
+	                   account, type, description);
 }
 
 const PurpleConnectionErrorInfo *
@@ -2901,8 +2917,27 @@ purple_accounts_init(void)
 	                       purple_value_new(PURPLE_TYPE_POINTER),
 	                       purple_value_new(PURPLE_TYPE_POINTER));
 
+	purple_signal_register(handle, "account-signed-on",
+	                       purple_marshal_VOID__POINTER, NULL, 1,
+	                       purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                        PURPLE_SUBTYPE_ACCOUNT));
+
+	purple_signal_register(handle, "account-signed-off",
+	                       purple_marshal_VOID__POINTER, NULL, 1,
+	                       purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                        PURPLE_SUBTYPE_ACCOUNT));
+
+	purple_signal_register(handle, "account-connection-error",
+	                       purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3,
+	                       purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                        PURPLE_SUBTYPE_ACCOUNT),
+	                       purple_value_new(PURPLE_TYPE_ENUM),
+	                       purple_value_new(PURPLE_TYPE_STRING));
+
 	purple_signal_connect(conn_handle, "signed-on", handle,
 	                      PURPLE_CALLBACK(signed_on_cb), NULL);
+	purple_signal_connect(conn_handle, "signed-off", handle,
+	                      PURPLE_CALLBACK(signed_off_cb), NULL);
 	purple_signal_connect(conn_handle, "connection-error", handle,
 	                      PURPLE_CALLBACK(connection_error_cb), NULL);
 


More information about the Commits mailing list