diff options
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 31 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-folder.c | 29 |
2 files changed, 60 insertions, 0 deletions
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index 00921637eb..d533b675b9 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -83,6 +83,8 @@ static guint32 mbox_get_message_flags(CamelFolder *folder, const char *uid); static void mbox_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set); static gboolean mbox_get_message_user_flag(CamelFolder *folder, const char *uid, const char *name); static void mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value); +static const char *mbox_get_message_user_tag(CamelFolder *folder, const char *uid, const char *name); +static void mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value); static void mbox_finalize(CamelObject * object); @@ -121,6 +123,8 @@ camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class) camel_folder_class->set_message_flags = mbox_set_message_flags; camel_folder_class->get_message_user_flag = mbox_get_message_user_flag; camel_folder_class->set_message_user_flag = mbox_set_message_user_flag; + camel_folder_class->get_message_user_tag = mbox_get_message_user_tag; + camel_folder_class->set_message_user_tag = mbox_set_message_user_tag; } static void @@ -592,3 +596,30 @@ mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *nam camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); } + +static const char *mbox_get_message_user_tag(CamelFolder *folder, const char *uid, const char *name) +{ + CamelMessageInfo *info; + CamelMboxFolder *mf = CAMEL_MBOX_FOLDER(folder); + + info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); + g_return_val_if_fail(info != NULL, FALSE); + + return camel_tag_get(&info->user_tags, name); +} + +static void mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value) +{ + CamelMessageInfo *info; + CamelMboxFolder *mf = CAMEL_MBOX_FOLDER(folder); + + info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); + g_return_if_fail(info != NULL); + + camel_tag_set(&info->user_tags, name, value); + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED; + camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); + camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); +} + + diff --git a/camel/providers/mh/camel-mh-folder.c b/camel/providers/mh/camel-mh-folder.c index 6b78df9b14..e899318f9f 100644 --- a/camel/providers/mh/camel-mh-folder.c +++ b/camel/providers/mh/camel-mh-folder.c @@ -77,6 +77,8 @@ static guint32 mh_get_message_flags(CamelFolder * folder, const char *uid); static void mh_set_message_flags(CamelFolder * folder, const char *uid, guint32 flags, guint32 set); static gboolean mh_get_message_user_flag(CamelFolder * folder, const char *uid, const char *name); static void mh_set_message_user_flag(CamelFolder * folder, const char *uid, const char *name, gboolean value); +static const char *mh_get_message_user_tag(CamelFolder *folder, const char *uid, const char *name); +static void mh_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value); static void mh_finalize(CamelObject * object); @@ -113,6 +115,8 @@ static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class) camel_folder_class->set_message_flags = mh_set_message_flags; camel_folder_class->get_message_user_flag = mh_get_message_user_flag; camel_folder_class->set_message_user_flag = mh_set_message_user_flag; + camel_folder_class->get_message_user_flag = mh_get_message_user_tag; + camel_folder_class->set_message_user_flag = mh_set_message_user_tag; } static void mh_finalize(CamelObject * object) @@ -497,3 +501,28 @@ static void mh_set_message_user_flag(CamelFolder * folder, const char *uid, cons camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); camel_object_trigger_event (CAMEL_OBJECT(folder), "message_changed", (char *) uid); } + +static const char *mh_get_message_user_tag(CamelFolder *folder, const char *uid, const char *name) +{ + CamelMessageInfo *info; + CamelMhFolder *mf = CAMEL_MH_FOLDER(folder); + + info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); + g_return_val_if_fail(info != NULL, FALSE); + + return camel_tag_get(&info->user_tags, name); +} + +static void mh_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value) +{ + CamelMessageInfo *info; + CamelMhFolder *mf = CAMEL_MH_FOLDER(folder); + + info = camel_folder_summary_uid(CAMEL_FOLDER_SUMMARY(mf->summary), uid); + g_return_if_fail(info != NULL); + + camel_tag_set(&info->user_tags, name, value); + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED; + camel_folder_summary_touch(CAMEL_FOLDER_SUMMARY(mf->summary)); + camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); +} |