diff src/protocols/jabber/auth.c @ 7644:4168b8881746

[gaim-migrate @ 8287] some error goodness committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 27 Nov 2003 07:04:26 +0000
parents 9008b5be4275
children 28100686bde9
line wrap: on
line diff
--- a/src/protocols/jabber/auth.c	Wed Nov 26 17:59:04 2003 +0000
+++ b/src/protocols/jabber/auth.c	Thu Nov 27 07:04:26 2003 +0000
@@ -75,12 +75,17 @@
 
 	auth = xmlnode_new("auth");
 	xmlnode_set_attrib(auth, "xmlns", "urn:ietf:params:xml:ns:xmpp-sasl");
-	if(digest_md5) {
+	if(0 && digest_md5) {
 		xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5");
 		js->auth_type = JABBER_AUTH_DIGEST_MD5;
 		/*
 	} else if(plain) {
 		xmlnode_set_attrib(auth, "mechanism", "PLAIN");
+		xmlnode_insert_data(auth, "\0", 1);
+		xmlnode_insert_data(auth, js->user->node, -1);
+		xmlnode_insert_data(auth, "\0", 1);
+		xmlnode_insert_data(auth, gaim_account_get_password(js->gc->account),
+				-1);
 		js->auth_type = JABBER_AUTH_PLAIN;
 		*/
 	} else {
@@ -135,7 +140,20 @@
 	if(!type) {
 		return;
 	} else if(!strcmp(type, "error")) {
-		/* XXX: handle error */
+		/* XXX: still need to handle XMPP-style errors */
+		xmlnode *error;
+		char *buf, *err_txt = NULL;
+		const char *code = NULL;
+		if((error = xmlnode_get_child(packet, "error"))) {
+			code = xmlnode_get_attrib(error, "code");
+			err_txt = xmlnode_get_data(error);
+		}
+		buf = g_strdup_printf("%s%s%s", code ? code : "", code ? ": " : "",
+				err_txt ? err_txt : _("Unknown Error"));
+		gaim_connection_error(js->gc, buf);
+		if(err_txt)
+			g_free(err_txt);
+		g_free(buf);
 	} else if(!strcmp(type, "result")) {
 		query = xmlnode_get_child(packet, "query");
 		if(js->stream_id && xmlnode_get_child(query, "digest")) {