projects
/
dockapps
/
wmnotify.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6331519
)
Improve IMAP debug messages
author
Hugo Villeneuve
<hugo@hugovil.com>
Sat, 14 Jan 2017 16:02:46 +0000
(11:02 -0500)
committer
Hugo Villeneuve
<hugo@hugovil.com>
Sat, 14 Jan 2017 16:05:48 +0000
(11:05 -0500)
src/imap.c
patch
|
blob
|
history
diff --git
a/src/imap.c
b/src/imap.c
index
13a3b0b
..
1c33b80
100644
(file)
--- a/
src/imap.c
+++ b/
src/imap.c
@@
-29,6
+29,7
@@
#include "network.h"
#include "imap.h"
#include "network.h"
#include "imap.h"
+#define DEBUG_RESPONSE_LINE_INDENT " "
#define IMAP4_ENDL "\r\n" /* CRLF */
#define IMAP4_ENDL "\r\n" /* CRLF */
@@
-60,6
+61,29
@@
static int unseen_string_found;
extern char tx_buffer[WMNOTIFY_BUFSIZE + 1];
extern char rx_buffer[WMNOTIFY_BUFSIZE + 1];
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;
static int IMAP4_ReceiveResponse(void)
{
int len;
@@
-125,7
+149,7
@@
get_packet:
rx_buffer[len - 1] = '\0';
if (wmnotify_infos.debug) {
rx_buffer[len - 1] = '\0';
if (wmnotify_infos.debug) {
-
printf("%s", rx_buffer
);
+
IMAP4_debug_response(rx_buffer, len
);
}
/*
}
/*