changeset 29711:87b166bd3760

merge of '512105f86bd25c63994d1ab26ed4d4998773c923' and 'a65c9ee5c5782d7276caae4991630797f79a2ce8'
author Mark Doliner <mark@kingant.net>
date Mon, 12 Apr 2010 06:49:00 +0000
parents 0417d6bc47cd (diff) ac49f12cddeb (current diff)
children 48e15c705add
files
diffstat 4 files changed, 74 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Mon Apr 12 06:48:14 2010 +0000
+++ b/COPYRIGHT	Mon Apr 12 06:49:00 2010 +0000
@@ -546,6 +546,7 @@
 Justin Wood
 Ximian
 Ma Xuan
+Yonas Yanfa
 Jared Yanovich
 Timmy Yee
 Li Yuan
--- a/ChangeLog.API	Mon Apr 12 06:48:14 2010 +0000
+++ b/ChangeLog.API	Mon Apr 12 06:49:00 2010 +0000
@@ -3,6 +3,10 @@
 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
--- a/doc/account-signals.dox	Mon Apr 12 06:48:14 2010 +0000
+++ b/doc/account-signals.dox	Mon Apr 12 06:49:00 2010 +0000
@@ -17,6 +17,9 @@
   @signal account-authorization-denied
   @signal account-authorization-granted
   @signal account-error-changed
+  @signal account-signed-on
+  @signal account-signed-off
+  @signal account-connection-error
  @endsignals
 
  @see account.h
@@ -196,5 +199,36 @@
   @since 2.3.0
  @endsignaldef
 
+ @signaldef account-signed-on
+  @signalproto
+void (*signed_on)(PurpleAccount *account);
+  @endsignalproto
+  @signaldesc
+   Emitted when an account has signed on.
+  @param account The account that has signed on.
+  @since 2.7.0
+ @endsignaldef
+
+ @signaldef account-signed-off
+  @signalproto
+void (*signed_off)(PurpleAccount *account);
+  @endsignalproto
+  @signaldesc
+   Emitted when an account has signed off.
+  @param account The account that has signed off.
+  @since 2.7.0
+ @endsignaldef
+
+ @signaldef account-connection-error
+  @signalproto
+void (*connection_error)(PurpleAccount *gc, PurpleConnectionError err, const gchar *desc)
+  @endsignalproto
+  @signaldesc
+   Emitted when a connection error occurs, before @ref signed-off.
+   @param account The account on which the error has occurred
+   @param err     The error that occurred
+   @param desc    A description of the error, giving more information.
+  @since 2.7.0
+ @endsignaldef
  */
 // vim: syntax=c.doxygen tw=75 et
--- a/libpurple/account.c	Mon Apr 12 06:48:14 2010 +0000
+++ b/libpurple/account.c	Mon Apr 12 06:49:00 2010 +0000
@@ -2510,6 +2510,19 @@
 {
 	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
@@ -2560,6 +2573,9 @@
 	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_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);