/pidgin/main: 3a71df246d07: Style: fix gg (partially)

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon Feb 3 15:43:20 EST 2014


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

Description:

Style: fix gg (partially)

diffstat:

 libpurple/protocols/gg/gg.c              |    8 +-
 libpurple/protocols/gg/pubdir-prpl.c     |   24 +-
 libpurple/protocols/gg/resolver-purple.c |   40 ++--
 libpurple/protocols/gg/roster.c          |  300 +++++++++++++++---------------
 libpurple/protocols/gg/roster.h          |    8 +-
 5 files changed, 194 insertions(+), 186 deletions(-)

diffs (truncated from 1090 to 300 lines):

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
@@ -833,20 +833,20 @@ static unsigned int ggp_send_typing(Purp
 {
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
 	int dummy_length; /* we don't send real length of typed message */
-	
+
 	if (state == PURPLE_IM_TYPED) /* not supported */
 		return 1;
-	
+
 	if (state == PURPLE_IM_TYPING)
 		dummy_length = (int)g_random_int();
 	else /* PURPLE_NOT_TYPING */
 		dummy_length = 0;
-	
+
 	gg_typing_notification(
 		info->session,
 		ggp_str_to_uin(name),
 		dummy_length); 
-	
+
 	return 1; /* wait 1 second before another notification */
 }
 
diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c
--- a/libpurple/protocols/gg/pubdir-prpl.c
+++ b/libpurple/protocols/gg/pubdir-prpl.c
@@ -74,7 +74,7 @@ static void ggp_pubdir_request_buddy_ali
 	int records_count, const ggp_pubdir_record *records, int next_offset,
 	void *user_data);
 
-// Searching for buddies.
+/* Searching for buddies. */
 
 #define GGP_PUBDIR_SEARCH_TITLE _("Gadu-Gadu Public Directory")
 #define GGP_PUBDIR_SEARCH_PER_PAGE 20
@@ -116,7 +116,7 @@ static void ggp_pubdir_search_results_in
 static void ggp_pubdir_search_results_new(PurpleConnection *gc, GList *row,
 	gpointer _form);
 
-// Own profile.
+/* Own profile. */
 
 static void ggp_pubdir_set_info_dialog(PurpleConnection *gc, int records_count,
 	const ggp_pubdir_record *records, int next_offset, void *user_data);
@@ -330,15 +330,17 @@ static void ggp_pubdir_got_data(PurpleHt
 		}
 
 		record->birth = ggp_date_from_iso8601(birth_s);
-		//TODO: calculate age from birth
+		/*TODO: calculate age from birth */
 
-		//TODO: verbose
-		purple_debug_misc("gg", "ggp_pubdir_got_data: [uin:%d] "
-			"[label:%s] [nick:%s] [first name:%s] [last name:%s] "
-			"[city:%s] [gender:%d] [age:%d] [birth:%lu]\n",
-			record->uin, record->label, record->nickname,
-			record->first_name, record->last_name, record->city,
-			record->gender, record->age, record->birth);
+		if (purple_debug_is_verbose()) {
+			purple_debug_misc("gg", "ggp_pubdir_got_data: [uin:%d] "
+				"[label:%s] [nick:%s] [first name:%s] "
+				"[last name:%s] [city:%s] [gender:%d] [age:%d] "
+				"[birth:%lu]\n", record->uin, record->label,
+				record->nickname, record->first_name,
+				record->last_name, record->city, record->gender,
+				record->age, record->birth);
+		}
 
 		g_free(city);
 
@@ -913,7 +915,7 @@ static void ggp_pubdir_set_info_got_toke
 
 	if (!token || !PURPLE_CONNECTION_IS_VALID(gc))
 	{
-		// TODO: notify about failure
+		/* TODO: notify about failure */
 		ggp_pubdir_record_free(record, 1);
 		return;
 	}
