/pidgin/main: 389e413e3414: Style: fix gg (partially)

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon Feb 3 15:49:46 EST 2014


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

Description:

Style: fix gg (partially)

diffstat:

 libpurple/protocols/gg/servconn.c  |   8 ++--
 libpurple/protocols/gg/status.c    |  56 ++++++++++++++++++-------------------
 libpurple/protocols/gg/status.h    |   4 +-
 libpurple/protocols/gg/utils.c     |  32 ++++++++++----------
 libpurple/protocols/gg/validator.c |  24 ++++++++--------
 libpurple/protocols/gg/xml.c       |  34 +++++++++++-----------
 6 files changed, 78 insertions(+), 80 deletions(-)

diffs (truncated from 579 to 300 lines):

diff --git a/libpurple/protocols/gg/servconn.c b/libpurple/protocols/gg/servconn.c
--- a/libpurple/protocols/gg/servconn.c
+++ b/libpurple/protocols/gg/servconn.c
@@ -48,14 +48,14 @@ static ggp_servconn_global_data global_d
 void ggp_servconn_setup(PurpleAccountOption *server_option)
 {
 	purple_prefs_add_string(GGP_SERVCONN_HISTORY_PREF, "");
-	
+
 	global_data.server_option = server_option;
 	global_data.server_history = ggp_strsplit_list(purple_prefs_get_string(
 		GGP_SERVCONN_HISTORY_PREF), ";", GGP_SERVCONN_HISTORY_MAXLEN + 1);
 	global_data.server_history = ggp_list_truncate(
 		global_data.server_history, GGP_SERVCONN_HISTORY_MAXLEN,
 		g_free);
-	
+
 	purple_account_option_string_set_hints(global_data.server_option,
 		ggp_servconn_get_servers());
 }
