Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/xmpp_helper.c @ 1800:d2747442918a
When displaying a server error, show the sender JID
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 20 Mar 2010 15:27:26 +0100 |
parents | e6e89b1d7831 |
children | e6d355e50d7a |
comparison
equal
deleted
inserted
replaced
1799:e73cd9377a4e | 1800:d2747442918a |
---|---|
342 } | 342 } |
343 | 343 |
344 // display_server_error(x) | 344 // display_server_error(x) |
345 // Display the error to the user | 345 // Display the error to the user |
346 // x: error tag xmlnode pointer | 346 // x: error tag xmlnode pointer |
347 void display_server_error(LmMessageNode *x) | 347 void display_server_error(LmMessageNode *x, const char *from) |
348 { | 348 { |
349 const char *desc = NULL, *errname=NULL, *s; | 349 const char *desc = NULL, *errname = NULL, *s; |
350 char *sdesc, *tmp; | 350 char *sdesc, *tmp; |
351 | 351 |
352 if (!x) return; | 352 if (!x) return; |
353 | 353 |
354 /* RFC3920: | 354 /* RFC3920: |
357 * stanza error conditions specified below; this element MUST be | 357 * stanza error conditions specified below; this element MUST be |
358 * qualified by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace. | 358 * qualified by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace. |
359 */ | 359 */ |
360 if (x->children) | 360 if (x->children) |
361 errname = x->children->name; | 361 errname = x->children->name; |
362 scr_LogPrint(LPRINT_LOGNORM, "Received error packet [%s]", | 362 |
363 (errname ? errname : "")); | 363 if (from) |
364 scr_LogPrint(LPRINT_LOGNORM, "Received error packet [%s] from <%s>", | |
365 (errname ? errname : ""), from); | |
366 else | |
367 scr_LogPrint(LPRINT_LOGNORM, "Received error packet [%s]", | |
368 (errname ? errname : "")); | |
364 | 369 |
365 // For backward compatibility | 370 // For backward compatibility |
366 if (!errname && ((s = lm_message_node_get_attribute(x, "code")) != NULL)) { | 371 if (!errname && ((s = lm_message_node_get_attribute(x, "code")) != NULL)) { |
367 // Default message | 372 // Default message |
368 desc = defaulterrormsg(atoi(s)); | 373 desc = defaulterrormsg(atoi(s)); |