cpw.qulogic.msn: d6d2e002: Take care of more cleanup in the MSN cod...

qulogic at pidgin.im qulogic at pidgin.im
Sat Jul 12 03:36:35 EDT 2008


-----------------------------------------------------------------
Revision: d6d2e0024c0c5f5f7b447551d746d165e2b58a8d
Ancestor: ad436c79b67d443d3b340634dff8751e0db6a099
Author: qulogic at pidgin.im
Date: 2008-07-12T06:44:19
Branch: im.pidgin.cpw.qulogic.msn
URL: http://d.pidgin.im/viewmtn/revision/info/d6d2e0024c0c5f5f7b447551d746d165e2b58a8d

Modified files:
        libpurple/protocols/msn/contact.c
        libpurple/protocols/msn/group.h
        libpurple/protocols/msn/msnutils.c
        libpurple/protocols/msn/nexus.h
        libpurple/protocols/msn/notification.c
        libpurple/protocols/msn/soap.c
        libpurple/protocols/msn/sync.c
        libpurple/protocols/msn/user.h
        libpurple/protocols/msn/userlist.c

ChangeLog: 

Take care of more cleanup in the MSN code.
No more C++ style comments.
msn_convert_iso8601 was replaced with purple_str_to_time everywhere, so 
remove it.
REM and SYN were removed in MSNP13.
REA was removed in MSNP11.
PRP and BLP were added already, so remove the TODO.
Contact information is now taken from the contact server, so remove all 
that commented code from the ADL command.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c	bc9b58278d97d62a0c16bd6bd76fb4d8d79b1486
+++ libpurple/protocols/msn/contact.c	2750528590a7986059560728aeb6f49d7fe68cab
@@ -939,8 +939,9 @@ msn_add_contact_read_cb(MsnSoapMessage *
 
 	purple_debug_info("msn", "Contact added successfully\n");
 
-	// the code this block is replacing didn't send ADL for yahoo contacts,
-	// but i haven't confirmed this is WLM's behaviour wrt yahoo contacts
+	/* the code this block is replacing didn't send ADL for yahoo contacts,
+	 * but i haven't confirmed this is WLM's behaviour wrt yahoo contacts
+	 */
 	if ( !msn_user_is_yahoo(session->account, state->who) ) {
 		msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL);
 		msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL);
@@ -1562,7 +1563,7 @@ msn_del_group(MsnSession *session, const
 	}
 
 	if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) {
-		// XXX add back PurpleGroup since it isn't really removed in the server?
+		/* XXX add back PurpleGroup since it isn't really removed in the server? */
 		return;
 	}
 
@@ -1608,7 +1609,7 @@ msn_contact_rename_group(MsnSession *ses
 	if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) {
 		MsnCallbackState *new_state = msn_callback_state_dup(state);
 		msn_add_group(session, new_state, new_group_name);
-		// XXX move every buddy there (we probably need to fix concurrent SOAP reqs first)
+		/* XXX move every buddy there (we probably need to fix concurrent SOAP reqs first) */
 	}
 
 	msn_callback_state_set_action(state, MSN_RENAME_GROUP);
============================================================
--- libpurple/protocols/msn/group.h	dc19e0caf7b65e17d4fc2ee76f4ea1eb5946a07e
+++ libpurple/protocols/msn/group.h	a66d80139657e16b3827146c09d01cb7de00c33d
@@ -49,9 +49,9 @@ struct _MsnGroup
 	char *name;             /**< The name of the group.     */
 };
 
-/**************************************************************************/
-/** @name Group API                                                       */
-/**************************************************************************/
+/**************************************************************************
+ ** @name Group API                                                       *
+ **************************************************************************/
 /*@{*/
 
 /**
@@ -105,4 +105,6 @@ const char *msn_group_get_name(const Msn
  * @return The name.
  */
 const char *msn_group_get_name(const MsnGroup *group);
+
 #endif /* _MSN_GROUP_H_ */
+
============================================================
--- libpurple/protocols/msn/msnutils.c	4fd2ea5ae69e8d6f62b4ac26d60eee5ebcae4cf2
+++ libpurple/protocols/msn/msnutils.c	1de0a29b4a85d85733dc1b094909358e606391dd
@@ -23,7 +23,6 @@
  */
 #include "msn.h"
 #include "msnutils.h"
-#include "time.h"
 
 #include "cipher.h"
 
