diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | camel/camel-folder.c | 20 | ||||
-rw-r--r-- | camel/camel-folder.h | 8 | ||||
-rw-r--r-- | camel/camel-mime-message.c | 35 | ||||
-rw-r--r-- | camel/camel-mime-message.h | 3 |
5 files changed, 66 insertions, 9 deletions
@@ -1,5 +1,14 @@ 1999-08-13 bertrand <Bertrand.Guiheneuf@aful.org> + * camel/camel-folder.c (_get_parmanent_flag_list): + (camel_folder_get_parmanent_flag_list): + new method, returns the list of permanent + flags supported by the folder. + + * camel/camel-mime-message.c (_get_flag_list): + (camel_mime_message_get_flag_list): new method, + return the list of flag name used by this message. + * camel/hash-table-utils.c (g_strcase_equal): (g_strcase_hash): those two func go here now. diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 1ea2a7247b..271b5e1644 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -53,6 +53,8 @@ static GList *_expunge (CamelFolder *folder); static CamelMimeMessage *_get_message (CamelFolder *folder, gint number); static gint _get_message_count (CamelFolder *folder); static gint _append_message (CamelFolder *folder, CamelMimeMessage *message); +static const GList *_list_permanent_flags (CamelFolder *folder); + static void _finalize (GtkObject *object); @@ -85,6 +87,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->get_message = _get_message; camel_folder_class->get_message_count = _get_message_count; camel_folder_class->append_message = _append_message; + camel_folder_class->list_permanent_flags = _list_permanent_flags; /* virtual method overload */ gtk_object_class->finalize = _finalize; @@ -129,7 +132,8 @@ _finalize (GtkObject *object) if (camel_folder->name) g_free (camel_folder->name); if (camel_folder->full_name) g_free (camel_folder->full_name); - + if (camel_folder->permanent_flags) g_free (camel_folder->permanent_flags); + GTK_OBJECT_CLASS (parent_class)->finalize (object); CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n"); } @@ -817,3 +821,17 @@ gint camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message { return CF_CLASS (folder)->append_message (folder, message); } + + +static const GList * +_list_permanent_flags (CamelFolder *folder) +{ + return folder->permanent_flags; +} + + +const GList * +camel_folder_list_permanent_flags (CamelFolder *folder) +{ + return CF_CLASS (folder)->list_permanent_flags (folder); +} diff --git a/camel/camel-folder.h b/camel/camel-folder.h index e980e39e15..10ed7d1718 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -69,7 +69,8 @@ struct _CamelFolder gchar *full_name; CamelStore *parent_store; CamelFolder *parent_folder; - + GList *permanent_flags; + }; @@ -101,6 +102,9 @@ typedef struct { CamelMimeMessage * (*get_message) (CamelFolder *folder, gint number); gint (*get_message_count) (CamelFolder *folder); gint (*append_message) (CamelFolder *folder, CamelMimeMessage *message); + const GList * (*list_permanent_flags) (CamelFolder *folder); + + } CamelFolderClass; @@ -127,7 +131,7 @@ CamelMimeMessage *camel_folder_get_message (CamelFolder *folder, gint number); gboolean camel_folder_exists (CamelFolder *folder); gint camel_folder_get_message_count (CamelFolder *folder); gint camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message); - +const GList *camel_folder_list_permanent_flags (CamelFolder *folder); #ifdef __cplusplus diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index 019903d75a..417ccc9ff0 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -61,20 +61,16 @@ static void _set_subject (CamelMimeMessage *mime_message, gchar *subject); static const gchar *_get_subject (CamelMimeMessage *mime_message); static void _set_from (CamelMimeMessage *mime_message, gchar *from); static const gchar *_get_from (CamelMimeMessage *mime_message); - static void _add_recipient (CamelMimeMessage *mime_message, gchar *recipient_type, gchar *recipient); static void _remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient); static const GList *_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type); - static void _set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value); static gboolean _get_flag (CamelMimeMessage *mime_message, const gchar *flag); - +static GList *_get_flag_list (CamelMimeMessage *mime_message); static void _set_message_number (CamelMimeMessage *mime_message, guint number); static guint _get_message_number (CamelMimeMessage *mime_message); - static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); static gboolean _parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value); - static void _finalize (GtkObject *object); /* Returns the class for a CamelMimeMessage */ @@ -126,6 +122,7 @@ camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class) camel_mime_message_class->get_recipients = _get_recipients; camel_mime_message_class->set_flag = _set_flag; camel_mime_message_class->get_flag = _get_flag; + camel_mime_message_class->get_flag_list = _get_flag_list; camel_mime_message_class->set_message_number = _set_message_number; camel_mime_message_class->get_message_number = _get_message_number; @@ -503,6 +500,34 @@ camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag) +static void +_add_flag_to_list (gpointer key, gpointer value, gpointer user_data) +{ + GList **flag_list = (GList **)user_data; + gchar *flag_name = (gchar *)key; + + if ((flag_name) && (flag_name[0] != '\0')) + *flag_list = g_list_append (*flag_list, flag_name); +} + +static GList * +_get_flag_list (CamelMimeMessage *mime_message) +{ + GList *flag_list = NULL; + + if (mime_message->flags) + g_hash_table_foreach (mime_message->flags, _add_flag_to_list, &flag_list); + return flag_list; +} + + +GList * +camel_mime_message_get_flag_list (CamelMimeMessage *mime_message) +{ + return CMM_CLASS (mime_message)->get_flag_list (mime_message); +} + + static void _set_message_number (CamelMimeMessage *mime_message, guint number) diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h index f88c78ddbd..27fa862f5e 100644 --- a/camel/camel-mime-message.h +++ b/camel/camel-mime-message.h @@ -97,7 +97,7 @@ typedef struct { const GList * (*get_recipients) (CamelMimeMessage *mime_message, const gchar *recipient_type); void (*set_flag) (CamelMimeMessage *mime_message, const gchar *flag, gboolean value); gboolean (*get_flag) (CamelMimeMessage *mime_message, const gchar *flag); - + GList * (*get_flag_list) (CamelMimeMessage *mime_message); void (*set_message_number)(CamelMimeMessage *mime_message, guint number); guint (*get_message_number)(CamelMimeMessage *mime_message); } CamelMimeMessageClass; @@ -128,6 +128,7 @@ const GList *camel_mime_message_get_recipients (CamelMimeMessage *mime_message, void camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value); gboolean camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag); +GList *camel_mime_message_get_flag_list (CamelMimeMessage *mime_message); guint camel_mime_message_get_message_number (CamelMimeMessage *mime_message); |