@@ -69,7 +69,7 @@ void ggp_servconn_add_server(const gchar
 {
 	GList *old_entry;
 	gchar *joined;
-	
+
 	old_entry = g_list_find_custom(global_data.server_history, server,
 		(GCompareFunc)g_strcmp0);
 	if (old_entry)
@@ -78,7 +78,7 @@ void ggp_servconn_add_server(const gchar
 		global_data.server_history = g_list_delete_link(
 			global_data.server_history, old_entry);
 	}
-	
+
 	global_data.server_history = g_list_prepend(global_data.server_history,
 		g_strdup(server));
 	global_data.server_history = ggp_list_truncate(
diff --git a/libpurple/protocols/gg/status.c b/libpurple/protocols/gg/status.c
--- a/libpurple/protocols/gg/status.c
+++ b/libpurple/protocols/gg/status.c
@@ -47,8 +47,6 @@ ggp_status_get_ssdata(PurpleConnection *
 
 static gchar * ggp_status_validate_description(const gchar* msg);
 
-////
-
 static inline ggp_status_session_data *
 ggp_status_get_ssdata(PurpleConnection *gc)
 {
@@ -63,7 +61,7 @@ void ggp_status_setup(PurpleConnection *
 
 	ggp_status_session_data *ssdata = g_new0(ggp_status_session_data, 1);
 	accdata->status_data = ssdata;
-	
+
 	ssdata->status_broadcasting =
 		purple_account_get_bool(account, "status_broadcasting", TRUE);
 }
@@ -79,7 +77,7 @@ static gchar * ggp_status_validate_descr
 {
 	if (msg == NULL || msg[0] == '\0')
 		return NULL;
-	
+
 	return ggp_utf8_strndup(msg, GG_STATUS_DESCR_MAXSIZE);
 }
 
@@ -125,9 +123,9 @@ int ggp_status_from_purplestatus(PurpleS
 	const char *status_id = purple_status_get_id(status);
 	const char *status_message =
 		purple_status_get_attr_string(status, "message");
-	
+
 	g_return_val_if_fail(message != NULL, 0);
-	
+
 	*message = NULL;
 	if (status_message)
 	{
@@ -136,7 +134,7 @@ int ggp_status_from_purplestatus(PurpleS
 		*message = ggp_status_validate_description(stripped);
 		g_free(stripped);
 	}
-	
+
 	if (0 == strcmp(status_id, "available"))
 		return status_message ? GG_STATUS_AVAIL_DESCR : GG_STATUS_AVAIL;
 	if (0 == strcmp(status_id, "freeforchat"))
@@ -151,7 +149,7 @@ int ggp_status_from_purplestatus(PurpleS
 	if (0 == strcmp(status_id, "offline"))
 		return status_message ?
 			GG_STATUS_NOT_AVAIL_DESCR : GG_STATUS_NOT_AVAIL;
-	
+
 	purple_debug_error("gg", "ggp_status_from_purplestatus: "
 		"unknown status requested (%s)\n", status_id);
 	return status_message ? GG_STATUS_AVAIL_DESCR : GG_STATUS_AVAIL;
@@ -216,7 +214,7 @@ void ggp_status_set_initial(PurpleConnec
 {
 	ggp_status_session_data *ssdata = ggp_status_get_ssdata(gc);
 	PurpleAccount *account = purple_connection_get_account(gc);
-	
+
 	glp->status = ggp_status_from_purplestatus(
 		purple_account_get_active_status(account), &glp->status_descr);
 	if (!ggp_status_get_status_broadcasting(gc))
@@ -230,10 +228,10 @@ gboolean ggp_status_set(PurpleAccount *a
 	ggp_status_session_data *ssdata = ggp_status_get_ssdata(gc);
 	GGPInfo *accdata = purple_connection_get_protocol_data(gc);
 	gchar *new_description = ggp_status_validate_description(msg);
-	
+
 	if (!ssdata->status_broadcasting)
 		status |= GG_STATUS_FRIENDS_MASK;
-	
+
 	if ((status == GG_STATUS_NOT_AVAIL ||
 		status == GG_STATUS_NOT_AVAIL_DESCR) &&
 		0 == g_strcmp0(ssdata->current_description, new_description))
@@ -245,12 +243,12 @@ gboolean ggp_status_set(PurpleAccount *a
 	}
 	g_free(ssdata->current_description);
 	ssdata->current_description = new_description;
-	
+
 	if (msg == NULL)
 		gg_change_status(accdata->session, status);
 	else
 		gg_change_status_descr(accdata->session, status, new_description);
-	
+
 	return TRUE;
 }
 
@@ -258,10 +256,10 @@ void ggp_status_set_purplestatus(PurpleA
 {
 	int status_gg;
 	gchar *msg = NULL;
-	
+
 	if (!purple_status_is_active(status))
 		return;
-	
+
 	status_gg = ggp_status_from_purplestatus(status, &msg);
 	ggp_status_set(account, status_gg, msg);
 	g_free(msg);
@@ -270,7 +268,7 @@ void ggp_status_set_purplestatus(PurpleA
 void ggp_status_set_disconnected(PurpleAccount *account)
 {
 	gchar *msg = NULL;
-	
+
 	ggp_status_from_purplestatus(purple_account_get_active_status(account),
 		&msg);
 	if (!ggp_status_set(account,
@@ -279,7 +277,7 @@ void ggp_status_set_disconnected(PurpleA
 		g_free(msg);
 		return;
 	}
-	
+
 	/*
 	struct gg_event *ev;
 	guint64 wait_start = ggp_microtime(), now;
@@ -296,7 +294,7 @@ void ggp_status_set_disconnected(PurpleA
 	}
 	*/
 	g_usleep(100000);
-	
+
 	g_free(msg);
 }
 
@@ -308,19 +306,19 @@ void ggp_status_fake_to_self(PurpleConne
 	const char *status_msg = purple_status_get_attr_string(status,
 		"message");
 	gchar *status_msg_gg = NULL;
-	
+
 	if (status_msg != NULL && status_msg[0] != '\0')
 	{
 		status_msg_gg = g_new0(gchar, GG_STATUS_DESCR_MAXSIZE + 1);
 		g_utf8_strncpy(status_msg_gg, status_msg,
 			GG_STATUS_DESCR_MAXSIZE);
 	}
-	
+
 	purple_prpl_got_user_status(account,
 		purple_account_get_username(account),
 		purple_status_get_id(status),
 		status_msg_gg ? "message" : NULL, status_msg_gg, NULL);
-	
+
 	g_free(status_msg_gg);
 }
 
@@ -345,16 +343,16 @@ void ggp_status_broadcasting_dialog(Purp
 	PurpleRequestFields *fields;
 	PurpleRequestFieldGroup *group;
 	PurpleRequestField *field;
-	
+
 	fields = purple_request_fields_new();
 	group = purple_request_field_group_new(NULL);
 	purple_request_fields_add_group(fields, group);
-	
+
 	field = purple_request_field_bool_new("buddies_only",
 		_("Show status only for buddies"),
 		!ggp_status_get_status_broadcasting(gc));
 	purple_request_field_group_add_field(group, field);
-	
+
 	purple_request_fields(gc,
 		_("Change status broadcasting"),
 		_("Please, select who can see your status"),
@@ -410,9 +408,9 @@ void ggp_status_got_others_buddy(PurpleC
 	const gchar *purple_status = ggp_status_to_purplestatus(status);
 	gchar *status_message = NULL;
 	gboolean is_own;
-	
+
 	is_own = 0 == g_strcmp0(ggp_uin_to_str(uin), purple_account_get_username(account));
-	
+
 	if (!buddy)
 	{
 		if (!is_own)
@@ -438,7 +436,7 @@ void ggp_status_got_others_buddy(PurpleC
 			status_message = NULL;
 		}
 	}
-	
+
 	if (uin == ggp_str_to_uin(purple_account_get_username(account)))
 	{
 		purple_debug_info("gg", "ggp_status_got_others_buddy: "
@@ -451,7 +449,7 @@ void ggp_status_got_others_buddy(PurpleC
 			"status of %u changed to %s [%s]\n", uin,
 			purple_status, status_message ? status_message : "");
 	}
-	
+
 	if (status_message)
 	{
 		purple_prpl_got_user_status(account, ggp_uin_to_str(uin),
@@ -462,7 +460,7 @@ void ggp_status_got_others_buddy(PurpleC
 		purple_prpl_got_user_status(account, ggp_uin_to_str(uin),
 			purple_status, NULL);
 	}
-	
+
 	g_free(status_message);
 }
 
diff --git a/libpurple/protocols/gg/status.h b/libpurple/protocols/gg/status.h
--- a/libpurple/protocols/gg/status.h
+++ b/libpurple/protocols/gg/status.h
@@ -43,7 +43,7 @@ int ggp_status_from_purplestatus(PurpleS
 const gchar * ggp_status_to_purplestatus(int status);
 const gchar * ggp_status_get_name(const gchar *purple_status);
 
-// own status
+/* own status */
 
 void ggp_status_set_initial(PurpleConnection *gc, struct gg_login_params *glp);
 
@@ -57,7 +57,7 @@ void ggp_status_set_status_broadcasting(
 	gboolean broadcasting);
 void ggp_status_broadcasting_dialog(PurpleConnection *gc);
 
-// buddy status
+/* buddy status */
 
 void ggp_status_got_others(PurpleConnection *gc, struct gg_event *ev);
 char * ggp_status_buddy_text(PurpleBuddy *buddy);
diff --git a/libpurple/protocols/gg/utils.c b/libpurple/protocols/gg/utils.c
--- a/libpurple/protocols/gg/utils.c
+++ b/libpurple/protocols/gg/utils.c
@@ -53,16 +53,16 @@ uin_t ggp_str_to_uin(const char *str)
 const char * ggp_uin_to_str(uin_t uin)
 {
 	static char buff[GGP_UIN_LEN_MAX + 1];
-	
+
 	g_snprintf(buff, GGP_UIN_LEN_MAX + 1, "%u", uin);
-	
+
 	return buff;
 }
 
 uin_t ggp_get_my_uin(PurpleConnection *gc)
 {
 	g_return_val_if_fail(gc != NULL, 0);
-	
+
 	return ggp_str_to_uin(purple_account_get_username(
 		purple_connection_get_account(gc)));



More information about the Commits mailing list