diff options
Diffstat (limited to 'camel/providers/mbox')
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 21 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-summary.c | 11 |
2 files changed, 26 insertions, 6 deletions
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 3403271e40..9d405bd1db 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -79,6 +79,8 @@ static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, Ca static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex); #endif +static void mbox_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException *ex); + GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count); static const CamelMessageInfo *mbox_summary_get_by_uid(CamelFolder *f, const char *uid); @@ -110,11 +112,9 @@ camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class) camel_folder_class->append_message = mbox_append_message; camel_folder_class->get_uid_list = mbox_get_uid_list; camel_folder_class->expunge = mbox_expunge; -#if 0 - camel_folder_class->copy_message_to = _copy_message_to; - camel_folder_class->get_message_uid = _get_message_uid; -#endif + camel_folder_class->get_message_by_uid = mbox_get_message_by_uid; + camel_folder_class->delete_message_by_uid = mbox_delete_message_by_uid; camel_folder_class->search_by_expression = mbox_search_by_expression; @@ -824,6 +824,19 @@ mbox_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex return mbox_get_message_by_uid (folder, info->info.uid, ex); } +static void +mbox_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException *ex) +{ + CamelMessageInfo *info; + CamelMboxFolder *mf = (CamelMboxFolder *)folder; + + info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, uid); + if (info) { + info->flags |= CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED; + camel_folder_summary_touch((CamelFolderSummary *)mf->summary); + } +} + /* track flag changes in the summary */ static void message_changed(CamelMimeMessage *m, int type, CamelMboxFolder *mf) diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index 56ff1cb198..dac2694f4c 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -299,6 +299,7 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset) } else { gtk_object_unref((GtkObject *)mp); /* end of file - no content? */ + printf("We radn out of file?\n"); return 0; } } @@ -308,6 +309,7 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset) info = camel_folder_summary_add_from_parser((CamelFolderSummary *)mbs, mp); if (info == NULL) { + printf("Could not build info from file?\n"); ok = -1; break; } @@ -315,6 +317,10 @@ summary_rebuild(CamelMboxSummary *mbs, off_t offset) g_assert(camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM_END); } + /* update the file size in the summary */ + if (ok != -1) + mbs->folder_size = camel_mime_parser_seek(mp, 0, SEEK_CUR); + printf("updating folder size = %d\n", mbs->folder_size); gtk_object_unref((GtkObject *)mp); return ok; @@ -631,7 +637,7 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs) } xevok = TRUE; } - xevnew = header_evolution_encode(strtoul(info->info.uid, NULL, 10), info->info.flags); + xevnew = header_evolution_encode(strtoul(info->info.uid, NULL, 10), info->info.flags & 0xffff); if (quick) { if (!xevok) { g_error("The summary told me I had an X-Evolution header, but i dont!"); @@ -664,6 +670,7 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs) info->frompos = frompos; offset = bodypos - info->info.content->bodypos; } + info->info.flags &= 0xffff; g_free(xevnew); xevnew = NULL; camel_mime_parser_drop_step(mp); camel_mime_parser_drop_step(mp); @@ -703,7 +710,7 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs) if (stat(mbs->folder_path, &st) == -1) goto error; - s->flags |= CAMEL_SUMMARY_DIRTY; + camel_folder_summary_touch(s); s->time = st.st_mtime; mbs->folder_size = st.st_size; camel_folder_summary_save(s); |