pidgin: 1bd16346: jabber: Use purple_strequal to simplify ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Nov 6 05:00:55 EST 2009


-----------------------------------------------------------------
Revision: 1bd1634659f0eb9457e31cdc36c935dc6b4c397a
Ancestor: 66b0effb2ec6ae19730c68703c5b4d91fdba5d51
Author: darkrain42 at pidgin.im
Date: 2009-11-06T08:47:28
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1bd1634659f0eb9457e31cdc36c935dc6b4c397a

Modified files:
        libpurple/protocols/jabber/auth.c

ChangeLog: 

jabber: Use purple_strequal to simplify some auth code

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/auth.c	7138ade357627765efeae5298b678d286ab53c99
+++ libpurple/protocols/jabber/auth.c	23b1efa8b388ed08c0e1a5d88ed61aace41b8bff
@@ -511,7 +511,7 @@ jabber_auth_start(JabberStream *js, xmln
 		 * support it and including it gives a false fall-back to other mechs offerred,
 		 * leading to incorrect error handling.
 		 */
-		if (mech_name && !strcmp(mech_name, "X-GOOGLE-TOKEN")) {
+		if (purple_strequal(mech_name, "X-GOOGLE-TOKEN")) {
 			g_free(mech_name);
 			continue;
 		}
@@ -519,9 +519,9 @@ jabber_auth_start(JabberStream *js, xmln
 		g_string_append(js->sasl_mechs, mech_name);
 		g_string_append_c(js->sasl_mechs, ' ');
 #else
-		if(mech_name && !strcmp(mech_name, "DIGEST-MD5"))
+		if (purple_strequal(mech_name, "DIGEST-MD5"))
 			digest_md5 = TRUE;
-		else if(mech_name && !strcmp(mech_name, "PLAIN"))
+		else if (purple_strequal(mech_name, "PLAIN"))
 			plain = TRUE;
 #endif
 		g_free(mech_name);
@@ -586,7 +586,7 @@ static void auth_old_result_cb(JabberStr
 		/* FIXME: Why is this not in jabber_parse_error? */
 		if((error = xmlnode_get_child(packet, "error")) &&
 					(err_code = xmlnode_get_attrib(error, "code")) &&
-					!strcmp(err_code, "401")) {
+					g_str_equal(err_code, "401")) {
 			reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 			/* Clear the pasword if it isn't being saved */
 			if (!purple_account_get_remember_password(js->gc->account))
@@ -887,8 +887,7 @@ jabber_auth_handle_challenge(JabberStrea
 			char *rspauth = g_hash_table_lookup(parts, "rspauth");
 
 
-			if(rspauth && js->expected_rspauth &&
-					!strcmp(rspauth, js->expected_rspauth)) {
+			if (rspauth && purple_strequal(rspauth, js->expected_rspauth)) {
 				jabber_send_raw(js,
 						"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
 						-1);
@@ -1014,7 +1013,7 @@ jabber_auth_handle_challenge(JabberStrea
 				 * realm are always encoded in UTF-8 (they seem to be the values
 				 * we pass in), so we need to ensure charset=utf-8 is set.
 				 */
-				if (!js->current_mech || !g_str_equal(js->current_mech, "DIGEST-MD5") ||
+				if (!purple_strequal(js->current_mech, "DIGEST-MD5") ||
 						strstr(c_out, ",charset="))
 					/* If we're not using DIGEST-MD5 or Cyrus SASL is fixed */
 					enc_out = purple_base64_encode((unsigned char*)c_out, clen);
@@ -1041,7 +1040,7 @@ void jabber_auth_handle_success(JabberSt
 	const void *x;
 #endif
 
-	if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
+	if (!purple_strequal(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
 		purple_connection_error_reason(js->gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Invalid response from server"));


More information about the Commits mailing list