changeset 22020:4163dcf643ae

Some readability changes. Refs #4533.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sun, 06 Jan 2008 21:15:17 +0000
parents 0ae2e64dcff9
children c72ea83f34d6
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo_filexfer.c
diffstat 2 files changed, 58 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Sun Jan 06 19:48:18 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Sun Jan 06 21:15:17 2008 +0000
@@ -1511,7 +1511,7 @@
 					  6, result6,
 					  96, result96,
 					  1, name,
-					  244,YAHOO_CLIENT_VERSION_ID,
+					  244, YAHOO_CLIENT_VERSION_ID,
 					  135, YAHOO_CLIENT_VERSION);
 	yahoo_packet_send_and_free(pack, yd);
 
@@ -1531,11 +1531,11 @@
 	char *enc_pass;
 	struct yahoo_data *yd = gc->proto_data;
 
-	PurpleCipher			*md5_cipher;
+	PurpleCipher		*md5_cipher;
 	PurpleCipherContext	*md5_ctx;
 	guchar				md5_digest[16];
 
-	PurpleCipher			*sha1_cipher;
+	PurpleCipher		*sha1_cipher;
 	PurpleCipherContext	*sha1_ctx1;
 	PurpleCipherContext	*sha1_ctx2;
 
@@ -1547,7 +1547,7 @@
 	char				*delimit_lookup		= ",;";
 
 	char				*password_hash		= (char *)g_malloc(25);
-	char				*crypt_hash		= (char *)g_malloc(25);
+	char				*crypt_hashi		= (char *)g_malloc(25);
 	char				*crypt_result		= NULL;
 
 	unsigned char		pass_hash_xor1[64];
@@ -1654,7 +1654,7 @@
 	 * dust on the values.
 	 */
 
-	for (magic_cnt = magic_len-2; magic_cnt >= 0; magic_cnt--) {
+	for (magic_cnt = magic_len - 2; magic_cnt >= 0; magic_cnt--) {
 		unsigned char	byte1;
 		unsigned char	byte2;
 
@@ -1670,7 +1670,7 @@
 		byte1 ^= byte2;
 
 		magic[magic_cnt+1] = byte1;
-			}
+	}
 
 	/*
 	 * Magic: Phase 3.  This computes 20 bytes.  The first 4 bytes are used as our magic
@@ -1685,8 +1685,8 @@
 	x = 0;
 
 	do {
-		unsigned int	bl = 0;
-		unsigned int	cl = magic[magic_cnt++];
+		unsigned int bl = 0;
+		unsigned int cl = magic[magic_cnt++];
 
 		if (magic_cnt >= magic_len)
 			break;
@@ -1711,17 +1711,18 @@
 
 	/* First four bytes are magic key. */
 	memcpy(&magic_key_char[0], comparison_src, 4);
-	magic_4 = magic_key_char[0] | (magic_key_char[1]<<8) | (magic_key_char[2]<<16) | (magic_key_char[3]<<24);
+	magic_4 = magic_key_char[0] | (magic_key_char[1] << 8) |
+			(magic_key_char[2] << 16) | (magic_key_char[3] << 24);
 
 	/*
 	 * Magic: Phase 4.  Determine what function to use later by getting outside/inside
 	 * loop values until we match our previous buffer.
 	 */
 	for (x = 0; x < 65535; x++) {
-		int			leave = 0;
+		int leave = 0;
 
 		for (y = 0; y < 5; y++) {
-			unsigned char	test[3];
+			unsigned char test[3];
 
 			/* Calculate buffer. */
 			test[0] = x;
@@ -2982,7 +2983,7 @@
 	yd->txbuf = purple_circ_buffer_new(0);
 	yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free);
 	yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-	yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,NULL);
+	yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
 	yd->confs = NULL;
 	yd->conf_id = 2;
 
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c	Sun Jan 06 19:48:18 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c	Sun Jan 06 21:15:17 2008 +0000
@@ -48,13 +48,23 @@
 	guint tx_handler;
 	gchar *rxqueue;
 	guint rxlen;
-	gchar *xfer_idstring_between_peers;
+	gchar *xfer_peer_idstring;
 	gchar *xfer_idstring_for_relay;
 	int version; /*0 for old, 15 for Y7(YMSG 15)*/
 	int info_val_249;
-	enum {STARTED = 0,HEAD_REQUESTED,HEAD_REPLY_RECEIVED,TRANSFER_PHASE,ACCEPTED} status_15;
-	GSList *filename_list;/*contains all filenames, in case of multiple transfers, with the first one in the list being the current(ymsg15)*/
-	GSList *size_list;/*corresponds to filename_list, with size as **STRING** */
+
+	enum {
+		STARTED = 0,
+		HEAD_REQUESTED,
+		HEAD_REPLY_RECEIVED,
+		TRANSFER_PHASE,
+		ACCEPTED
+	} status_15;
+
+	/* contains all filenames, in case of multiple transfers, with the first
+	 * one in the list being the current file's name (ymsg15) */
+	GSList *filename_list;
+	GSList *size_list; /*corresponds to filename_list, with size as **STRING** */
 	gboolean firstoflist;
 };
 
