Mercurial > pidgin
changeset 21390:aa52a0a224be
Add purple_account_clear_current_error(), which does what it says on the tin.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Fri, 02 Nov 2007 15:00:24 +0000 |
parents | b7a004e65702 |
children | 4b1088076c50 |
files | ChangeLog.API libpurple/account.c libpurple/account.h |
diffstat | 3 files changed, 29 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Fri Nov 02 14:48:06 2007 +0000 +++ b/ChangeLog.API Fri Nov 02 15:00:24 2007 +0000 @@ -39,6 +39,8 @@ account is happy with life), to allow bits of the UI to know the last error without caching it themselves (as PidginBuddyList does). + * purple_account_clear_current_error() to reset an account's + error state to NULL. * An account-error-changed signal, firing when purple_account_get_current_error()'s return value changes.
--- a/libpurple/account.c Fri Nov 02 14:48:06 2007 +0000 +++ b/libpurple/account.c Fri Nov 02 15:00:24 2007 +0000 @@ -85,8 +85,6 @@ static GList *handles = NULL; -static void clear_current_error(PurpleAccount *account); - /********************************************************************* * Writing to disk * *********************************************************************/ @@ -2233,29 +2231,11 @@ } static void -clear_current_error(PurpleAccount *account) -{ - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - PurpleConnectionErrorInfo *old; - - if (priv->current_error) - { - old = priv->current_error; - priv->current_error = NULL; - purple_signal_emit(purple_accounts_get_handle(), - "account-error-changed", - account, old, priv->current_error); - g_free (old); - } - -} - -static void signed_on_cb(PurpleConnection *gc, gpointer unused) { PurpleAccount *account = purple_connection_get_account(gc); - clear_current_error(account); + purple_account_clear_current_error(account); } static void @@ -2285,6 +2265,24 @@ return priv->current_error; } +static void +purple_account_clear_current_error(PurpleAccount *account) +{ + PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); + PurpleConnectionErrorInfo *old; + + if (priv->current_error) + { + old = priv->current_error; + priv->current_error = NULL; + purple_signal_emit(purple_accounts_get_handle(), + "account-error-changed", + account, old, priv->current_error); + g_free (old); + } +} + + void purple_accounts_add(PurpleAccount *account) { @@ -2313,7 +2311,7 @@ * which is the end of the guarantee that the the error's pointer is * valid. */ - clear_current_error(account); + purple_account_clear_current_error(account); purple_signal_emit(purple_accounts_get_handle(), "account-removed", account); }
--- a/libpurple/account.h Fri Nov 02 14:48:06 2007 +0000 +++ b/libpurple/account.h Fri Nov 02 15:00:24 2007 +0000 @@ -907,6 +907,13 @@ */ const PurpleConnectionErrorInfo *purple_account_get_current_error(PurpleAccount *account); +/** + * Clear an account's current error state, resetting it to @c NULL. + * + * @param account The account whose error state should be cleared. + */ +static void purple_account_clear_current_error(PurpleAccount *account); + /*@}*/ /**************************************************************************/