/soc/2013/ankitkv/gobjectification: dc9c911dbd35: Started GObjec...

Ankit Vani a at nevitus.org
Wed Jul 10 14:25:37 EDT 2013


Changeset: dc9c911dbd35417fae9e5b16062c1a507e41ab54
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-10 23:55 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/dc9c911dbd35

Description:

Started GObjectification of PurpleConnection.
* Changed prefix of PurpleConnectionFlags values from PURPLE_CONNECTION_ to PURPLE_CONNECTION_FLAG_
* Changed prefix of PurpleConnectionState values from PURPLE_ TO PURPLE_CONNECTION_

diffstat:

 libpurple/account.c                     |  12 ++++----
 libpurple/buddylist.c                   |   2 +-
 libpurple/connection.c                  |  16 ++++++------
 libpurple/connection.h                  |  38 +++++++++++++++---------------
 libpurple/conversation.c                |   2 +-
 libpurple/plugins/tcl/tcl_cmds.c        |   6 ++--
 libpurple/protocols/bonjour/bonjour.c   |   4 +-
 libpurple/protocols/gg/gg.c             |   2 +-
 libpurple/protocols/irc/irc.c           |   2 +-
 libpurple/protocols/irc/msgs.c          |   6 ++--
 libpurple/protocols/jabber/disco.c      |   4 +-
 libpurple/protocols/jabber/jabber.c     |  10 ++++----
 libpurple/protocols/msn/msn.c           |   4 +-
 libpurple/protocols/msn/session.c       |   2 +-
 libpurple/protocols/mxit/login.c        |   8 +++---
 libpurple/protocols/mxit/protocol.c     |   2 +-
 libpurple/protocols/myspace/myspace.c   |   4 +-
 libpurple/protocols/novell/novell.c     |   2 +-
 libpurple/protocols/null/nullprpl.c     |   2 +-
 libpurple/protocols/oscar/oscar.c       |  10 ++++----
 libpurple/protocols/sametime/sametime.c |  12 ++++----
 libpurple/protocols/silc/silc.c         |   2 +-
 libpurple/protocols/simple/simple.c     |   2 +-
 libpurple/protocols/yahoo/libymsg.c     |   4 +-
 libpurple/protocols/zephyr/zephyr.c     |   4 +-
 libpurple/server.c                      |   4 +-
 pidgin/gtkblist.c                       |  14 +++++-----
 pidgin/gtkconv.c                        |  40 ++++++++++++++++----------------
 pidgin/gtkimhtml.c                      |  18 +++++++-------
 pidgin/gtkpounce.c                      |   2 +-
 pidgin/gtkprefs.c                       |   4 +-
 pidgin/gtkwebview.c                     |  18 +++++++-------
 32 files changed, 131 insertions(+), 131 deletions(-)

diffs (truncated from 1000 to 300 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -697,7 +697,7 @@ purple_account_request_change_user_info(
 	purple_request_input(gc, _("Set User Info"), primary, NULL,
 					   purple_account_get_user_info(account),
 					   TRUE, FALSE, ((gc != NULL) &&
-					   (purple_connection_get_flags(gc) & PURPLE_CONNECTION_HTML) ? "html" : NULL),
+					   (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_HTML) ? "html" : NULL),
 					   _("Save"), G_CALLBACK(set_user_info_cb),
 					   _("Cancel"), NULL,
 					   account, NULL, NULL,
@@ -1286,11 +1286,11 @@ purple_account_get_state(const PurpleAcc
 {
 	PurpleConnection *gc;
 
-	g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED);
+	g_return_val_if_fail(account != NULL, PURPLE_CONNECTION_DISCONNECTED);
 
 	gc = purple_account_get_connection(account);
 	if (!gc)
-		return PURPLE_DISCONNECTED;
+		return PURPLE_CONNECTION_DISCONNECTED;
 
 	return purple_connection_get_state(gc);
 }
@@ -1298,19 +1298,19 @@ purple_account_get_state(const PurpleAcc
 gboolean
 purple_account_is_connected(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_CONNECTED);
+	return (purple_account_get_state(account) == PURPLE_CONNECTION_CONNECTED);
 }
 
 gboolean
 purple_account_is_connecting(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_CONNECTING);
+	return (purple_account_get_state(account) == PURPLE_CONNECTION_CONNECTING);
 }
 
 gboolean
 purple_account_is_disconnected(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_DISCONNECTED);
+	return (purple_account_get_state(account) == PURPLE_CONNECTION_DISCONNECTED);
 }
 
 const char *
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -1498,7 +1498,7 @@ void purple_blist_remove_group(PurpleGro
 	{
 		PurpleConnection *gc = (PurpleConnection *)l->data;
 
-		if (purple_connection_get_state(gc) == PURPLE_CONNECTED)
+		if (purple_connection_get_state(gc) == PURPLE_CONNECTION_CONNECTED)
 			purple_account_remove_group(purple_connection_get_account(gc), group);
 	}
 
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -143,7 +143,7 @@ void
 	if ((password != NULL) && (*password != '\0'))
 		gc->password = g_strdup(password);
 	purple_connection_set_account(gc, account);
-	purple_connection_set_state(gc, PURPLE_CONNECTING);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTING);
 	connections = g_list_append(connections, gc);
 	purple_account_set_connection(account, gc);
 
