/soc/2013/ankitkv/gobjectification: 374a9500c430: Added _purple_...
Ankit Vani
a at nevitus.org
Thu Jul 11 16:02:17 EDT 2013
Changeset: 374a9500c4308b13e8f72039bb5708191c48c727
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-12 01:32 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/374a9500c430
Description:
Added _purple_connection_wants_to_die() to internal.h to be used by account.c. Removed _purple_connection_destroy().
diffstat:
libpurple/account.c | 4 ++--
libpurple/connection.c | 3 ++-
libpurple/connection.h | 6 +-----
libpurple/internal.h | 11 +++++------
libpurple/protocols/bonjour/jabber.c | 2 +-
5 files changed, 11 insertions(+), 15 deletions(-)
diffs (92 lines):
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -362,7 +362,7 @@ purple_account_disconnect(PurpleAccount
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 @@ purple_account_set_enabled(PurpleAccount
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);
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -78,7 +78,8 @@ struct _PurpleConnectionPrivate
*/
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 */
};
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -409,9 +409,7 @@ void purple_connection_notice(PurpleConn
/**
* 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 @@ purple_connection_ssl_error (PurpleConne
* <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.
*/
diff --git a/libpurple/internal.h b/libpurple/internal.h
--- a/libpurple/internal.h
+++ b/libpurple/internal.h
@@ -203,14 +203,13 @@ void _purple_connection_new(PurpleAccoun
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_ */
diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c
--- a/libpurple/protocols/bonjour/jabber.c
+++ b/libpurple/protocols/bonjour/jabber.c
@@ -1232,7 +1232,7 @@ bonjour_jabber_stop(BonjourJabber *jdata
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;
More information about the Commits
mailing list