| 349 |
349 |
| 350 void jabber_send_raw(JabberStream *js, const char *data, int len) |
350 void jabber_send_raw(JabberStream *js, const char *data, int len) |
| 351 { |
351 { |
| 352 |
352 |
| 353 /* because printing a tab to debug every minute gets old */ |
353 /* because printing a tab to debug every minute gets old */ |
| 354 if(strcmp(data, "\t")) |
354 if(strcmp(data, "\t")) { |
| 355 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s\n", |
355 char *text = NULL, *last_part = NULL, *tag_start = NULL; |
| 356 js->gsc ? " (ssl)" : "", data); |
356 |
| |
357 /* Because debug logs with plaintext passwords make me sad */ |
| |
358 if(js->state != JABBER_STREAM_CONNECTED && |
| |
359 /* Either <auth> or <query><password>... */ |
| |
360 (((tag_start = strstr(data, "<auth ")) && |
| |
361 strstr(data, "xmlns='urn:ietf:params:xml:ns:xmpp-sasl'")) || |
| |
362 ((tag_start = strstr(data, "<query ")) && |
| |
363 strstr(data, "xmlns='jabber:iq:auth'>") && |
| |
364 (tag_start = strstr(tag_start, "<password>"))))) { |
| |
365 char *data_start, *tag_end = strchr(tag_start, '>'); |
| |
366 text = g_strdup(data); |
| |
367 |
| |
368 data_start = text + (tag_end - data) + 1; |
| |
369 |
| |
370 last_part = strchr(data_start, '<'); |
| |
371 *data_start = '\0'; |
| |
372 } |
| |
373 |
| |
374 purple_debug(PURPLE_DEBUG_MISC, "jabber", "Sending%s: %s%s%s\n", |
| |
375 js->gsc ? " (ssl)" : "", text ? text : data, |
| |
376 last_part ? "password removed" : "", |
| |
377 last_part ? last_part : ""); |
| |
378 |
| |
379 g_free(text); |
| |
380 } |
| 357 |
381 |
| 358 /* If we've got a security layer, we need to encode the data, |
382 /* If we've got a security layer, we need to encode the data, |
| 359 * splitting it on the maximum buffer length negotiated */ |
383 * splitting it on the maximum buffer length negotiated */ |
| 360 |
384 |
| 361 purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data); |
385 purple_signal_emit(my_protocol, "jabber-sending-text", js->gc, &data); |