@@ -476,31 +475,7 @@ msn_parse_socket(const char *str, char *
 	*ret_host = host;
 	*ret_port = port;
 }
-/***************************************************************************
- * MSN Time Related Funciton
- ***************************************************************************/
-#if 0
-int
-msn_convert_iso8601(const char *timestr,struct tm tm_time)
-{
-	char temp[64];
-	struct tm ctime;
-	time_t ts;
 
-	purple_debug_info("msn", "convert string is{%s}\n", timestr);
-	tzset();
-	/*copy string first*/
-	memset(temp, 0, sizeof(temp));
-	strncpy(temp, timestr, strlen(timestr));
-
-	/*convert via strptime()*/
-	memset(&ctime, 0, sizeof(struct tm));
-	strptime(temp, "%d %b %Y %T %Z", &ctime);
-	ts = mktime(&ctime) - timezone;
-	localtime_r(&ts, tm_time);
-}
-#endif
-
 /***************************************************************************
  * MSN Challenge Computing Function
  ***************************************************************************/
============================================================
--- libpurple/protocols/msn/nexus.h	a13a1124cea055eb92e4cdff8154852c33321c3a
+++ libpurple/protocols/msn/nexus.h	3306b8423ecbad2f872a93fdeeb5e9e5813a4fe4
@@ -186,14 +186,14 @@ struct _MsnUsrKey
 typedef struct _MsnUsrKey MsnUsrKey;
 struct _MsnUsrKey
 {
-	int size; // 28. Does not count data
-	int crypt_mode; // CRYPT_MODE_CBC (1)
-	int cipher_type; // TripleDES (0x6603)
-	int hash_type; // SHA1 (0x8004)
-	int iv_len;    // 8
-	int hash_len;  // 20
-	int cipher_len; // 72
-	// Data
+	int size; /* 28. Does not count data */
+	int crypt_mode; /* CRYPT_MODE_CBC (1) */
+	int cipher_type; /* TripleDES (0x6603) */
+	int hash_type; /* SHA1 (0x8004) */
+	int iv_len;    /* 8 */
+	int hash_len;  /* 20 */
+	int cipher_len; /* 72 */
+	/* Data */
 	char iv[8];
 	char hash[20];
 	char cipher[72];
============================================================
--- libpurple/protocols/msn/notification.c	1522358bf4430f4b80b09a15a6578bf84e47a2ab
+++ libpurple/protocols/msn/notification.c	6dc1a0e96efcbd7e66802399e72d5b9564644919
@@ -228,16 +228,7 @@ usr_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	if (!g_ascii_strcasecmp(cmd->params[1], "OK"))
 	{
 		/* authenticate OK */
-		/* friendly name part no longer true in msnp11 */
-#if 0
-		const char *friendly = purple_url_decode(cmd->params[3]);
-
-		purple_connection_set_display_name(gc, friendly);
-#endif
 		msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN);
-
-//		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], "SSO"))
 	{
@@ -315,8 +306,6 @@ ver_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	 * to see the Local ID
 	 */
 	msn_cmdproc_send(cmdproc, "CVR",
-//					 "0x0409 winnt 5.1 i386 MSG80BETA 8.0.0689 msmsgs %s",
-//					"0x0804 winnt 5.1 i386 MSNMSGR 8.0.0792 msmsgs %s",
 					"0x0409 winnt 5.1 i386 MSNMSGR 8.5.1288 msmsgs %s",
 					 purple_account_get_username(account));
 }
@@ -722,33 +711,18 @@ adl_cmd_parse(MsnCmdProc *cmdproc, MsnCo
 		domain = xmlnode_get_attrib(domain_node, "n");
 
 		for (contact_node = xmlnode_get_child(domain_node, "c"); contact_node; contact_node = xmlnode_get_next_twin(contact_node)) {
-//			gchar *name = NULL, *friendlyname = NULL, *passport= NULL;
 			const gchar *list;
 			gint list_op = 0;
 
-//			name = xmlnode_get_attrib(contact_node, "n");
 			list = xmlnode_get_attrib(contact_node, "l");
 			if (list != NULL) {
 				list_op = atoi(list);
 			}
-//			friendlyname = xmlnode_get_attrib(contact_node, "f");
 
-//			passport = g_strdup_printf("%s@%s", name, domain);
-
-//			if (friendlyname != NULL) {
-//				decoded_friendlyname = g_strdup(purple_url_decode(friendlyname));
-//			} else {
-//				decoded_friendlyname = g_strdup(passport);
-//			}
-
 			if (list_op & MSN_LIST_RL_OP) {
 				/* someone is adding us */
-//				got_new_entry(cmdproc->session->account->gc, passport, decoded_friendly_name);
 				msn_get_contact_list(cmdproc->session, MSN_PS_PENDING_LIST, NULL);
 			}
-
-//			g_free(decoded_friendly_name);
-//			g_free(passport);
 		}
 	}
 
@@ -802,8 +776,8 @@ fqy_cmd_post(MsnCmdProc *cmdproc, MsnCom
 {
 	purple_debug_info("msn", "FQY payload:\n%s\n", payload);
 	g_return_if_fail(cmdproc->session != NULL);
-//	msn_notification_post_adl(cmdproc, payload, len);
-//	msn_get_address_book(cmdproc->session, MSN_AB_SAVE_CONTACT, NULL, NULL);
+/*	msn_notification_post_adl(cmdproc, payload, len); */
+/*	msn_get_address_book(cmdproc->session, MSN_AB_SAVE_CONTACT, NULL, NULL); */
 }
 
 static void
@@ -936,7 +910,7 @@ adg_cmd(MsnCmdProc *cmdproc, MsnCommand 
 			msn_userlist_move_buddy(userlist, data->who, data->old_group_name, group_name);
 			g_free(data->old_group_name);
 		} else {
-			// msn_add_contact_to_group(userlist, data, data->who, group_name);
+			/* msn_add_contact_to_group(userlist, data, data->who, group_name); */
 		}
 	}
 }
