aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-folder.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-29 09:49:06 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-29 09:49:06 +0800
commitda2fff47da91473e5299e311b7ec698463823f1f (patch)
tree60cc88608cc599d867ade4cb6dbd690f85109d1c /camel/providers/imap/camel-imap-folder.c
parentdca8b620c8b20654cc47cff442aa7f2c4d61257a (diff)
downloadgsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.tar
gsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.tar.gz
gsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.tar.bz2
gsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.tar.lz
gsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.tar.xz
gsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.tar.zst
gsoc2013-evolution-da2fff47da91473e5299e311b7ec698463823f1f.zip
Make sure the third word/token (whatever) is "EXPUNGE" and not something
2000-07-28 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (imap_expunge): Make sure the third word/token (whatever) is "EXPUNGE" and not something else like "EXISTS" or "RECENT". When removing the message from the summary also make sure to free that data to avoid leakage. Also make sure to subtract 1 from the 'id' since IMAP starts at 1 and our summary starts at 0 :-) svn path=/trunk/; revision=4411
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r--camel/providers/imap/camel-imap-folder.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 48ae72d032..954e103c8f 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -398,34 +398,44 @@ imap_expunge (CamelFolder *folder, CamelException *ex)
}
/* else we have a message id? */
- if (*word >= '0' && *word <= '9') {
+ if (*word >= '0' && *word <= '9' && !strncmp ("EXPUNGE", imap_next_word (word), 7)) {
int id;
id = atoi (word);
-
- d(fprintf (stderr, "Expunging message %d from the summary\n", id + i));
- if (id < imap_folder->summary->len) {
+ d(fprintf (stderr, "Expunging message %d from the summary (i = %d)\n", id + i, i));
+
+ if (id <= imap_folder->summary->len) {
CamelMessageInfo *info;
- info = (CamelMessageInfo *) imap_folder->summary->pdata[id];
+ info = (CamelMessageInfo *) imap_folder->summary->pdata[id - 1];
/* remove from the lookup table and summary */
g_hash_table_remove (imap_folder->summary_hash, info->uid);
- g_ptr_array_remove_index (imap_folder->summary, id);
+ g_ptr_array_remove_index (imap_folder->summary, id - 1);
+
+ /* free the info data */
+ g_free (info->subject);
+ g_free (info->from);
+ g_free (info->to);
+ g_free (info->cc);
+ g_free (info->uid);
+ g_free (info->message_id);
+ header_references_list_clear (&info->references);
+ g_free (info);
+ info = NULL;
} else {
/* Hopefully this should never happen */
d(fprintf (stderr, "imap expunge-error: message %d is out of range\n", id));
}
- } else {
- /* Huh? */
- d(fprintf (stderr, "imap expunge-warning: unexpected token: '%s'\n", word));
}
} else {
break;
}
for ( ; *node && *node != '\n'; node++);
+ if (*node)
+ node++;
}
g_free (result);
@@ -836,20 +846,20 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
status != CAMEL_IMAP_FAIL && result ? result :
"Unknown error");
g_free (result);
- return camel_mime_message_new ();
+ return NULL;
}
for (p = result; *p && *p != '{' && *p != '\n'; p++);
if (*p != '{') {
g_free (result);
- return camel_mime_message_new ();
+ return NULL;
}
part_len = atoi (p + 1);
for ( ; *p && *p != '\n'; p++);
if (*p != '\n') {
g_free (result);
- return camel_mime_message_new ();
+ return NULL;
}
/* calculate the new part-length */
@@ -884,22 +894,23 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex)
"Unknown error");
g_free (result);
g_free (header);
- return camel_mime_message_new ();
+ return NULL;
}
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') {
- g_free (result);
- g_free (header);
- return camel_mime_message_new ();
+ /* this is a hack for when the part length isn't in {}'s */
+ part_len = 1;
+ for ( ; *p && *p != '\n'; p++);
+ p++;
+ } else {
+ part_len = atoi (p + 1);
+ for ( ; *p && *p != '\n'; p++);
+ if (*p != '\n') {
+ g_free (result);
+ g_free (header);
+ return NULL;
+ }
}
/* calculate the new part-length */