# HG changeset patch # User Nathan Walp # Date 1068880160 0 # Node ID 43a214a385d19861562de4bb4ac825a926c9ea27 # Parent e804d727867f30a218b260086e6d25379c2110d6 [gaim-migrate @ 8127] this is what I accomplished on the ride to atlanta. pathetic, eh? committer: Tailor Script diff -r e804d727867f -r 43a214a385d1 src/protocols/jabber/auth.c --- a/src/protocols/jabber/auth.c Fri Nov 14 18:40:37 2003 +0000 +++ b/src/protocols/jabber/auth.c Sat Nov 15 07:09:20 2003 +0000 @@ -127,47 +127,52 @@ JabberIq *iq; xmlnode *query, *x; gboolean digest = FALSE; + const char *type = xmlnode_get_attrib(packet, "type"); const char *pw = gaim_account_get_password(js->gc->account); - /* XXX: check for an */ - - query = xmlnode_get_child(packet, "query"); - if(js->stream_id && xmlnode_get_child(query, "digest")) { - digest = TRUE; - } else if(!xmlnode_get_child(query, "password")) { - gaim_connection_error(js->gc, - _("Server does not use any supported authentication method")); + if(!type) { return; - } + } else if(strcmp(type, "error")) { + /* XXX: handle error */ + } else if(strcmp(type, "result")) { + query = xmlnode_get_child(packet, "query"); + if(js->stream_id && xmlnode_get_child(query, "digest")) { + digest = TRUE; + } else if(!xmlnode_get_child(query, "password")) { + gaim_connection_error(js->gc, + _("Server does not use any supported authentication method")); + return; + } - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); + iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); + query = xmlnode_get_child(iq->node, "query"); + x = xmlnode_new_child(query, "username"); + xmlnode_insert_data(x, js->user->node, -1); + x = xmlnode_new_child(query, "resource"); + xmlnode_insert_data(x, js->user->resource, -1); - if(digest) { - unsigned char hashval[20]; - char *s, h[41], *p; - int i; + if(digest) { + unsigned char hashval[20]; + char *s, h[41], *p; + int i; - x = xmlnode_new_child(query, "digest"); - s = g_strdup_printf("%s%s", js->stream_id, pw); - shaBlock((unsigned char *)s, strlen(s), hashval); - p = h; - for(i=0; i<20; i++, p+=2) - snprintf(p, 3, "%02x", hashval[i]); - xmlnode_insert_data(x, h, -1); - g_free(s); - } else { - x = xmlnode_new_child(query, "password"); - xmlnode_insert_data(x, pw, -1); + x = xmlnode_new_child(query, "digest"); + s = g_strdup_printf("%s%s", js->stream_id, pw); + shaBlock((unsigned char *)s, strlen(s), hashval); + p = h; + for(i=0; i<20; i++, p+=2) + snprintf(p, 3, "%02x", hashval[i]); + xmlnode_insert_data(x, h, -1); + g_free(s); + } else { + x = xmlnode_new_child(query, "password"); + xmlnode_insert_data(x, pw, -1); + } + + jabber_iq_set_callback(iq, auth_old_result_cb, NULL); + + jabber_iq_send(iq); } - - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - - jabber_iq_send(iq); } void jabber_auth_start_old(JabberStream *js) diff -r e804d727867f -r 43a214a385d1 src/protocols/jabber/iq.c --- a/src/protocols/jabber/iq.c Fri Nov 14 18:40:37 2003 +0000 +++ b/src/protocols/jabber/iq.c Sat Nov 15 07:09:20 2003 +0000 @@ -361,9 +361,11 @@ jabber_disco_items_parse(js, packet); return; } + /* } else if(xmlnode_get_child(packet, "si")) { jabber_si_parse(js, packet); return; + */ } /* If we got here, no pre-defined handlers got it, lets see if a special diff -r e804d727867f -r 43a214a385d1 src/protocols/jabber/jabber.c --- a/src/protocols/jabber/jabber.c Fri Nov 14 18:40:37 2003 +0000 +++ b/src/protocols/jabber/jabber.c Sat Nov 15 07:09:20 2003 +0000 @@ -1075,7 +1075,7 @@ NULL, NULL, jabber_idle_set, - NULL, /* change_passwd */ /* XXX */ + NULL, jabber_roster_add_buddy, NULL, jabber_roster_remove_buddy,