pidgin: 17c1e048: Document the code I just touched, and us...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Mar 13 15:35:48 EST 2010


-----------------------------------------------------------------
Revision: 17c1e048674ec57bdadbafc0b1e598a37143eccd
Ancestor: f1264b136d57d1ee917f59945e91b9b2bd4b2410
Author: rekkanoryo at pidgin.im
Date: 2010-03-13T20:30:08
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/17c1e048674ec57bdadbafc0b1e598a37143eccd

Modified files:
        libpurple/protocols/yahoo/libymsg.c

ChangeLog: 

Document the code I just touched, and use a convenience variable in a couple
more places to make the code easier to read.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c	e3799dbd66b307186051113ea090105aee8324f7
+++ libpurple/protocols/yahoo/libymsg.c	c72e755bfc3f8f6f9280f2e79ece8f0e9b18e439
@@ -1854,6 +1854,7 @@ static void yahoo_auth16_stage1_cb(Purpl
 		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 @@ static void yahoo_auth16_stage1_cb(Purpl
 
 		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 @@ static void yahoo_auth16_stage1_cb(Purpl
 				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 @@ static void yahoo_auth16_stage1_cb(Purpl
 		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);


More information about the Commits mailing list