pidgin: 05d010cd: Add account-(created|destroying) signals...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Fri May 1 12:30:27 EDT 2009
-----------------------------------------------------------------
Revision: 05d010cd0d7eb6dffadd96bffd5396665ab43174
Ancestor: 8567515a55af9b920b1ff380fe95c5f9c138f4ec
Author: darkrain42 at pidgin.im
Date: 2009-05-01T06:59:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/05d010cd0d7eb6dffadd96bffd5396665ab43174
Modified files:
ChangeLog.API doc/account-signals.dox libpurple/account.c
ChangeLog:
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.
-------------- next part --------------
============================================================
--- ChangeLog.API 99b9a8724eeeacae75763222086da67e8a09d270
+++ ChangeLog.API 0a1a50aa1da396c399fbfbae4975fe844c28dcb2
@@ -9,7 +9,10 @@ version 2.6.0 (??/??/2009):
* PURPLE_CONTACT
* PURPLE_BUDDY
* PURPLE_CHAT
- * account-actions-changed (see account-signals.dox)
+ * Account signals (see account-signals.dox)
+ * account-actions-changed
+ * account-created
+ * account-destroying
* purple_buddy_destroy
* purple_buddy_get_protocol_data
* purple_buddy_set_protocol_data
============================================================
--- doc/account-signals.dox aa104adec82568d433a16c118e3f3f046ba54289
+++ doc/account-signals.dox 0d19c6172e97756bf58163090cafe91818c9a843
@@ -1,6 +1,8 @@
/** @page account-signals Account Signals
@signals
+ @signal account-created
+ @signal account-destroying
@signal account-added
@signal account-connecting
@signal account-removed
@@ -21,6 +23,26 @@
<hr>
+ @signaldef account-created
+ @signalproto
+void (*account_created)(PurpleAccount *account);
+ @endsignalproto
+ @signaldesc
+ Emitted when an account is created by calling purple_account_new.
+ @param account The account.
+ @since 2.6.0
+ @endsignaldef
+
+ @signaldef account-destroying
+ @signalproto
+void (*account_destroying)(PurpleAccount *account);
+ @endsignalproto
+ @signaldesc
+ Emitted when an account is about to be destroyed.
+ @param account The account.
+ @since 2.6.0
+ @endsignaldef
+
@signaldef account-added
@signalproto
void (*account_added)(PurpleAccount *account);
@@ -28,6 +50,7 @@ void (*account_added)(PurpleAccount *acc
@signaldesc
Emitted when an account is added.
@param account The account that was added.
+ @see purple_accounts_add
@endsignaldef
@signaldef account-connecting
@@ -46,6 +69,7 @@ void (*account_removed)(PurpleAccount *a
@signaldesc
Emitted when an account is removed.
@param account The account that was removed.
+ @see purple_accounts_remove
@endsignaldef
@signaldef account-disabled
============================================================
--- libpurple/account.c 1e14b918b175465951bc9d012bc277d5911e3ccc
+++ libpurple/account.c c20d2f91ac5b9ebe011e0e76ea5659f81b327e49
@@ -954,6 +954,8 @@ purple_account_new(const char *username,
/* 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 @@ purple_account_destroy(PurpleAccount *ac
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_accounts_init(void)
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));
More information about the Commits
mailing list