@@ -212,7 +212,7 @@ void
 	if ((password != NULL) && (*password != '\0'))
 		gc->password = g_strdup(password);
 	purple_connection_set_account(gc, account);
-	purple_connection_set_state(gc, PURPLE_CONNECTING);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTING);
 	connections = g_list_append(connections, gc);
 	purple_account_set_connection(account, gc);
 
@@ -237,7 +237,7 @@ void
 
 	purple_debug_info("connection", "Disconnecting connection %p\n", gc);
 
-	if (purple_connection_get_state(gc) != PURPLE_CONNECTING)
+	if (purple_connection_get_state(gc) != PURPLE_CONNECTION_CONNECTING)
 		remove = TRUE;
 
 	purple_signal_emit(purple_connections_get_handle(), "signing-off", gc);
@@ -269,7 +269,7 @@ void
 
 	connections = g_list_remove(connections, gc);
 
-	purple_connection_set_state(gc, PURPLE_DISCONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_DISCONNECTED);
 
 	if (remove)
 		purple_blist_remove_account(account);
@@ -318,14 +318,14 @@ purple_connection_set_state(PurpleConnec
 
 	ops = purple_connections_get_ui_ops();
 
-	if (gc->state == PURPLE_CONNECTING) {
+	if (gc->state == PURPLE_CONNECTION_CONNECTING) {
 		connections_connecting = g_list_append(connections_connecting, gc);
 	}
 	else {
 		connections_connecting = g_list_remove(connections_connecting, gc);
 	}
 
-	if (gc->state == PURPLE_CONNECTED) {
+	if (gc->state == PURPLE_CONNECTION_CONNECTED) {
 		PurpleAccount *account;
 		PurplePresence *presence;
 
@@ -363,7 +363,7 @@ purple_connection_set_state(PurpleConnec
 
 		update_keepalive(gc, TRUE);
 	}
-	else if (gc->state == PURPLE_DISCONNECTED) {
+	else if (gc->state == PURPLE_CONNECTION_DISCONNECTED) {
 		PurpleAccount *account = purple_connection_get_account(gc);
 
 		if (purple_prefs_get_bool("/purple/logging/log_system"))
@@ -424,7 +424,7 @@ purple_connection_set_protocol_data(Purp
 PurpleConnectionState
 purple_connection_get_state(const PurpleConnection *gc)
 {
-	g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED);
+	g_return_val_if_fail(gc != NULL, PURPLE_CONNECTION_DISCONNECTED);
 
 	return gc->state;
 }
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -35,25 +35,25 @@ typedef struct _PurpleConnection PurpleC
  */
 typedef enum /*< flags >*/
 {
-	PURPLE_CONNECTION_HTML       = 0x0001, /**< Connection sends/receives in 'HTML'. */
-	PURPLE_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive
-					           background colors.                  */
-	PURPLE_CONNECTION_AUTO_RESP  = 0x0004,  /**< Send auto responses when away.       */
-	PURPLE_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
-	PURPLE_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
-	PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
-	PURPLE_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */
-	PURPLE_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
-	PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100, /**< Connection supports sending and receiving custom smileys */
-	PURPLE_CONNECTION_SUPPORT_MOODS = 0x0200, /**< Connection supports setting moods */
-	PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES = 0x0400 /**< Connection supports setting a message on moods */
+	PURPLE_CONNECTION_FLAG_HTML       = 0x0001, /**< Connection sends/receives in 'HTML'. */
+	PURPLE_CONNECTION_FLAG_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive
+					                                 background colors.                  */
+	PURPLE_CONNECTION_FLAG_AUTO_RESP  = 0x0004,  /**< Send auto responses when away.       */
+	PURPLE_CONNECTION_FLAG_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
+	PURPLE_CONNECTION_FLAG_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
+	PURPLE_CONNECTION_FLAG_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
+	PURPLE_CONNECTION_FLAG_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */
+	PURPLE_CONNECTION_FLAG_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
+	PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY = 0x0100, /**< Connection supports sending and receiving custom smileys */
+	PURPLE_CONNECTION_FLAG_SUPPORT_MOODS = 0x0200, /**< Connection supports setting moods */
+	PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES = 0x0400 /**< Connection supports setting a message on moods */
 } PurpleConnectionFlags;
 
 typedef enum
 {
-	PURPLE_DISCONNECTED = 0, /**< Disconnected. */
-	PURPLE_CONNECTED,        /**< Connected.    */
-	PURPLE_CONNECTING        /**< Connecting.   */
+	PURPLE_CONNECTION_DISCONNECTED = 0, /**< Disconnected. */
+	PURPLE_CONNECTION_CONNECTED,        /**< Connected.    */
+	PURPLE_CONNECTION_CONNECTING        /**< Connecting.   */
 
 } PurpleConnectionState;
 
@@ -133,7 +133,7 @@ typedef enum
 	PURPLE_CONNECTION_ERROR_OTHER_ERROR = 16
 } PurpleConnectionError;
 
-/** Holds the type of an error along with its description. */
+/** Holds the type of an error along with its description. TODO GBoxed */
 typedef struct
 {
 	/** The type of error. */
@@ -225,7 +225,7 @@ typedef struct
 } PurpleConnectionUiOps;
 
 
-/* Represents an active connection on an account. */
+/* Represents an active connection on an account. TODO GObject */
 struct _PurpleConnection
 {
 	PurplePlugin *prpl;            /**< The protocol plugin.               */
@@ -266,7 +266,7 @@ G_BEGIN_DECLS
 
 /**
  * Sets the connection state.  PRPLs should call this and pass in
- * the state #PURPLE_CONNECTED when the account is completely
+ * the state #PURPLE_CONNECTION_CONNECTED when the account is completely
  * signed on.  What does it mean to be completely signed on?  If
  * the core can call prpl->set_status, and it successfully changes
  * your status, then the account is online.
@@ -332,7 +332,7 @@ PurpleConnectionFlags purple_connection_
  * @return TRUE if the account is connected, otherwise returns FALSE.
  */
 #define PURPLE_CONNECTION_IS_CONNECTED(gc) \
-	(purple_connection_get_state(gc) == PURPLE_CONNECTED)
+	(purple_connection_get_state(gc) == PURPLE_CONNECTION_CONNECTED)
 
 /**
  * Returns the connection's account.
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -120,7 +120,7 @@ common_send(PurpleConversation *conv, co
 			displayed = purple_markup_linkify(message);
 	}
 
-	if (displayed && (priv->features & PURPLE_CONNECTION_HTML) &&
+	if (displayed && (priv->features & PURPLE_CONNECTION_FLAG_HTML) &&
 		!(msgflags & PURPLE_MESSAGE_RAW)) {
 		sent = g_strdup(displayed);
 	} else
diff --git a/libpurple/plugins/tcl/tcl_cmds.c b/libpurple/plugins/tcl/tcl_cmds.c
--- a/libpurple/plugins/tcl/tcl_cmds.c
+++ b/libpurple/plugins/tcl/tcl_cmds.c
@@ -742,13 +742,13 @@ int tcl_cmd_connection(ClientData unused
 		if ((gc = tcl_validate_gc(objv[2], interp)) == NULL)
 			return TCL_ERROR;
 		switch (purple_connection_get_state(gc)) {
-		case PURPLE_DISCONNECTED:
+		case PURPLE_CONNECTION_DISCONNECTED:
 			Tcl_SetObjResult(interp, Tcl_NewStringObj("disconnected", -1));
 			break;
-		case PURPLE_CONNECTED:
+		case PURPLE_CONNECTION_CONNECTED:
 			Tcl_SetObjResult(interp, Tcl_NewStringObj("connected", -1));
 			break;
-		case PURPLE_CONNECTING:
+		case PURPLE_CONNECTION_CONNECTING:
 			Tcl_SetObjResult(interp, Tcl_NewStringObj("connecting", -1));
 			break;
 		}
diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c
--- a/libpurple/protocols/bonjour/bonjour.c
+++ b/libpurple/protocols/bonjour/bonjour.c
@@ -103,7 +103,7 @@ bonjour_login(PurpleAccount *account)
 	}
 #endif /* _WIN32 */
 
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML);
 	bd = g_new0(BonjourData, 1);
 	purple_connection_set_protocol_data(gc, bd);
 
@@ -152,7 +152,7 @@ bonjour_login(PurpleAccount *account)
 	bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data);
 
 	/* Show the buddy list by telling Purple we have already connected */
-	purple_connection_set_state(gc, PURPLE_CONNECTED);
+	purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED);
 }
 
 static void
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -688,7 +688,7 @@ static void ggp_async_login_handler(gpoi
 							  ggp_callback_recv, gc);
 
 				purple_connection_update_progress(gc, _("Connected"), 1, 2);
-				purple_connection_set_state(gc, PURPLE_CONNECTED);
+				purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED);
 				
 				ggp_buddylist_send(gc);
 				ggp_roster_request_update(gc);
diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c
--- a/libpurple/protocols/irc/irc.c
+++ b/libpurple/protocols/irc/irc.c
@@ -335,7 +335,7 @@ static void irc_login(PurpleAccount *acc
 	const char *username = purple_account_get_username(account);
 
 	gc = purple_account_get_connection(account);
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_NEWLINES);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_NEWLINES);
 
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
 		purple_connection_error (gc,
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -94,7 +94,7 @@ static void irc_connected(struct irc_con
 		return;
 
 	purple_connection_set_display_name(gc, nick);
-	purple_connection_set_state(gc, PURPLE_CONNECTED);



More information about the Commits mailing list