@@ -69,10 +79,10 @@
 	yd = gc->proto_data;
 
 	/*remove entry from map*/
-	if(xd->xfer_idstring_between_peers) {
-		xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xd->xfer_idstring_between_peers);
+	if(xd->xfer_peer_idstring) {
+		xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring);
 		if(xfer)
-			g_hash_table_remove(yd->xfer_peer_idstring_map, xd->xfer_idstring_between_peers);
+			g_hash_table_remove(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring);
 	}
 
 	/*empty file & filesize list*/
@@ -90,7 +100,7 @@
 	g_free(xd->host);
 	g_free(xd->path);
 	g_free(xd->txbuf);
-	g_free(xd->xfer_idstring_between_peers);
+	g_free(xd->xfer_peer_idstring);
 	g_free(xd->xfer_idstring_for_relay);
 	if (xd->tx_handler)
 		purple_input_remove(xd->tx_handler);
@@ -352,7 +362,7 @@
 		yahoo_packet_hash(pkt, "sssiiiisiii",
 			1, purple_normalize(account, purple_account_get_username(account)),
 			5, xfer->who,
-			265, xfer_data->xfer_idstring_between_peers,
+			265, xfer_data->xfer_peer_idstring,
 			222, 1,
 			266, 1,
 			302, 268,
@@ -370,7 +380,7 @@
 			yahoo_packet_hash(pkt, "sssi",
 				1, purple_normalize(account, purple_account_get_username(account)),
 				5, xfer->who,
-				265, xfer_data->xfer_idstring_between_peers,
+				265, xfer_data->xfer_peer_idstring,
 				222, 3);
 		} else {
 			pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15,
@@ -379,7 +389,7 @@
 			yahoo_packet_hash(pkt, "sssi",
 				1, purple_normalize(account, purple_account_get_username(account)),
 				5, xfer->who,
-				265, xfer_data->xfer_idstring_between_peers,
+				265, xfer_data->xfer_peer_idstring,
 				271, 1);
 		}
 	}
@@ -520,7 +530,7 @@
 			yahoo_packet_hash(pkt, "sssi",
 				1, purple_normalize(account, purple_account_get_username(account)),
 				5, xfer->who,
-				265, xfer_data->xfer_idstring_between_peers,
+				265, xfer_data->xfer_peer_idstring,
 				66, -1);
 		}
 		else
@@ -531,7 +541,7 @@
 			yahoo_packet_hash(pkt, "sssi",
 				1, purple_normalize(account, purple_account_get_username(account)),
 				5, xfer->who,
-				265, xfer_data->xfer_idstring_between_peers,
+				265, xfer_data->xfer_peer_idstring,
 				222, 2);
 		}
 		yahoo_packet_send_and_free(pkt, yd);
@@ -568,7 +578,7 @@
 			yahoo_packet_hash(pkt, "sssi",
 				1, purple_normalize(account, purple_account_get_username(account)),
 				5, xfer->who,
-				265, xfer_data->xfer_idstring_between_peers,
+				265, xfer_data->xfer_peer_idstring,
 				222, 4);
 		}
 		else
@@ -579,7 +589,7 @@
 			yahoo_packet_hash(pkt, "sssi",
 				1, purple_normalize(account, purple_account_get_username(account)),
 				5, xfer->who,
-				265, xfer_data->xfer_idstring_between_peers,
+				265, xfer_data->xfer_peer_idstring,
 				66, -1);
 		}
 		yahoo_packet_send_and_free(pkt, yd);
@@ -675,8 +685,8 @@
 				purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv);
 
 				/*update map to current xfer*/
-				g_hash_table_remove(yd->xfer_peer_idstring_map, xfer_data->xfer_idstring_between_peers);
-				g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_idstring_between_peers, xfer);
+				g_hash_table_remove(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring);
+				g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer);
 
 				/* Now perform the request */
 				purple_xfer_request(xfer);
@@ -1010,7 +1020,7 @@
 	yahoo_packet_hash(pkt, "ssssis",
 		1, purple_normalize(account, purple_account_get_username(account)),
 		5, xfer->who,
-		265, xd->xfer_idstring_between_peers,
+		265, xd->xfer_peer_idstring,
 		27,  filename,
 		249, 3,
 		250, xd->host);
@@ -1039,8 +1049,8 @@
 		xfer_data->status_15 = STARTED;
 		purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15);
 		xfer_data->version = 15;
