changeset 11628:e1e47878d0ed

[gaim-migrate @ 13903] sadrul's patch, updated by charkins, to remove the old account-away signal and replace it with account-status-changed committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sat, 08 Oct 2005 19:27:13 +0000
parents 5dbefebb20cb
children f18930698b5c
files doc/account-signals.dox plugins/signals-test.c src/account.c src/prpl.c
diffstat 4 files changed, 36 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/doc/account-signals.dox	Sat Oct 08 18:21:48 2005 +0000
+++ b/doc/account-signals.dox	Sat Oct 08 19:27:13 2005 +0000
@@ -1,26 +1,15 @@
 /** @page account-signals Account Signals
 
  @signals
-  @signal account-away
   @signal account-connecting
   @signal account-setting-info
   @signal account-set-info
   @signal account-warned
+  @signal account-status-changed
  @endsignals
 
  <hr>
 
- @signaldef account-away
-  @signalproto
-void (*account_away)(GaimAccount *account, const char *state, const char *message);
-  @endsignalproto
-  @signaldesc
-   Emitted when an account goes away.
-  @param account The account that went away.
-  @param state   The away state.
-  @param message The away message.
- @endsignaldef
-
  @signaldef account-connecting
   @signalproto
 void (*account_connecting)(GaimAccount *account);
@@ -62,5 +51,16 @@
   @param level   The new warning level.
  @endsignaldef
 
+ @signaldef account-status-changed
+  @signalproto
+void (*account_status_changed)(GaimAccount *account, GaimStatus *old, GaimStatus *new);
+  @endsignalproto
+  @signaldesc
+   Emitted when the status of an account changes (after the change).
+  @param account The account that changed status.
+  @param old     The status before change.
+  @param new     The status after change.
+ @endsignaldef
+
  */
 // vim: syntax=c tw=75 et
--- a/plugins/signals-test.c	Sat Oct 08 18:21:48 2005 +0000
+++ b/plugins/signals-test.c	Sat Oct 08 19:27:13 2005 +0000
@@ -31,6 +31,7 @@
 #include "ft.h"
 #include "signals.h"
 #include "version.h"
+#include "status.h"
 
 /**************************************************************************
  * Account subsystem signal callbacks
@@ -43,14 +44,6 @@
 }
 
 static void
-account_away_cb(GaimAccount *account, const char *state,
-				const char *message, void *data)
-{
-	gaim_debug_misc("signals test", "account-away (%s, %s, %s)\n",
-					gaim_account_get_username(account), state, message);
-}
-
-static void
 account_setting_info_cb(GaimAccount *account, const char *info, void *data)
 {
 	gaim_debug_misc("signals test", "account-setting-info (%s, %s)\n",
@@ -64,6 +57,16 @@
 					gaim_account_get_username(account), info);
 }
 
+static void
+account_status_changed(GaimAccount *account, GaimStatus *old, GaimStatus *new,
+						gpointer data)
+{
+	gaim_debug_misc("signals test", "account-status-changed (%s, %s, %s)\n",
+					gaim_account_get_username(account),
+					gaim_status_get_name(old),
+					gaim_status_get_name(new));
+}
+
 /**************************************************************************
  * Buddy Icons signal callbacks
  **************************************************************************/
@@ -563,12 +566,12 @@
 	/* Accounts subsystem signals */
 	gaim_signal_connect(accounts_handle, "account-connecting",
 						plugin, GAIM_CALLBACK(account_connecting_cb), NULL);
-	gaim_signal_connect(accounts_handle, "account-away",
-						plugin, GAIM_CALLBACK(account_away_cb), NULL);
 	gaim_signal_connect(accounts_handle, "account-setting-info",
 						plugin, GAIM_CALLBACK(account_setting_info_cb), NULL);
 	gaim_signal_connect(accounts_handle, "account-set-info",
 						plugin, GAIM_CALLBACK(account_set_info_cb), NULL);
+	gaim_signal_connect(accounts_handle, "account-status-changed",
+						plugin, GAIM_CALLBACK(account_status_changed), NULL);
 
 	/* Buddy Icon subsystem signals */
 	gaim_signal_connect(buddy_icons_handle, "buddy-icon-cached",
--- a/src/account.c	Sat Oct 08 18:21:48 2005 +0000
+++ b/src/account.c	Sat Oct 08 19:27:13 2005 +0000
@@ -2101,13 +2101,6 @@
 						 gaim_value_new(GAIM_TYPE_SUBTYPE,
 										GAIM_SUBTYPE_ACCOUNT));
 
-	gaim_signal_register(handle, "account-away",
-						 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_ACCOUNT),
-						 gaim_value_new(GAIM_TYPE_STRING),
-						 gaim_value_new(GAIM_TYPE_STRING));
-
 	gaim_signal_register(handle, "account-setting-info",
 						 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
 						 gaim_value_new(GAIM_TYPE_SUBTYPE,
@@ -2128,6 +2121,13 @@
 						 gaim_marshal_VOID__POINTER, NULL, 1,
 						 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT));
 
+	gaim_signal_register(handle, "account-status-changed",
+						 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_ACCOUNT),
+						 gaim_value_new(GAIM_TYPE_POINTER),
+						 gaim_value_new(GAIM_TYPE_POINTER));
+	
 	load_accounts();
 
 }
--- a/src/prpl.c	Sat Oct 08 18:21:48 2005 +0000
+++ b/src/prpl.c	Sat Oct 08 19:27:13 2005 +0000
@@ -297,7 +297,11 @@
 	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
 
 	if (prpl_info->set_status != NULL)
+	{
 		prpl_info->set_status(account, new_status);
+		gaim_signal_emit(gaim_accounts_get_handle(), "account-status-changed",
+						account, old_status, new_status);
+	}
 }
 
 GList *