/pidgin/main: aa1f0e988567: Style: fix gg (partially)

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon Feb 3 15:18:30 EST 2014


Changeset: aa1f0e988567d0debf25dc43b238836177736632
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-02-03 21:18 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/aa1f0e988567

Description:

Style: fix gg (partially)

diffstat:

 libpurple/protocols/gg/account.c    |   8 +++---
 libpurple/protocols/gg/avatar.c     |  15 ++++++-----
 libpurple/protocols/gg/blist.c      |   2 +-
 libpurple/protocols/gg/chat.c       |   5 ++-
 libpurple/protocols/gg/deprecated.c |   8 +++---
 libpurple/protocols/gg/gg.c         |  46 ++++++++++++++++++------------------
 6 files changed, 43 insertions(+), 41 deletions(-)

diffs (truncated from 324 to 300 lines):

diff --git a/libpurple/protocols/gg/account.c b/libpurple/protocols/gg/account.c
--- a/libpurple/protocols/gg/account.c
+++ b/libpurple/protocols/gg/account.c
@@ -308,7 +308,7 @@ static void ggp_account_register_dialog_
 }
 
 #if 0
-// libgadu 1.12.x: use it for invalid token
+/* libgadu 1.12.x: use it for invalid token */
 static void ggp_account_register_dialog_invalid(
 	ggp_account_register_data *register_data, const gchar *message)
 {
@@ -342,7 +342,7 @@ static void ggp_account_register_respons
 	}
 	if (!success || !register_result->success)
 	{
-		//TODO (libgadu 1.12.x): check register_result->error
+		/* TODO (libgadu 1.12.x): check register_result->error */
 		purple_debug_error("gg", "ggp_account_register_response: "
 			"error\n");
 		purple_notify_error(NULL,
@@ -627,7 +627,7 @@ static void ggp_account_chpass_response(
 	}
 	if (!success || !chpass_result->success)
 	{
-		//TODO (libgadu 1.12.x): check chpass_result->error
+		/* TODO (libgadu 1.12.x): check chpass_result->error */
 		purple_debug_error("gg", "ggp_account_chpass_response: "
 			"error\n");
 		purple_notify_error(NULL,
@@ -651,6 +651,6 @@ static void ggp_account_chpass_response(
 
 	ggp_account_chpass_data_free(chpass_data);
 
-	//TODO: reconnect / check how it is done in original client
+	/* TODO: reconnect / check how it is done in original client */
 	purple_account_disconnect(account);
 }
diff --git a/libpurple/protocols/gg/avatar.c b/libpurple/protocols/gg/avatar.c
--- a/libpurple/protocols/gg/avatar.c
+++ b/libpurple/protocols/gg/avatar.c
@@ -37,7 +37,7 @@
 #include "utils.h"
 #include "oauth/oauth-purple.h"
 
-// Common
+/* Common */
 
 static inline ggp_avatar_session_data *
 ggp_avatar_get_avdata(PurpleConnection *gc);
@@ -47,7 +47,7 @@ static gboolean ggp_avatar_timer_cb(gpoi
 #define GGP_AVATAR_USERAGENT "GG Client build 11.0.0.7562"
 #define GGP_AVATAR_SIZE_MAX 1048576
 
-// Buddy avatars updating
+/* Buddy avatars updating */
 
 typedef struct
 {
@@ -64,7 +64,7 @@ static void ggp_avatar_buddy_update_rece
 
 #define GGP_AVATAR_BUDDY_URL "http://avatars.gg.pl/%u/s,big"
 
-// Own avatar setting
+/* Own avatar setting */
 
 typedef struct
 {
@@ -132,9 +132,10 @@ static gboolean ggp_avatar_timer_cb(gpoi
 	avdata = ggp_avatar_get_avdata(gc);
 	if (avdata->current_update != NULL)
 	{
-		//TODO: verbose mode
-		//purple_debug_misc("gg", "ggp_avatar_timer_cb(%p): there is "
-		//	"already an update running\n", gc);
+		if (purple_debug_is_verbose()) {
+			purple_debug_misc("gg", "ggp_avatar_timer_cb(%p): "
+				"there is already an update running\n", gc);
+		}
 		return TRUE;
 	}
 
@@ -151,7 +152,7 @@ void ggp_avatar_buddy_update(PurpleConne
 {
 	ggp_avatar_session_data *avdata = ggp_avatar_get_avdata(gc);
 	ggp_avatar_buddy_update_req *pending_update =
-		g_new(ggp_avatar_buddy_update_req, 1); //TODO: leak?
+		g_new(ggp_avatar_buddy_update_req, 1); /* TODO: leak? */
 
 	if (purple_debug_is_verbose()) {
 		purple_debug_misc("gg", "ggp_avatar_buddy_update(%p, %u, %lu)\n", gc,
diff --git a/libpurple/protocols/gg/blist.c b/libpurple/protocols/gg/blist.c
--- a/libpurple/protocols/gg/blist.c
+++ b/libpurple/protocols/gg/blist.c
@@ -37,7 +37,7 @@
 #define F_UIN 6
 
 /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */
-// this is for for notify purposes, not synchronizing buddy list
+/* this is for for notify purposes, not synchronizing buddy list */
 void ggp_buddylist_send(PurpleConnection *gc)
 {
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
diff --git a/libpurple/protocols/gg/chat.c b/libpurple/protocols/gg/chat.c
--- a/libpurple/protocols/gg/chat.c
+++ b/libpurple/protocols/gg/chat.c
@@ -601,8 +601,9 @@ PurpleRoomlist * ggp_chat_roomlist_get_l
 		purple_roomlist_room_add(roomlist, room);
 	}
 
-	//TODO
-	//purple_roomlist_set_in_progress(roomlist, FALSE);
+	/* TODO
+	 * purple_roomlist_set_in_progress(roomlist, FALSE);
+	 */
 	g_object_ref(roomlist);
 	purple_timeout_add(1, ggp_chat_roomlist_get_list_finish, roomlist);
 	return roomlist;
diff --git a/libpurple/protocols/gg/deprecated.c b/libpurple/protocols/gg/deprecated.c
--- a/libpurple/protocols/gg/deprecated.c
+++ b/libpurple/protocols/gg/deprecated.c
@@ -34,7 +34,7 @@
 gboolean ggp_deprecated_setup_proxy(PurpleConnection *gc)
 {
 	PurpleProxyInfo *gpi = purple_proxy_get_setup(purple_connection_get_account(gc));
-	
+
 	if ((purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) &&
 		(purple_proxy_info_get_host(gpi) == NULL ||
 		purple_proxy_info_get_port(gpi) <= 0))
@@ -46,7 +46,7 @@ gboolean ggp_deprecated_setup_proxy(Purp
 			purple_request_cpar_from_connection(gc));
 		return FALSE;
 	}
-	
+
 	if (purple_proxy_info_get_type(gpi) == PURPLE_PROXY_NONE)
 	{
 		gg_proxy_enabled = 0;
@@ -54,11 +54,11 @@ gboolean ggp_deprecated_setup_proxy(Purp
 	}
 
 	gg_proxy_enabled = 1;
-	//TODO: memleak
+	/* TODO: memleak */
 	gg_proxy_host = g_strdup(purple_proxy_info_get_host(gpi));
 	gg_proxy_port = purple_proxy_info_get_port(gpi);
 	gg_proxy_username = g_strdup(purple_proxy_info_get_username(gpi));
 	gg_proxy_password = g_strdup(purple_proxy_info_get_password(gpi));
-	
+
 	return TRUE;
 }
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
@@ -63,8 +63,8 @@ ggp_buddy_data * ggp_buddy_get_data(Purp
 	ggp_buddy_data *buddy_data = purple_buddy_get_protocol_data(buddy);
 	if (buddy_data)
 		return buddy_data;
-	
-	buddy_data = g_new0(ggp_buddy_data, 1); //TODO: leak
+
+	buddy_data = g_new0(ggp_buddy_data, 1); /* TODO: leak */
 	purple_buddy_set_protocol_data(buddy, buddy_data);
 	return buddy_data;
 }
@@ -106,7 +106,7 @@ uin_t ggp_own_uin(PurpleConnection *gc)
 }
 
 /* ---------------------------------------------------------------------- */
-// buddy list import/export from/to file
+/* buddy list import/export from/to file */
 
 static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename)
 {
@@ -124,7 +124,7 @@ static void ggp_callback_buddylist_save_
 		return;
 	}
 
-	if(purple_util_write_data_to_file_absolute(filename, buddylist, -1)) {
+	if (purple_util_write_data_to_file_absolute(filename, buddylist, -1)) {
 		purple_notify_info(account, _("Save Buddylist..."),
 			_("Buddylist saved successfully!"), NULL,
 			purple_request_cpar_from_connection(gc));
@@ -199,9 +199,9 @@ static void ggp_add_deny(PurpleConnectio
 {
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
 	uin_t uin = ggp_str_to_uin(who);
-	
+
 	purple_debug_info("gg", "ggp_add_deny: %u\n", uin);
-	
+
 	gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL);
 	gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED);
 }
@@ -210,9 +210,9 @@ static void ggp_rem_deny(PurpleConnectio
 {
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
 	uin_t uin = ggp_str_to_uin(who);
-	
+
 	purple_debug_info("gg", "ggp_rem_deny: %u\n", uin);
-	
+
 	gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED);
 	gg_add_notify_ex(info->session, uin, GG_USER_NORMAL);
 }
@@ -258,17 +258,17 @@ static void ggp_xml_event_handler(Purple
 	while (xmlnode_next_event != NULL)
 	{
 		PurpleXmlNode *xmlnode_current_event = xmlnode_next_event;
-		
+
 		PurpleXmlNode *xmlnode_type;
 		char *event_type_raw;
 		int event_type = 0;
-		
+
 		PurpleXmlNode *xmlnode_sender;
 		char *event_sender_raw;
 		uin_t event_sender = 0;
 
 		xmlnode_next_event = purple_xmlnode_get_next_twin(xmlnode_next_event);
-		
+
 		xmlnode_type = purple_xmlnode_get_child(xmlnode_current_event, "type");
 		if (xmlnode_type == NULL)
 			continue;
@@ -276,7 +276,7 @@ static void ggp_xml_event_handler(Purple
 		if (event_type_raw != NULL)
 			event_type = atoi(event_type_raw);
 		g_free(event_type_raw);
-		
+
 		xmlnode_sender = purple_xmlnode_get_child(xmlnode_current_event, "sender");
 		if (xmlnode_sender != NULL)
 		{
@@ -285,7 +285,7 @@ static void ggp_xml_event_handler(Purple
 				event_sender = ggp_str_to_uin(event_sender_raw);
 			g_free(event_sender_raw);
 		}
-		
+
 		switch (event_type)
 		{
 			case 28: /* avatar update */
@@ -299,7 +299,7 @@ static void ggp_xml_event_handler(Purple
 					event_type, event_sender);
 		}
 	}
-	
+
 	out:
 		if (xml)
 			purple_xmlnode_free(xml);
@@ -514,7 +514,7 @@ void ggp_async_login_handler(gpointer _g
 
 				purple_connection_update_progress(gc, _("Connected"), 1, 2);
 				purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED);
-				
+
 				ggp_buddylist_send(gc);
 				ggp_roster_request_update(gc);
 			}
@@ -723,7 +723,7 @@ static void ggp_login(PurpleAccount *acc
 		GG_FEATURE_USER_DATA);
 
 	glp->async = 1;
-	
+
 	encryption_type = purple_account_get_string(account, "encryption",
 		"opportunistic_tls");
 	purple_debug_info("gg", "Requested encryption type: %s\n",
@@ -832,14 +832,14 @@ static void ggp_close(PurpleConnection *
 static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, PurpleIMTypingState state)
 {
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
-	int dummy_length; // we don't send real length of typed message
+	int dummy_length; /* we don't send real length of typed message */
 	
-	if (state == PURPLE_IM_TYPED) // not supported
+	if (state == PURPLE_IM_TYPED) /* not supported */
 		return 1;
 	
 	if (state == PURPLE_IM_TYPING)
 		dummy_length = (int)g_random_int();
-	else // PURPLE_NOT_TYPING
+	else /* PURPLE_NOT_TYPING */
 		dummy_length = 0;
 	
 	gg_typing_notification(
@@ -847,7 +847,7 @@ static unsigned int ggp_send_typing(Purp
 		ggp_str_to_uin(name),
 		dummy_length); 
 	
-	return 1; // wait 1 second before another notification
+	return 1; /* wait 1 second before another notification */
 }



More information about the Commits mailing list