diff --git a/libpurple/protocols/gg/resolver-purple.c b/libpurple/protocols/gg/resolver-purple.c
--- a/libpurple/protocols/gg/resolver-purple.c
+++ b/libpurple/protocols/gg/resolver-purple.c
@@ -45,7 +45,7 @@ static void ggp_resolver_purple_cb(GSLis
 typedef struct
 {
 	PurpleDnsQueryData *purpleQuery;
-	
+
 	/**
 	 * File descriptors:
 	 *  pipes[0] - for reading
@@ -71,29 +71,29 @@ void ggp_resolver_purple_cb(GSList *host
 	const int fd = data->pipes[1];
 	int ipv4_count, all_count, write_size;
 	struct in_addr *addresses;
-	
+
 	purple_debug_misc("gg", "ggp_resolver_purple_cb(%p, %p, \"%s\")\n",
 		hosts, cbdata, error_message);
-	
+
 	data->purpleQuery = NULL;
-	
+
 	if (error_message)
 	{
 		purple_debug_error("gg", "ggp_resolver_purple_cb failed: %s\n",
 			error_message);
 	}
-	
+
 	all_count = g_slist_length(hosts);
 	g_assert(all_count % 2 == 0);
 	all_count /= 2;
 	addresses = malloc((all_count + 1) * sizeof(struct in_addr));
-	
+
 	ipv4_count = 0;
 	while (hosts && (hosts = g_slist_delete_link(hosts, hosts)))
 	{
 		const struct sockaddr *addr = hosts->data;
 		char dst[INET6_ADDRSTRLEN];
-		
+
 		if (addr->sa_family == AF_INET6)
 		{
 			inet_ntop(addr->sa_family,
@@ -110,7 +110,7 @@ void ggp_resolver_purple_cb(GSList *host
 				dst, sizeof(dst));
 			purple_debug_misc("gg", "ggp_resolver_purple_cb "
 				"ipv4: %s\n", dst);
-			
+
 			g_assert(ipv4_count < all_count);
 			addresses[ipv4_count++] = addr_ipv4;
 		}
@@ -119,13 +119,13 @@ void ggp_resolver_purple_cb(GSList *host
 			purple_debug_warning("gg", "ggp_resolver_purple_cb "
 				"unexpected sa_family: %d\n", addr->sa_family);
 		}
-		
+
 		g_free(hosts->data);
 		hosts = g_slist_delete_link(hosts, hosts);
 	}
-	
+
 	addresses[ipv4_count].s_addr = INADDR_NONE;
-	
+
 	write_size = (ipv4_count + 1) * sizeof(struct in_addr);
 	if (write(fd, addresses, write_size) != write_size)
 	{
@@ -141,13 +141,13 @@ int ggp_resolver_purple_start(int *fd, v
 	ggp_resolver_purple_data *data;
 	purple_debug_misc("gg", "ggp_resolver_purple_start(%p, %p, \"%s\")\n",
 		fd, private_data, hostname);
-	
+
 	data = malloc(sizeof(ggp_resolver_purple_data));
 	*private_data = (void*)data;
 	data->purpleQuery = NULL;
 	data->pipes[0] = 0;
 	data->pipes[1] = 0;
-	
+
 	if (purple_input_pipe(data->pipes) != 0)
 	{
 		purple_debug_error("gg", "ggp_resolver_purple_start: "
@@ -155,9 +155,9 @@ int ggp_resolver_purple_start(int *fd, v
 		ggp_resolver_purple_cleanup(private_data, 0);
 		return -1;
 	}
-	
+
 	*fd = data->pipes[0];
-	
+
 	/* account and port is unknown in this context */
 	data->purpleQuery = purple_dnsquery_a(NULL, hostname, 80,
 		ggp_resolver_purple_cb, (gpointer)data);
@@ -169,7 +169,7 @@ int ggp_resolver_purple_start(int *fd, v
 		ggp_resolver_purple_cleanup(private_data, 0);
 		return -1;
 	}
-	
+
 	return 0;
 }
 
@@ -177,20 +177,20 @@ void ggp_resolver_purple_cleanup(void **
 {
 	ggp_resolver_purple_data *data =
 		(ggp_resolver_purple_data*)(*private_data);
-	
+
 	purple_debug_misc("gg", "ggp_resolver_purple_cleanup(%p, %d)\n",
 		private_data, force);
-	
+
 	if (!data)
 		return;
 	*private_data = NULL;
-	
+
 	if (data->purpleQuery)
 		purple_dnsquery_destroy(data->purpleQuery);
 	if (data->pipes[0])
 		close(data->pipes[0]);
 	if (data->pipes[1])
 		close(data->pipes[1]);
-	
+
 	free(data);
 }
diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c
--- a/libpurple/protocols/gg/roster.c
+++ b/libpurple/protocols/gg/roster.c
@@ -42,34 +42,34 @@
 #define GGP_ROSTER_GROUPID_DEFAULT "00000000-0000-0000-0000-000000000000"
 #define GGP_ROSTER_GROUPID_BOTS "0b345af6-0001-0000-0000-000000000004"
 
-// TODO: ignored contacts synchronization (?)
+/* TODO: ignored contacts synchronization (?) */
 
 typedef struct
 {
 	int version;
-	
+
 	PurpleXmlNode *xml;
-	
+
 	PurpleXmlNode *groups_node, *contacts_node;
-	
+
 	/**
 	 * Key: (uin_t) user identifier
 	 * Value: (PurpleXmlNode*) xml node for contact
 	 */
 	GHashTable *contact_nodes;
-	
+
 	/**
 	 * Key: (gchar*) group id
 	 * Value: (PurpleXmlNode*) xml node for group
 	 */
 	GHashTable *group_nodes;
-	
+
 	/**
 	 * Key: (gchar*) group name
 	 * Value: (gchar*) group id
 	 */
 	GHashTable *group_ids;
-	
+
 	/**
 	 * Key: (gchar*) group id
 	 * Value: (gchar*) group name
@@ -110,12 +110,12 @@ static gboolean ggp_roster_timer_cb(gpoi
 static void ggp_roster_dump(ggp_roster_content *content);
 #endif
 
-// synchronization control
+/* synchronization control */
 static gboolean ggp_roster_is_synchronized(PurpleBuddy *buddy);
 static void ggp_roster_set_synchronized(PurpleConnection *gc,
 	PurpleBuddy *buddy, gboolean synchronized);
 
-// buddy list import
+/* buddy list import */
 static gboolean ggp_roster_reply_list_read_group(PurpleXmlNode *node,
 	ggp_roster_content *content);
 static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc,
@@ -123,7 +123,7 @@ static gboolean ggp_roster_reply_list_re
 static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version,
 	const char *reply);
 
-// buddy list export
+/* buddy list export */
 static const gchar * ggp_roster_send_update_group_add(
 	ggp_roster_content *content, PurpleGroup *group);
 static gboolean ggp_roster_send_update_contact_update(PurpleConnection *gc,
@@ -167,13 +167,13 @@ static void ggp_roster_content_free(ggp_
 static void ggp_roster_change_free(gpointer _change)
 {
 	ggp_roster_change *change = _change;
-	
+
 	if (change->type == GGP_ROSTER_CHANGE_GROUP_RENAME)
 	{
 		g_free(change->data.group_rename.old_name);
 		g_free(change->data.group_rename.new_name);
 	}



More information about the Commits mailing list