comparison libpurple/protocols/jabber/jabber.c @ 28888:562fd22dbe89

jabber: Print account name on sent stanzas in the debug log.
author Paul Aurich <paul@darkrain42.org>
date Fri, 06 Nov 2009 08:14:53 +0000
parents c3be1de8abde
children fa7f3426ed13
comparison
equal deleted inserted replaced
28886:9d6e1327f614 28888:562fd22dbe89
375 return success; 375 return success;
376 } 376 }
377 377
378 void jabber_send_raw(JabberStream *js, const char *data, int len) 378 void jabber_send_raw(JabberStream *js, const char *data, int len)
379 { 379 {
380
381 /* because printing a tab to debug every minute gets old */ 380 /* because printing a tab to debug every minute gets old */
382 if(strcmp(data, "\t")) { 381 if(strcmp(data, "\t")) {
382 const char *username;
383 char *text = NULL, *last_part = NULL, *tag_start = NULL; 383 char *text = NULL, *last_part = NULL, *tag_start = NULL;
384 384
385 /* Because debug logs with plaintext passwords make me sad */ 385 /* Because debug logs with plaintext passwords make me sad */
386 if(js->state != JABBER_STREAM_CONNECTED && 386 if(js->state != JABBER_STREAM_CONNECTED &&
387 /* Either <auth> or <query><password>... */ 387 /* Either <auth> or <query><password>... */
402 402
403 last_part = strchr(data_start, '<'); 403 last_part = strchr(data_start, '<');
404 *data_start = '\0'; 404 *data_start = '\0';
405 } 405 }
406 406
407 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s%s%s\n", 407 username = purple_connection_get_display_name(js->gc);
408 jabber_stream_is_ssl(js) ? " (ssl)" : "", text ? text : data, 408 if (!username)
409 username = purple_account_get_username(purple_connection_get_account(js->gc));
410
411 purple_debug_misc("jabber", "Sending%s (%s): %s%s%s\n",
412 jabber_stream_is_ssl(js) ? " (ssl)" : "", username,
413 text ? text : data,
409 last_part ? "password removed" : "", 414 last_part ? "password removed" : "",
410 last_part ? last_part : ""); 415 last_part ? last_part : "");
411 416
412 g_free(text); 417 g_free(text);
413 } 418 }