[evolution-data-server/wip/camel-more-gobject: 40/62] Early work on porting CamelMessageInfo to GObject



commit d1c6c7e6041bcda5cb71779c0327cac69a7316d9
Author: Corentin Noël <corentin elementary io>
Date:   Mon Aug 29 19:38:19 2016 +0200

    Early work on porting CamelMessageInfo to GObject

 camel/Makefile.am            |    2 +
 camel/camel-folder-summary.c |  554 -------------------------
 camel/camel-folder-summary.h |  253 +------------
 camel/camel-message-info.c   |  925 ++++++++++++++++++++++++++++++++++++++++++
 camel/camel-message-info.h   |  211 ++++++++++
 5 files changed, 1139 insertions(+), 806 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index dc7bb1d..1bc66f4 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -92,6 +92,7 @@ libcamel_1_2_la_SOURCES = \
        camel-medium.c \
        camel-memchunk.c \
        camel-mempool.c \
+       camel-message-info.c \
        camel-mime-filter-basic.c \
        camel-mime-filter-bestenc.c \
        camel-mime-filter-canon.c \
@@ -210,6 +211,7 @@ libcamelinclude_HEADERS = \
        camel-medium.h \
        camel-memchunk.h \
        camel-mempool.h \
+       camel-message-info.h \
        camel-mime-filter-basic.h \
        camel-mime-filter-bestenc.h \
        camel-mime-filter-canon.h \
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index eb46cfe..39aa3e6 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -4594,26 +4594,6 @@ camel_message_info_new (CamelFolderSummary *summary)
 }
 
 /**
- * camel_message_info_ref:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Reference an info.
- * Returns: (transfer full) (type CamelMessageInfo):
- **/
-gpointer
-camel_message_info_ref (gpointer o)
-{
-       CamelMessageInfo *mi = o;
-
-       g_return_val_if_fail (mi != NULL, NULL);
-       g_return_val_if_fail (mi->refcount > 0, NULL);
-
-       g_atomic_int_inc (&mi->refcount);
-
-       return o;
-}
-
-/**
  * camel_message_info_new_from_header:
  * @summary: a #CamelFolderSummary object or %NULL
  * @header: raw header
@@ -4635,44 +4615,6 @@ camel_message_info_new_from_header (CamelFolderSummary *summary,
 }
 
 /**
- * camel_message_info_unref:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Unref's and potentially frees a #CamelMessageInfo and its contents.
- **/
-void
-camel_message_info_unref (gpointer o)
-{
-       CamelMessageInfo *mi = o;
-
-       g_return_if_fail (mi != NULL);
-       g_return_if_fail (mi->refcount > 0);
-
-       if (g_atomic_int_dec_and_test (&mi->refcount)) {
-               if (mi->summary != NULL) {
-                       CamelFolderSummaryClass *class;
-
-                       /* FIXME This is kinda busted, should really
-                        *       be handled by message_info_free(). */
-                       if (mi->summary->priv->build_content
-                           && ((CamelMessageInfoBase *) mi)->content) {
-                               camel_folder_summary_content_info_free (
-                                       mi->summary,
-                                       ((CamelMessageInfoBase *) mi)->content);
-                               ((CamelMessageInfoBase *) mi)->content = NULL;
-                       }
-
-                       class = CAMEL_FOLDER_SUMMARY_GET_CLASS (mi->summary);
-                       g_return_if_fail (class->message_info_free != NULL);
-
-                       class->message_info_free (mi->summary, mi);
-               } else {
-                       message_info_free (NULL, mi);
-               }
-       }
-}
-
-/**
  * camel_message_info_clone:
  * @info: (type CamelMessageInfo): a #CamelMessageInfo
  *
@@ -4691,502 +4633,6 @@ camel_message_info_clone (gconstpointer o)
                return message_info_clone (NULL, mi);
 }
 
-/**
- * camel_message_info_get_ptr:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- * @id: info to get
- *
- * Generic accessor method for getting pointer data.
- *
- * Returns: (transfer none): the pointer data
- *
- * Since: 3.22
- **/
-gconstpointer
-camel_message_info_get_ptr (gconstpointer info,
-                           gint id)
-{
-       const CamelMessageInfo *nfo = info;
-
-       g_return_val_if_fail (info != NULL, NULL);
-
-       if (nfo->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (nfo->summary)->info_ptr (nfo, id);
-       else
-               return info_ptr (nfo, id);
-}
-
-/**
- * camel_message_info_get_uint32:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- * @id: info to get
- *
- * Generic accessor method for getting 32bit unsigned integer data.
- *
- * Returns: the guint32 data
- *
- * Since: 3.22
- **/
-guint32
-camel_message_info_get_uint32 (gconstpointer info,
-                              gint id)
-{
-       const CamelMessageInfo *nfo = info;
-
-       g_return_val_if_fail (info != NULL, 0);
-
-       if (nfo->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (nfo->summary)->info_uint32 (nfo, id);
-       else
-               return info_uint32 (nfo, id);
-}
-
-/**
- * camel_message_info_get_time:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- * @id: info to get
- *
- * Generic accessor method for getting time_t data.
- *
- * Returns: the time_t data
- *
- * Since: 3.22
- **/
-time_t
-camel_message_info_get_time (gconstpointer info,
-                            gint id)
-{
-       const CamelMessageInfo *nfo = info;
-
-       g_return_val_if_fail (info != NULL, (time_t) 0);
-
-       if (nfo->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (nfo->summary)->info_time (nfo, id);
-       else
-               return info_time (nfo, id);
-}
-
-/**
- * camel_message_info_get_uid:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the uid of the #CamelMessageInfo
- *
- * Returns: the uid
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_uid (gconstpointer info)
-{
-       const CamelMessageInfo *nfo = info;
-
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return nfo->uid;
-}
-
-/**
- * camel_message_info_get_subject:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the subject of the #CamelMessageInfo
- *
- * Returns: the subject
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_subject (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_SUBJECT);
-}
-
-/**
- * camel_message_info_get_preview:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the preview of the #CamelMessageInfo
- *
- * Returns: the preview
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_preview (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_PREVIEW);
-}
-
-/**
- * camel_message_info_get_from:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the from field of the #CamelMessageInfo
- *
- * Returns: the from field
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_from (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_FROM);
-}
-
-/**
- * camel_message_info_get_to:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the to field of the #CamelMessageInfo
- *
- * Returns: the to field
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_to (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_TO);
-}
-
-/**
- * camel_message_info_get_cc:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the cc field of the #CamelMessageInfo
- *
- * Returns: the cc field
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_cc (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_CC);
-}
-
-/**
- * camel_message_info_get_mlist:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the mlist of the #CamelMessageInfo
- *
- * Returns: the mlist
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_mlist (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_MLIST);
-}
-
-/**
- * camel_message_info_get_flags:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the flags of the #CamelMessageInfo
- *
- * Returns: the flags
- *
- * Since: 3.22
- **/
-guint32
-camel_message_info_get_flags (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, 0);
-
-       return camel_message_info_get_uint32 (info, CAMEL_MESSAGE_INFO_FLAGS);
-}
-
-/**
- * camel_message_info_get_size:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the size of the #CamelMessageInfo
- *
- * Returns: the size
- *
- * Since: 3.22
- **/
-guint32
-camel_message_info_get_size (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, 0);
-
-       return camel_message_info_get_uint32 (info, CAMEL_MESSAGE_INFO_SIZE);
-}
-
-/**
- * camel_message_info_get_date_sent:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the sent date of the #CamelMessageInfo
- *
- * Returns: the sent date
- *
- * Since: 3.22
- **/
-time_t
-camel_message_info_get_date_sent (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, (time_t) 0);
-
-       return camel_message_info_get_time (info, CAMEL_MESSAGE_INFO_DATE_SENT);
-}
-
-/**
- * camel_message_info_get_date_received:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the received date of the #CamelMessageInfo
- *
- * Returns: the received date
- *
- * Since: 3.22
- **/
-time_t
-camel_message_info_get_date_received (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, (time_t) 0);
-
-       return camel_message_info_get_time (info, CAMEL_MESSAGE_INFO_DATE_RECEIVED);
-}
-
-/**
- * camel_message_info_get_user_flag:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- * @id: user flag to get
- *
- * Get the state of a user flag named @id.
- *
- * Returns: the state of the user flag
- *
- * Since: 3.22
- **/
-gboolean
-camel_message_info_get_user_flag (gconstpointer info,
-                                 const gchar *id)
-{
-       const CamelMessageInfo *nfo = info;
-
-       g_return_val_if_fail (info != NULL, FALSE);
-
-       if (nfo->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (nfo->summary)->info_user_flag (nfo, id);
-       else
-               return info_user_flag (nfo, id);
-}
-
-/**
- * camel_message_info_get_user_tag:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- * @id: user tag to get
- *
- * Get the value of a user tag named @id.
- *
- * Returns: the value of the user tag
- *
- * Since: 3.22
- **/
-const gchar *
-camel_message_info_get_user_tag (gconstpointer info,
-                                const gchar *id)
-{
-       const CamelMessageInfo *nfo = info;
-
-       g_return_val_if_fail (info != NULL, NULL);
-
-       if (nfo->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (nfo->summary)->info_user_tag (nfo, id);
-       else
-               return info_user_tag (nfo, id);
-}
-
-/**
- * camel_message_info_get_message_id:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the #CamelSummaryMessageID of the #CamelMessageInfo
- *
- * Returns: the id of the message
- *
- * Since: 3.22
- **/
-const CamelSummaryMessageID *
-camel_message_info_get_message_id (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_MESSAGE_ID);
-}
-
-/**
- * camel_message_info_get_references:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the #CamelSummaryReferences of the #CamelMessageInfo
- *
- * Returns: the references of the message
- *
- * Since: 3.22
- **/
-const CamelSummaryReferences *
-camel_message_info_get_references (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_REFERENCES);
-}
-
-/**
- * camel_message_info_get_user_flags:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the #CamelFlag of the #CamelMessageInfo
- *
- * Returns: the flags of the message
- *
- * Since: 3.22
- **/
-const CamelFlag *
-camel_message_info_get_user_flags (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_USER_FLAGS);
-}
-
-/**
- * camel_message_info_get_user_tags:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the #CamelTag of the #CamelMessageInfo
- *
- * Returns: the tags of the message
- *
- * Since: 3.22
- **/
-const CamelTag *
-camel_message_info_get_user_tags (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_USER_TAGS);
-}
-
-/**
- * camel_message_info_get_headers:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the #CamelHeaderParam of the #CamelMessageInfo
- *
- * Returns: the headers of the message
- *
- * Since: 3.22
- **/
-const CamelHeaderParam *
-camel_message_info_get_headers (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_HEADERS);
-}
-
-/**
- * camel_message_info_get_content:
- * @info: (type CamelMessageInfo): a #CamelMessageInfo
- *
- * Get the #CamelMessageContentInfo of the #CamelMessageInfo
- *
- * Returns: the content of the message
- *
- * Since: 3.22
- **/
-const CamelMessageContentInfo *
-camel_message_info_get_content (gconstpointer info)
-{
-       g_return_val_if_fail (info != NULL, NULL);
-
-       return camel_message_info_get_ptr (info, CAMEL_MESSAGE_INFO_CONTENT);
-}
-
-/**
- * camel_message_info_set_flags:
- * @info: a #CamelMessageInfo
- * @flags: mask of flags to change
- * @set: state the flags should be changed to
- *
- * Change the state of the system flags on the #CamelMessageInfo
- *
- * Returns: %TRUE if any of the flags changed or %FALSE otherwise
- **/
-gboolean
-camel_message_info_set_flags (CamelMessageInfo *info,
-                              CamelMessageFlags flags,
-                              guint32 set)
-{
-       if (info->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (info->summary)->info_set_flags (info, flags, set);
-       else
-               return info_set_flags (info, flags, set);
-}
-
-/**
- * camel_message_info_set_user_flag:
- * @info: a #CamelMessageInfo
- * @id: name of the user flag to set
- * @state: state to set the flag to
- *
- * Set the state of a user flag on a #CamelMessageInfo.
- *
- * Returns: %TRUE if the state changed or %FALSE otherwise
- **/
-gboolean
-camel_message_info_set_user_flag (CamelMessageInfo *info,
-                                  const gchar *id,
-                                  gboolean state)
-{
-       if (info->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (info->summary)->info_set_user_flag (info, id, state);
-       else
-               return info_set_user_flag (info, id, state);
-}
-
-/**
- * camel_message_info_set_user_tag:
- * @info: a #CamelMessageInfo
- * @id: name of the user tag to set
- * @val: value to set
- *
- * Set the value of a user tag on a #CamelMessageInfo.
- *
- * Returns: %TRUE if the value changed or %FALSE otherwise
- **/
-gboolean
-camel_message_info_set_user_tag (CamelMessageInfo *info,
-                                 const gchar *id,
-                                 const gchar *val)
-{
-       if (info->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (info->summary)->info_set_user_tag (info, id, val);
-       else
-               return info_set_user_tag (info, id, val);
-}
-
 void
 camel_content_info_dump (CamelMessageContentInfo *ci,
                          gint depth)
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index d6dfff0..b265639 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -29,6 +29,7 @@
 
 #include <camel/camel-index.h>
 #include <camel/camel-memchunk.h>
+#include <camel/camel-message-info.h>
 #include <camel/camel-mime-message.h>
 #include <camel/camel-mime-parser.h>
 
@@ -60,9 +61,6 @@ typedef struct _CamelFolderSummary CamelFolderSummary;
 typedef struct _CamelFolderSummaryClass CamelFolderSummaryClass;
 typedef struct _CamelFolderSummaryPrivate CamelFolderSummaryPrivate;
 
-typedef struct _CamelMessageInfo CamelMessageInfo;
-typedef struct _CamelMessageInfoBase CamelMessageInfoBase;
-
 typedef struct _CamelMessageContentInfo CamelMessageContentInfo;
 
 /* A tree of message content info structures
@@ -80,136 +78,6 @@ struct _CamelMessageContentInfo {
        guint32 size;
 };
 
-/* system flag bits */
-typedef enum _CamelMessageFlags {
-       CAMEL_MESSAGE_ANSWERED = 1 << 0,
-       CAMEL_MESSAGE_DELETED = 1 << 1,
-       CAMEL_MESSAGE_DRAFT = 1 << 2,
-       CAMEL_MESSAGE_FLAGGED = 1 << 3,
-       CAMEL_MESSAGE_SEEN = 1 << 4,
-
-       /* these aren't really system flag bits, but are convenience flags */
-       CAMEL_MESSAGE_ATTACHMENTS = 1 << 5,
-       CAMEL_MESSAGE_ANSWERED_ALL = 1 << 6,
-       CAMEL_MESSAGE_JUNK = 1 << 7,
-       CAMEL_MESSAGE_SECURE = 1 << 8,
-       CAMEL_MESSAGE_NOTJUNK = 1 << 9,
-       CAMEL_MESSAGE_FORWARDED = 1 << 10,
-
-       /* following flags are for the folder, and are not really permanent flags */
-       CAMEL_MESSAGE_FOLDER_FLAGGED = 1 << 16, /* for use by the folder implementation */
-       /* flags after 1 << 16 are used by camel providers,
- *         if adding non permanent flags, add them to the end  */
-
-       CAMEL_MESSAGE_JUNK_LEARN = 1 << 30, /* used when setting CAMEL_MESSAGE_JUNK flag
-                                            * to say that we request junk plugin
-                                            * to learn that message as junk/non junk */
-       CAMEL_MESSAGE_USER = 1 << 31 /* supports user flags */
-} CamelMessageFlags;
-
-/* Changes to system flags will NOT trigger a folder changed event */
-#define CAMEL_MESSAGE_SYSTEM_MASK (0xffff << 16)
-
-typedef struct _CamelFlag {
-       struct _CamelFlag *next;
-       gchar name[1];          /* name allocated as part of the structure */
-} CamelFlag;
-
-typedef struct _CamelTag {
-       struct _CamelTag *next;
-       gchar *value;
-       gchar name[1];          /* name allocated as part of the structure */
-} CamelTag;
-
-/* a summary messageid is a 64 bit identifier (partial md5 hash) */
-typedef struct _CamelSummaryMessageID {
-       union {
-               guint64 id;
-               guchar hash[8];
-               struct {
-                       guint32 hi;
-                       guint32 lo;
-               } part;
-       } id;
-} CamelSummaryMessageID;
-
-/* summary references is a fixed size array of references */
-typedef struct _CamelSummaryReferences {
-       gint size;
-       CamelSummaryMessageID references[1];
-} CamelSummaryReferences;
-
-/* accessor id's */
-enum {
-       CAMEL_MESSAGE_INFO_SUBJECT,
-       CAMEL_MESSAGE_INFO_FROM,
-       CAMEL_MESSAGE_INFO_TO,
-       CAMEL_MESSAGE_INFO_CC,
-       CAMEL_MESSAGE_INFO_MLIST,
-
-       CAMEL_MESSAGE_INFO_FLAGS,
-       CAMEL_MESSAGE_INFO_SIZE,
-
-       CAMEL_MESSAGE_INFO_DATE_SENT,
-       CAMEL_MESSAGE_INFO_DATE_RECEIVED,
-
-       CAMEL_MESSAGE_INFO_MESSAGE_ID,
-       CAMEL_MESSAGE_INFO_REFERENCES,
-       CAMEL_MESSAGE_INFO_USER_FLAGS,
-       CAMEL_MESSAGE_INFO_USER_TAGS,
-
-       CAMEL_MESSAGE_INFO_HEADERS,
-       CAMEL_MESSAGE_INFO_PREVIEW,
-       CAMEL_MESSAGE_INFO_CONTENT,
-       CAMEL_MESSAGE_INFO_LAST
-};
-
-/* information about a given message, use accessors */
-struct _CamelMessageInfo {
-       CamelFolderSummary *summary;
-
-       volatile gint refcount;
-       const gchar *uid;
-       /*FIXME: Make it work with the CAMEL_MESSADE_DB_DIRTY flag instead of another 4 bytes*/
-       guint dirty : 1;
-};
-
-/* For classes wishing to do the provided i/o, or for anonymous users,
- * they must subclass or use this messageinfo structure */
-/* Otherwise they can do their own thing entirely */
-struct _CamelMessageInfoBase {
-       CamelFolderSummary *summary;
-
-       volatile gint refcount;
-       const gchar *uid;
-       /*FIXME: Make it work with the CAMEL_MESSADE_DB_DIRTY flag instead of another 4 bytes*/
-       guint dirty : 1;
-
-       const gchar *subject;
-       const gchar *from;
-       const gchar *to;
-       const gchar *cc;
-       const gchar *mlist;
-
-       CamelMessageFlags flags;
-       guint32 size;
-
-       time_t date_sent;
-       time_t date_received;
-
-       CamelSummaryMessageID message_id;
-       CamelSummaryReferences *references;/* from parent to root */
-
-       struct _CamelFlag *user_flags;
-       struct _CamelTag *user_tags;
-
-       /* tree of content description - NULL if it is not available */
-       CamelMessageContentInfo *content;
-       struct _camel_header_param *headers;
-       gchar *preview;
-       gchar *bodystructure;
-};
-
 /**
  * CamelFolderSummaryFlags:
  * @CAMEL_FOLDER_SUMMARY_DIRTY:
@@ -499,125 +367,6 @@ void              camel_folder_summary_prepare_fetch_all
 void           camel_folder_summary_lock       (CamelFolderSummary *summary);
 void           camel_folder_summary_unlock     (CamelFolderSummary *summary);
 
-/* message flag operations */
-gboolean       camel_flag_get                  (CamelFlag **list,
-                                                const gchar *name);
-gboolean       camel_flag_set                  (CamelFlag **list,
-                                                const gchar *name,
-                                                gboolean value);
-gboolean       camel_flag_list_copy            (CamelFlag **to,
-                                                CamelFlag **from);
-gint           camel_flag_list_size            (CamelFlag **list);
-void           camel_flag_list_free            (CamelFlag **list);
-
-CamelMessageFlags
-               camel_system_flag               (const gchar *name);
-gboolean       camel_system_flag_get           (CamelMessageFlags flags,
-                                                const gchar *name);
-
-/* message tag operations */
-const gchar *  camel_tag_get                   (CamelTag **list,
-                                                const gchar *name);
-gboolean       camel_tag_set                   (CamelTag **list,
-                                                const gchar *name,
-                                                const gchar *value);
-gboolean       camel_tag_list_copy             (CamelTag **to,
-                                                CamelTag **from);
-gint           camel_tag_list_size             (CamelTag **list);
-void           camel_tag_list_free             (CamelTag **list);
-
-/* Summary may be null */
-/* Use anonymous pointers to avoid tons of cast crap */
-GType          camel_message_info_get_type     (void) G_GNUC_CONST;
-gpointer       camel_message_info_new          (CamelFolderSummary *summary);
-gpointer       camel_message_info_ref          (gpointer info);
-CamelMessageInfo *
-               camel_message_info_new_from_header
-                                               (CamelFolderSummary *summary,
-                                                struct _camel_header_raw *header);
-void           camel_message_info_unref        (gpointer info);
-gpointer       camel_message_info_clone        (gconstpointer info);
-
-/* These will be fully removed soon, left only for a backward compatibility */
-#define camel_message_info_ptr                 camel_message_info_get_ptr
-#define camel_message_info_uint32              camel_message_info_get_uint32
-#define camel_message_info_time                        camel_message_info_get_time
-#define camel_message_info_uid                 camel_message_info_get_uid
-#define camel_message_info_subject             camel_message_info_get_subject
-#define camel_message_info_preview             camel_message_info_get_preview
-#define camel_message_info_from                        camel_message_info_get_from
-#define camel_message_info_to                  camel_message_info_get_to
-#define camel_message_info_cc                  camel_message_info_get_cc
-#define camel_message_info_mlist               camel_message_info_get_mlist
-#define camel_message_info_flags               camel_message_info_get_flags
-#define camel_message_info_size                        camel_message_info_get_size
-#define camel_message_info_date_sent           camel_message_info_get_date_sent
-#define camel_message_info_date_received       camel_message_info_get_date_received
-#define camel_message_info_message_id          camel_message_info_get_message_id
-#define camel_message_info_references          camel_message_info_get_references
-#define camel_message_info_user_flags          camel_message_info_get_user_flags
-#define camel_message_info_user_tags           camel_message_info_get_user_tags
-#define camel_message_info_headers             camel_message_info_get_headers
-#define camel_message_info_content             camel_message_info_get_content
-#define camel_message_info_user_flag           camel_message_info_get_user_flag
-#define camel_message_info_user_tag            camel_message_info_get_user_tag
-
-/* accessors */
-gconstpointer  camel_message_info_get_ptr      (gconstpointer info,
-                                                gint id);
-guint32                camel_message_info_get_uint32   (gconstpointer info,
-                                                gint id);
-time_t         camel_message_info_get_time     (gconstpointer info,
-                                                gint id);
-
-const gchar *  camel_message_info_get_uid      (gconstpointer info);
-const gchar *  camel_message_info_get_subject  (gconstpointer info);
-const gchar *  camel_message_info_get_preview  (gconstpointer info);
-const gchar *  camel_message_info_get_from     (gconstpointer info);
-const gchar *  camel_message_info_get_to       (gconstpointer info);
-
-const gchar *  camel_message_info_get_cc       (gconstpointer info);
-const gchar *  camel_message_info_get_mlist    (gconstpointer info);
-guint32                camel_message_info_get_flags    (gconstpointer info);
-guint32                camel_message_info_get_size     (gconstpointer info);
-
-time_t         camel_message_info_get_date_sent
-                                               (gconstpointer info);
-time_t         camel_message_info_get_date_received
-                                               (gconstpointer info);
-
-const CamelSummaryMessageID *
-               camel_message_info_get_message_id
-                                               (gconstpointer info);
-const CamelSummaryReferences *
-               camel_message_info_get_references
-                                               (gconstpointer info);
-const CamelFlag *
-               camel_message_info_get_user_flags
-                                               (gconstpointer info);
-const CamelTag *
-               camel_message_info_get_user_tags
-                                               (gconstpointer info);
-const CamelHeaderParam *
-               camel_message_info_get_headers  (gconstpointer info);
-const CamelMessageContentInfo *
-               camel_message_info_get_content  (gconstpointer info);
-gboolean       camel_message_info_get_user_flag(gconstpointer info,
-                                                const gchar *id);
-const gchar *  camel_message_info_get_user_tag (gconstpointer info,
-                                                const gchar *id);
-
-gboolean       camel_message_info_set_flags    (CamelMessageInfo *info,
-                                                CamelMessageFlags flags,
-                                                guint32 set);
-gboolean       camel_message_info_set_user_flag
-                                               (CamelMessageInfo *info,
-                                                const gchar *id,
-                                                gboolean state);
-gboolean       camel_message_info_set_user_tag (CamelMessageInfo *info,
-                                                const gchar *id,
-                                                const gchar *val);
-
 /* debugging functions */
 void           camel_content_info_dump         (CamelMessageContentInfo *ci,
                                                 gint depth);
diff --git a/camel/camel-message-info.c b/camel/camel-message-info.c
new file mode 100644
index 0000000..b0458d7
--- /dev/null
+++ b/camel/camel-message-info.c
@@ -0,0 +1,925 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Michael Zucchi <notzed ximian com>
+ */
+
+#define CAMEL_MESSAGE_INFO_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfoPrivate))
+
+enum {
+       PROP_0,
+       PROP_UID,
+       PROP_SUBJECT,
+       PROP_FROM,
+       PROP_TO,
+       PROP_CC,
+       PROP_MLIST,
+       PROP_FLAGS,
+       PROP_SIZE,
+       PROP_DATE_SENT,
+       PROP_DATE_RECEIVED,
+       PROP_MESSAGE_ID,
+       PROP_REFERENCES,
+       PROP_USER_FLAGS,
+       PROP_USER_TAGS,
+       PROP_CONTENT,
+       PROP_HEADERS,
+       PROP_PREVIEW,
+       PROP_BODY_STRUCTURE,
+       PROP_DIRTY
+}
+
+struct _CamelMessageInfoPrivate {
+       const gchar *uid;
+       /*FIXME: Make it work with the CAMEL_MESSADE_DB_DIRTY flag instead of another 4 bytes*/
+       gboolean dirty : 1;
+
+       const gchar *subject;
+       const gchar *from;
+       const gchar *to;
+       const gchar *cc;
+       const gchar *mlist;
+
+       CamelMessageFlags flags;
+       guint32 size;
+
+       time_t date_sent;
+       time_t date_received;
+
+       CamelSummaryMessageID message_id;
+       CamelSummaryReferences *references;/* from parent to root */
+
+       struct _CamelFlag *user_flags;
+       struct _CamelTag *user_tags;
+
+       /* tree of content description - NULL if it is not available */
+       CamelMessageContentInfo *content;
+       struct _camel_header_param *headers;
+       gchar *preview;
+       gchar *body_structure;
+};
+
+static void
+message_info_set_property (GObject *object,
+                             guint property_id,
+                             const GValue *value,
+                             GParamSpec *pspec)
+{
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+message_info_get_property (GObject *object,
+                             guint property_id,
+                             GValue *value,
+                             GParamSpec *pspec)
+{
+       switch (property_id) {
+               case PROP_UID:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_uid (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_SUBJECT:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_subject (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_FROM:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_from (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_TO:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_to (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_CC:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_cc (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_MLIST:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_mlist (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_FLAGS:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_flags (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_SIZE:
+                       g_value_set_uint (
+                               value,
+                               camel_message_info_get_size (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_DATE_SENT:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_date_sent (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_DATE_RECEIVED:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_date_received (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_MESSAGE_ID:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_message_id (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_REFERENCES:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_references (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_USER_FLAGS:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_user_flags (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_USER_TAGS:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_user_tags (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_CONTENT:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_content (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_HEADERS:
+                       g_value_set_pointer (
+                               value,
+                               camel_message_info_get_headers (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_PREVIEW:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_preview (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_BODY_STRUCTURE:
+                       g_value_set_string (
+                               value,
+                               camel_message_info_get_body_structure (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+
+               case PROP_DIRTY:
+                       g_value_set_boolean (
+                               value,
+                               camel_message_info_get_dirty (
+                               CAMEL_MESSAGE_INFO (object)));
+                       return;
+       }
+
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+camel_message_info_class_init (CamelMessageInfoClass *class)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (CamelMessageInfoClassPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->set_property = message_info_set_property;
+       object_class->get_property = message_info_get_property;
+
+       /**
+        * CamelMessageInfo:uid
+        *
+        * The unique identifier of this #CamelMessageInfo.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_UID,
+               g_param_spec_string (
+                       "uid",
+                       "UID",
+                       "The unique identifier of this message info",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:subject
+        *
+        * The subject of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_SUBJECT,
+               g_param_spec_string (
+                       "subject",
+                       "Subject",
+                       "The subject of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:from
+        *
+        * The from field of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_FROM,
+               g_param_spec_string (
+                       "from",
+                       "From",
+                       "The from field of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:to
+        *
+        * The to field of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_TO,
+               g_param_spec_string (
+                       "to",
+                       "To",
+                       "The to field of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:cc
+        *
+        * The cc field of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_CC,
+               g_param_spec_string (
+                       "cc",
+                       "Cc",
+                       "The cc field of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:mlist
+        *
+        * The mlist field of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_MLIST,
+               g_param_spec_string (
+                       "mlist",
+                       "MList",
+                       "The mlist field of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:size
+        *
+        * The size of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_SIZE,
+               g_param_spec_uint (
+                       "size",
+                       "Size",
+                       "The size of the message",
+                       0, G_MAXUINT32, 0,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:flags
+        *
+        * The flags of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_FLAGS,
+               g_param_spec_pointer (
+                       "flags",
+                       "Flags",
+                       "The flags of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:date_sent
+        *
+        * The sent date of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_DATE_SENT,
+               g_param_spec_pointer (
+                       "date-sent",
+                       "Date sent",
+                       "The sent date of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:date-received
+        *
+        * The reception date of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_DATE_RECEIVED,
+               g_param_spec_pointer (
+                       "date-received",
+                       "Date received",
+                       "The reception date of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:message-id
+        *
+        * The ID of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_MESSAGE_ID,
+               g_param_spec_pointer (
+                       "message-id",
+                       "Message ID",
+                       "The ID of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:references
+        *
+        * The references of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_REFERENCES,
+               g_param_spec_pointer (
+                       "references",
+                       "References",
+                       "The references of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:user-flags
+        *
+        * The user flags of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_USER_FLAGS,
+               g_param_spec_pointer (
+                       "user-flags",
+                       "User Flags",
+                       "The user flags of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:user-tags
+        *
+        * The user tags of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_USER_TAGS,
+               g_param_spec_pointer (
+                       "user-tags",
+                       "User Tags",
+                       "The user tags of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:content
+        *
+        * The content of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_CONTENT,
+               g_param_spec_pointer (
+                       "content",
+                       "Content",
+                       "The content of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:user-tags
+        *
+        * The user tags of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_HEADERS,
+               g_param_spec_pointer (
+                       "user-tags",
+                       "User Tags",
+                       "The user tags of the message",
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:preview
+        *
+        * The preview of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_PREVIEW,
+               g_param_spec_string (
+                       "preview",
+                       "Preview",
+                       "The preview of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:body-structure
+        *
+        * The body of the message.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_BODY_STRUCTURE,
+               g_param_spec_string (
+                       "body-structure",
+                       "Body Structure",
+                       "The body of the message",
+                       NULL,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+
+       /**
+        * CamelMessageInfo:dirty
+        *
+        * Whether the message is in dirty state.
+        **/
+       g_object_class_install_property (
+               object_class,
+               PROP_DIRTY,
+               g_param_spec_boolean (
+                       "dirty",
+                       "Dirty",
+                       "Whether the message is in dirty state",
+                       TRUE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+camel_message_info_init (CamelMessageInfo *self)
+{
+  /* initialize the object */
+}
+
+/**
+ * camel_message_info_new:
+ *
+ * Create a new #CamelMessageInfo object.
+ *
+ * Returns: a new #CamelMessageInfo object
+ **/
+CamelMessageInfo *
+camel_message_info_new ()
+{
+       return g_object_new (CAMEL_TYPE_MESSAGE_INFO, NULL);
+}
+
+/**
+ * camel_message_info_get_uid:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the uid of the #CamelMessageInfo
+ *
+ * Returns: the uid
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_uid     (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->uid;
+}
+
+/**
+ * camel_message_info_get_subject:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the subject of the #CamelMessageInfo
+ *
+ * Returns: the subject
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_subject (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->subject;
+}
+
+/**
+ * camel_message_info_get_preview:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the preview of the #CamelMessageInfo
+ *
+ * Returns: the preview
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_preview (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->preview;
+}
+
+/**
+ * camel_message_info_get_from:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the from field of the #CamelMessageInfo
+ *
+ * Returns: the from field
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_from    (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->from;
+}
+
+/**
+ * camel_message_info_get_to:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the to field of the #CamelMessageInfo
+ *
+ * Returns: the to field
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_to      (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->to;
+}
+
+/**
+ * camel_message_info_get_cc:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the cc field of the #CamelMessageInfo
+ *
+ * Returns: the cc field
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_cc      (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->cc;
+}
+
+/**
+ * camel_message_info_get_mlist:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the mlist of the #CamelMessageInfo
+ *
+ * Returns: the mlist
+ *
+ * Since: 3.22
+ **/
+const gchar *
+camel_message_info_get_mlist   (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->mlist;
+}
+
+/**
+ * camel_message_info_get_flags:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the flags of the #CamelMessageInfo
+ *
+ * Returns: the flags
+ *
+ * Since: 3.22
+ **/
+CamelMessageFlags
+camel_message_info_get_flags   (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->flags;
+}
+
+/**
+ * camel_message_info_get_size:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the size of the #CamelMessageInfo
+ *
+ * Returns: the size
+ *
+ * Since: 3.22
+ **/
+guint32
+camel_message_info_get_size    (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->size;
+}
+
+/**
+ * camel_message_info_get_date_sent:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the sent date of the #CamelMessageInfo
+ *
+ * Returns: the sent date
+ *
+ * Since: 3.22
+ **/
+time_t
+camel_message_info_get_date_sent       (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->date_sent;
+}
+
+/**
+ * camel_message_info_get_date_received:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the received date of the #CamelMessageInfo
+ *
+ * Returns: the received date
+ *
+ * Since: 3.22
+ **/
+time_t
+camel_message_info_get_date_received   (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->date_received;
+}
+
+/**
+ * camel_message_info_get_message_id:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the #CamelSummaryMessageID of the #CamelMessageInfo
+ *
+ * Returns: the id of the message
+ *
+ * Since: 3.22
+ **/
+const CamelSummaryMessageID *
+camel_message_info_get_message_id      (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->id;
+}
+
+/**
+ * camel_message_info_get_references:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the #CamelSummaryReferences of the #CamelMessageInfo
+ *
+ * Returns: the references of the message
+ *
+ * Since: 3.22
+ **/
+const CamelSummaryReferences *
+camel_message_info_get_references      (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->references;
+}
+
+/**
+ * camel_message_info_get_user_flags:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the #CamelFlag of the #CamelMessageInfo
+ *
+ * Returns: the flags of the message
+ *
+ * Since: 3.22
+ **/
+const CamelFlag *
+camel_message_info_get_user_flags      (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->user_flags;
+}
+
+/**
+ * camel_message_info_get_user_tags:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the #CamelTag of the #CamelMessageInfo
+ *
+ * Returns: the tags of the message
+ *
+ * Since: 3.22
+ **/
+const CamelTag *
+camel_message_info_get_user_tags       (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->user_flags;
+}
+
+/**
+ * camel_message_info_get_headers:
+ * @info: a #CamelMessageInfo
+ *
+ * Get the #CamelHeaderParam of the #CamelMessageInfo
+ *
+ * Returns: the headers of the message
+ *
+ * Since: 3.22
+ **/
+const CamelHeaderParam *
+camel_message_info_get_headers (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->headers;
+}
+
+/**
+ * camel_message_info_get_content:
+ * @info: a #CamelMessageInfo object
+ *
+ * Returns: the content
+ **/
+const CamelMessageContentInfo *
+camel_message_info_get_content (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->content;
+}
+
+/**
+ * camel_message_info_get_dirty:
+ * @info: a #CamelMessageInfo object
+ *
+ * Returns: whether the #CamelMessageInfo is in a dirty state
+ **/
+gboolean
+camel_message_info_get_dirty   (CamelMessageInfo *info)
+{
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (info), NULL);
+
+       return info->priv->dirty;
+}
+
+
+/**
+ * camel_message_info_set_flags:
+ * @info: a #CamelMessageInfo
+ * @flags: mask of flags to change
+ * @set: state the flags should be changed to
+ *
+ * Change the state of the system flags on the #CamelMessageInfo
+ *
+ * Returns: %TRUE if any of the flags changed or %FALSE otherwise
+ **/
+gboolean
+camel_message_info_set_flags (CamelMessageInfo *info,
+                              CamelMessageFlags flags,
+                              guint32 set)
+{
+       return FALSE;
+}
+
+/**
+ * camel_message_info_set_user_flag:
+ * @info: a #CamelMessageInfo
+ * @id: name of the user flag to set
+ * @state: state to set the flag to
+ *
+ * Set the state of a user flag on a #CamelMessageInfo.
+ *
+ * Returns: %TRUE if the state changed or %FALSE otherwise
+ **/
+gboolean
+camel_message_info_set_user_flag (CamelMessageInfo *info,
+                                  const gchar *id,
+                                  gboolean state)
+{
+       return FALSE;
+}
+
+/**
+ * camel_message_info_set_user_tag:
+ * @info: a #CamelMessageInfo
+ * @id: name of the user tag to set
+ * @val: value to set
+ *
+ * Set the value of a user tag on a #CamelMessageInfo.
+ *
+ * Returns: %TRUE if the value changed or %FALSE otherwise
+ **/
+gboolean
+camel_message_info_set_user_tag (CamelMessageInfo *info,
+                                 const gchar *id,
+                                 const gchar *val)
+{
+       return FALSE;
+}
diff --git a/camel/camel-message-info.h b/camel/camel-message-info.h
new file mode 100644
index 0000000..eca410b
--- /dev/null
+++ b/camel/camel-message-info.h
@@ -0,0 +1,211 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This library is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Michael Zucchi <notzed ximian com>
+ */
+
+#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
+#error "Only <camel/camel.h> can be included directly."
+#endif
+
+#ifndef CAMEL_MESSAGE_INFO_H
+#define CAMEL_MESSAGE_INFO_H
+
+#include <stdio.h>
+#include <time.h>
+
+#include <camel/camel-index.h>
+#include <camel/camel-memchunk.h>
+#include <camel/camel-mime-message.h>
+#include <camel/camel-mime-parser.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_MESSAGE_INFO \
+       (camel_message_info_get_type ())
+#define CAMEL_MESSAGE_INFO(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfo))
+#define CAMEL_MESSAGE_INFO_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfoClass))
+#define CAMEL_IS_MESSAGE_INFO(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO))
+#define CAMEL_IS_MESSAGE_INFO_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), CAMEL_TYPE_MESSAGE_INFO))
+#define CAMEL_MESSAGE_INFO_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfoClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelMessageInfo CamelMessageInfo;
+typedef struct _CamelMessageInfoClass CamelMessageInfoClass;
+typedef struct _CamelMessageInfoPrivate CamelMessageInfoPrivate;
+
+/* system flag bits */
+typedef enum _CamelMessageFlags {
+       CAMEL_MESSAGE_ANSWERED = 1 << 0,
+       CAMEL_MESSAGE_DELETED = 1 << 1,
+       CAMEL_MESSAGE_DRAFT = 1 << 2,
+       CAMEL_MESSAGE_FLAGGED = 1 << 3,
+       CAMEL_MESSAGE_SEEN = 1 << 4,
+
+       /* these aren't really system flag bits, but are convenience flags */
+       CAMEL_MESSAGE_ATTACHMENTS = 1 << 5,
+       CAMEL_MESSAGE_ANSWERED_ALL = 1 << 6,
+       CAMEL_MESSAGE_JUNK = 1 << 7,
+       CAMEL_MESSAGE_SECURE = 1 << 8,
+       CAMEL_MESSAGE_NOTJUNK = 1 << 9,
+       CAMEL_MESSAGE_FORWARDED = 1 << 10,
+
+       /* following flags are for the folder, and are not really permanent flags */
+       CAMEL_MESSAGE_FOLDER_FLAGGED = 1 << 16, /* for use by the folder implementation */
+       /* flags after 1 << 16 are used by camel providers,
+ *         if adding non permanent flags, add them to the end  */
+
+       CAMEL_MESSAGE_JUNK_LEARN = 1 << 30, /* used when setting CAMEL_MESSAGE_JUNK flag
+                                            * to say that we request junk plugin
+                                            * to learn that message as junk/non junk */
+       CAMEL_MESSAGE_USER = 1 << 31 /* supports user flags */
+} CamelMessageFlags;
+
+/* Changes to system flags will NOT trigger a folder changed event */
+#define CAMEL_MESSAGE_SYSTEM_MASK (0xffff << 16)
+
+typedef struct _CamelFlag {
+       struct _CamelFlag *next;
+       gchar name[1];          /* name allocated as part of the structure */
+} CamelFlag;
+
+typedef struct _CamelTag {
+       struct _CamelTag *next;
+       gchar *value;
+       gchar name[1];          /* name allocated as part of the structure */
+} CamelTag;
+
+/* a summary messageid is a 64 bit identifier (partial md5 hash) */
+typedef struct _CamelSummaryMessageID {
+       union {
+               guint64 id;
+               guchar hash[8];
+               struct {
+                       guint32 hi;
+                       guint32 lo;
+               } part;
+       } id;
+} CamelSummaryMessageID;
+
+/* summary references is a fixed size array of references */
+typedef struct _CamelSummaryReferences {
+       gint size;
+       CamelSummaryMessageID references[1];
+} CamelSummaryReferences;
+
+struct _CamelMessageInfo {
+       GObject parent;
+       CamelMessageInfoPrivate *priv;
+};
+
+struct _CamelMessageInfoClass {
+       GObjectClass parent_class;
+};
+
+/* Summary may be null */
+/* Use anonymous pointers to avoid tons of cast crap */
+GType          camel_message_info_get_type     (void) G_GNUC_CONST;
+CamelMessageInfo *     camel_message_info_new          ();
+CamelMessageInfo *     camel_message_info_clone        (CamelMessageInfo *info);
+
+const gchar *  camel_message_info_get_uid      (CamelMessageInfo *info);
+const gchar *  camel_message_info_get_subject  (CamelMessageInfo *info);
+const gchar *  camel_message_info_get_preview  (CamelMessageInfo *info);
+const gchar *  camel_message_info_get_from     (CamelMessageInfo *info);
+const gchar *  camel_message_info_get_to       (CamelMessageInfo *info);
+
+const gchar *  camel_message_info_get_cc       (CamelMessageInfo *info);
+const gchar *  camel_message_info_get_mlist    (CamelMessageInfo *info);
+guint32                camel_message_info_get_flags    (CamelMessageInfo *info);
+guint32                camel_message_info_get_size     (CamelMessageInfo *info);
+
+time_t         camel_message_info_get_date_sent
+                                               (CamelMessageInfo *info);
+time_t         camel_message_info_get_date_received
+                                               (CamelMessageInfo *info);
+
+const CamelSummaryMessageID *
+               camel_message_info_get_message_id
+                                               (CamelMessageInfo *info);
+const CamelSummaryReferences *
+               camel_message_info_get_references
+                                               (CamelMessageInfo *info);
+const CamelFlag *
+               camel_message_info_get_user_flags
+                                               (CamelMessageInfo *info);
+const CamelTag *
+               camel_message_info_get_user_tags
+                                               (CamelMessageInfo *info);
+const CamelHeaderParam *
+               camel_message_info_get_headers  (CamelMessageInfo *info);
+const CamelMessageContentInfo *
+               camel_message_info_get_content  (CamelMessageInfo *info);
+gboolean       camel_message_info_get_user_flag(CamelMessageInfo *info,
+                                                const gchar *id);
+const gchar *  camel_message_info_get_user_tag (CamelMessageInfo *info,
+                                                const gchar *id);
+
+gboolean       camel_message_info_set_flags    (CamelMessageInfo *info,
+                                                CamelMessageFlags flags,
+                                                guint32 set);
+gboolean       camel_message_info_set_user_flag
+                                               (CamelMessageInfo *info,
+                                                const gchar *id,
+                                                gboolean state);
+gboolean       camel_message_info_set_user_tag (CamelMessageInfo *info,
+                                                const gchar *id,
+                                                const gchar *val);
+
+/* message flag operations */
+gboolean       camel_flag_get                  (CamelFlag **list,
+                                                const gchar *name);
+gboolean       camel_flag_set                  (CamelFlag **list,
+                                                const gchar *name,
+                                                gboolean value);
+gboolean       camel_flag_list_copy            (CamelFlag **to,
+                                                CamelFlag **from);
+gint           camel_flag_list_size            (CamelFlag **list);
+void           camel_flag_list_free            (CamelFlag **list);
+
+CamelMessageFlags
+               camel_system_flag               (const gchar *name);
+gboolean       camel_system_flag_get           (CamelMessageFlags flags,
+                                                const gchar *name);
+
+/* message tag operations */
+const gchar *  camel_tag_get                   (CamelTag **list,
+                                                const gchar *name);
+gboolean       camel_tag_set                   (CamelTag **list,
+                                                const gchar *name,
+                                                const gchar *value);
+gboolean       camel_tag_list_copy             (CamelTag **to,
+                                                CamelTag **from);
+gint           camel_tag_list_size             (CamelTag **list);
+void           camel_tag_list_free             (CamelTag **list);
+
+G_END_DECLS
+
+#endif /* CAMEL_MESSAGE_INFO_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]