Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 25933:050052891c55
Pass IQ handlers type, from, id, and the child node
As QuLogic pointed out in 8a80f271, it's pointless for the handlers to re-get
the information from the IQ stanza. Additionally, instead of string-matching
the type everywhere, pass around a JabberIqType.
Last, 'child' cannot be NULL, but 'from' may be.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 08 Feb 2009 06:31:18 +0000 |
parents | ced3d4ab745a |
children | 439f07ce4c8a |
comparison
equal
deleted
inserted
replaced
25932:969c89c09ad7 | 25933:050052891c55 |
---|---|
967 | 967 |
968 jabber_iq_set_callback(iq, jabber_registration_result_cb, to); | 968 jabber_iq_set_callback(iq, jabber_registration_result_cb, to); |
969 jabber_iq_send(iq); | 969 jabber_iq_send(iq); |
970 } | 970 } |
971 | 971 |
972 void jabber_register_parse(JabberStream *js, xmlnode *packet) | 972 void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type, |
973 const char *id, xmlnode *query) | |
973 { | 974 { |
974 PurpleAccount *account = purple_connection_get_account(js->gc); | 975 PurpleAccount *account = purple_connection_get_account(js->gc); |
975 const char *type; | |
976 const char *from; | |
977 PurpleRequestFields *fields; | 976 PurpleRequestFields *fields; |
978 PurpleRequestFieldGroup *group; | 977 PurpleRequestFieldGroup *group; |
979 PurpleRequestField *field; | 978 PurpleRequestField *field; |
980 xmlnode *query, *x, *y; | 979 xmlnode *x, *y; |
981 char *instructions; | 980 char *instructions; |
982 JabberRegisterCBData *cbdata; | 981 JabberRegisterCBData *cbdata; |
983 gboolean registered = FALSE; | 982 gboolean registered = FALSE; |
984 | 983 |
985 if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) | 984 if (type != JABBER_IQ_RESULT) |
986 return; | 985 return; |
987 | 986 |
988 from = xmlnode_get_attrib(packet, "from"); | |
989 if (!from) | 987 if (!from) |
990 from = js->serverFQDN; | 988 from = js->serverFQDN; |
991 g_return_if_fail(from != NULL); | 989 g_return_if_fail(from != NULL); |
992 | 990 |
993 if(js->registration) { | 991 if(js->registration) { |
994 /* get rid of the login thingy */ | 992 /* get rid of the login thingy */ |
995 purple_connection_set_state(js->gc, PURPLE_CONNECTED); | 993 purple_connection_set_state(js->gc, PURPLE_CONNECTED); |
996 } | 994 } |
997 | |
998 query = xmlnode_get_child(packet, "query"); | |
999 | 995 |
1000 if(xmlnode_get_child(query, "registered")) { | 996 if(xmlnode_get_child(query, "registered")) { |
1001 registered = TRUE; | 997 registered = TRUE; |
1002 | 998 |
1003 if(js->registration) { | 999 if(js->registration) { |