-		xfer_data->xfer_idstring_between_peers = yahoo_xfer_new_xfer_id();
-		g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_idstring_between_peers, xfer);
+		xfer_data->xfer_peer_idstring = yahoo_xfer_new_xfer_id();
+		g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer);
 	}
 
 	/* Now perform the request */
@@ -1247,7 +1257,7 @@
 	struct yahoo_xfer_data *xfer_data;
 	char *service = NULL;
 	char *filename = NULL;
-	char *xfer_idstring_between_peers = NULL;
+	char *xfer_peer_idstring = NULL;
 	unsigned long filesize = 0L;
 	GSList *l;
 	GSList *filename_list = NULL;
@@ -1267,7 +1277,7 @@
 			to = pair->value;
 			break;
 		case 265:
-			xfer_idstring_between_peers = pair->value;
+			xfer_peer_idstring = pair->value;
 			break;
 		case 27:
 			filename_list = g_slist_prepend(filename_list, g_strdup(pair->value));
@@ -1292,13 +1302,13 @@
 
 		}
 	}
-	if(!xfer_idstring_between_peers)
+	if(!xfer_peer_idstring)
 		return;
 
 	if(val_222 == 2 || val_222 == 4)
 	{
 		xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map,
-								   xfer_idstring_between_peers);
+								   xfer_peer_idstring);
 		if(!xfer) return;
 		purple_xfer_cancel_remote(xfer);
 		return;
@@ -1306,7 +1316,7 @@
 	if(val_222 == 3)
 	{
 		xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map,
-								   xfer_idstring_between_peers);
+								   xfer_peer_idstring);
 		if(!xfer)
 			return;
 		/*
@@ -1356,7 +1366,7 @@
 	xfer_data->version = 15;
 	xfer_data->firstoflist = TRUE;
 	xfer_data->gc = gc;
-	xfer_data->xfer_idstring_between_peers = g_strdup(xfer_idstring_between_peers);
+	xfer_data->xfer_peer_idstring = g_strdup(xfer_peer_idstring);
 	xfer_data->filename_list = filename_list;
 	xfer_data->size_list = size_list;
 	
@@ -1386,7 +1396,7 @@
 		purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv);
 
 		g_hash_table_insert(yd->xfer_peer_idstring_map,
-							xfer_data->xfer_idstring_between_peers,
+							xfer_data->xfer_peer_idstring,
 							xfer);
 		
 		if(nooffiles > 1) {
@@ -1411,7 +1421,7 @@
 	struct yahoo_data *yd;
 	struct yahoo_xfer_data *xfer_data;
 	char *filename = NULL;
-	char *xfer_idstring_between_peers = NULL;
+	char *xfer_peer_idstring = NULL;
 	char *xfer_idstring_for_relay = NULL;
 	GSList *l;
 	struct yahoo_packet *pkt_to_send;
@@ -1430,7 +1440,7 @@
 			to = pair->value;
 			break;
 		case 265:
-			xfer_idstring_between_peers = pair->value;
+			xfer_peer_idstring = pair->value;
 			break;
 		case 27:
 			filename = pair->value;
@@ -1456,10 +1466,10 @@
 		}
 	}
 
-	if(!xfer_idstring_between_peers)
+	if(!xfer_peer_idstring)
 		return;
 
-	xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_idstring_between_peers);
+	xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring);
 
 	if(!xfer) return;
 
@@ -1486,7 +1496,7 @@
 	yahoo_packet_hash(pkt_to_send, "ssssisi",
 		1, purple_normalize(account, purple_account_get_username(account)),
 		5, xfer->who,
-		265, xfer_data->xfer_idstring_between_peers,
+		265, xfer_data->xfer_peer_idstring,
 		27, xfer->filename,
 		249, xfer_data->info_val_249,
 		251, xfer_data->xfer_idstring_for_relay,
@@ -1504,7 +1514,7 @@
 /*TODO: Check filename etc. No probs till some hacker comes in the way*/
 void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *pkt)
 {
-	gchar *xfer_idstring_between_peers = NULL;
+	gchar *xfer_peer_idstring = NULL;
 	gchar *xfer_idstring_for_relay = NULL;
 	PurpleXfer *xfer;
 	struct yahoo_data *yd;
@@ -1522,14 +1532,14 @@
 			xfer_idstring_for_relay = pair->value;
 			break;
 		case 265:
-			xfer_idstring_between_peers = pair->value;
+			xfer_peer_idstring = pair->value;
 			break;
 		case 66:
 			val_66 = atol(pair->value);
 		}
 	}
 
-	xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_idstring_between_peers);
+	xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring);
 	if(!xfer) return;
 
 	if(val_66 == -1 || !(xfer_idstring_for_relay))