@@ -1194,35 +1168,6 @@ static void
 }
 
 static void
-rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
-{
-	MsnSession *session;
-	PurpleAccount *account;
-	PurpleConnection *gc;
-	const char *friendly;
-	char *username;
-
-	session = cmdproc->session;
-	account = session->account;
-	username = g_strdup(purple_normalize(account,
-						purple_account_get_username(account)));
-
-	/* Only set display name if our *own* friendly name changed! */
-	if (strcmp(username, purple_normalize(account, cmd->params[2])))
-	{
-		g_free(username);
-		return;
-	}
-
-	g_free(username);
-
-	gc = account->gc;
-	friendly = purple_url_decode(cmd->params[3]);
-
-	purple_connection_set_display_name(gc, friendly);
-}
-
-static void
 prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
 	MsnSession *session = cmdproc->session;
@@ -1845,10 +1790,6 @@ initial_mdata_msg(MsnCmdProc *cmdproc, M
 		/* This isn't an official message. */
 		return;
 
-	/*new a oim session*/
-//	session->oim = msn_oim_new(session);
-//	msn_oim_connect(session->oim);
-
 	table = msn_message_get_hashtable_from_body(msg);
 
 	mdata = g_hash_table_lookup(table, "Mail-Data");
@@ -2069,25 +2010,19 @@ msn_notification_init(void)
 void
 msn_notification_init(void)
 {
-	/* TODO: check prp, blp */
-
 	cbs_table = msn_table_new();
 
 	/* Synchronous */
 	msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL);
 	msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd);
 	msn_table_add_cmd(cbs_table, "ADL", "ILN", iln_cmd);
-//	msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd);	/* Removed as of MSNP13 */
 	msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd);
 	msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd);
 	msn_table_add_cmd(cbs_table, "USR", "GCF", gcf_cmd);
-//	msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd);	/* Removed as of MSNP13 */
 	msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd);
 	msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd);
-	msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd);
 	msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd);
 	msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd);
-//	msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL);
 	msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd);
 	msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd);
 	msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd);
@@ -2125,7 +2060,6 @@ msn_notification_init(void)
 	msn_table_add_error(cbs_table, "ADL", adl_error);
 	msn_table_add_error(cbs_table, "REG", reg_error);
 	msn_table_add_error(cbs_table, "RMG", rmg_error);
