changeset 32354:ec6371d4cae8

Add purple_account_is_disconnecting() accessor function.
author andrew.victor@mxit.com
date Sun, 06 Nov 2011 20:31:14 +0000
parents cb486df263ef
children 08151b40c598
files ChangeLog.API libpurple/account.c libpurple/account.h libpurple/protocols/irc/cmds.c libpurple/protocols/jabber/jabber.c libpurple/protocols/oscar/flap_connection.c
diffstat 6 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun Nov 06 19:46:57 2011 +0000
+++ b/ChangeLog.API	Sun Nov 06 20:31:14 2011 +0000
@@ -4,6 +4,7 @@
 	libpurple:
 		Added:
 		* pidgin_create_webview
+		* purple_account_is_disconnecting
 		* purple_account_get_ui_data
 		* purple_account_set_ui_data
 		* purple_account_register_completed
--- a/libpurple/account.c	Sun Nov 06 19:46:57 2011 +0000
+++ b/libpurple/account.c	Sun Nov 06 20:31:14 2011 +0000
@@ -1274,6 +1274,14 @@
 	account->disconnecting = FALSE;
 }
 
+gboolean
+purple_account_is_disconnecting(const PurpleAccount *account)
+{
+	g_return_val_if_fail(account != NULL, TRUE);
+	
+	return account->disconnecting;
+}
+
 void
 purple_account_notify_added(PurpleAccount *account, const char *remote_user,
                           const char *id, const char *alias,
--- a/libpurple/account.h	Sun Nov 06 19:46:57 2011 +0000
+++ b/libpurple/account.h	Sun Nov 06 20:31:14 2011 +0000
@@ -246,6 +246,15 @@
 void purple_account_disconnect(PurpleAccount *account);
 
 /**
+ * Indicates if the account is currently being disconnected.
+ *
+ * @param account The account
+ *
+ * @return TRUE if the account is being disconnected.
+ */
+gboolean purple_account_is_disconnecting(const PurpleAccount *account);
+
+/**
  * Notifies the user that the account was added to a remote user's
  * buddy list.
  *
--- a/libpurple/protocols/irc/cmds.c	Sun Nov 06 19:46:57 2011 +0000
+++ b/libpurple/protocols/irc/cmds.c	Sun Nov 06 20:31:14 2011 +0000
@@ -423,7 +423,7 @@
 
 		irc->quitting = TRUE;
 
-		if (!irc->account->disconnecting)
+		if (!purple_account_is_disconnecting(irc->account))
 			purple_account_set_status(irc->account, "offline", TRUE, NULL);
 	}
 
--- a/libpurple/protocols/jabber/jabber.c	Sun Nov 06 19:46:57 2011 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Nov 06 20:31:14 2011 +0000
@@ -440,7 +440,7 @@
 		 * we're disconnecting, don't generate (possibly another) error that
 		 * (for some UIs) would mask the first.
 		 */
-		if (!account->disconnecting) {
+		if (!purple_account_is_disconnecting(account)) {
 			gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
 					g_strerror(errno));
 			purple_connection_error(js->gc,
--- a/libpurple/protocols/oscar/flap_connection.c	Sun Nov 06 19:46:57 2011 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c	Sun Nov 06 20:31:14 2011 +0000
@@ -456,7 +456,7 @@
 	 * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then
 	 * we should try to request one instead of disconnecting.
 	 */
-	if (!account->disconnecting && ((od->oscar_connections == NULL)
+	if (!purple_account_is_disconnecting(account) && ((od->oscar_connections == NULL)
 			|| (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE))))
 	{
 		/* No more FLAP connections!  Sign off this PurpleConnection! */