aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-folder.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-24 09:37:43 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-24 09:37:43 +0800
commite9112cf496ef8dd380ac030624b1fbda2b0d8c3d (patch)
tree25ceaf3cc7c09434ca6830a3def83202258d4867 /camel/providers/imap/camel-imap-folder.c
parent6095a951335a4edc3d9ed8f9e31913f8413decfa (diff)
downloadgsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.tar
gsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.tar.gz
gsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.tar.bz2
gsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.tar.lz
gsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.tar.xz
gsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.tar.zst
gsoc2013-evolution-e9112cf496ef8dd380ac030624b1fbda2b0d8c3d.zip
Made it a little more forgiving. Also set current_folder to NULL as there
2000-07-23 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-store.c (imap_disconnect): Made it a little more forgiving. Also set current_folder to NULL as there is no selected folder after a disconnect. (stream_is_alive): Detects whether or not a socket is "alive" (camel_imap_command_extended): Use stream_is_alive() to aid in the detection of a disconnected state. svn path=/trunk/; revision=4288
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r--camel/providers/imap/camel-imap-folder.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 28cf4a848d..1093005376 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -786,14 +786,14 @@ imap_delete_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
static CamelMimeMessage *
imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
{
- CamelStream *msgstream;
+ CamelStream *msgstream = NULL;
/*CamelStreamFilter *f_stream;*/
/*CamelMimeFilter *filter;*/
- CamelMimeMessage *msg;
+ CamelMimeMessage *msg = NULL;
/*CamelMimePart *part;*/
- gchar *result, *header, *body, *mesg, *p, *q;
- int status, part_len;
-
+ gchar *result, *header = NULL, *body = NULL, *mesg = NULL, *p = NULL, *q = NULL;
+ int status = 0, part_len = 0;
+
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
&result, "UID FETCH %s BODY.PEEK[HEADER]", uid);
@@ -808,20 +808,20 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
g_free (result);
return camel_mime_message_new ();
}
-
+
for (p = result; *p && *p != '{' && *p != '\n'; p++);
if (*p != '{') {
g_free (result);
return camel_mime_message_new ();
}
-
- part_len = atoi (p + 1);
+
+ part_len = atoi (p + 1);
for ( ; *p && *p != '\n'; p++);
if (*p != '\n') {
g_free (result);
return camel_mime_message_new ();
}
-
+
/* calculate the new part-length */
for (q = p; *q && (q - p) <= part_len; q++) {
if (*q == '\n')
@@ -829,15 +829,15 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
}
/* FIXME: This is a hack for IMAP daemons that send us a UID at the end of each FETCH */
for (q--, part_len--; q > p && *(q-1) != '\n'; q--, part_len--);
-
- header = g_strndup (p, part_len + 1);
+ header = g_strndup (p, part_len + 1);
+
g_free (result);
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);
-
+
if (!result || status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
@@ -850,14 +850,14 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
g_free (header);
return camel_mime_message_new ();
}
-
+
for (p = result; *p && *p != '{' && *p != '\n'; p++);
if (*p != '{') {
g_free (result);
g_free (header);
return camel_mime_message_new ();
}
-
+
part_len = atoi (p + 1);
for ( ; *p && *p != '\n'; p++);
if (*p != '\n') {
@@ -865,7 +865,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
g_free (header);
return camel_mime_message_new ();
}
-
+
/* calculate the new part-length */
for (q = p; *q && (q - p) <= part_len; q++) {
if (*q == '\n')
@@ -873,19 +873,19 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
}
/* FIXME: This is a hack for IMAP daemons that send us a UID at the end of each FETCH */
for ( ; q > p && *(q-1) != '\n'; q--, part_len--);
-
+
body = g_strndup (p, part_len + 1);
-
+
g_free (result);
d(fprintf (stderr, "*** We got the body ***\n"));
-
+
mesg = g_strdup_printf ("%s\n%s", header, body);
g_free (header);
g_free (body);
d(fprintf (stderr, "*** We got the mesg ***\n"));
-
+
d(fprintf (stderr, "Message:\n%s\n", mesg));
-
+
msgstream = camel_stream_mem_new_with_buffer (mesg, strlen (mesg) + 1);
#if 0
f_stream = camel_stream_filter_new_with_stream (msgstream);
@@ -902,7 +902,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
#endif
gtk_object_unref (GTK_OBJECT (msgstream));
/*gtk_object_unref (GTK_OBJECT (f_stream));*/
-
+
d(fprintf (stderr, "*** We're returning... ***\n"));
return msg;