-	/* msn_table_add_error(cbs_table, "REA", rea_error); */
 	msn_table_add_error(cbs_table, "USR", usr_error);
 
 	msn_table_add_msg_type(cbs_table,
============================================================
--- libpurple/protocols/msn/soap.c	14343d1edb922f5132d958ebcd6d2c7d0599772d
+++ libpurple/protocols/msn/soap.c	8178ba07dceaf5900e45f1b09986a7bad1ceb2c4
@@ -288,13 +288,13 @@ msn_soap_read_cb(gpointer data, gint fd,
 	if(cnt < 0 && errno == EAGAIN && count == 0)
 		return;
 
-	// msn_soap_process could alter errno
+	/* msn_soap_process could alter errno */
 	perrno = errno;
 	msn_soap_process(conn);
 	
 	if (cnt < 0 && perrno != EAGAIN) {
 		purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
-		// It's possible msn_soap_process closed the ssl connection
+		/* It's possible msn_soap_process closed the ssl connection */
 		if (conn->ssl) {
 			purple_ssl_close(conn->ssl);
 			conn->ssl = NULL;
============================================================
--- libpurple/protocols/msn/sync.c	e5d8fb58240c16ec7efce53e0e444a09d4e5291a
+++ libpurple/protocols/msn/sync.c	0cb9f45e3bfe36969509d4598af0eed22571398b
@@ -216,8 +216,6 @@ msn_sync_init(void)
 void
 msn_sync_init(void)
 {
-	/* TODO: check prp, blp, bpr */
-
 	cbs_table = msn_table_new();
 
 	/* Syncing */
============================================================
--- libpurple/protocols/msn/user.h	444e18d26caee1e1627bf1d9ce88a017893958e3
+++ libpurple/protocols/msn/user.h	6cd70c88902fe440003b602239110199c82ac120
@@ -97,9 +97,9 @@ struct _MsnUser
 				     indexed by the list it belongs to		*/
 };
 
-/**************************************************************************/
-/** @name User API                                                        */
-/**************************************************************************/
+/**************************************************************************
+ ** @name User API                                                        *
+ **************************************************************************/
 /*@{*/
 
 /**
============================================================
--- libpurple/protocols/msn/userlist.c	94f6aae6b31d1ea68c82a19cbdc36d8ad9ba03ae
+++ libpurple/protocols/msn/userlist.c	d5ac35b788b3219542de29549f1577ca62ada422
@@ -138,36 +138,6 @@ msn_userlist_user_is_in_list(MsnUser *us
 		return FALSE;
 }
 
-#if 0
-static const char*
-get_friendly_name(MsnUser *user)
-{
-	const char *friendly_name;
-
-	g_return_val_if_fail(user != NULL, NULL);
-
-	friendly_name = msn_user_get_friendly_name(user);
-
-	if (friendly_name != NULL)
-		friendly_name = purple_url_encode(friendly_name);
-	else
-		friendly_name = msn_user_get_passport(user);
-
-	/* this might be a bit of a hack, but it should prevent notification server
-	 * disconnections for people who have buddies with insane friendly names
-	 * who added you to their buddy list from being disconnected. Stu. */
-	/* Shx: What? Isn't the store_name obtained from the server, and hence it's
-	 * below the BUDDY_ALIAS_MAXLEN ? */
-	/* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're
-	 * probably decoding the incoming store_name wrong, or something. bleh. */
-
-	if (strlen(friendly_name) > BUDDY_ALIAS_MAXLEN)
-		friendly_name = msn_user_get_passport(user);
-
-	return friendly_name;
-}
-#endif
-
 /**************************************************************************
  * Server functions
  **************************************************************************/
@@ -256,7 +226,7 @@ msn_got_add_user(MsnSession *session, Ms
 			 *       looked at this.  Maybe we should use the store
 			 *       name instead? --KingAnt
 			 */
-//			got_new_entry(gc, passport, friendly);
+/*			got_new_entry(gc, passport, friendly); */
 		}
 	}
 
@@ -386,7 +356,7 @@ msn_got_lst_user(MsnSession *session, Ms
 
 		if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP)))
 		{
-//			got_new_entry(gc, passport, store);
+/*			got_new_entry(gc, passport, store); */
 		}
 	}
 
@@ -779,10 +749,6 @@ msn_userlist_add_buddy_to_list(MsnUserLi
 		return;
 	}
 
-	//friendly_name = (user != NULL) ? get_friendly_name(user) : who;
-
-	//purple_debug_info("msn", "store_name = %s\n", store_name);
-
 	/* XXX: see XXX above, this should really be done when we get the response from
 		the server */
 


More information about the Commits mailing list