#include "network.h"
#include "imap.h"
+#define DEBUG_RESPONSE_LINE_INDENT " "
#define IMAP4_ENDL "\r\n" /* CRLF */
extern char tx_buffer[WMNOTIFY_BUFSIZE + 1];
extern char rx_buffer[WMNOTIFY_BUFSIZE + 1];
+static void
+IMAP4_debug_response(const char *buf, int len)
+{
+ int k, l;
+
+ k = strlen(rx_buffer);
+
+ if (k >= sizeof(rx_buffer)) {
+ k = 0;
+ }
+
+ printf(DEBUG_RESPONSE_LINE_INDENT);
+ for (l = 0; l < k; l++) {
+ if ((rx_buffer[l] == '\n') && (l < (k - 1))) {
+ printf("\n" DEBUG_RESPONSE_LINE_INDENT);
+ }
+ else
+ {
+ printf("%c", rx_buffer[l]);
+ }
+ }
+}
+
static int IMAP4_ReceiveResponse(void)
{
int len;
rx_buffer[len - 1] = '\0';
if (wmnotify_infos.debug) {
- printf("%s", rx_buffer);
+ IMAP4_debug_response(rx_buffer, len);
}
/*