aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-08-04 12:36:19 +0800
committerDan Winship <danw@src.gnome.org>2000-08-04 12:36:19 +0800
commit6165277ab5cb78f13b238e4a0f9c08cacafd1821 (patch)
treeae7ca858a86c55736d424141b24a57931442d2d7
parent61fae09dc0157bde0e1853a788c200e6830978a7 (diff)
downloadgsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.tar
gsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.tar.gz
gsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.tar.bz2
gsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.tar.lz
gsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.tar.xz
gsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.tar.zst
gsoc2013-evolution-6165277ab5cb78f13b238e4a0f9c08cacafd1821.zip
add a debugging macro for doing protocol tracing.
* providers/pop3/camel-pop3-store.c: add a debugging macro for doing protocol tracing. svn path=/trunk/; revision=4526
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/providers/pop3/camel-pop3-store.c26
2 files changed, 29 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 70abe69566..1cf46e5f6c 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-04 Dan Winship <danw@helixcode.com>
+
+ * providers/pop3/camel-pop3-store.c: add a debugging macro for
+ doing protocol tracing.
+
2000-08-03 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c (camel_imap_folder_new): Only
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index e1f2f5f59b..953a286a25 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -23,6 +23,8 @@
* USA
*/
+#define d(x)
+
#include "config.h"
#include <sys/types.h>
@@ -423,6 +425,7 @@ pop3_connect (CamelService *service, CamelException *ex)
service->url->port = KPOP_PORT;
#endif
+ d(printf ("POP3: Connecting to %s\n", service->url->host));
if (!connect_to_server (service, TRUE, ex))
return FALSE;
@@ -542,6 +545,8 @@ pop3_disconnect (CamelService *service, CamelException *ex)
if (!service_class->disconnect (service, ex))
return FALSE;
+ d(printf ("POP3: Disconnecting from %s\n", service->url->host));
+
if (store->ostream) {
gtk_object_unref (GTK_OBJECT (store->ostream));
store->ostream = NULL;
@@ -634,11 +639,19 @@ camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...)
cmdbuf = g_strdup_vprintf (fmt, ap);
va_end (ap);
+#if d(!)0
+ if (!strncmp (cmdbuf, "PASS", 4))
+ printf ("POP3: >>> PASS xxx\n");
+ else
+ printf ("POP3: >>> %s\n", cmdbuf);
+#endif
+
/* Send the command */
if (camel_stream_printf (store->ostream, "%s\r\n", cmdbuf) == -1) {
g_free (cmdbuf);
if (*ret)
- *ret = g_strdup(strerror(errno));
+ *ret = g_strdup (g_strerror (errno));
+ d(printf ("POP3: !!! %s\n", g_strerror (errno)));
return CAMEL_POP3_FAIL;
}
g_free (cmdbuf);
@@ -656,9 +669,12 @@ pop3_get_response (CamelPop3Store *store, char **ret)
CAMEL_STREAM_BUFFER (store->istream));
if (respbuf == NULL) {
if (ret)
- *ret = g_strdup(strerror(errno));
+ *ret = g_strdup (g_strerror (errno));
+ d(printf ("POP3: !!! %s\n", g_strerror (errno)));
return CAMEL_POP3_FAIL;
}
+ d(printf ("POP3: <<< %s\n", respbuf));
+
if (!strncmp (respbuf, "+OK", 3))
status = CAMEL_POP3_OK;
else if (!strncmp (respbuf, "-ERR", 4))
@@ -726,6 +742,12 @@ camel_pop3_command_get_additional_data (CamelPop3Store *store, CamelException *e
datap = (char *) data->pdata[i];
ptr = (*datap == '.') ? datap + 1 : datap;
len = strlen (ptr);
+#if d(!)0
+ if (i == data->len - 1)
+ printf ("POP3: <<<<<< %s\n", ptr);
+ else if (i == 0)
+ printf ("POP3: <<<<<< %s...\n", ptr);
+#endif
memcpy (p, ptr, len);
p += len;
*p++ = '\n';