changeset 29588:78f972c7de0e

Document the code I just touched, and use a convenience variable in a couple more places to make the code easier to read.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sat, 13 Mar 2010 20:30:08 +0000
parents ff8e865bf524
children c4fe6afad87a
files libpurple/protocols/yahoo/libymsg.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/libymsg.c	Sat Mar 13 20:24:52 2010 +0000
+++ b/libpurple/protocols/yahoo/libymsg.c	Sat Mar 13 20:30:08 2010 +0000
@@ -1854,6 +1854,7 @@
 		return;
 	}
 	else if (len > 0 && ret_data && *ret_data) {
+		PurpleAccount *account = purple_connection_get_account(gc);
 		gchar **split_data = g_strsplit(ret_data, "\r\n", -1);
 		int totalelements = 0;
 		int response_no = -1;
@@ -1861,12 +1862,12 @@
 
 		totalelements = g_strv_length(split_data);
 
-		if(totalelements == 1) {
+		if(totalelements == 1) { /* Received an error code */
 			response_no = strtol(split_data[0], NULL, 10);
-		} else if(totalelements == 2 || totalelements == 3 ) {
+		} else if(totalelements == 2 || totalelements == 3 ) { /* received valid data */
 			response_no = strtol(split_data[0], NULL, 10);
 			token = g_strdup(split_data[1] + strlen("ymsgr="));
-		} else { /* It looks like a transparent proxy has returned an invalid document */
+		} else { /* It looks like a transparent proxy has returned a document we don't want */
 			response_no = -1;
 		}
 
@@ -1886,8 +1887,8 @@
 				case 1212:
 					/* Password incorrect */
 					/* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */
-					if (!purple_account_get_remember_password(purple_connection_get_account(gc)))
-						purple_account_set_password(purple_connection_get_account(gc), NULL);
+					if (!purple_account_get_remember_password(account))
+						purple_account_set_password(account, NULL);
 					error_reason = g_strdup(_("Incorrect password"));
 					error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 					break;
@@ -1929,7 +1930,6 @@
 		else {
 			/* OK to login, correct information provided */
 			PurpleUtilFetchUrlData *url_data = NULL;
-			PurpleAccount *account = purple_connection_get_account(gc);
 			char *url = NULL;
 			gboolean yahoojp = yahoo_is_japan(account);
 			gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE);