diff libpurple/account.c @ 26845:76a1598ecf1c

Add account-(created|destroying) signals. These differ from account-(added|removed) in that they're called at allocation/destruction time instead of when adding the account to the account.c-scoped accounts list (nullclient doesn't call purple_accounts_add). For 3.0.0, barring complaints, it might be reasonable to remove purple_accounts_add and fold purple_accounts_remove into purple_accounts_delete and drop their signals.
author Paul Aurich <paul@darkrain42.org>
date Fri, 01 May 2009 06:59:36 +0000
parents 83e6e710cbf3
children 8290e36a5a73
line wrap: on
line diff
--- a/libpurple/account.c	Thu Apr 30 14:44:01 2009 +0000
+++ b/libpurple/account.c	Fri May 01 06:59:36 2009 +0000
@@ -954,6 +954,8 @@
 	/* 0 is not a valid privacy setting */
 	account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL;
 
+	purple_signal_emit(purple_accounts_get_handle(), "account-created", account);
+
 	prpl = purple_find_prpl(protocol_id);
 
 	if (prpl == NULL)
@@ -987,6 +989,7 @@
 	g_return_if_fail(account != NULL);
 
 	purple_debug_info("account", "Destroying account %p\n", account);
+	purple_signal_emit(purple_accounts_get_handle(), "account-destroying", account);
 
 	for (l = purple_get_conversations(); l != NULL; l = l->next)
 	{
@@ -2725,6 +2728,14 @@
 										PURPLE_SUBTYPE_ACCOUNT),
 						 purple_value_new(PURPLE_TYPE_STRING));
 
+	purple_signal_register(handle, "account-created",
+						 purple_marshal_VOID__POINTER, NULL, 1,
+						 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
+
+	purple_signal_register(handle, "account-destroying",
+						 purple_marshal_VOID__POINTER, NULL, 1,
+						 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));
+
 	purple_signal_register(handle, "account-added",
 						 purple_marshal_VOID__POINTER, NULL, 1,
 						 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT));