comparison libpurple/protocols/jabber/jabber.c @ 15917:26593bef6568

Minor code cleanup
author Mark Doliner <mark@kingant.net>
date Sun, 25 Mar 2007 07:07:29 +0000
parents 4be5d38ee117
children ac1a32ebd62c
comparison
equal deleted inserted replaced
15916:4be5d38ee117 15917:26593bef6568
169 169
170 static void tls_init(JabberStream *js); 170 static void tls_init(JabberStream *js);
171 171
172 void jabber_process_packet(JabberStream *js, xmlnode *packet) 172 void jabber_process_packet(JabberStream *js, xmlnode *packet)
173 { 173 {
174 const char *xmlns;
175
174 purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, &packet); 176 purple_signal_emit(my_protocol, "jabber-receiving-xmlnode", js->gc, &packet);
175 177
176 /* if the signal leaves us with a null packet, we're done */ 178 /* if the signal leaves us with a null packet, we're done */
177 if(NULL == packet) 179 if(NULL == packet)
178 return; 180 return;
181
182 xmlns = xmlnode_get_namespace(packet);
179 183
180 if(!strcmp(packet->name, "iq")) { 184 if(!strcmp(packet->name, "iq")) {
181 jabber_iq_parse(js, packet); 185 jabber_iq_parse(js, packet);
182 } else if(!strcmp(packet->name, "presence")) { 186 } else if(!strcmp(packet->name, "presence")) {
183 jabber_presence_parse(js, packet); 187 jabber_presence_parse(js, packet);
184 } else if(!strcmp(packet->name, "message")) { 188 } else if(!strcmp(packet->name, "message")) {
185 jabber_message_parse(js, packet); 189 jabber_message_parse(js, packet);
186 } else if(!strcmp(packet->name, "stream:features")) { 190 } else if(!strcmp(packet->name, "stream:features")) {
187 jabber_stream_features_parse(js, packet); 191 jabber_stream_features_parse(js, packet);
188 } else if (!strcmp(packet->name, "features") && 192 } else if (!strcmp(packet->name, "features") &&
189 !strcmp(xmlnode_get_namespace(packet), "http://etherx.jabber.org/streams")) { 193 !strcmp(xmlns, "http://etherx.jabber.org/streams")) {
190 jabber_stream_features_parse(js, packet); 194 jabber_stream_features_parse(js, packet);
191 } else if(!strcmp(packet->name, "stream:error")) { 195 } else if(!strcmp(packet->name, "stream:error") ||
192 jabber_stream_handle_error(js, packet); 196 (!strcmp(packet->name, "error") &&
193 } else if (!strcmp(packet->name, "error") && 197 !strcmp(xmlns, "http://etherx.jabber.org/streams")))
194 !strcmp(xmlnode_get_namespace(packet), "http://etherx.jabber.org/streams")) { 198 {
195 jabber_stream_handle_error(js, packet); 199 jabber_stream_handle_error(js, packet);
196 } else if(!strcmp(packet->name, "challenge")) { 200 } else if(!strcmp(packet->name, "challenge")) {
197 if(js->state == JABBER_STREAM_AUTHENTICATING) 201 if(js->state == JABBER_STREAM_AUTHENTICATING)
198 jabber_auth_handle_challenge(js, packet); 202 jabber_auth_handle_challenge(js, packet);
199 } else if(!strcmp(packet->name, "success")) { 203 } else if(!strcmp(packet->name, "success")) {
1528 js->gc->wants_to_die = TRUE; 1532 js->gc->wants_to_die = TRUE;
1529 text = _("Authentication Failure"); 1533 text = _("Authentication Failure");
1530 } 1534 }
1531 } else if(!strcmp(packet->name, "stream:error") || 1535 } else if(!strcmp(packet->name, "stream:error") ||
1532 (!strcmp(packet->name, "error") && 1536 (!strcmp(packet->name, "error") &&
1533 !strcmp(xmlnode_get_namespace(packet), "http://etherx.jabber.org/streams"))) { 1537 !strcmp(xmlns, "http://etherx.jabber.org/streams"))) {
1534 if(xmlnode_get_child(packet, "bad-format")) { 1538 if(xmlnode_get_child(packet, "bad-format")) {
1535 text = _("Bad Format"); 1539 text = _("Bad Format");
1536 } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { 1540 } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) {
1537 text = _("Bad Namespace Prefix"); 1541 text = _("Bad Namespace Prefix");
1538 } else if(xmlnode_get_child(packet, "conflict")) { 1542 } else if(xmlnode_get_child(packet, "conflict")) {