Added _purple_connection_wants_to_die() to internal.h to be used by account.c. Removed _purple_connection_destroy(). soc.2013.gobjectification

Fri, 12 Jul 2013 01:32:00 +0530

author
Ankit Vani <a@nevitus.org>
date
Fri, 12 Jul 2013 01:32:00 +0530
branch
soc.2013.gobjectification
changeset 34751
374a9500c430
parent 34750
826c1611ef90
child 34752
c43a22ac7452

Added _purple_connection_wants_to_die() to internal.h to be used by account.c. Removed _purple_connection_destroy().

libpurple/account.c file | annotate | diff | comparison | revisions
libpurple/connection.c file | annotate | diff | comparison | revisions
libpurple/connection.h file | annotate | diff | comparison | revisions
libpurple/internal.h file | annotate | diff | comparison | revisions
libpurple/protocols/bonjour/jabber.c file | annotate | diff | comparison | revisions
--- a/libpurple/account.c	Thu Jul 11 21:59:34 2013 +0530
+++ b/libpurple/account.c	Fri Jul 12 01:32:00 2013 +0530
@@ -362,7 +362,7 @@
 	priv->disconnecting = TRUE;
 
 	gc = purple_account_get_connection(account);
-	_purple_connection_destroy(gc);
+	g_object_unref(gc);
 	purple_account_set_connection(account, NULL);
 
 	priv->disconnecting = FALSE;
@@ -881,7 +881,7 @@
 	else if(!was_enabled && value)
 		purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
 
-	if ((gc != NULL) && (gc->wants_to_die == TRUE))
+	if ((gc != NULL) && (_purple_connection_wants_to_die(gc)))
 		return;
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
--- a/libpurple/connection.c	Thu Jul 11 21:59:34 2013 +0530
+++ b/libpurple/connection.c	Fri Jul 12 01:32:00 2013 +0530
@@ -78,7 +78,8 @@
 	 */
 	gboolean wants_to_die;
 
-	guint disconnect_timeout;  /**< Timer used for nasty stack tricks         */
+	guint disconnect_timeout;  /**< Timer used for nasty stack tricks
+	                                TODO Get rid of this.                     */
 	time_t last_received;      /**< When we last received a packet. Set by the
 	                                prpl to avoid sending unneeded keepalives */
 };
--- a/libpurple/connection.h	Thu Jul 11 21:59:34 2013 +0530
+++ b/libpurple/connection.h	Fri Jul 12 01:32:00 2013 +0530
@@ -409,9 +409,7 @@
 
 /**
  * Closes a connection with an error and a human-readable description of the
- * error.  It also sets @c gc->wants_to_die to the value of
- * #purple_connection_error_is_fatal(@a reason), mainly for
- * backwards-compatibility.
+ * error.
  *
  * @param gc          the connection which is closing.
  * @param reason      why the connection is closing.
@@ -444,8 +442,6 @@
  * <tt> purple_connection_error_is_fatal
  * (PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED)</tt> is @c TRUE.
  *
- * (This function is meant to replace checking PurpleConnection.wants_to_die.)
- *
  * @return @c TRUE if the account should not be automatically reconnected, and
  *         @c FALSE otherwise.
  */
--- a/libpurple/internal.h	Thu Jul 11 21:59:34 2013 +0530
+++ b/libpurple/internal.h	Fri Jul 12 01:32:00 2013 +0530
@@ -203,14 +203,13 @@
 void _purple_connection_new_unregister(PurpleAccount *account, const char *password,
                                        PurpleAccountUnregistrationCb cb, void *user_data);
 /**
- * Disconnects and destroys a PurpleConnection.
+ * Checks if a connection is disconnecting, and should not attempt to reconnect.
  *
- * @note This function should only be called by purple_account_disconnect()
- *        in account.c.  If you're trying to sign off an account, use that
- *        function instead.
+ * @note This function should only be called by purple_account_set_enabled()
+ *       in account.c.
  *
- * @param gc The purple connection to destroy.
+ * @param gc  The connection to check
  */
-void _purple_connection_destroy(PurpleConnection *gc);
+gboolean _purple_connection_wants_to_die(const PurpleConnection *gc);
 
 #endif /* _PURPLE_INTERNAL_H_ */
--- a/libpurple/protocols/bonjour/jabber.c	Thu Jul 11 21:59:34 2013 +0530
+++ b/libpurple/protocols/bonjour/jabber.c	Fri Jul 12 01:32:00 2013 +0530
@@ -1232,7 +1232,7 @@
 			BonjourBuddy *bb = purple_buddy_get_protocol_data((PurpleBuddy*) l->data);
 			if (bb && bb->conversation) {
 				/* Any ongoing connection attempt is cancelled
-				 * by _purple_connection_destroy */
+				 * when a connection is destroyed */
 				bb->conversation->connect_data = NULL;
 				bonjour_jabber_close_conversation(bb->conversation);
 				bb->conversation = NULL;

mercurial