diff options
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 13 | ||||
-rw-r--r-- | camel/providers/local/camel-local-store.c | 3 | ||||
-rw-r--r-- | camel/providers/local/camel-local-summary.c | 5 | ||||
-rw-r--r-- | camel/providers/local/camel-maildir-summary.c | 14 | ||||
-rw-r--r-- | camel/providers/local/camel-mbox-summary.c | 15 | ||||
-rw-r--r-- | camel/providers/local/camel-mh-summary.c | 4 |
6 files changed, 46 insertions, 8 deletions
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index 16ca2d8b2e..787b482169 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -138,9 +138,22 @@ local_finalize(CamelObject * object) { CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(object); + if (local_folder->summary) { + camel_local_summary_sync(local_folder->summary, FALSE, local_folder->changes, NULL); + camel_object_unref((CamelObject *)local_folder->summary); + } + + if (local_folder->search) { + camel_object_unref((CamelObject *)local_folder->search); + } + + /* must free index after summary, since it isn't refcounted */ if (local_folder->index) ibex_close(local_folder->index); + while (local_folder->locked> 0) + camel_local_folder_unlock(local_folder); + g_free(local_folder->base_path); g_free(local_folder->folder_path); g_free(local_folder->summary_path); diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 748cc45290..9af9df2744 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -77,6 +77,9 @@ camel_local_store_init (gpointer object, gpointer klass) CamelStore *store = CAMEL_STORE (object); /* local names are filenames, so they are case-sensitive. */ + if (store->folders) + g_hash_table_destroy(store->folders); + store->folders = g_hash_table_new (g_str_hash, g_str_equal); } diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c index 81cde8e808..83b0e6313b 100644 --- a/camel/providers/local/camel-local-summary.c +++ b/camel/providers/local/camel-local-summary.c @@ -470,14 +470,13 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo } if (flag || tag) { - g_string_append(out, "; "); val = g_string_new(""); if (flag) { while (flag) { g_string_append(val, flag->name); if (flag->next) - g_string_append_c(out, ','); + g_string_append_c(val, ','); flag = flag->next; } header_set_param(¶ms, "flags", val->str); @@ -489,7 +488,7 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo g_string_append_c(val, '='); g_string_append(val, tag->value); if (tag->next) - g_string_append_c(out, ','); + g_string_append_c(val, ','); tag = tag->next; } header_set_param(¶ms, "tags", val->str); diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c index fe88539ca3..0fa9f1c0d9 100644 --- a/camel/providers/local/camel-maildir-summary.c +++ b/camel/providers/local/camel-maildir-summary.c @@ -38,6 +38,7 @@ #define CAMEL_MAILDIR_SUMMARY_VERSION (0x2000) static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _header_raw *); +static void message_info_free(CamelFolderSummary *, CamelMessageInfo *mi); static int maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex); static int maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex); @@ -86,6 +87,7 @@ camel_maildir_summary_class_init (CamelMaildirSummaryClass *class) /* override methods */ sklass->message_info_new = message_info_new; + sklass->message_info_free = message_info_free; sklass->next_uid_string = maildir_summary_next_uid_string; lklass->check = maildir_summary_check; @@ -118,6 +120,7 @@ camel_maildir_summary_finalise(CamelObject *obj) { CamelMaildirSummary *o = (CamelMaildirSummary *)obj; + g_free(o->priv->hostname); g_free(o->priv); } @@ -253,6 +256,16 @@ static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _header return mi; } +static void message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi) +{ + CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi; + + g_free(mdi->filename); + + ((CamelFolderSummaryClass *) parent_class)->message_info_free(s, mi); +} + + static char *maildir_summary_next_uid_string(CamelFolderSummary *s) { CamelMaildirSummary *mds = (CamelMaildirSummary *)s; @@ -476,6 +489,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca g_free(dest); } } + closedir(dir); g_free(new); g_free(cur); diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c index b4c2d151a5..b2a5e13e4a 100644 --- a/camel/providers/local/camel-mbox-summary.c +++ b/camel/providers/local/camel-mbox-summary.c @@ -646,7 +646,7 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha int i, count; CamelMboxMessageInfo *info; int fd = -1; - char *xevnew; + char *xevnew, *xevtmp; const char *xev; int len; off_t lastpos; @@ -709,12 +709,20 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha goto error; } xevnew = camel_local_summary_encode_x_evolution(cls, (CamelMessageInfo *)info); - /* the raw header contains a leading ' ', so count that too */ - if (strlen(xev)-1 != strlen(xevnew)) { + /* SIGH: encode_param_list is about the only function which folds headers by itself. + This should be fixed somehow differently (either parser doesn't fold headers, + or param_list doesn't, or something */ + xevtmp = header_unfold(xevnew); + /* the raw header contains a leading ' ', so (dis)count that too */ + if (strlen(xev)-1 != strlen(xevtmp)) { g_free(xevnew); + g_free(xevtmp); g_warning("Hmm, the xev headers shouldn't have changed size, but they did"); goto error; } + g_free(xevtmp); + + /* we write out the xevnew string, assuming its been folded identically to the original too! */ lastpos = lseek(fd, 0, SEEK_CUR); lseek(fd, xevoffset+strlen("X-Evolution: "), SEEK_SET); @@ -722,6 +730,7 @@ mbox_summary_sync_quick(CamelLocalSummary *cls, gboolean expunge, CamelFolderCha len = write(fd, xevnew, strlen(xevnew)); } while (len == -1 && errno == EINTR); lseek(fd, lastpos, SEEK_SET); + g_free(xevnew); camel_mime_parser_drop_step(mp); camel_mime_parser_drop_step(mp); diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c index c28ee1f495..e9fb9f116c 100644 --- a/camel/providers/local/camel-mh-summary.c +++ b/camel/providers/local/camel-mh-summary.c @@ -145,7 +145,7 @@ static char *mh_summary_next_uid_string(CamelFolderSummary *s) CamelLocalSummary *cls = (CamelLocalSummary *)s; int fd = -1; guint32 uid; - char *name = NULL; + char *name; /* if we are working to add an existing file, then use current_uid */ if (mhs->priv->current_uid) @@ -153,12 +153,12 @@ static char *mh_summary_next_uid_string(CamelFolderSummary *s) /* else scan for one - and create it too, to make sure */ do { - g_free(name); close(fd); uid = camel_folder_summary_next_uid(s); name = g_strdup_printf("%s/%u", cls->folder_path, uid); /* O_EXCL isn't guaranteed, sigh. Oh well, bad luck, mh has problems anyway */ fd = open(name, O_WRONLY|O_CREAT|O_EXCL, 0600); + g_free(name); } while (fd == -1 && errno == EEXIST); close(fd); |