Mercurial > pidgin.yaz
changeset 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 | 4a592e898162 |
children | 0e99b80b54c6 |
files | ChangeLog.API doc/account-signals.dox libpurple/account.c |
diffstat | 3 files changed, 39 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Thu Apr 30 14:44:01 2009 +0000 +++ b/ChangeLog.API Fri May 01 06:59:36 2009 +0000 @@ -9,7 +9,10 @@ * 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
--- a/doc/account-signals.dox Thu Apr 30 14:44:01 2009 +0000 +++ b/doc/account-signals.dox Fri May 01 06:59:36 2009 +0000 @@ -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 @@ @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 @@ @signaldesc Emitted when an account is removed. @param account The account that was removed. + @see purple_accounts_remove @endsignaldef @signaldef account-disabled
--- 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));