changeset 20425:5048651671e1

Revert a bunch of whitespace changes so reviewing a diff against im.pidgin.pidgin doesn't make my eyes bleed quite as much
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 26 May 2007 13:59:07 +0000
parents b462ef222d28
children 637e080758a9
files libpurple/protocols/msn/cmdproc.c libpurple/protocols/msn/directconn.c libpurple/protocols/msn/group.c libpurple/protocols/msn/msg.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/object.c libpurple/protocols/msn/servconn.c libpurple/protocols/msn/state.c libpurple/protocols/msn/switchboard.c libpurple/protocols/msn/table.c libpurple/protocols/msn/transaction.c libpurple/protocols/msn/user.c libpurple/protocols/msn/userlist.c
diffstat 14 files changed, 146 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/cmdproc.c	Sat May 26 13:59:07 2007 +0000
@@ -89,7 +89,8 @@
 
 	tmp = (incoming) ? 'S' : 'C';
 
-	if ((show[len - 1] == '\n') && (show[len - 2] == '\r')){
+	if ((show[len - 1] == '\n') && (show[len - 2] == '\r'))
+	{
 		show[len - 2] = '\0';
 	}
 
@@ -126,14 +127,14 @@
 		trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds,
 											   trans->command);
 
-	if (trans->payload != NULL){
+	if (trans->payload != NULL)
+	{
 		data = g_realloc(data, len + trans->payload_len);
 		memcpy(data + len, trans->payload, trans->payload_len);
 		len += trans->payload_len;
 	}
 
 	msn_servconn_write(servconn, data, len);
-//	purple_debug_info("<<","%s\n",data);
 
 	g_free(data);
 }
