im.pidgin.cpw.resiak.disconnectreason: 629b51aa395bedfed85aeed90d12ff466580fe12
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Sun Oct 28 12:56:22 EDT 2007
-----------------------------------------------------------------
Revision: 629b51aa395bedfed85aeed90d12ff466580fe12
Ancestor: cc7a76663ff40601e0aa4a29123d5a90a963c324
Author: resiak at soc.pidgin.im
Date: 2007-10-28T13:01:45
Branch: im.pidgin.cpw.resiak.disconnectreason
Modified files:
doc/account-signals.dox libpurple/account.c
pidgin/gtkblist.c
ChangeLog:
Add the old error to the account-error-changed signal.
-------------- next part --------------
============================================================
--- doc/account-signals.dox d22e0c89753f0ac1c592e54b25e3c6369035f5d5
+++ doc/account-signals.dox c09ab1804ee6a0d402581edb7014de22c841126f
@@ -144,12 +144,14 @@ void (*account_authorization_granted)(Pu
@signaldef account-error-changed
@signalproto
-void (*account_error_changed)(PurpleAccount *account, const PurpleAccountCurrentError *current_error);
+void (*account_error_changed)(PurpleAccount *account, const PurpleAccountCurrentError *old_error, const PurpleAccountCurrentError *current_error);
@endsignalproto
@signaldesc
Emitted when @a account's error changes.
- @param account The account whose error has changed.
- @param current_error The account's current error, or @c NULL if it has no error.
+ @param account The account whose error has changed.
+ @param old_error The account's previous error, or @c NULL if it had no
+ error.
+ @param new_error The account's new error, or @c NULL if it has no error.
@see purple_account_get_current_error()
@since 2.3.0
@endsignaldef
============================================================
--- libpurple/account.c 47a1ec154aa64ecdb8a19d471f52916736946d15
+++ libpurple/account.c 1a1e9e55d46ed6cdee20cc82669030caa4fde2a8
@@ -2236,14 +2236,18 @@ clear_current_error(PurpleAccount *accou
clear_current_error(PurpleAccount *account)
{
PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
+ PurpleAccountCurrentError *old;
+
if (priv->current_error)
{
- g_free (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);
}
- purple_signal_emit(purple_accounts_get_handle(), "account-error-changed",
- account, priv->current_error);
}
static void
@@ -2262,14 +2266,16 @@ connection_error_cb(PurpleConnection *gc
{
PurpleAccount *account = purple_connection_get_account(gc);
PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
+ PurpleAccountCurrentError *old = priv->current_error;
- if (!priv->current_error)
- priv->current_error = g_new0(PurpleAccountCurrentError, 1);
+ priv->current_error = g_new0(PurpleAccountCurrentError, 1);
priv->current_error->reason = err;
priv->current_error->description = desc;
- purple_signal_emit(purple_accounts_get_handle(), "account-error-changed",
- account, priv->current_error);
+ purple_signal_emit(purple_accounts_get_handle(),
+ "account-error-changed",
+ account, old, priv->current_error);
+ g_free(old);
}
const PurpleAccountCurrentError *
@@ -2581,9 +2587,11 @@ purple_accounts_init(void)
purple_value_new(PURPLE_TYPE_STRING));
purple_signal_register(handle, "account-error-changed",
- purple_marshal_VOID__POINTER_POINTER, NULL, 2,
+ purple_marshal_VOID__POINTER_POINTER_POINTER,
+ NULL, 3,
purple_value_new(PURPLE_TYPE_SUBTYPE,
PURPLE_SUBTYPE_ACCOUNT),
+ purple_value_new(PURPLE_TYPE_POINTER),
purple_value_new(PURPLE_TYPE_POINTER));
purple_signal_connect(conn_handle, "signed-on", handle,
============================================================
--- pidgin/gtkblist.c 02ac21eafa5eb0c5f26487eae41ac3752e79d469
+++ pidgin/gtkblist.c 6991cc675e5f4c20222b188161142c1271f0cde8
@@ -4393,12 +4393,14 @@ create_connection_error_buttons(gpointer
gtk_widget_show_all(gtkblist->error_buttons);
}
-void
-account_error_changed_cb(PurpleAccount *account,
- PurpleAccountCurrentError *err)
+static void
+update_account_error_state(PurpleAccount *account,
+ PurpleAccountCurrentError *old,
+ PurpleAccountCurrentError *new,
+ PidginBuddyList *gtkblist)
{
- if (err)
- pidgin_blist_update_account_error_state(account, err->description);
+ if (new)
+ pidgin_blist_update_account_error_state(account, new->description);
else
pidgin_blist_update_account_error_state(account, NULL);
}
@@ -4967,7 +4969,7 @@ static void pidgin_blist_show(PurpleBudd
PURPLE_CALLBACK(account_status_changed),
gtkblist);
purple_signal_connect(handle, "account-error-changed", gtkblist,
- PURPLE_CALLBACK(account_error_changed_cb),
+ PURPLE_CALLBACK(update_account_error_state),
gtkblist);
handle = pidgin_account_get_handle();
More information about the Commits
mailing list