From 14bc1cbfc8a8c492e4a280655238159e004c53b3 Mon Sep 17 00:00:00 2001 From: NotZed Date: Wed, 17 May 2000 19:24:24 +0000 Subject: All this basically to support user flags in the summary. They are not yet All this basically to support user flags in the summary. They are not yet saved to the message headers (complicates things a bit). 2000-05-17 NotZed * providers/mbox/camel-mbox-folder.c (message_changed): Snoop changes to user flags on the message into the summary as well. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_init): Changed version init to include the parent class version info (i.e. add it not overwrite it). * camel-folder-summary.c (message_info_new): Initialise user_flags to empty. (message_info_load): And load user flags. (message_info_save): And save user flags. (message_info_free): And free them. (CAMEL_FOLDER_SUMMARY_VERSION): Bumped file revision. * camel-folder-summary.h: Added user-flags to summary. * camel-mime-message.c (camel_mime_message_set_user_flag): Dont use a hashtable for user flags. (camel_mime_message_get_user_flag): And changed here too. (camel_flag_get): New interface to get a flag from a flag list. Flag lists are easier to work with than hash tables, and save memory too. (camel_flag_set): And set. (camel_flag_list_free): And free. (free_key_only): Discard. (finalize): Remove the flag list. svn path=/trunk/; revision=3107 --- camel/providers/mbox/camel-mbox-folder.c | 7 +++++++ camel/providers/mbox/camel-mbox-summary.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'camel/providers') diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 9d405bd1db..460b970ca7 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -842,6 +842,7 @@ static void message_changed(CamelMimeMessage *m, int type, CamelMboxFolder *mf) { CamelMessageInfo *info; + CamelFlag *flag; printf("Message changed: %s: %d\n", m->message_uid, type); switch (type) { @@ -849,6 +850,12 @@ message_changed(CamelMimeMessage *m, int type, CamelMboxFolder *mf) info = camel_folder_summary_uid((CamelFolderSummary *)mf->summary, m->message_uid); if (info) { info->flags = m->flags | CAMEL_MESSAGE_FOLDER_FLAGGED; + camel_flag_list_free(&info->user_flags); + flag = m->user_flags; + while (flag) { + camel_flag_set(&info->user_flags, flag->name, TRUE); + flag = flag->next; + } camel_folder_summary_touch((CamelFolderSummary *)mf->summary); } else g_warning("Message changed event on message not in summary: %s", m->message_uid); diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index dac2694f4c..46b180e999 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -117,7 +117,7 @@ camel_mbox_summary_init (CamelMboxSummary *obj) s->content_info_size = sizeof(CamelMboxMessageContentInfo); /* and a unique file version */ - s->version = CAMEL_MBOX_SUMMARY_VERSION; + s->version += CAMEL_MBOX_SUMMARY_VERSION; } static void -- cgit v1.2.3