aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-09 08:22:54 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-09 08:22:54 +0800
commitd1bc4936d699830da46e384d32d9f60f3f8dc3fa (patch)
tree440f8f09bcfbbbee7e2df93d4f5618c86020eb9d /camel/providers/imap
parentce3c2273262985f373126cc7fe4041c5da94d362 (diff)
downloadgsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.gz
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.bz2
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.lz
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.xz
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.tar.zst
gsoc2013-evolution-d1bc4936d699830da46e384d32d9f60f3f8dc3fa.zip
Update to reflect past changes in the Camel API. Use gtk macro casts
2000-07-08 Jeffrey Stedfast <fejj@helixcode.com> * providers/nntp/camel-nntp-folder.c: * providers/nntp/camel-nntp-utils.c: * providers/nntp/camel-nntp-store.c: Update to reflect past changes in the Camel API. Use gtk macro casts wherever possible and use glib's memory functions instead of standard c's (since they are not compatable) * providers/smtp/camel-smtp-transport.c: * providers/imap/camel-imap-store.c: Wrap debug print statements in a macro * providers/imap/camel-imap-stream.c (stream_read): Make sure that we get up to and including the last \n of the mime part. * providers/imap/camel-imap-folder.c (imap_get_message): Make sure that we get up to and including the last \n of the mime part. Wrap debug print statements in a macro. svn path=/trunk/; revision=3984
Diffstat (limited to 'camel/providers/imap')
-rw-r--r--camel/providers/imap/camel-imap-folder.c36
-rw-r--r--camel/providers/imap/camel-imap-store.c17
-rw-r--r--camel/providers/imap/camel-imap-stream.c2
3 files changed, 31 insertions, 24 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 8922d0dd4d..d92f260870 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -50,7 +50,7 @@
#include "camel-exception.h"
#include "camel-mime-utils.h"
-#define d(x)
+#define d(x) x
#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (GTK_OBJECT (o)->klass))
@@ -714,7 +714,7 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex)
f = folder + strlen (folder_path) + 1;
memmove (folder, f, strlen (f) + 1);
}
- printf ("adding folder: %s\n", folder);
+ d(fprintf (stderr, "adding folder: %s\n", folder));
g_ptr_array_add (listing, folder);
@@ -791,11 +791,13 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
if (*q == '\n')
part_len--;
}
+ /* we want to make sure we get up to the last \n */
+ for ( ; *q && *q != '\n'; q++, part_len++);
header = g_strndup (p, part_len);
g_free (result);
- printf ("*** We got the header ***\n");
+ d(fprintf (stderr, "*** We got the header ***\n"));
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
&result, "UID FETCH %s BODY[TEXT]", uid);
@@ -833,18 +835,20 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
if (*q == '\n')
part_len--;
}
+ /* we want to make sure we get up to the last \n */
+ for ( ; *q && *q != '\n'; q++, part_len++);
body = g_strndup (p, part_len);
g_free (result);
- printf ("*** We got the body ***\n");
+ d(fprintf (stderr, "*** We got the body ***\n"));
mesg = g_strdup_printf ("%s\n%s", header, body);
g_free (header);
g_free (body);
- printf ("*** We got the mesg ***\n");
+ d(fprintf (stderr, "*** We got the mesg ***\n"));
- fprintf (stderr, "Message:\n%s\n", mesg);
+ d(fprintf (stderr, "Message:\n%s\n", mesg));
msgstream = camel_stream_mem_new_with_buffer (mesg, strlen (mesg) + 1);
#if 0
@@ -853,7 +857,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
id = camel_stream_filter_add (f_stream, CAMEL_MIME_FILTER (filter));
#endif
msg = camel_mime_message_new ();
- printf ("*** We created the camel_mime_message ***\n");
+ d(fprintf (stderr, "*** We created the camel_mime_message ***\n"));
camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), msgstream);
#if 0
@@ -863,7 +867,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
gtk_object_unref (GTK_OBJECT (msgstream));
/*gtk_object_unref (GTK_OBJECT (f_stream));*/
- printf ("*** We're returning... ***\n");
+ d(fprintf (stderr, "*** We're returning... ***\n"));
return msg;
@@ -1067,7 +1071,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
if (!result || *result != '*') {
g_free (result);
- fprintf (stderr, "Warning: UID for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: UID for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1084,7 +1088,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
p = strchr (result, '(');
if (!p || strncasecmp (p + 1, "UID", 3)) {
g_free (result);
- fprintf (stderr, "Warning: UID for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: UID for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1101,7 +1105,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
for (p += 4; *p && (*p < '0' || *p > '9'); p++); /* advance to <uid> */
for (q = p; *q && *q != ')' && *q != ' '; q++); /* find the end of the <uid> */
info->uid = g_strndup (p, (gint)(q - p));
- printf ("*** info->uid = %s\n", info->uid);
+ d(fprintf (stderr, "*** info->uid = %s\n", info->uid));
g_free (result);
/* now to get the flags */
@@ -1133,7 +1137,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
if (!result || *result != '*') {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: FLAGS for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1151,7 +1155,7 @@ imap_get_summary (CamelFolder *folder, CamelException *ex)
p = strchr (result, '(') + 1;
if (strncasecmp (p, "FLAGS", 5)) {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %d not found\n", i);
+ d(fprintf (stderr, "Warning: FLAGS for message %d not found\n", i));
g_free (info->subject);
g_free (info->from);
@@ -1295,14 +1299,14 @@ imap_get_message_info (CamelFolder *folder, const char *uid)
if (status != CAMEL_IMAP_OK) {
g_free (result);
- fprintf (stderr, "Warning: Error getting FLAGS for message %s\n", uid);
+ d(fprintf (stderr, "Warning: Error getting FLAGS for message %s\n", uid));
return info; /* I guess we should return what we got so far? */
}
if (!result || *result != '*') {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid);
+ d(fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid));
return info; /* I guess we should return what we got so far? */
}
@@ -1310,7 +1314,7 @@ imap_get_message_info (CamelFolder *folder, const char *uid)
p = strchr (result, '(') + 1;
if (strncasecmp (p, "FLAGS", 5)) {
g_free (result);
- fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid);
+ d(fprintf (stderr, "Warning: FLAGS for message %s not found\n", uid));
return info; /* I guess we should return what we got so far? */
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 75da7529b3..e7c9d98673 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -47,6 +47,8 @@
#include "camel-url.h"
#include "string-utils.h"
+#define d(x) x
+
/* Specified in RFC 2060 */
#define IMAP_PORT 143
@@ -336,7 +338,7 @@ imap_connect (CamelService *service, CamelException *ex)
g_free (result);
- fprintf (stderr, "IMAP provider does%shave SEARCH support\n", store->has_search_capability ? " " : "n't ");
+ d(fprintf (stderr, "IMAP provider does%shave SEARCH support\n", store->has_search_capability ? " " : "n't "));
service_class->connect (service, ex);
@@ -384,7 +386,7 @@ imap_folder_exists (CamelFolder *folder)
else
folder_path = g_strdup (folder->full_name);
- printf ("doing an EXAMINE...\n");
+ d(fprintf (stderr, "doing an EXAMINE...\n"));
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL,
&result, "EXAMINE %s", folder_path);
@@ -570,7 +572,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
cmdbuf = g_strdup_vprintf (fmt, ap);
va_end (ap);
- fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf);
+ d(fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf));
fflush (stderr);
if (camel_stream_printf (store->ostream, "%s %s\r\n", cmdid, cmdbuf) == -1) {
@@ -590,8 +592,7 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
return CAMEL_IMAP_FAIL;
}
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
- fflush (stderr);
+ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
status = camel_imap_status (cmdid, respbuf);
g_free (cmdid);
@@ -672,7 +673,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
cmdbuf = g_strdup_vprintf (fmt, app);
va_end (app);
- fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf);
+ d(fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf));
if (camel_stream_printf (store->ostream, "%s %s\r\n", cmdid, cmdbuf) == -1) {
g_free (cmdbuf);
@@ -690,11 +691,11 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
respbuf = camel_stream_buffer_read_line (stream);
if (!respbuf || !strncmp(respbuf, cmdid, strlen(cmdid)) ) {
/* IMAP's last response starts with our command id */
- fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)");
+ d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
break;
}
- fprintf (stderr, "received: %s\n", respbuf);
+ d(fprintf (stderr, "received: %s\n", respbuf));
g_ptr_array_add (data, respbuf);
len += strlen (respbuf) + 1;
diff --git a/camel/providers/imap/camel-imap-stream.c b/camel/providers/imap/camel-imap-stream.c
index d7fb0ee75c..9f45ed2291 100644
--- a/camel/providers/imap/camel-imap-stream.c
+++ b/camel/providers/imap/camel-imap-stream.c
@@ -168,6 +168,8 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
if (*q == '\n')
part_len--;
}
+ /* we want to make sure we get up to the last \n */
+ for ( ; *q && *q != '\n'; q++, part_len++);
imap_stream->cache = g_strndup (p, part_len);
g_free (result);