diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 12 | ||||
-rw-r--r-- | camel/camel-folder.c | 58 | ||||
-rw-r--r-- | camel/camel-folder.h | 16 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 31 | ||||
-rw-r--r-- | camel/providers/mh/camel-mh-folder.c | 29 |
5 files changed, 142 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 0c9869871f..8a3e50bc87 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,8 +1,18 @@ 2000-08-11 Not Zed <NotZed@HelixCode.com> - * camel-folder.c (move_message_to): Yay so lets fix an already fixed fix, again. + * providers/mh/camel-mh-folder.c (mh_set_message_user_tag): + Implement. + (mh_get_message_user_tag): Implement. + + * providers/mbox/camel-mbox-folder.c (mbox_get_message_user_tag): + (mbox_set_message_user_tag): Implement. + + * camel-folder.c (move_message_to): Yay so lets fix an already + fixed fix, again. (copy_message_to): and here too ... update for api change to append(). And removed another warning. + (camel_folder_set_message_user_tag): Routine to set message tags. + (camel_folder_get_message_user_tag): And accessor. 2000-08-10 Christopher James Lahey <clahey@helixcode.com> diff --git a/camel/camel-folder.c b/camel/camel-folder.c index cb0fa02ae8..e498680fab 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -58,11 +58,11 @@ static guint32 get_permanent_flags (CamelFolder *folder); static guint32 get_message_flags (CamelFolder *folder, const char *uid); static void set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set); -static gboolean get_message_user_flag (CamelFolder *folder, const char *uid, - const char *name); +static gboolean get_message_user_flag (CamelFolder *folder, const char *uid, const char *name); static void set_message_user_flag (CamelFolder *folder, const char *uid, const char *name, gboolean value); - +static const char *get_message_user_tag(CamelFolder *folder, const char *uid, const char *name); +static void set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value); static GPtrArray *get_subfolder_names (CamelFolder *folder); static void free_subfolder_names (CamelFolder *folder, @@ -152,6 +152,8 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->set_message_flags = set_message_flags; camel_folder_class->get_message_user_flag = get_message_user_flag; camel_folder_class->set_message_user_flag = set_message_user_flag; + camel_folder_class->get_message_user_tag = get_message_user_tag; + camel_folder_class->set_message_user_tag = set_message_user_tag; camel_folder_class->get_message = get_message; camel_folder_class->get_uids = get_uids; camel_folder_class->free_uids = free_uids; @@ -721,6 +723,56 @@ camel_folder_set_message_user_flag (CamelFolder *folder, const char *uid, CF_CLASS (folder)->set_message_user_flag (folder, uid, name, value); } +static const char *get_message_user_tag(CamelFolder *folder, const char *uid, const char *name) +{ + g_warning ("CamelFolder::get_message_user_tag not implemented " + "for `%s'", camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder))); + return NULL; +} + +/** + * camel_folder_get_message_user_tag: + * @folder: a CamelFolder + * @uid: the UID of a message in @folder + * @name: the name of a user tag + * + * Return value: Returns the value of the user tag. + **/ +const char * +camel_folder_get_message_user_tag (CamelFolder *folder, const char *uid, const char *name) +{ + g_return_val_if_fail (CAMEL_IS_FOLDER (folder), 0); + + return CF_CLASS (folder)->get_message_user_tag (folder, uid, name); +} + + +static void +set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value) +{ + g_warning ("CamelFolder::set_message_user_tag not implemented " + "for `%s'", camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder))); +} + +/** + * camel_folder_set_message_user_tag: + * @folder: a CamelFolder + * @uid: the UID of a message in @folder + * @name: the name of the user tag to set + * @value: the value to set it to + * + * Sets the user tag specified by @name to the value specified by @value + * on the indicated message. (This may or may not persist after the + * folder or store is closed. See camel_folder_get_permanent_flags().) + **/ +void +camel_folder_set_message_user_tag (CamelFolder *folder, const char *uid, const char *name, const char *value) +{ + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + + CF_CLASS (folder)->set_message_user_tag (folder, uid, name, value); +} + static const CamelMessageInfo * get_message_info (CamelFolder *folder, const char *uid) diff --git a/camel/camel-folder.h b/camel/camel-folder.h index b394013d5d..da76618b57 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -127,6 +127,14 @@ typedef struct { const char *name, gboolean value); + const char * (*get_message_user_tag) (CamelFolder *folder, + const char *uid, + const char *name); + void (*set_message_user_tag) (CamelFolder *folder, + const char *uid, + const char *name, + const char *value); + CamelMimeMessage * (*get_message) (CamelFolder *folder, const gchar *uid, CamelException *ex); @@ -223,6 +231,14 @@ void camel_folder_set_message_user_flag (CamelFolder *folder, const char *uid, const char *name, gboolean value); +const char * camel_folder_get_message_user_tag (CamelFolder *folder, + const char *uid, + const char *name); + +void camel_folder_set_message_user_tag (CamelFolder *folder, + const char *uid, + const char *name, + const char *value); 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); +} |