Mercurial > pidgin.yaz
changeset 30118:4d0ccbc905aa
account: Add copies of connection signed-(on|off) and connection-error.
These are useful for D-Bus, where a program has no ability to figure out
what account correlates to a signed-off or connection-error signal without
tracking (before-hand) the association with account and connection id
(by the time the program tries to call purple_connection_get_account, the
gc is destroyed). Fixes #11130.
Patch from Yonas Yanfa (I fixed a few issues and moved it all to account.c)
committer: Paul Aurich <paul@darkrain42.org>
author | yonas.yanfa@gmail.com |
---|---|
date | Mon, 12 Apr 2010 03:55:07 +0000 |
parents | ae2b1f9bde75 |
children | 0417d6bc47cd |
files | COPYRIGHT ChangeLog.API libpurple/account.c |
diffstat | 3 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Mon Apr 12 03:42:03 2010 +0000 +++ b/COPYRIGHT Mon Apr 12 03:55:07 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 03:42:03 2010 +0000 +++ b/ChangeLog.API Mon Apr 12 03:55:07 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/libpurple/account.c Mon Apr 12 03:42:03 2010 +0000 +++ b/libpurple/account.c Mon Apr 12 03:55:07 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);