@@ -227,7 +228,8 @@
 {
 	MsnMsgTypeCb cb;
 
-	if (msn_message_get_content_type(msg) == NULL){
+	if (msn_message_get_content_type(msg) == NULL)
+	{
 		purple_debug_misc("msn", "failed to find message content\n");
 		return;
 	}
@@ -235,7 +237,8 @@
 	cb = g_hash_table_lookup(cmdproc->cbs_table->msgs,
 							 msn_message_get_content_type(msg));
 
-	if (cb == NULL){
+	if (cb == NULL)
+	{
 		purple_debug_warning("msn", "Unhandled content-type '%s'\n",
 						   msn_message_get_content_type(msg));
 
--- a/libpurple/protocols/msn/directconn.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/directconn.c	Sat May 26 13:59:07 2007 +0000
@@ -487,7 +487,6 @@
 void
 msn_directconn_destroy(MsnDirectConn *directconn)
 {
-
 	if (directconn->connect_data != NULL)
 		purple_proxy_connect_cancel(directconn->connect_data);
 
--- a/libpurple/protocols/msn/group.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/group.c	Sat May 26 13:59:07 2007 +0000
@@ -88,4 +88,3 @@
 
 	return group->name;
 }
-
--- a/libpurple/protocols/msn/msg.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/msg.c	Sat May 26 13:59:07 2007 +0000
@@ -23,7 +23,6 @@
  */
 #include "msn.h"
 #include "msg.h"
-#define MSN_DEBUG_MSG
 
 MsnMessage *
 msn_message_new(MsnMsgType type)
@@ -105,7 +104,8 @@
 	purple_debug_info("msn", "message unref (%p)[%d]\n", msg, msg->ref_count);
 #endif
 
-	if (msg->ref_count == 0){
+	if (msg->ref_count == 0)
+	{
 		msn_message_destroy(msg);
 
 		return NULL;
@@ -215,7 +215,6 @@
 	char **elems, **cur, **tokens;
 
 	g_return_if_fail(payload != NULL);
-//	purple_debug_info("MaYuan","payload:{%s}\n",payload);
 	tmp_base = tmp = g_malloc0(payload_len + 1);
 	memcpy(tmp_base, payload, payload_len);
 
@@ -232,7 +231,8 @@
 
 	elems = g_strsplit(tmp, line_dem, 0);
 
-	for (cur = elems; *cur != NULL; cur++){
+	for (cur = elems; *cur != NULL; cur++)
+	{
 		const char *key, *value;
 
 		tokens = g_strsplit(*cur, ": ", 2);
@@ -241,16 +241,20 @@
 		value = tokens[1];
 
 		/*if not MIME content ,then return*/
-		if (!strcmp(key, "MIME-Version")){
+		if (!strcmp(key, "MIME-Version"))
+		{
 			g_strfreev(tokens);
 			continue;
 		}
 
-		if (!strcmp(key, "Content-Type")){
+		if (!strcmp(key, "Content-Type"))
+		{
 			char *charset, *c;
 
-			if ((c = strchr(value, ';')) != NULL){
-				if ((charset = strchr(c, '=')) != NULL)	{
+			if ((c = strchr(value, ';')) != NULL)
+			{
+				if ((charset = strchr(c, '=')) != NULL)
+				{
 					charset++;
 					msn_message_set_charset(msg, charset);
 				}
@@ -259,7 +263,9 @@
 			}
 
 			msn_message_set_content_type(msg, value);
-		}else{
+		}
+		else
+		{
 			msn_message_set_attr(msg, key, value);
 		}
 
@@ -275,7 +281,8 @@
 	content_type = msn_message_get_content_type(msg);
 
 	if (content_type != NULL &&
-		!strcmp(content_type, "application/x-msnmsgrp2p")){
+		!strcmp(content_type, "application/x-msnmsgrp2p"))
+	{
 		MsnSlpHeader header;
 		MsnSlpFooter footer;
 		int body_len;
@@ -317,7 +324,9 @@
 			tmp += sizeof(footer);
 			msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value);
 		}
-	}else{
+	}
+	else
+	{
 		if (payload_len - (tmp - tmp_base) > 0) {
 			msg->body_len = payload_len - (tmp - tmp_base);
 			msg->body = g_malloc0(msg->body_len + 1);
@@ -468,14 +477,16 @@
 	}
 	else
 	{
-		if (body != NULL){
+		if (body != NULL)
+		{
 			memcpy(n, body, body_len);
 			n += body_len;
 			*n = '\0';
 		}
 	}
 
-	if (ret_size != NULL){
+	if (ret_size != NULL)
+	{
 		*ret_size = n - base;
 
 		if (*ret_size > 1664)
@@ -514,11 +525,14 @@
 	if (msg->body != NULL)
 		g_free(msg->body);
 
-	if (data != NULL && len > 0){
+	if (data != NULL && len > 0)
+	{
 		msg->body = g_malloc0(len + 1);
 		memcpy(msg->body, data, len);
 		msg->body_len = len;
-	}else{
+	}
+	else
+	{
 		msg->body = NULL;
 		msg->body_len = 0;
 	}
@@ -773,4 +787,3 @@
 
 	g_string_free(str, TRUE);
 }
-
--- a/libpurple/protocols/msn/msn.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Sat May 26 13:59:07 2007 +0000
@@ -665,11 +665,11 @@
 	status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
 			NULL, NULL, FALSE, TRUE, FALSE);
 	types = g_list_append(types, status);
-	
+
 	status = purple_status_type_new_full(PURPLE_STATUS_MOBILE,
 			"mobile", NULL, FALSE, FALSE, TRUE);
 	types = g_list_append(types, status);
-	
+
 	return types;
 }
 
@@ -795,8 +795,7 @@
 		return;
 	}
 
-	if (purple_account_get_bool(account, "http_method", FALSE))
-		http_method = TRUE;
+	http_method = purple_account_get_bool(account, "http_method", FALSE);
 
 	host = purple_account_get_string(account, "server", MSN_SERVER);
 	port = purple_account_get_int(account, "port", MSN_PORT);
@@ -939,8 +938,8 @@
 		MsnSession *session;
 		MsnOim *oim;
 		char *friendname;
-		
-		purple_debug_info("MaYuan","prepare to send offline Message\n");		
+
+		purple_debug_info("MaYuan","prepare to send offline Message\n");
 		session = gc->proto_data;
 		/* XXX/khc: hack */
 		if (!session->oim)
@@ -1012,7 +1011,8 @@
 
 	gc = purple_account_get_connection(account);
 
-	if (gc != NULL){
+	if (gc != NULL)
+	{
 		session = gc->proto_data;
 		msn_change_status(session);
 	}
@@ -1237,9 +1237,12 @@
 	cmdproc = session->notification->cmdproc;
 
 	if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL ||
-		account->perm_deny == PURPLE_PRIVACY_DENY_USERS){
+		account->perm_deny == PURPLE_PRIVACY_DENY_USERS)
+	{
 		msn_cmdproc_send(cmdproc, "BLP", "%s", "AL");
-	}else{
+	}
+	else
+	{
 		msn_cmdproc_send(cmdproc, "BLP", "%s", "BL");
 	}
 }
@@ -1389,11 +1392,14 @@
 	purple_debug_info("MaYuan","rename group:old{%s},new{%s}",old_name,enc_new_group_name);
 	old_gid = msn_userlist_find_group_id(session->userlist, old_name);
 
-	if (old_gid != NULL){
+	if (old_gid != NULL)
+	{
 		/*find a Group*/
 		msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid,
 						 enc_new_group_name);
-	}else{
+	}
+	else
+	{
 		/*not found*/
 		msn_cmdproc_send(cmdproc, "ADG", "%s 0", enc_new_group_name);
 	}
@@ -1462,11 +1468,13 @@
 
 	/*we can't delete the default group*/
 	if(!strcmp(group->name,MSN_INDIVIDUALS_GROUP_NAME)||
-		!strcmp(group->name,MSN_NON_IM_GROUP_NAME)){
+		!strcmp(group->name,MSN_NON_IM_GROUP_NAME))
+	{
 		return ;
 	}
 	group_id = msn_userlist_find_group_id(session->userlist, group->name);
-	if (group_id != NULL){
+	if (group_id != NULL)
+	{
 		msn_del_group(session,group_id);
 	}
 }
@@ -1482,16 +1490,19 @@
 	b = purple_find_buddy(purple_connection_get_account(info_data->gc),
 						info_data->name);
 
-	if (b){
+	if (b)
+	{
 		char *tmp;
 
-		if (b->alias && b->alias[0]){
+		if (b->alias && b->alias[0])
+		{
 			char *aliastext = g_markup_escape_text(b->alias, -1);
 			purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext);
 			g_free(aliastext);
 		}
 
-		if (b->server_alias){
+		if (b->server_alias)
+		{
 			char *nicktext = g_markup_escape_text(b->server_alias, -1);
 			tmp = g_strdup_printf("<font sml=\"msn\">%s</font><br>", nicktext);
 			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
@@ -1515,7 +1526,8 @@
 {
 	char *p, *q;
 
-	if ((p = strstr(url_text, PHOTO_URL)) != NULL){
+	if ((p = strstr(url_text, PHOTO_URL)) != NULL)
+	{
 		p += strlen(PHOTO_URL);
 	}
 	if (p && (strncmp(p, "http://",strlen("http://")) == 0) && ((q = strchr(p, '"')) != NULL))
@@ -2232,7 +2244,8 @@
 	N_("Windows Live Messenger Protocol Plugin"),
 	                                                  /**  description    */
 	N_("Windows Live Messenger Protocol Plugin"),
-	"MaYuan <mayuan2006@gmail.com>",				/**< author         */
+	"Christian Hammond <chipx86@gnupdate.org>, "
+	"MaYuan <mayuan2006@gmail.com>",				  /**< author         */
 	PURPLE_WEBSITE,                                     /**< homepage       */
 
 	msn_load,                                         /**< load           */
--- a/libpurple/protocols/msn/notification.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/notification.c	Sat May 26 13:59:07 2007 +0000
@@ -121,9 +121,12 @@
 
 	vers = g_strjoinv(" ", a);
 
-	if (session->login_step == MSN_LOGIN_STEP_START){
+	if (session->login_step == MSN_LOGIN_STEP_START)
+	{
 		msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE);
-	}else{
+	}
+	else
+	{
 		msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2);
 	}
 
@@ -174,16 +177,22 @@
 	account = session->account;
 	gc = purple_account_get_connection(account);
 
-	if (error == 224){
-		if (group_id == 0){
+	if (error == 224)
+	{
+		if (group_id == 0)
+		{
 			return;
-		}else{
+		}
+		else
+		{
 			const char *group_name;
 			group_name = msn_userlist_find_group_name(session->userlist,group_id);
 			reason = g_strdup_printf(_("%s is not a valid group."),
 									 group_name);
 		}
-	}else{
+	}
+	else
+	{
 		reason = g_strdup(_("Unknown error."));
 	}
 
@@ -232,7 +241,8 @@
 	account = session->account;
 	gc = purple_account_get_connection(account);
 
-	if (!g_ascii_strcasecmp(cmd->params[1], "OK")){
+	if (!g_ascii_strcasecmp(cmd->params[1], "OK"))
+	{
 		/* authenticate OK */
 		/* friendly name part no longer true in msnp11 */
 #if 0
@@ -244,7 +254,9 @@
 
 //		msn_cmdproc_send(cmdproc, "SYN", "%s", "0");
 		//TODO we should use SOAP contact to fetch contact list
-	} else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")){
+	}
+	else if (!g_ascii_strcasecmp(cmd->params[1], "TWN"))
+	{
 		/* Passport authentication */
 		char **elems, **cur, **tokens;
 
@@ -254,9 +266,11 @@
 		session->nexus->challenge_data_str = g_strdup(cmd->params[3]);
 		elems = g_strsplit(cmd->params[3], ",", 0);
 
-		for (cur = elems; *cur != NULL; cur++){
+		for (cur = elems; *cur != NULL; cur++)
+		{
 			tokens = g_strsplit(*cur, "=", 2);
-			if(tokens[0]&&tokens[1]){
+			if(tokens[0]&&tokens[1])
+			{
 				purple_debug_info("MaYuan","challenge %p,key:%s,value:%s\n",
 									session->nexus->challenge_data,tokens[0],tokens[1]);
 				g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]);
@@ -321,7 +335,8 @@
 		}
 	}
 
-	if (!protocol_supported){
+	if (!protocol_supported)
+	{
 		msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL,
 							  NULL);
 		return;
@@ -531,7 +546,7 @@
 
 /**************************************************************************
  * Challenges
- *  we use MD5 to caculate the Chanllenges 
+ *  we use MD5 to caculate the Challenges
  **************************************************************************/
 static void
 chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -551,7 +566,8 @@
 	purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
 	purple_cipher_context_destroy(context);
 
-	for (i = 0; i < 16; i++){
+	for (i = 0; i < 16; i++)
+	{
 		g_snprintf(buf + (i*2), 3, "%02x", digest[i]);
 	}
 #else
--- a/libpurple/protocols/msn/object.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/object.c	Sat May 26 13:59:07 2007 +0000
@@ -295,7 +295,8 @@
 
 	g_return_val_if_fail(sha1 != NULL, NULL);
 
-	for (l = local_objs; l != NULL; l = l->next){
+	for (l = local_objs; l != NULL; l = l->next)
+	{
 		MsnObject *local_obj = l->data;
 
 		if (!strcmp(msn_object_get_sha1(local_obj), sha1))
@@ -342,4 +343,3 @@
 
 	return NULL;
 }
-
--- a/libpurple/protocols/msn/servconn.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/servconn.c	Sat May 26 13:59:07 2007 +0000
@@ -168,7 +168,7 @@
 static void
 connect_cb(gpointer data, gint source, PurpleInputCondition cond)
 {
-	MsnServConn *servconn = data;
+	MsnServConn *servconn;
 
 	servconn = data;
 	servconn->connect_data = NULL;
--- a/libpurple/protocols/msn/state.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/state.c	Sat May 26 13:59:07 2007 +0000
@@ -265,10 +265,13 @@
 
 	msnobj = msn_user_get_object(user);
 
-	if (msnobj == NULL){
+	if (msnobj == NULL)
+	{
 		msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text,
 						 MSN_CLIENT_ID);
-	}else{
+	}
+	else
+	{
 		char *msnobj_str;
 
 		msnobj_str = msn_object_to_string(msnobj);
--- a/libpurple/protocols/msn/switchboard.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Sat May 26 13:59:07 2007 +0000
@@ -989,13 +989,16 @@
 	swboard = cmdproc->data;
 	g_return_if_fail(swboard != NULL);
 
-	if (msn_switchboard_is_invited(swboard)){
+	if (msn_switchboard_is_invited(swboard))
+	{
 		swboard->empty = FALSE;
 
 		msn_cmdproc_send(cmdproc, "ANS", "%s %s %s",
 						 purple_account_get_username(account),
 						 swboard->auth_key, swboard->session_id);
-	}else{
+	}
+	else
+	{
 		msn_cmdproc_send(cmdproc, "USR", "%s %s",
 						 purple_account_get_username(account),
 						 swboard->auth_key);
--- a/libpurple/protocols/msn/table.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/table.c	Sat May 26 13:59:07 2007 +0000
@@ -77,14 +77,20 @@
 
 	cbs = NULL;
 
-	if (command == NULL){
+	if (command == NULL)
+	{
 		cbs = table->async;
-	}else if (strcmp(command, "fallback") == 0)	{
+	}
+	else if (strcmp(command, "fallback") == 0)
+	{
 		cbs = table->fallback;
-	}else{
+	}
+	else
+	{
 		cbs = g_hash_table_lookup(table->cmds, command);
 
-		if (cbs == NULL){
+		if (cbs == NULL)
+		{
 			cbs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
 			g_hash_table_insert(table->cmds, command, cbs);
 		}
--- a/libpurple/protocols/msn/transaction.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/transaction.c	Sat May 26 13:59:07 2007 +0000
@@ -205,7 +205,8 @@
 void
 msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb)
 {
-	if (trans->timer){
+	if (trans->timer)
+	{
 		purple_debug_error("msn", "This shouldn't be happening\n");
 		purple_timeout_remove(trans->timer);
 	}
--- a/libpurple/protocols/msn/user.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/user.c	Sat May 26 13:59:07 2007 +0000
@@ -60,9 +60,11 @@
 	if (user->clientcaps != NULL)
 		g_hash_table_destroy(user->clientcaps);
 
-	if (user->group_ids != NULL){
+	if (user->group_ids != NULL)
+	{
 		GList *l;
-		for (l = user->group_ids; l != NULL; l = l->next){
+		for (l = user->group_ids; l != NULL; l = l->next)
+		{
 			g_free(l->data);
 		}
 		g_list_free(user->group_ids);
@@ -183,7 +185,8 @@
 {
 	g_return_if_fail(user != NULL);
 
-	if (name != NULL){
+	if (name != NULL)
+	{
 		g_free(user->store_name);
 		user->store_name = g_strdup(name);
 	}
@@ -199,7 +202,7 @@
 }
 
 void
-msn_user_set_type(MsnUser *user,int type)
+msn_user_set_type(MsnUser *user, int type)
 {
 	g_return_if_fail(user != NULL);
 
@@ -207,9 +210,10 @@
 }
 
 void
-msn_user_set_op(MsnUser *user,int list_op)
+msn_user_set_op(MsnUser *user, int list_op)
 {
-	g_return_if_fail(list_op != 0);
+	g_return_if_fail(user != NULL);
+
 	user->list_op |= list_op;
 }
 
--- a/libpurple/protocols/msn/userlist.c	Sat May 26 13:11:35 2007 +0000
+++ b/libpurple/protocols/msn/userlist.c	Sat May 26 13:59:07 2007 +0000
@@ -114,7 +114,8 @@
 	if (!(user->list_op & list_op))
 		return FALSE;
 
-	if (list_id == MSN_LIST_FL){
+	if (list_id == MSN_LIST_FL)
+	{
 		if (group_id != NULL)
 			return user_is_in_group(user, group_id);
 	}
@@ -164,7 +165,8 @@
 
 	data->who = g_strdup(who);
 
-	if (old_group_name){
+	if (old_group_name)
+	{
 		data->old_group_name = g_strdup(old_group_name);
 		/*delete the old group via SOAP action*/
 		msn_del_group(session,old_group_name);
@@ -356,7 +358,8 @@
 	if (list_op & MSN_LIST_FL_OP)
 	{
 		GSList *c;
-		for (c = group_ids; c != NULL; c = g_slist_next(c))	{
+		for (c = group_ids; c != NULL; c = g_slist_next(c))
+		{
 			char *group_id;
 			group_id = c->data;
 			msn_user_add_group_id(user, group_id);
@@ -518,7 +521,8 @@
 	g_return_val_if_fail(userlist != NULL, NULL);
 	g_return_val_if_fail(id       != NULL, NULL);
 
-	for (l = userlist->groups; l != NULL; l = l->next){
+	for (l = userlist->groups; l != NULL; l = l->next)
+	{
 		MsnGroup *group = l->data;
 
 		if (!g_strcasecmp(group->id,id))
@@ -616,10 +620,12 @@
 
 	group_id = NULL;
 
-	if (group_name != NULL){
+	if (group_name != NULL)
+	{
 		group_id = msn_userlist_find_group_id(userlist, group_name);
 
-		if (group_id == NULL){
+		if (group_id == NULL)
+		{
 			/* Whoa, there is no such group. */
 			purple_debug_error("msn", "Group doesn't exist: %s\n", group_name);
 			return;
@@ -660,7 +666,8 @@
 		/* only notify the user about problems adding to the friends list
 		 * maybe we should do something else for other lists, but it probably
 		 * won't cause too many problems if we just ignore it */
-		if (list_id == MSN_LIST_FL)	{
+		if (list_id == MSN_LIST_FL)
+		{
 			char *str = g_strdup_printf(_("Unable to add \"%s\"."), who);
 			purple_notify_error(NULL, NULL, str,
 							  _("The screen name specified is invalid."));