comparison 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
comparison
equal deleted inserted replaced
7643:834570cb8d86 7644:4168b8881746
73 } 73 }
74 } 74 }
75 75
76 auth = xmlnode_new("auth"); 76 auth = xmlnode_new("auth");
77 xmlnode_set_attrib(auth, "xmlns", "urn:ietf:params:xml:ns:xmpp-sasl"); 77 xmlnode_set_attrib(auth, "xmlns", "urn:ietf:params:xml:ns:xmpp-sasl");
78 if(digest_md5) { 78 if(0 && digest_md5) {
79 xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); 79 xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5");
80 js->auth_type = JABBER_AUTH_DIGEST_MD5; 80 js->auth_type = JABBER_AUTH_DIGEST_MD5;
81 /* 81 /*
82 } else if(plain) { 82 } else if(plain) {
83 xmlnode_set_attrib(auth, "mechanism", "PLAIN"); 83 xmlnode_set_attrib(auth, "mechanism", "PLAIN");
84 xmlnode_insert_data(auth, "\0", 1);
85 xmlnode_insert_data(auth, js->user->node, -1);
86 xmlnode_insert_data(auth, "\0", 1);
87 xmlnode_insert_data(auth, gaim_account_get_password(js->gc->account),
88 -1);
84 js->auth_type = JABBER_AUTH_PLAIN; 89 js->auth_type = JABBER_AUTH_PLAIN;
85 */ 90 */
86 } else { 91 } else {
87 gaim_connection_error(js->gc, 92 gaim_connection_error(js->gc,
88 _("Server does not use any supported authentication method")); 93 _("Server does not use any supported authentication method"));
133 const char *pw = gaim_account_get_password(js->gc->account); 138 const char *pw = gaim_account_get_password(js->gc->account);
134 139
135 if(!type) { 140 if(!type) {
136 return; 141 return;
137 } else if(!strcmp(type, "error")) { 142 } else if(!strcmp(type, "error")) {
138 /* XXX: handle error */ 143 /* XXX: still need to handle XMPP-style errors */
144 xmlnode *error;
145 char *buf, *err_txt = NULL;
146 const char *code = NULL;
147 if((error = xmlnode_get_child(packet, "error"))) {
148 code = xmlnode_get_attrib(error, "code");
149 err_txt = xmlnode_get_data(error);
150 }
151 buf = g_strdup_printf("%s%s%s", code ? code : "", code ? ": " : "",
152 err_txt ? err_txt : _("Unknown Error"));
153 gaim_connection_error(js->gc, buf);
154 if(err_txt)
155 g_free(err_txt);
156 g_free(buf);
139 } else if(!strcmp(type, "result")) { 157 } else if(!strcmp(type, "result")) {
140 query = xmlnode_get_child(packet, "query"); 158 query = xmlnode_get_child(packet, "query");
141 if(js->stream_id && xmlnode_get_child(query, "digest")) { 159 if(js->stream_id && xmlnode_get_child(query, "digest")) {
142 digest = TRUE; 160 digest = TRUE;
143 } else if(!xmlnode_get_child(query, "password")) { 161 } else if(!xmlnode_get_child(query, "password")) {