[evolution-data-server/wip/camel-more-gobject: 53/62] Use GObject-based CamelMessageInfo



commit 1c5fdcc040e7a1a9351dce335f01d14741d58920
Author: Milan Crha <mcrha redhat com>
Date:   Fri Sep 9 13:54:30 2016 +0200

    Use GObject-based CamelMessageInfo
    
    The code builds. It doesn't mean it does what it should do.
    
    There are also compiler warnings shown during the build, which will
    be addressed later.

 camel/camel-db.c                                   |   20 +-
 camel/camel-db.h                                   |    4 +-
 camel/camel-filter-driver.c                        |   19 +-
 camel/camel-filter-search.c                        |   93 +-
 camel/camel-folder-search.c                        |    5 +-
 camel/camel-folder-summary.c                       | 1747 ++------------------
 camel/camel-folder-summary.h                       |  259 +---
 camel/camel-folder-thread.c                        |   62 +-
 camel/camel-folder.c                               |   71 +-
 camel/camel-folder.h                               |   22 +-
 camel/camel-message-info-base.c                    |  454 +++---
 camel/camel-message-info-base.h                    |   48 +-
 camel/camel-message-info.c                         | 1724 ++++++++++----------
 camel/camel-message-info.h                         |  318 ++--
 camel/camel-mime-part-utils.c                      |    8 +-
 camel/camel-mime-utils.c                           |  164 ++-
 camel/camel-mime-utils.h                           |   10 +
 camel/camel-vee-folder.c                           |   22 +-
 camel/camel-vee-message-info.c                     |  328 +++--
 camel/camel-vee-message-info.h                     |   62 +-
 camel/camel-vee-summary.c                          |  280 +---
 camel/camel-vee-summary.h                          |    8 +-
 camel/camel-vtrash-folder.c                        |   12 +-
 camel/providers/imapx/camel-imapx-command.c        |    4 +-
 camel/providers/imapx/camel-imapx-folder.c         |    4 +-
 camel/providers/imapx/camel-imapx-message-info.c   |  198 ++--
 camel/providers/imapx/camel-imapx-message-info.h   |   80 +-
 camel/providers/imapx/camel-imapx-search.c         |    3 +-
 camel/providers/imapx/camel-imapx-server.c         |  404 +++---
 camel/providers/imapx/camel-imapx-summary.c        |  240 +---
 camel/providers/imapx/camel-imapx-summary.h        |   14 -
 camel/providers/imapx/camel-imapx-utils.c          |  171 ++-
 camel/providers/imapx/camel-imapx-utils.h          |   17 +-
 camel/providers/local/camel-local-summary.c        |  135 +-
 camel/providers/local/camel-local-summary.h        |   14 +-
 camel/providers/local/camel-maildir-folder.c       |   41 +-
 camel/providers/local/camel-maildir-message-info.c |  128 +-
 camel/providers/local/camel-maildir-message-info.h |   61 +-
 camel/providers/local/camel-maildir-summary.c      |  166 +--
 camel/providers/local/camel-maildir-summary.h      |   15 +-
 camel/providers/local/camel-mbox-folder.c          |   52 +-
 camel/providers/local/camel-mbox-message-info.c    |  128 +-
 camel/providers/local/camel-mbox-message-info.h    |   52 +-
 camel/providers/local/camel-mbox-summary.c         |  332 ++---
 camel/providers/local/camel-mbox-summary.h         |    6 -
 camel/providers/local/camel-mh-folder.c            |    2 +-
 camel/providers/local/camel-mh-summary.c           |   29 +-
 camel/providers/local/camel-spool-summary.c        |    9 +-
 camel/providers/nntp/camel-nntp-folder.c           |   12 +-
 camel/providers/nntp/camel-nntp-summary.c          |   21 +-
 camel/providers/pop3/camel-pop3-folder.c           |    4 +-
 camel/tests/lib/folders.c                          |   12 +-
 52 files changed, 3020 insertions(+), 5074 deletions(-)
---
diff --git a/camel/camel-db.c b/camel/camel-db.c
index e51f162..641f025 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -1974,8 +1974,8 @@ write_mir (CamelDB *cdb,
                record->attachment,
                record->dirty,
                record->size,
-               (gint64) record->dsent,
-               (gint64) record->dreceived,
+               record->dsent,
+               record->dreceived,
                record->subject,
                record->from,
                record->to,
@@ -2444,14 +2444,14 @@ camel_db_camel_mir_free (CamelMIRecord *record)
 {
        if (record) {
                camel_pstring_free (record->uid);
-               camel_pstring_free (record->subject);
-               camel_pstring_free (record->from);
-               camel_pstring_free (record->to);
-               camel_pstring_free (record->cc);
-               camel_pstring_free (record->mlist);
-               camel_pstring_free (record->followup_flag);
-               camel_pstring_free (record->followup_completed_on);
-               camel_pstring_free (record->followup_due_by);
+               g_free (record->subject);
+               g_free (record->from);
+               g_free (record->to);
+               g_free (record->cc);
+               g_free (record->mlist);
+               g_free (record->followup_flag);
+               g_free (record->followup_completed_on);
+               g_free (record->followup_due_by);
                g_free (record->part);
                g_free (record->labels);
                g_free (record->usertags);
diff --git a/camel/camel-db.h b/camel/camel-db.h
index b454af9..bcfb202 100644
--- a/camel/camel-db.h
+++ b/camel/camel-db.h
@@ -179,8 +179,8 @@ typedef struct _CamelMIRecord {
        gboolean junk;
        gboolean attachment;
        guint32 size;
-       time_t dsent;
-       time_t dreceived;
+       gint64 dsent; /* time_t */
+       gint64 dreceived; /* time_t */
        gchar *subject;
        gchar *from;
        gchar *to;
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index 7a2bd1e..bbff006 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -1347,7 +1347,7 @@ camel_filter_driver_flush (CamelFilterDriver *driver,
 
 static gint
 decode_flags_from_xev (const gchar *xev,
-                       CamelMessageInfoBase *mi)
+                       CamelMessageInfo *mi)
 {
        guint32 uid, flags = 0;
        gchar *header;
@@ -1361,7 +1361,8 @@ decode_flags_from_xev (const gchar *xev,
        }
        g_free (header);
 
-       mi->flags = flags;
+       camel_message_info_set_flags (mi, ~0, flags);
+
        return 0;
 }
 
@@ -1454,9 +1455,9 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                /* Try and see if it has X-Evolution headers */
                xev = camel_header_raw_find (&mime_part->headers, "X-Evolution", NULL);
                if (xev)
-                       decode_flags_from_xev (xev, (CamelMessageInfoBase *) info);
+                       decode_flags_from_xev (xev, info);
 
-               ((CamelMessageInfoBase *) info)->size = camel_mime_parser_tell (mp) - last;
+               camel_message_info_set_size (info, camel_mime_parser_tell (mp) - last);
 
                last = camel_mime_parser_tell (mp);
                status = camel_filter_driver_filter_message (
@@ -1468,7 +1469,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                        report_status (
                                driver, CAMEL_FILTER_STATUS_END,
                                100, _("Failed on message %d"), i);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                        g_propagate_error (error, local_error);
                        goto fail;
                }
@@ -1478,7 +1479,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                /* skip over the FROM_END state */
                camel_mime_parser_step (mp, NULL, NULL);
 
-               camel_message_info_unref (info);
+               g_clear_object (&info);
        }
 
        camel_operation_progress (cancellable, 100);
@@ -1567,7 +1568,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
                        store_uid, store_uid, cancellable, &local_error);
 
                if (camel_folder_has_summary_capability (folder))
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
 
                if (local_error != NULL || status == -1) {
                        report_status (
@@ -1867,7 +1868,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                g_object_unref (driver->priv->message);
 
        if (freeinfo)
-               camel_message_info_unref (info);
+               g_clear_object (&info);
 
        return 0;
 
@@ -1879,7 +1880,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                g_object_unref (driver->priv->message);
 
        if (freeinfo)
-               camel_message_info_unref (info);
+               g_clear_object (&info);
 
        g_propagate_error (error, driver->priv->error);
        driver->priv->error = NULL;
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 06173ad..d79f9ee 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -150,16 +150,18 @@ check_header_in_message_info (CamelMessageInfo *info,
 {
        struct _KnownHeaders {
                const gchar *header_name;
-               guint info_key;
+               const gchar *info_name;
+               camel_search_t type;
        } known_headers[] = {
-               { "Subject", CAMEL_MESSAGE_INFO_SUBJECT },
-               { "From", CAMEL_MESSAGE_INFO_FROM },
-               { "To", CAMEL_MESSAGE_INFO_TO },
-               { "Cc", CAMEL_MESSAGE_INFO_CC }
+               { "Subject", "subject", CAMEL_SEARCH_TYPE_ENCODED },
+               { "From", "from", CAMEL_SEARCH_TYPE_ADDRESS_ENCODED },
+               { "To", "to", CAMEL_SEARCH_TYPE_ADDRESS_ENCODED },
+               { "Cc", "cc", CAMEL_SEARCH_TYPE_ADDRESS_ENCODED }
        };
-       camel_search_t type = CAMEL_SEARCH_TYPE_ENCODED;
-       const gchar *name, *value;
+       const gchar *name;
+       gchar *value;
        gboolean found = FALSE;
+       camel_search_t use_type;
        gint ii;
 
        g_return_val_if_fail (argc > 1, FALSE);
@@ -177,20 +179,20 @@ check_header_in_message_info (CamelMessageInfo *info,
                gint jj;
 
                for (jj = 0; jj < G_N_ELEMENTS (known_headers); jj++) {
-                       value = camel_message_info_get_ptr (info, known_headers[jj].info_key);
+                       value = NULL;
+
+                       g_object_get (G_OBJECT (info), known_headers[jj].info_name, &value, NULL);
+
                        if (!value)
                                continue;
 
-                       if (known_headers[jj].info_key == CAMEL_MESSAGE_INFO_SUBJECT)
-                               type = CAMEL_SEARCH_TYPE_ENCODED;
-                       else
-                               type = CAMEL_SEARCH_TYPE_ADDRESS_ENCODED;
-
                        for (ii = 1; ii < argc && !*matched; ii++) {
                                if (argv[ii]->type == CAMEL_SEXP_RES_STRING)
-                                       *matched = camel_search_header_match (value, argv[ii]->value.string, 
how, type, NULL);
+                                       *matched = camel_search_header_match (value, argv[ii]->value.string, 
how, known_headers[jj].type, NULL);
                        }
 
+                       g_free (value);
+
                        if (*matched)
                                return TRUE;
                }
@@ -203,21 +205,24 @@ check_header_in_message_info (CamelMessageInfo *info,
        for (ii = 0; ii < G_N_ELEMENTS (known_headers); ii++) {
                found = g_ascii_strcasecmp (name, known_headers[ii].header_name) == 0;
                if (found) {
-                       value = camel_message_info_get_ptr (info, known_headers[ii].info_key);
-                       if (known_headers[ii].info_key != CAMEL_MESSAGE_INFO_SUBJECT)
-                               type = CAMEL_SEARCH_TYPE_ADDRESS_ENCODED;
+                       g_object_get (G_OBJECT (info), known_headers[ii].info_name, &value, NULL);
+                       use_type = known_headers[ii].type;
                        break;
                }
        }
 
-       if (!found || !value)
+       if (!found || !value) {
+               g_free (value);
                return FALSE;
+       }
 
        for (ii = 1; ii < argc && !*matched; ii++) {
                if (argv[ii]->type == CAMEL_SEXP_RES_STRING)
-                       *matched = camel_search_header_match (value, argv[ii]->value.string, how, type, NULL);
+                       *matched = camel_search_header_match (value, argv[ii]->value.string, how, use_type, 
NULL);
        }
 
+       g_free (value);
+
        return TRUE;
 }
 
@@ -847,7 +852,7 @@ junk_test (struct _CamelSExp *f,
        CamelMimeMessage *message;
        CamelJunkStatus status;
        const GHashTable *ht;
-       const CamelHeaderParam *node;
+       const CamelNameValueArray *info_headers;
        gboolean sender_is_known;
        gboolean message_is_junk = FALSE;
        GError *error = NULL;
@@ -889,30 +894,44 @@ junk_test (struct _CamelSExp *f,
        /* Check the headers for a junk designation. */
 
        ht = camel_session_get_junk_headers (fms->session);
-       node = camel_message_info_get_headers (info);
 
-       while (node != NULL) {
-               const gchar *value = NULL;
+       camel_message_info_property_lock (info);
 
-               if (node->name != NULL)
-                       value = g_hash_table_lookup (
-                               (GHashTable *) ht, node->name);
+       info_headers = camel_message_info_get_headers (info);
+       if (info_headers) {
+               guint len, ii;
 
-               message_is_junk =
-                       (value != NULL) &&
-                       (camel_strstrcase (node->value, value) != NULL);
+               len = camel_name_value_array_get_length (info_headers);
+               for (ii = 0; ii < len; ii++) {
+                       const gchar *hdr_name = NULL;
+                       const gchar *hdr_value = NULL;
+                       const gchar *junk_value = NULL;
 
-               if (message_is_junk) {
-                       if (camel_debug ("junk"))
-                               printf (
-                                       "Message contains \"%s: %s\"",
-                                       node->name, value);
-                       goto done;
-               }
+                       if (!camel_name_value_array_get (info_headers, ii, &hdr_name, &hdr_value))
+                               continue;
 
-               node = node->next;
+                       if (!hdr_name || !hdr_value)
+                               continue;
+
+                       junk_value = g_hash_table_lookup ((GHashTable *) ht, hdr_name);
+
+                       message_is_junk =
+                               (junk_value != NULL) &&
+                               (camel_strstrcase (hdr_value, junk_value) != NULL);
+
+                       if (message_is_junk) {
+                               if (camel_debug ("junk"))
+                                       printf (
+                                               "Message contains \"%s: %s\"",
+                                               hdr_name, junk_value);
+                               camel_message_info_property_unlock (info);
+                               goto done;
+                       }
+               }
        }
 
+       camel_message_info_property_unlock (info);
+
        /* Not every message info has headers available, thus try headers of the message itself */
        message = camel_filter_search_get_message (fms, f);
        if (message) {
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index adbc95a..b55454d 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -274,8 +274,7 @@ get_current_message (CamelFolderSearch *search)
        if (!search || !search->folder || !search->current)
                return NULL;
 
-       return camel_folder_get_message_sync (
-               search->folder, search->current->uid, search->priv->cancellable, NULL);
+       return camel_folder_get_message_sync (search->folder, camel_message_info_get_uid (search->current), 
search->priv->cancellable, NULL);
 }
 
 static CamelSExpResult *
@@ -912,7 +911,7 @@ folder_search_match_all (CamelSExp *sexp,
                } else {
                        g_ptr_array_add (r->value.ptrarray, (gchar *) uid);
                }
-               camel_message_info_unref (search->current);
+               g_clear_object (&search->current);
        }
        search->current = NULL;
        return r;
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 77420fd..f438739 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -126,12 +126,10 @@ static gint my_list_size (struct _node **list);
 static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, struct _camel_header_raw *);
 static CamelMessageInfo * message_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
 static CamelMessageInfo * message_info_new_from_message (CamelFolderSummary *summary, CamelMimeMessage *msg, 
const gchar *bodystructure);
-static void              message_info_free (CamelFolderSummary *, CamelMessageInfo *);
 
 static CamelMessageContentInfo * content_info_new_from_header (CamelFolderSummary *, struct 
_camel_header_raw *);
 static CamelMessageContentInfo * content_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
 static CamelMessageContentInfo * content_info_new_from_message (CamelFolderSummary *summary, CamelMimePart 
*mp);
-static void                     content_info_free (CamelFolderSummary *, CamelMessageContentInfo *);
 
 static gint save_message_infos_to_db (CamelFolderSummary *summary, GError **error);
 static gint camel_read_mir_callback (gpointer  ref, gint ncol, gchar ** cols, gchar ** name);
@@ -158,11 +156,6 @@ enum {
 
 G_DEFINE_TYPE (CamelFolderSummary, camel_folder_summary, G_TYPE_OBJECT)
 
-G_DEFINE_BOXED_TYPE (CamelMessageInfo,
-               camel_message_info,
-               camel_message_info_ref,
-               camel_message_info_unref)
-
 static gboolean
 remove_each_item (gpointer uid,
                   gpointer mi,
@@ -186,8 +179,7 @@ remove_all_loaded (CamelFolderSummary *summary)
 
        g_hash_table_foreach_remove (summary->priv->loaded_infos, remove_each_item, &to_remove_infos);
 
-       g_slist_foreach (to_remove_infos, (GFunc) camel_message_info_unref, NULL);
-       g_slist_free (to_remove_infos);
+       g_slist_free_full (to_remove_infos, g_object_unref);
 
        camel_folder_summary_unlock (summary);
 }
@@ -557,166 +549,6 @@ summary_header_to_db (CamelFolderSummary *summary,
        return record;
 }
 
-static CamelMessageInfo *
-message_info_from_db (CamelFolderSummary *summary,
-                      CamelMIRecord *record)
-{
-       CamelMessageInfoBase *mi;
-       gint i;
-       gint count;
-       gchar *part, *label;
-
-       mi = (CamelMessageInfoBase *) camel_message_info_new (summary);
-
-       io (printf ("Loading message info from db\n"));
-
-       mi->flags = record->flags;
-       mi->size = record->size;
-       mi->date_sent = record->dsent;
-       mi->date_received = record->dreceived;
-
-       mi->uid = (gchar *) camel_pstring_strdup (record->uid);
-       mi->subject = (gchar *) camel_pstring_add (record->subject, FALSE);
-       mi->from = (gchar *) camel_pstring_add (record->from, FALSE);
-       mi->to = (gchar *) camel_pstring_add (record->to, FALSE);
-       mi->cc = (gchar *) camel_pstring_add (record->cc, FALSE);
-       mi->mlist = (gchar *) camel_pstring_add (record->mlist, FALSE);
-
-       /* Evolution itself doesn't yet use this, so we ignore it (saving some memory) */
-       mi->bodystructure = NULL;
-
-       /* Extract Message id & References */
-       mi->content = NULL;
-       part = record->part;
-       if (part) {
-               mi->message_id.id.part.hi = bdata_extract_digit (&part);
-               mi->message_id.id.part.lo = bdata_extract_digit (&part);
-               count = bdata_extract_digit (&part);
-
-               if (count > 0) {
-                       mi->references = g_malloc (sizeof (*mi->references) + ((count - 1) * sizeof 
(mi->references->references[0])));
-                       mi->references->size = count;
-                       for (i = 0; i < count; i++) {
-                               mi->references->references[i].id.part.hi = bdata_extract_digit (&part);
-                               mi->references->references[i].id.part.lo = bdata_extract_digit (&part);
-                       }
-               } else
-                       mi->references = NULL;
-
-       }
-
-       /* Extract User flags/labels */
-       part = record->labels;
-       if (part) {
-               label = part;
-               for (i = 0; part[i]; i++) {
-
-                       if (part[i] == ' ') {
-                               part[i] = 0;
-                               camel_flag_set (&mi->user_flags, label, TRUE);
-                               label = &(part[i + 1]);
-                               part[i] = ' ';
-                       }
-               }
-               camel_flag_set (&mi->user_flags, label, TRUE);
-       }
-
-       /* Extract User tags */
-       part = record->usertags;
-       count = bdata_extract_digit (&part);
-       for (i = 0; i < count; i++) {
-               gchar *name, *value;
-
-               name = bdata_extract_string (&part);
-               value = bdata_extract_string (&part);
-               camel_tag_set (&mi->user_tags, name, value);
-
-               g_free (name);
-               g_free (value);
-       }
-
-       return (CamelMessageInfo *) mi;
-}
-
-static CamelMIRecord *
-message_info_to_db (CamelFolderSummary *summary,
-                    CamelMessageInfo *info)
-{
-       CamelMIRecord *record = g_new0 (CamelMIRecord, 1);
-       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
-       GString *tmp;
-       CamelFlag *flag;
-       CamelTag *tag;
-       gint count, i;
-
-       /* Assume that we dont have to take care of DB Safeness. It will be done while doing the DB 
transaction */
-       record->uid = (gchar *) camel_pstring_strdup (camel_message_info_get_uid (info));
-       record->flags = mi->flags;
-
-       record->read = ((mi->flags & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_JUNK))) ? 1 
: 0;
-       record->deleted = mi->flags & CAMEL_MESSAGE_DELETED ? 1 : 0;
-       record->replied = mi->flags & CAMEL_MESSAGE_ANSWERED ? 1 : 0;
-       record->important = mi->flags & CAMEL_MESSAGE_FLAGGED ? 1 : 0;
-       record->junk = mi->flags & CAMEL_MESSAGE_JUNK ? 1 : 0;
-       record->dirty = mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED ? 1 : 0;
-       record->attachment = mi->flags & CAMEL_MESSAGE_ATTACHMENTS ? 1 : 0;
-
-       record->size = mi->size;
-       record->dsent = mi->date_sent;
-       record->dreceived = mi->date_received;
-
-       record->subject = (gchar *) camel_pstring_strdup (camel_message_info_get_subject (info));
-       record->from = (gchar *) camel_pstring_strdup (camel_message_info_get_from (info));
-       record->to = (gchar *) camel_pstring_strdup (camel_message_info_get_to (info));
-       record->cc = (gchar *) camel_pstring_strdup (camel_message_info_get_cc (info));
-       record->mlist = (gchar *) camel_pstring_strdup (camel_message_info_get_mlist (info));
-
-       record->followup_flag = (gchar *) camel_pstring_strdup (camel_message_info_get_user_tag (info, 
"follow-up"));
-       record->followup_completed_on = (gchar *) camel_pstring_strdup (camel_message_info_get_user_tag 
(info, "completed-on"));
-       record->followup_due_by = (gchar *) camel_pstring_strdup (camel_message_info_get_user_tag (info, 
"due-by"));
-
-       record->bodystructure = mi->bodystructure ? g_strdup (mi->bodystructure) : NULL;
-
-       tmp = g_string_new (NULL);
-       if (mi->references) {
-               g_string_append_printf (tmp, "%lu %lu %lu", (gulong) mi->message_id.id.part.hi, (gulong) 
mi->message_id.id.part.lo, (gulong) mi->references->size);
-               for (i = 0; i < mi->references->size; i++)
-                       g_string_append_printf (tmp, " %lu %lu", (gulong) 
mi->references->references[i].id.part.hi, (gulong) mi->references->references[i].id.part.lo);
-       } else {
-               g_string_append_printf (tmp, "%lu %lu %lu", (gulong) mi->message_id.id.part.hi, (gulong) 
mi->message_id.id.part.lo, (gulong) 0);
-       }
-       record->part = tmp->str;
-       g_string_free (tmp, FALSE);
-
-       tmp = g_string_new (NULL);
-       flag = mi->user_flags;
-       while (flag) {
-               g_string_append_printf (tmp, "%s ", flag->name);
-               flag = flag->next;
-       }
-
-       /* Strip off the last space */
-       if (tmp->len)
-               tmp->len--;
-
-       record->labels = tmp->str;
-       g_string_free (tmp, FALSE);
-
-       tmp = g_string_new (NULL);
-       count = camel_tag_list_size (&mi->user_tags);
-       g_string_append_printf (tmp, "%lu", (gulong) count);
-       tag = mi->user_tags;
-       while (tag) {
-               /* FIXME: Should we handle empty tags? Can it be empty? If it potential crasher ahead*/
-               g_string_append_printf (tmp, " %lu-%s %lu-%s", (gulong) strlen (tag->name), tag->name, 
(gulong) strlen (tag->value), tag->value);
-               tag = tag->next;
-       }
-       record->usertags = tmp->str;
-       g_string_free (tmp, FALSE);
-
-       return record;
-}
-
 static CamelMessageContentInfo *
 content_info_from_db (CamelFolderSummary *summary,
                       CamelMIRecord *record)
@@ -735,17 +567,17 @@ content_info_from_db (CamelFolderSummary *summary,
        ci = camel_folder_summary_content_info_new (summary);
        if (*part == ' ') part++; /* Move off the space in the record */
 
-       type = bdata_extract_string (&part);
-       subtype = bdata_extract_string (&part);
+       type = camel_util_bdata_get_string (&part, NULL);
+       subtype = camel_util_bdata_get_string (&part, NULL);
        ct = camel_content_type_new (type, subtype);
        g_free (type);          /* can this be removed? */
        g_free (subtype);
-       count = bdata_extract_digit (&part);
+       count = camel_util_bdata_get_number (&part, 0);
 
        for (i = 0; i < count; i++) {
                gchar *name, *value;
-               name = bdata_extract_string (&part);
-               value = bdata_extract_string (&part);
+               name = camel_util_bdata_get_string (&part, NULL);
+               value = camel_util_bdata_get_string (&part, NULL);
 
                camel_content_type_set_param (ct, name, value);
                /* TODO: do this so we dont have to double alloc/free */
@@ -755,10 +587,10 @@ content_info_from_db (CamelFolderSummary *summary,
        ci->type = ct;
 
        /* FIXME[disk-summary] move all these to camel pstring */
-       ci->id = bdata_extract_string (&part);
-       ci->description = bdata_extract_string (&part);
-       ci->encoding = bdata_extract_string (&part);
-       ci->size = bdata_extract_digit (&part);
+       ci->id = camel_util_bdata_get_string (&part, NULL);
+       ci->description = camel_util_bdata_get_string (&part, NULL);
+       ci->encoding = camel_util_bdata_get_string (&part, NULL);
+       ci->size = camel_util_bdata_get_number (&part, 0);
 
        record->cinfo = part; /* Keep moving the cursor in the record */
 
@@ -920,231 +752,6 @@ camel_folder_summary_replace_flags (CamelFolderSummary *summary,
        return changed;
 }
 
-static CamelMessageInfo *
-message_info_clone (CamelFolderSummary *summary,
-                    const CamelMessageInfo *mi)
-{
-       CamelMessageInfoBase *to, *from = (CamelMessageInfoBase *) mi;
-       CamelFlag *flag;
-       CamelTag *tag;
-
-       to = (CamelMessageInfoBase *) camel_message_info_new (summary);
-
-       to->flags = from->flags;
-       to->size = from->size;
-       to->date_sent = from->date_sent;
-       to->date_received = from->date_received;
-       to->refcount = 1;
-
-       /* NB: We don't clone the uid */
-
-       to->subject = camel_pstring_strdup (from->subject);
-       to->from = camel_pstring_strdup (from->from);
-       to->to = camel_pstring_strdup (from->to);
-       to->cc = camel_pstring_strdup (from->cc);
-       to->mlist = camel_pstring_strdup (from->mlist);
-       memcpy (&to->message_id, &from->message_id, sizeof (to->message_id));
-       to->preview = g_strdup (from->preview);
-       if (from->references) {
-               gint len = sizeof (*from->references) + ((from->references->size - 1) * sizeof 
(from->references->references[0]));
-
-               to->references = g_malloc (len);
-               memcpy (to->references, from->references, len);
-       }
-
-       flag = from->user_flags;
-       while (flag) {
-               camel_flag_set (&to->user_flags, flag->name, TRUE);
-               flag = flag->next;
-       }
-
-       tag = from->user_tags;
-       while (tag) {
-               camel_tag_set (&to->user_tags, tag->name, tag->value);
-               tag = tag->next;
-       }
-
-       if (from->content) {
-               /* FIXME: copy content-infos */
-       }
-
-       return (CamelMessageInfo *) to;
-}
-
-static gconstpointer
-info_ptr (const CamelMessageInfo *mi,
-          gint id)
-{
-       switch (id) {
-               case CAMEL_MESSAGE_INFO_SUBJECT:
-                       return ((const CamelMessageInfoBase *) mi)->subject;
-               case CAMEL_MESSAGE_INFO_FROM:
-                       return ((const CamelMessageInfoBase *) mi)->from;
-               case CAMEL_MESSAGE_INFO_TO:
-                       return ((const CamelMessageInfoBase *) mi)->to;
-               case CAMEL_MESSAGE_INFO_CC:
-                       return ((const CamelMessageInfoBase *) mi)->cc;
-               case CAMEL_MESSAGE_INFO_MLIST:
-                       return ((const CamelMessageInfoBase *) mi)->mlist;
-               case CAMEL_MESSAGE_INFO_MESSAGE_ID:
-                       return &((const CamelMessageInfoBase *) mi)->message_id;
-               case CAMEL_MESSAGE_INFO_REFERENCES:
-                       return ((const CamelMessageInfoBase *) mi)->references;
-               case CAMEL_MESSAGE_INFO_USER_FLAGS:
-                       return ((const CamelMessageInfoBase *) mi)->user_flags;
-               case CAMEL_MESSAGE_INFO_USER_TAGS:
-                       return ((const CamelMessageInfoBase *) mi)->user_tags;
-               case CAMEL_MESSAGE_INFO_HEADERS:
-                       return ((const CamelMessageInfoBase *) mi)->headers;
-               case CAMEL_MESSAGE_INFO_CONTENT:
-                       return ((const CamelMessageInfoBase *) mi)->content;
-               case CAMEL_MESSAGE_INFO_PREVIEW:
-                       return ((const CamelMessageInfoBase *) mi)->preview;
-               default:
-                       g_return_val_if_reached (NULL);
-       }
-}
-
-static guint32
-info_uint32 (const CamelMessageInfo *mi,
-             gint id)
-{
-       switch (id) {
-               case CAMEL_MESSAGE_INFO_FLAGS:
-                       return ((const CamelMessageInfoBase *) mi)->flags;
-               case CAMEL_MESSAGE_INFO_SIZE:
-                       return ((const CamelMessageInfoBase *) mi)->size;
-               default:
-                       g_return_val_if_reached (0);
-       }
-}
-
-static time_t
-info_time (const CamelMessageInfo *mi,
-           gint id)
-{
-       switch (id) {
-               case CAMEL_MESSAGE_INFO_DATE_SENT:
-                       return ((const CamelMessageInfoBase *) mi)->date_sent;
-               case CAMEL_MESSAGE_INFO_DATE_RECEIVED:
-                       return ((const CamelMessageInfoBase *) mi)->date_received;
-               default:
-                       g_return_val_if_reached (0);
-       }
-}
-
-static gboolean
-info_user_flag (const CamelMessageInfo *mi,
-                const gchar *id)
-{
-       return camel_flag_get (&((CamelMessageInfoBase *) mi)->user_flags, id);
-}
-
-static const gchar *
-info_user_tag (const CamelMessageInfo *mi,
-               const gchar *id)
-{
-       return camel_tag_get (&((CamelMessageInfoBase *) mi)->user_tags, id);
-}
-
-static gboolean
-info_set_user_flag (CamelMessageInfo *info,
-                    const gchar *name,
-                    gboolean value)
-{
-       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
-       gint res;
-
-       res = camel_flag_set (&mi->user_flags, name, value);
-
-       if (mi->summary && res && mi->summary->priv->folder && mi->uid
-           && camel_folder_summary_check_uid (mi->summary, mi->uid)) {
-               CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
-
-               mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-               mi->dirty = TRUE;
-               camel_folder_summary_touch (mi->summary);
-               camel_folder_change_info_change_uid (changes, camel_message_info_get_uid (info));
-               camel_folder_changed (mi->summary->priv->folder, changes);
-               camel_folder_change_info_free (changes);
-       }
-
-       return res;
-}
-
-static gboolean
-info_set_user_tag (CamelMessageInfo *info,
-                   const gchar *name,
-                   const gchar *value)
-{
-       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
-       gint res;
-
-       res = camel_tag_set (&mi->user_tags, name, value);
-
-       if (mi->summary && res && mi->summary->priv->folder && mi->uid
-           && camel_folder_summary_check_uid (mi->summary, mi->uid)) {
-               CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
-
-               mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-               mi->dirty = TRUE;
-               camel_folder_summary_touch (mi->summary);
-               camel_folder_change_info_change_uid (changes, camel_message_info_get_uid (info));
-               camel_folder_changed (mi->summary->priv->folder, changes);
-               camel_folder_change_info_free (changes);
-       }
-
-       return res;
-}
-
-static gboolean
-info_set_flags (CamelMessageInfo *info,
-                guint32 flags,
-                guint32 set)
-{
-       guint32 old;
-       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
-       gboolean counts_changed = FALSE;
-
-       old = camel_message_info_get_flags (info);
-       mi->flags = (old & ~flags) | (set & flags);
-       if (old != mi->flags) {
-               mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-               mi->dirty = TRUE;
-               if (mi->summary)
-                       camel_folder_summary_touch (mi->summary);
-       }
-
-       if (mi->summary) {
-               camel_folder_summary_lock (mi->summary);
-               g_object_freeze_notify (G_OBJECT (mi->summary));
-               counts_changed = camel_folder_summary_replace_flags (mi->summary, info);
-       }
-
-       if (!counts_changed && ((old & ~CAMEL_MESSAGE_SYSTEM_MASK) == (mi->flags & 
~CAMEL_MESSAGE_SYSTEM_MASK)) && !((set & CAMEL_MESSAGE_JUNK_LEARN) && !(set & CAMEL_MESSAGE_JUNK))) {
-               if (mi->summary) {
-                       g_object_thaw_notify (G_OBJECT (mi->summary));
-                       camel_folder_summary_unlock (mi->summary);
-               }
-               return FALSE;
-       }
-
-       if (mi->summary) {
-               g_object_thaw_notify (G_OBJECT (mi->summary));
-               camel_folder_summary_unlock (mi->summary);
-       }
-
-       if (mi->summary && mi->summary->priv->folder && mi->uid) {
-               CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
-
-               camel_folder_change_info_change_uid (changes, camel_message_info_get_uid (info));
-               camel_folder_changed (mi->summary->priv->folder, changes);
-               camel_folder_change_info_free (changes);
-       }
-
-       return TRUE;
-}
-
 static void
 camel_folder_summary_class_init (CamelFolderSummaryClass *class)
 {
@@ -1158,43 +765,24 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *class)
        object_class->dispose = folder_summary_dispose;
        object_class->finalize = folder_summary_finalize;
 
-       class->message_info_type = XCAMEL_TYPE_MESSAGE_INFO_BASE;
-
-       class->message_info_size = sizeof (CamelMessageInfoBase);
-       class->content_info_size = sizeof (CamelMessageContentInfo);
+       class->message_info_type = CAMEL_TYPE_MESSAGE_INFO_BASE;
 
        class->summary_header_from_db = summary_header_from_db;
        class->summary_header_to_db = summary_header_to_db;
-       class->message_info_from_db = message_info_from_db;
-       class->message_info_to_db = message_info_to_db;
        class->content_info_from_db = content_info_from_db;
        class->content_info_to_db = content_info_to_db;
 
        class->message_info_new_from_header = message_info_new_from_header;
        class->message_info_new_from_parser = message_info_new_from_parser;
        class->message_info_new_from_message = message_info_new_from_message;
-       class->message_info_free = message_info_free;
-       class->message_info_clone = message_info_clone;
        class->message_info_from_uid = message_info_from_uid;
 
        class->content_info_new_from_header = content_info_new_from_header;
        class->content_info_new_from_parser = content_info_new_from_parser;
        class->content_info_new_from_message = content_info_new_from_message;
-       class->content_info_free = content_info_free;
 
        class->next_uid_string = next_uid_string;
 
-       class->info_ptr = info_ptr;
-       class->info_uint32 = info_uint32;
-       class->info_time = info_time;
-       class->info_user_flag = info_user_flag;
-       class->info_user_tag = info_user_tag;
-
-       class->info_set_user_flag = info_set_user_flag;
-       class->info_set_user_tag = info_set_user_tag;
-
-       class->info_set_flags = info_set_flags;
-
        /**
         * CamelFolderSummary:folder
         *
@@ -1844,7 +1432,7 @@ camel_folder_summary_peek_loaded (CamelFolderSummary *summary,
        info = g_hash_table_lookup (summary->priv->loaded_infos, uid);
 
        if (info)
-               camel_message_info_ref (info);
+               g_object_ref (info);
 
        return info;
 }
@@ -1913,7 +1501,7 @@ message_info_from_uid (CamelFolderSummary *summary,
        }
 
        if (info)
-               camel_message_info_ref (info);
+               g_object_ref (info);
 
        camel_folder_summary_unlock (summary);
 
@@ -2001,7 +1589,7 @@ perform_content_info_load_from_db (CamelFolderSummary *summary,
        if (!part)
                return ci;
        if (*part == ' ') part++;
-       count = bdata_extract_digit (&part);
+       count = camel_util_bdata_get_number (&part, 0);
 
        mir->cinfo = part;
        for (i = 0; i < count; i++) {
@@ -2024,10 +1612,10 @@ gather_dirty_or_flagged_uids (gpointer key,
                              gpointer user_data)
 {
        const gchar *uid = key;
-       CamelMessageInfoBase *info = value;
+       CamelMessageInfo *info = value;
        GHashTable *hash = user_data;
 
-       if (info->dirty || (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0)
+       if (camel_message_info_get_dirty (info) || (camel_message_info_get_flags (info) & 
CAMEL_MESSAGE_FOLDER_FLAGGED) != 0)
                g_hash_table_insert (hash, (gpointer) camel_pstring_strdup (uid), GINT_TO_POINTER (1));
 }
 
@@ -2074,10 +1662,10 @@ camel_folder_summary_get_changed (CamelFolderSummary *summary)
 
 static void
 count_changed_uids (gchar *key,
-                    CamelMessageInfoBase *info,
+                    CamelMessageInfo *info,
                     gint *count)
 {
-       if (info->dirty)
+       if (camel_message_info_get_dirty (info))
                (*count)++;
 }
 
@@ -2095,10 +1683,10 @@ cfs_count_dirty (CamelFolderSummary *summary)
 
 static gboolean
 remove_item (gchar *uid,
-             CamelMessageInfoBase *info,
+             CamelMessageInfo *info,
              GSList **to_remove_infos)
 {
-       if (info->refcount == 1 && !info->dirty && (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
+       if (G_OBJECT (info)->ref_count == 1 && !camel_message_info_get_dirty (info) && 
(camel_message_info_get_flags (info) & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
                *to_remove_infos = g_slist_prepend (*to_remove_infos, info);
                return TRUE;
        }
@@ -2123,8 +1711,7 @@ remove_cache (CamelSession *session,
 
        g_hash_table_foreach_remove (summary->priv->loaded_infos, (GHRFunc) remove_item, &to_remove_infos);
 
-       g_slist_foreach (to_remove_infos, (GFunc) camel_message_info_unref, NULL);
-       g_slist_free (to_remove_infos);
+       g_slist_free_full (to_remove_infos, g_object_unref);
 
        camel_folder_summary_unlock (summary);
 
@@ -2268,7 +1855,7 @@ msg_update_preview (const gchar *uid,
                     gpointer value,
                     CamelFolder *folder)
 {
-       CamelMessageInfoBase *info = (CamelMessageInfoBase *) camel_folder_summary_get (folder->summary, uid);
+       CamelMessageInfo *info = camel_folder_summary_get (folder->summary, uid);
        CamelMimeMessage *msg;
        CamelStore *parent_store;
        const gchar *full_name;
@@ -2279,20 +1866,21 @@ msg_update_preview (const gchar *uid,
        /* FIXME Pass a GCancellable */
        msg = camel_folder_get_message_sync (folder, uid, NULL, NULL);
        if (msg != NULL) {
-               if (camel_mime_message_build_preview ((CamelMimePart *) msg, (CamelMessageInfo *) info) && 
info->preview) {
+               if (camel_mime_message_build_preview ((CamelMimePart *) msg, info) && 
camel_message_info_get_preview (info)) {
                        if (parent_store && !is_in_memory_summary (folder->summary))
-                               camel_db_write_preview_record (parent_store->cdb_w, full_name, info->uid, 
info->preview, NULL);
+                               camel_db_write_preview_record (parent_store->cdb_w, full_name,
+                                       camel_message_info_get_uid (info), camel_message_info_get_preview 
(info), NULL);
                }
        }
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 }
 
 static void
 pick_uids (const gchar *uid,
-           CamelMessageInfoBase *mi,
+           CamelMessageInfo *mi,
            GPtrArray *array)
 {
-       if (mi->preview)
+       if (camel_message_info_get_preview (mi))
                g_ptr_array_add (array, (gchar *) camel_pstring_strdup (uid));
 }
 
@@ -2306,16 +1894,17 @@ copy_all_uids_to_hash (gpointer uid,
 }
 
 static gboolean
-fill_mi (const gchar *uid,
-         const gchar *msg,
+fill_mi (gchar *uid,
+         gchar *msg,
          CamelFolder *folder)
 {
-       CamelMessageInfoBase *info;
+       CamelMessageInfo *info;
 
        info = g_hash_table_lookup (folder->summary->priv->loaded_infos, uid);
        if (info) /* We re assign the memory of msg */
-               info->preview = (gchar *) msg;
+               camel_message_info_set_preview (info, msg);
        camel_pstring_free (uid); /* unref the uid */
+       g_free (msg);
 
        return TRUE;
 }
@@ -2450,7 +2039,7 @@ camel_folder_summary_add_preview (CamelFolderSummary *summary,
                                   CamelMessageInfo *info)
 {
        camel_folder_summary_lock (summary);
-       g_hash_table_insert (summary->priv->preview_updates, (gchar *) info->uid, ((CamelMessageInfoBase *) 
info)->preview);
+       g_hash_table_insert (summary->priv->preview_updates, (gpointer) camel_message_info_get_uid (info), 
(gpointer) camel_message_info_get_preview (info));
        camel_folder_summary_touch (summary);
        camel_folder_summary_unlock (summary);
 }
@@ -2654,6 +2243,7 @@ camel_read_mir_callback (gpointer ref,
        CamelFolderSummary *summary = data->summary;
        CamelMIRecord *mir;
        CamelMessageInfo *info;
+       gchar *bdata_ptr;
        gint ret = 0;
 
        mir = g_new0 (CamelMIRecord , 1);
@@ -2668,35 +2258,35 @@ camel_read_mir_callback (gpointer ref,
        }
        camel_folder_summary_unlock (summary);
 
-       info = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->message_info_from_db (summary, mir);
-
-       if (info) {
-
+       info = camel_message_info_new (summary);
+       bdata_ptr = mir->bdata;
+       if (camel_message_info_load (info, mir, &bdata_ptr)) {
                if (summary->priv->build_content) {
                        gchar *tmp;
                        tmp = mir->cinfo;
                        /* FIXME: this should be done differently, how i don't know */
-                       ((CamelMessageInfoBase *) info)->content = perform_content_info_load_from_db 
(summary, mir);
+                       /* #warning Possibly remove the content info code */
+                       /*((CamelMessageInfoBase *) info)->content = perform_content_info_load_from_db 
(summary, mir);
                        if (((CamelMessageInfoBase *) info)->content == NULL) {
-                               camel_message_info_unref (info);
-                               info = NULL;
+                               g_clear_object (&info);
                        }
                        mir->cinfo = tmp;
 
                        if (!info) {
                                camel_db_camel_mir_free (mir);
                                return -1;
-                       }
+                       }*/
                }
 
                /* Just now we are reading from the DB, it can't be dirty. */
-               ((CamelMessageInfoBase *) info)->dirty = FALSE;
+               camel_message_info_set_dirty (info, FALSE);
                if (data->add)
                        camel_folder_summary_add (summary, info);
                else
                        camel_folder_summary_insert (summary, info, TRUE);
 
        } else {
+               g_clear_object (&info);
                g_warning ("Loading messageinfo from db failed");
                ret = -1;
        }
@@ -2737,48 +2327,70 @@ save_to_db_cb (gpointer key,
                gpointer value,
                gpointer data)
 {
-       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) value;
-       CamelFolderSummary *summary = (CamelFolderSummary *) mi->summary;
+       CamelMessageInfo *mi = value;
+       CamelFolderSummary *summary;
        CamelStore *parent_store;
        const gchar *full_name;
        CamelDB *cdb;
        CamelMIRecord *mir;
+       GString *bdata_str;
        GError **error = data;
 
+       if (!camel_message_info_get_dirty (mi))
+               return;
+
+       summary = camel_message_info_ref_summary (mi);
+       if (!summary)
+               return;
+
        full_name = camel_folder_get_full_name (summary->priv->folder);
        parent_store = camel_folder_get_parent_store (summary->priv->folder);
-       if (!parent_store)
+       if (!parent_store) {
+               g_clear_object (&summary);
                return;
+       }
 
        cdb = parent_store->cdb_w;
 
-       if (!mi->dirty)
+       mir = g_new0 (CamelMIRecord, 1);
+       bdata_str = g_string_new (NULL);
+
+       if (!camel_message_info_save (mi, mir, bdata_str)) {
+               g_warning ("Failed to save message info: %s\n", camel_message_info_get_uid (mi));
+               g_string_free (bdata_str, TRUE);
+               camel_db_camel_mir_free (mir);
+               g_clear_object (&summary);
                return;
+       }
 
-       mir = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->message_info_to_db (summary, (CamelMessageInfo *) mi);
+       g_warn_if_fail (mir->bdata == NULL);
+       mir->bdata = g_string_free (bdata_str, FALSE);
+       bdata_str = NULL;
 
-       if (mir && summary->priv->build_content) {
-               if (!perform_content_info_save_to_db (summary, ((CamelMessageInfoBase *) mi)->content, mir)) {
-                       g_warning ("unable to save mir+cinfo for uid: %s\n", mir->uid);
+       if (summary->priv->build_content) {
+               /* #warning Possibly remove the mi::content info */
+               /*if (!perform_content_info_save_to_db (summary, ((CamelMessageInfoBase *) mi)->content, 
mir)) {
+                       g_warning ("unable to save mir+cinfo for uid: %s\n", camel_message_info_get_uid (mi));
                        camel_db_camel_mir_free (mir);
-                       /* FIXME: Add exception here */
+                       g_clear_object (&summary);
+                       / * FIXME: Add exception here * /
                        return;
-               }
+               }*/
        }
 
-       g_return_if_fail (mir != NULL);
-
        if (camel_db_write_message_info_record (cdb, full_name, mir, error) != 0) {
                camel_db_camel_mir_free (mir);
+               g_clear_object (&summary);
                return;
        }
 
        /* Reset the dirty flag which decides if the changes are synced to the DB or not.
        The FOLDER_FLAGGED should be used to check if the changes are synced to the server.
        So, dont unset the FOLDER_FLAGGED flag */
-       mi->dirty = FALSE;
+       camel_message_info_set_dirty (mi, FALSE);
 
        camel_db_camel_mir_free (mir);
+       g_clear_object (&summary);
 }
 
 static gint
@@ -3027,35 +2639,51 @@ static gboolean
 summary_assign_uid (CamelFolderSummary *summary,
                     CamelMessageInfo *info)
 {
-       const gchar *uid;
+       const gchar *info_uid;
+       gchar *new_uid;
        CamelMessageInfo *mi;
 
-       uid = camel_message_info_get_uid (info);
+       camel_message_info_set_abort_notifications (info, TRUE);
+       camel_message_info_property_lock (info);
+
+       info_uid = camel_message_info_get_uid (info);
 
-       if (uid == NULL || uid[0] == 0) {
-               camel_pstring_free (info->uid);
-               uid = info->uid = (gchar *) camel_pstring_add (camel_folder_summary_next_uid_string 
(summary), TRUE);
+       if (!info_uid || !*info_uid) {
+               new_uid = camel_folder_summary_next_uid_string (summary);
+
+               camel_message_info_set_uid (info, new_uid);
+       } else {
+               new_uid = g_strdup (info_uid);
        }
 
        camel_folder_summary_lock (summary);
 
-       while ((mi = g_hash_table_lookup (summary->priv->loaded_infos, uid))) {
+       while ((mi = g_hash_table_lookup (summary->priv->loaded_infos, new_uid))) {
                camel_folder_summary_unlock (summary);
 
-               if (mi == info)
+               g_free (new_uid);
+
+               if (mi == info) {
+                       camel_message_info_property_unlock (info);
                        return FALSE;
+               }
 
                d (printf ("Trying to insert message with clashing uid (%s).  new uid re-assigned", 
camel_message_info_get_uid (info)));
 
-               camel_pstring_free (info->uid);
-               uid = info->uid = camel_pstring_add (camel_folder_summary_next_uid_string (summary), TRUE);
-               camel_message_info_set_flags (info, CAMEL_MESSAGE_FOLDER_FLAGGED, 
CAMEL_MESSAGE_FOLDER_FLAGGED);
+               new_uid = camel_folder_summary_next_uid_string (summary);
+               camel_message_info_set_uid (info, new_uid);
+               camel_message_info_set_folder_flagged (info, TRUE);
 
                camel_folder_summary_lock (summary);
        }
 
+       g_free (new_uid);
+
        camel_folder_summary_unlock (summary);
 
+       camel_message_info_property_unlock (info);
+       camel_message_info_set_abort_notifications (info, FALSE);
+
        return TRUE;
 }
 
@@ -3076,8 +2704,6 @@ void
 camel_folder_summary_add (CamelFolderSummary *summary,
                           CamelMessageInfo *info)
 {
-       CamelMessageInfoBase *base_info;
-
        g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
 
        if (info == NULL)
@@ -3089,10 +2715,9 @@ camel_folder_summary_add (CamelFolderSummary *summary,
                return;
        }
 
-       base_info = (CamelMessageInfoBase *) info;
        folder_summary_update_counts_by_flags (summary, camel_message_info_get_flags (info), 
UPDATE_COUNTS_ADD);
-       base_info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-       base_info->dirty = TRUE;
+       camel_message_info_set_folder_flagged (info, TRUE);
+       camel_message_info_set_dirty (info, TRUE);
 
        g_hash_table_insert (
                summary->priv->uids,
@@ -3125,11 +2750,9 @@ camel_folder_summary_insert (CamelFolderSummary *summary,
        camel_folder_summary_lock (summary);
 
        if (!load) {
-               CamelMessageInfoBase *base_info = (CamelMessageInfoBase *) info;
-
                folder_summary_update_counts_by_flags (summary, camel_message_info_get_flags (info), 
UPDATE_COUNTS_ADD);
-               base_info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-               base_info->dirty = TRUE;
+               camel_message_info_set_folder_flagged (info, TRUE);
+               camel_message_info_set_dirty (info, TRUE);
 
                g_hash_table_insert (
                        summary->priv->uids,
@@ -3152,8 +2775,8 @@ camel_folder_summary_insert (CamelFolderSummary *summary,
  *
  * Create a new info record from a header.
  *
- * Returns: the newly allocated record which must be unreferenced with
- *          camel_message_info_unref()
+ * Returns: (transfer full): a newly created #CamelMessageInfo. Unref it
+ *   with g_object_unref(), when done with it.
  **/
 CamelMessageInfo *
 camel_folder_summary_info_new_from_header (CamelFolderSummary *summary,
@@ -3187,8 +2810,8 @@ camel_folder_summary_info_new_from_header (CamelFolderSummary *summary,
  * Once complete, the parser will be positioned at the end of
  * the message.
  *
- * Returns: the newly allocated record which must be unreferenced with
- *          camel_message_info_unref()
+ * Returns: (transfer full): a newly created #CamelMessageInfo. Unref it
+ *   with g_object_unref(), when done with it.
  **/
 CamelMessageInfo *
 camel_folder_summary_info_new_from_parser (CamelFolderSummary *summary,
@@ -3224,9 +2847,6 @@ camel_folder_summary_info_new_from_parser (CamelFolderSummary *summary,
                        camel_mime_filter_index_set_name (CAMEL_MIME_FILTER_INDEX (p->filter_index), name);
                }
 
-               /* always scan the content info, even if we dont save it */
-               ((CamelMessageInfoBase *) info)->content = summary_build_content_info (summary, info, mp);
-
                if (name && p->index) {
                        camel_index_write_name (p->index, name);
                        g_object_unref (name);
@@ -3236,7 +2856,7 @@ camel_folder_summary_info_new_from_parser (CamelFolderSummary *summary,
 
                g_rec_mutex_unlock (&summary->priv->filter_lock);
 
-               ((CamelMessageInfoBase *) info)->size = camel_mime_parser_tell (mp) - start;
+               camel_message_info_set_size (info, camel_mime_parser_tell (mp) - start);
        }
        return info;
 }
@@ -3249,8 +2869,8 @@ camel_folder_summary_info_new_from_parser (CamelFolderSummary *summary,
  *
  * Create a summary item from a message.
  *
- * Returns: the newly allocated record which must be unreferenced with
- *          camel_message_info_unref()
+ * Returns: (transfer full): a newly created #CamelMessageInfo. Unref it
+ *   with g_object_unref(), when done with it.
  **/
 CamelMessageInfo *
 camel_folder_summary_info_new_from_message (CamelFolderSummary *summary,
@@ -3286,8 +2906,6 @@ camel_folder_summary_info_new_from_message (CamelFolderSummary *summary,
                }
        }
 
-       ((CamelMessageInfoBase *) info)->content = summary_build_content_info_message (summary, info, 
(CamelMimePart *) msg);
-
        if (name) {
                camel_index_write_name (p->index, name);
                g_object_unref (name);
@@ -3313,8 +2931,16 @@ camel_folder_summary_content_info_free (CamelFolderSummary *summary,
 {
        CamelMessageContentInfo *pw, *pn;
 
+       g_return_if_fail (ci != NULL);
+
        pw = ci->childs;
-       CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->content_info_free (summary, ci);
+
+       camel_content_type_unref (ci->type);
+       g_free (ci->id);
+       g_free (ci->description);
+       g_free (ci->encoding);
+       g_slice_free1 (sizeof (CamelMessageContentInfo), ci);
+
        while (pw) {
                pn = pw->next;
                camel_folder_summary_content_info_free (summary, pw);
@@ -3420,7 +3046,7 @@ camel_folder_summary_remove (CamelFolderSummary *summary,
        g_return_val_if_fail (info != NULL, FALSE);
 
        if (camel_folder_summary_remove_uid (summary, camel_message_info_get_uid (info))) {
-               camel_message_info_unref (info);
+               g_clear_object (&info);
                return TRUE;
        }
 
@@ -3515,7 +3141,7 @@ camel_folder_summary_remove_uids (CamelFolderSummary *summary,
                        g_hash_table_remove (summary->priv->loaded_infos, uid_copy);
 
                        if (mi)
-                               camel_message_info_unref (mi);
+                               g_clear_object (&mi);
                        camel_pstring_free (uid_copy);
                }
        }
@@ -3616,12 +3242,7 @@ message_info_new_from_message (CamelFolderSummary *summary,
                                CamelMimeMessage *msg,
                                const gchar *bodystructure)
 {
-       CamelMessageInfo *mi;
-
-       mi = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS (summary)))->message_info_new_from_header 
(summary, ((CamelMimePart *) msg)->headers);
-       ((CamelMessageInfoBase *) mi)->bodystructure = g_strdup (bodystructure);
-
-       return mi;
+       return CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->message_info_new_from_header (summary, 
((CamelMimePart *) msg)->headers);
 }
 
 static CamelMessageContentInfo *
@@ -3630,7 +3251,7 @@ content_info_new_from_message (CamelFolderSummary *summary,
 {
        CamelMessageContentInfo *ci;
 
-       ci = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS (summary)))->content_info_new_from_header 
(summary, mp->headers);
+       ci = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->content_info_new_from_header (summary, mp->headers);
 
        return ci;
 }
@@ -3694,12 +3315,9 @@ summary_format_string (struct _camel_header_raw *h,
 CamelMessageContentInfo *
 camel_folder_summary_content_info_new (CamelFolderSummary *summary)
 {
-       CamelFolderSummaryClass *class;
-
-       class = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary);
-       g_return_val_if_fail (class->content_info_size > 0, NULL);
+       g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), NULL);
 
-       return g_slice_alloc0 (class->content_info_size);
+       return g_slice_alloc0 (sizeof (CamelMessageContentInfo));
 }
 
 static CamelMessageInfo *
@@ -3710,7 +3328,7 @@ message_info_new_from_header (CamelFolderSummary *summary,
        GSList *refs, *irt, *scan;
        gchar *subject, *from, *to, *cc, *mlist;
        CamelContentType *ct = NULL;
-       CamelMessageInfoBase *mi;
+       CamelMessageInfo *mi;
        guint8 *digest;
        gsize length;
        gchar *msgid;
@@ -3719,7 +3337,9 @@ message_info_new_from_header (CamelFolderSummary *summary,
        length = g_checksum_type_get_length (G_CHECKSUM_MD5);
        digest = g_alloca (length);
 
-       mi = (CamelMessageInfoBase *) camel_message_info_new (summary);
+       mi = camel_message_info_new (summary);
+
+       camel_message_info_set_abort_notifications (mi, TRUE);
 
        if ((content = camel_header_raw_find (&h, "Content-Type", NULL))
             && (ct = camel_content_type_decode (content))
@@ -3738,53 +3358,62 @@ message_info_new_from_header (CamelFolderSummary *summary,
        if (ct)
                camel_content_type_unref (ct);
 
-       mi->subject = camel_pstring_add (subject, TRUE);
-       mi->from = camel_pstring_add (from, TRUE);
-       mi->to = camel_pstring_add (to, TRUE);
-       mi->cc = camel_pstring_add (cc, TRUE);
-       mi->mlist = camel_pstring_add (mlist, TRUE);
+       camel_message_info_set_subject (mi, subject);
+       camel_message_info_set_from (mi, from);
+       camel_message_info_set_to (mi, to);
+       camel_message_info_set_cc (mi, cc);
+       camel_message_info_set_mlist (mi, mlist);
 
-       mi->user_flags = NULL;
-       mi->user_tags = NULL;
+       g_free (subject);
+       g_free (from);
+       g_free (to);
+       g_free (cc);
+       g_free (mlist);
 
        if ((date = camel_header_raw_find (&h, "date", NULL)))
-               mi->date_sent = camel_header_decode_date (date, NULL);
+               camel_message_info_set_date_sent (mi, camel_header_decode_date (date, NULL));
        else
-               mi->date_sent = 0;
+               camel_message_info_set_date_sent (mi, 0);
 
        received = camel_header_raw_find (&h, "received", NULL);
        if (received)
                received = strrchr (received, ';');
        if (received)
-               mi->date_received = camel_header_decode_date (received + 1, NULL);
+               camel_message_info_set_date_received (mi, camel_header_decode_date (received + 1, NULL));
        else
-               mi->date_received = 0;
+               camel_message_info_set_date_received (mi, 0);
 
        /* Fallback to Received date, when the Date header is missing */
-       if (!mi->date_sent)
-               mi->date_sent = mi->date_received;
+       if (!camel_message_info_get_date_sent (mi))
+               camel_message_info_set_date_sent (mi, camel_message_info_get_date_received (mi));
 
        /* If neither Received is available, then use the current time. */
-       if (!mi->date_sent)
-               mi->date_sent = time (NULL);
+       if (!camel_message_info_get_date_sent (mi))
+               camel_message_info_set_date_sent (mi, (gint64) time (NULL));
 
        msgid = camel_header_msgid_decode (camel_header_raw_find (&h, "message-id", NULL));
        if (msgid) {
                GChecksum *checksum;
+               CamelSummaryMessageID message_id;
 
                checksum = g_checksum_new (G_CHECKSUM_MD5);
                g_checksum_update (checksum, (guchar *) msgid, -1);
                g_checksum_get_digest (checksum, digest, &length);
                g_checksum_free (checksum);
 
-               memcpy (mi->message_id.id.hash, digest, sizeof (mi->message_id.id.hash));
+               memcpy (message_id.id.hash, digest, sizeof (message_id.id.hash));
                g_free (msgid);
+
+               camel_message_info_set_message_id (mi, message_id.id.id);
        }
 
        /* decode our references and in-reply-to headers */
        refs = camel_header_references_decode (camel_header_raw_find (&h, "references", NULL));
        irt = camel_header_references_decode (camel_header_raw_find (&h, "in-reply-to", NULL));
        if (refs || irt) {
+               GArray *references;
+               CamelSummaryMessageID message_id;
+
                if (irt) {
                        /* The References field is populated from the "References" and/or "In-Reply-To"
                         * headers. If both headers exist, take the first thing in the In-Reply-To header
@@ -3797,8 +3426,8 @@ message_info_new_from_header (CamelFolderSummary *summary,
                }
 
                count = g_slist_length (refs);
-               mi->references = g_malloc (sizeof (*mi->references) + ((count - 1) * sizeof 
(mi->references->references[0])));
-               count = 0;
+               references = g_array_sized_new (FALSE, FALSE, sizeof (guint64), count);
+
                for (scan = refs; scan != NULL; scan = g_slist_next (scan)) {
                        GChecksum *checksum;
 
@@ -3807,51 +3436,18 @@ message_info_new_from_header (CamelFolderSummary *summary,
                        g_checksum_get_digest (checksum, digest, &length);
                        g_checksum_free (checksum);
 
-                       memcpy (mi->references->references[count].id.hash, digest, sizeof 
(mi->message_id.id.hash));
-                       count++;
+                       memcpy (message_id.id.hash, digest, sizeof (message_id.id.hash));
+
+                       g_array_append_val (references, message_id.id.id);
                }
-               mi->references->size = count;
                g_slist_free_full (refs, g_free);
-       }
 
-       return (CamelMessageInfo *) mi;
-}
+               camel_message_info_take_references (mi, references);
+       }
 
-static void
-message_info_free (CamelFolderSummary *summary,
-                   CamelMessageInfo *info)
-{
-       CamelFolderSummaryClass *class;
-       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
+       camel_message_info_set_abort_notifications (mi, FALSE);
 
-       if (mi->uid) {
-               if (summary) {
-                       camel_folder_summary_lock (summary);
-                       if (g_hash_table_lookup (summary->priv->loaded_infos, mi->uid) == mi) {
-                               g_hash_table_remove (summary->priv->loaded_infos, mi->uid);
-                       }
-                       camel_folder_summary_unlock (summary);
-               }
-               camel_pstring_free (mi->uid);
-       }
-       camel_pstring_free (mi->subject);
-       camel_pstring_free (mi->from);
-       camel_pstring_free (mi->to);
-       camel_pstring_free (mi->cc);
-       camel_pstring_free (mi->mlist);
-       g_free (mi->bodystructure);
-       g_free (mi->references);
-       g_free (mi->preview);
-       camel_flag_list_free (&mi->user_flags);
-       camel_tag_list_free (&mi->user_tags);
-       if (mi->headers)
-               camel_header_param_list_free (mi->headers);
-
-       if (summary) {
-               class = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary);
-               g_slice_free1 (class->message_info_size, mi);
-       } else
-               g_slice_free (CamelMessageInfoBase, mi);
+       return mi;
 }
 
 static CamelMessageContentInfo *
@@ -3872,21 +3468,6 @@ content_info_new_from_header (CamelFolderSummary *summary,
        return ci;
 }
 
-static void
-content_info_free (CamelFolderSummary *summary,
-                   CamelMessageContentInfo *ci)
-{
-       CamelFolderSummaryClass *class;
-
-       class = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary);
-
-       camel_content_type_unref (ci->type);
-       g_free (ci->id);
-       g_free (ci->description);
-       g_free (ci->encoding);
-       g_slice_free1 (class->content_info_size, ci);
-}
-
 static gchar *
 next_uid_string (CamelFolderSummary *summary)
 {
@@ -4192,325 +3773,6 @@ summary_build_content_info_message (CamelFolderSummary *summary,
        return info;
 }
 
-/**
- * camel_flag_get:
- * @list: the address of a #CamelFlag list
- * @name: name of the flag to get
- *
- * Find the state of the flag @name in @list.
- *
- * Returns: the state of the flag (%TRUE or %FALSE)
- **/
-gboolean
-camel_flag_get (CamelFlag **list,
-                const gchar *name)
-{
-       CamelFlag *flag;
-       flag = *list;
-       while (flag) {
-               if (!strcmp (flag->name, name))
-                       return TRUE;
-               flag = flag->next;
-       }
-       return FALSE;
-}
-
-/**
- * camel_flag_set:
- * @list: the address of a #CamelFlag list
- * @name: name of the flag to set or change
- * @value: the value to set on the flag
- *
- * Set the state of a flag @name in the list @list to @value.
- *
- * Returns: %TRUE if the value of the flag has been changed or %FALSE
- * otherwise
- **/
-gboolean
-camel_flag_set (CamelFlag **list,
-                const gchar *name,
-                gboolean value)
-{
-       CamelFlag *flag, *tmp;
-       gsize tmp_len = 0;
-
-       if (!name)
-               return TRUE;
-
-       /* this 'trick' works because flag->next is the first element */
-       flag = (CamelFlag *) list;
-       while (flag->next) {
-               tmp = flag->next;
-               if (!strcmp (flag->next->name, name)) {
-                       if (!value) {
-                               flag->next = tmp->next;
-                               g_free (tmp);
-                       }
-                       return !value;
-               }
-               flag = tmp;
-       }
-
-       if (value) {
-               tmp_len = sizeof (*tmp) + strlen (name);
-               tmp = g_malloc (tmp_len);
-               g_strlcpy (tmp->name, name, strlen (name) + 1);
-               tmp->next = NULL;
-               flag->next = tmp;
-       }
-       return value;
-}
-
-/**
- * camel_flag_list_size:
- * @list: the address of a #CamelFlag list
- *
- * Get the length of the flag list.
- *
- * Returns: the number of flags in the list
- **/
-gint
-camel_flag_list_size (CamelFlag **list)
-{
-       gint count = 0;
-       CamelFlag *flag;
-
-       flag = *list;
-       while (flag) {
-               count++;
-               flag = flag->next;
-       }
-       return count;
-}
-
-/**
- * camel_flag_list_free:
- * @list: the address of a #CamelFlag list
- *
- * Free the memory associated with the flag list @list.
- **/
-void
-camel_flag_list_free (CamelFlag **list)
-{
-       CamelFlag *flag, *tmp;
-       flag = *list;
-       while (flag) {
-               tmp = flag->next;
-               g_free (flag);
-               flag = tmp;
-       }
-       *list = NULL;
-}
-
-/**
- * camel_flag_list_copy:
- * @to: the address of the #CamelFlag list to copy to
- * @from: the address of the #CamelFlag list to copy from
- *
- * Copy a flag list.
- *
- * Returns: %TRUE if @to is changed or %FALSE otherwise
- **/
-gboolean
-camel_flag_list_copy (CamelFlag **to,
-                      CamelFlag **from)
-{
-       CamelFlag *flag, *tmp;
-       gboolean changed = FALSE;
-
-       if (*to == NULL && from == NULL)
-               return FALSE;
-
-       /* Remove any now-missing flags */
-       flag = (CamelFlag *) to;
-       while (flag->next) {
-               tmp = flag->next;
-               if (!camel_flag_get (from, tmp->name)) {
-                       if (*tmp->name)
-                               changed = TRUE;
-                       flag->next = tmp->next;
-                       g_free (tmp);
-               } else {
-                       flag = tmp;
-               }
-       }
-
-       /* Add any new non-empty flags */
-       flag = *from;
-       while (flag) {
-               if (*flag->name)
-                       changed |= camel_flag_set (to, flag->name, TRUE);
-               flag = flag->next;
-       }
-
-       return changed;
-}
-
-/**
- * camel_tag_get:
- * @list: the address of a #CamelTag list
- * @name: name of the tag to get
- *
- * Find the flag @name in @list and get the value.
- *
- * Returns: the value of the flag  or %NULL if unset
- **/
-const gchar *
-camel_tag_get (CamelTag **list,
-               const gchar *name)
-{
-       CamelTag *tag;
-
-       tag = *list;
-       while (tag) {
-               if (!strcmp (tag->name, name))
-                       return (const gchar *) tag->value;
-               tag = tag->next;
-       }
-       return NULL;
-}
-
-/**
- * camel_tag_set:
- * @list: the address of a #CamelTag list
- * @name: name of the tag to set
- * @value: value to set on the tag
- *
- * Set the tag @name in the tag list @list to @value.
- *
- * Returns: %TRUE if the value on the tag changed or %FALSE otherwise
- **/
-gboolean
-camel_tag_set (CamelTag **list,
-               const gchar *name,
-               const gchar *value)
-{
-       CamelTag *tag, *tmp;
-
-       /* this 'trick' works because tag->next is the first element */
-       tag = (CamelTag *) list;
-       while (tag->next) {
-               tmp = tag->next;
-               if (!strcmp (tmp->name, name)) {
-                       if (value == NULL) { /* clear it? */
-                               tag->next = tmp->next;
-                               g_free (tmp->value);
-                               g_free (tmp);
-                               return TRUE;
-                       } else if (strcmp (tmp->value, value)) { /* has it changed? */
-                               g_free (tmp->value);
-                               tmp->value = g_strdup (value);
-                               return TRUE;
-                       }
-                       return FALSE;
-               }
-               tag = tmp;
-       }
-
-       if (value) {
-               tmp = g_malloc (sizeof (*tmp) + strlen (name));
-               g_strlcpy (tmp->name, name, strlen (name) + 1);
-               tmp->value = g_strdup (value);
-               tmp->next = NULL;
-               tag->next = tmp;
-               return TRUE;
-       }
-       return FALSE;
-}
-
-/**
- * camel_tag_list_size:
- * @list: the address of a #CamelTag list
- *
- * Get the number of tags present in the tag list @list.
- *
- * Returns: the number of tags
- **/
-gint
-camel_tag_list_size (CamelTag **list)
-{
-       gint count = 0;
-       CamelTag *tag;
-
-       tag = *list;
-       while (tag) {
-               count++;
-               tag = tag->next;
-       }
-       return count;
-}
-
-static void
-rem_tag (gchar *key,
-         gchar *value,
-         CamelTag **to)
-{
-       camel_tag_set (to, key, NULL);
-}
-
-/**
- * camel_tag_list_copy:
- * @to: the address of the #CamelTag list to copy to
- * @from: the address of the #CamelTag list to copy from
- *
- * Copy a tag list.
- *
- * Returns: %TRUE if @to is changed or %FALSE otherwise
- **/
-gboolean
-camel_tag_list_copy (CamelTag **to,
-                     CamelTag **from)
-{
-       gint changed = FALSE;
-       CamelTag *tag;
-       GHashTable *left;
-
-       if (*to == NULL && from == NULL)
-               return FALSE;
-
-       left = g_hash_table_new (g_str_hash, g_str_equal);
-       tag = *to;
-       while (tag) {
-               g_hash_table_insert (left, tag->name, tag);
-               tag = tag->next;
-       }
-
-       tag = *from;
-       while (tag) {
-               changed |= camel_tag_set (to, tag->name, tag->value);
-               g_hash_table_remove (left, tag->name);
-               tag = tag->next;
-       }
-
-       if (g_hash_table_size (left) > 0) {
-               g_hash_table_foreach (left, (GHFunc) rem_tag, to);
-               changed = TRUE;
-       }
-       g_hash_table_destroy (left);
-
-       return changed;
-}
-
-/**
- * camel_tag_list_free:
- * @list: the address of a #CamelTag list
- *
- * Free the tag list @list.
- **/
-void
-camel_tag_list_free (CamelTag **list)
-{
-       CamelTag *tag, *tmp;
-       tag = *list;
-       while (tag) {
-               tmp = tag->next;
-               g_free (tag->value);
-               g_free (tag);
-               tag = tmp;
-       }
-       *list = NULL;
-}
-
 static struct flag_names_t {
        const gchar *name;
        guint32 value;
@@ -4566,59 +3828,6 @@ camel_system_flag_get (CamelMessageFlags flags,
 }
 
 /**
- * camel_message_info_new:
- * @summary: (nullable): a #CamelFolderSummary object or %NULL
- *
- * Create a new #CamelMessageInfo.
- *
- * Returns: (transfer full) (type CamelMessageInfo): a new #CamelMessageInfo
- **/
-gpointer
-camel_message_info_new (CamelFolderSummary *summary)
-{
-       CamelFolderSummaryClass *class;
-       CamelMessageInfo *info;
-       gsize message_info_size;
-
-       if (summary != NULL) {
-               class = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary);
-               g_return_val_if_fail (class->message_info_size > 0, NULL);
-               message_info_size = class->message_info_size;
-       } else {
-               message_info_size = sizeof (CamelMessageInfoBase);
-       }
-
-       info = g_slice_alloc0 (message_info_size);
-       info->refcount = 1;
-       info->summary = summary;
-
-       /* We assume that mi is always dirty unless freshly read or just saved*/
-       ((CamelMessageInfoBase *) info)->dirty = TRUE;
-
-       return info;
-}
-
-/**
- * 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
@@ -4633,565 +3842,11 @@ camel_message_info_new_from_header (CamelFolderSummary *summary,
                                     struct _camel_header_raw *header)
 {
        if (summary != NULL)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->
-                       message_info_new_from_header (summary, header);
+               return CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->message_info_new_from_header (summary, 
header);
        else
                return message_info_new_from_header (NULL, header);
 }
 
-/**
- * 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
- *
- * Duplicate a #CamelMessageInfo.
- *
- * Returns: (transfer full) (type CamelMessageInfo): the duplicated #CamelMessageInfo
- **/
-gpointer
-camel_message_info_clone (gconstpointer o)
-{
-       const CamelMessageInfo *mi = o;
-
-       if (mi->summary)
-               return CAMEL_FOLDER_SUMMARY_GET_CLASS (mi->summary)->message_info_clone (mi->summary, mi);
-       else
-               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)
@@ -5228,24 +3883,6 @@ camel_content_info_dump (CamelMessageContentInfo *ci,
        }
 }
 
-void
-camel_message_info_dump (CamelMessageInfo *info)
-{
-       if (info == NULL) {
-               printf ("No message?\n");
-               return;
-       }
-
-       printf ("Subject: %s\n", camel_message_info_get_subject (info));
-       printf ("To: %s\n", camel_message_info_get_to (info));
-       printf ("Cc: %s\n", camel_message_info_get_cc (info));
-       printf ("mailing list: %s\n", camel_message_info_get_mlist (info));
-       printf ("From: %s\n", camel_message_info_get_from (info));
-       printf ("UID: %s\n", camel_message_info_get_uid (info));
-       printf ("Flags: %04x\n", camel_message_info_get_flags (info));
-       camel_content_info_dump (((CamelMessageInfoBase *) info)->content, 0);
-}
-
 /**
  * camel_folder_summary_lock:
  * @summary: a #CamelFolderSummary
@@ -5277,47 +3914,3 @@ camel_folder_summary_unlock (CamelFolderSummary *summary)
 
        g_rec_mutex_unlock (&summary->priv->summary_lock);
 }
-
-gint
-bdata_extract_digit (/* const */ gchar **part)
-{
-       if (!part || !*part || !**part)
-               return 0;
-
-       if (**part == ' ')
-               *part += 1;
-
-       if (!**part)
-               return 0;
-
-       return strtoul (*part, part, 10);
-}
-
-/* expecting "digit-value", where digit is length of the value */
-gchar *
-bdata_extract_string (/* const */ gchar **part)
-{
-       gint len, has_len;
-       gchar *val;
-
-       len = bdata_extract_digit (part);
-
-       /* might be a '-' sign */
-       if (part && *part && **part)
-               *part += 1;
-
-       if (len <= 0 || !part || !*part || !**part)
-               return g_strdup ("");
-
-       if (!**part)
-               return g_strdup ("");
-
-       has_len = strlen (*part);
-       if (has_len < len)
-               len = has_len;
-
-       val = g_strndup (*part, len);
-       *part += len;
-
-       return val;
-}
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 7462190..3ca1e1a 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -60,9 +60,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,94 +77,6 @@ struct _CamelMessageContentInfo {
        guint32 size;
 };
 
-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;
-
-/* 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:
@@ -205,10 +114,6 @@ struct _CamelFolderSummaryClass {
 
        GType message_info_type;
 
-       /* sizes of memory objects */
-       gsize message_info_size;
-       gsize content_info_size;
-
        /* Load/Save folder summary from DB*/
        gboolean        (*summary_header_from_db)
                                        (CamelFolderSummary *summary,
@@ -217,14 +122,7 @@ struct _CamelFolderSummaryClass {
                        (*summary_header_to_db)
                                        (CamelFolderSummary *summary,
                                         GError **error);
-       CamelMessageInfo *
-                       (*message_info_from_db)
-                                       (CamelFolderSummary *summary,
-                                        struct _CamelMIRecord *mir);
-       struct _CamelMIRecord *
-                       (*message_info_to_db)
-                                       (CamelFolderSummary *summary,
-                                        CamelMessageInfo *info);
+
        CamelMessageContentInfo *
                        (*content_info_from_db)
                                        (CamelFolderSummary *summary,
@@ -248,13 +146,6 @@ struct _CamelFolderSummaryClass {
                                        (CamelFolderSummary *summary,
                                         CamelMimeMessage *message,
                                         const gchar *bodystructure);
-       void            (*message_info_free)
-                                       (CamelFolderSummary *summary,
-                                        CamelMessageInfo *ci);
-       CamelMessageInfo *
-                       (*message_info_clone)
-                                       (CamelFolderSummary *summary,
-                                        const CamelMessageInfo *info);
 
        /* save/load individual content info's */
        CamelMessageContentInfo *
@@ -269,9 +160,6 @@ struct _CamelFolderSummaryClass {
                        (*content_info_new_from_message)
                                        (CamelFolderSummary *summary,
                                         CamelMimePart *mime_part);
-       void            (*content_info_free)
-                                       (CamelFolderSummary *summary,
-                                        CamelMessageContentInfo *ci);
        CamelMessageInfo *
                        (*message_info_from_uid)
                                        (CamelFolderSummary *summary,
@@ -281,34 +169,8 @@ struct _CamelFolderSummaryClass {
        gchar *         (*next_uid_string)
                                        (CamelFolderSummary *summary);
 
-       /* virtual accessors on messageinfo's */
-       gconstpointer   (*info_ptr)     (const CamelMessageInfo *info,
-                                        gint id);
-       guint32         (*info_uint32)  (const CamelMessageInfo *info,
-                                        gint id);
-       time_t          (*info_time)    (const CamelMessageInfo *info,
-                                        gint id);
-
-       gboolean        (*info_user_flag)
-                                       (const CamelMessageInfo *info,
-                                        const gchar *id);
-       const gchar *   (*info_user_tag)
-                                       (const CamelMessageInfo *info,
-                                        const gchar *id);
-
-       /* set accessors for the modifyable bits */
-       gboolean        (*info_set_user_flag)
-                                       (CamelMessageInfo *info,
-                                        const gchar *id,
-                                        gboolean state);
-       gboolean        (*info_set_user_tag)
-                                       (CamelMessageInfo *info,
-                                        const gchar *id,
-                                        const gchar *val);
-       gboolean        (*info_set_flags)
-                                       (CamelMessageInfo *info,
-                                        guint32 mask,
-                                        guint32 set);
+       /* Padding for future expansion */
+       gpointer reserved[20];
 };
 
 GType          camel_folder_summary_get_type   (void);
@@ -459,133 +321,18 @@ 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);
-void           camel_message_info_dump         (CamelMessageInfo *info);
-
-/* utility functions for bdata string decomposition */
-gint           bdata_extract_digit             (gchar **part);
-gchar *                bdata_extract_string            (gchar **part);
 
 G_END_DECLS
 
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
index 642a197..c07c429 100644
--- a/camel/camel-folder-thread.c
+++ b/camel/camel-folder-thread.c
@@ -374,12 +374,16 @@ dump_tree_rec (struct _tree_info *info,
                        g_hash_table_insert (info->visited, c, c);
                }
                if (c->message) {
+                       CamelSummaryMessageID message_id;
+
+                       message_id.id.id = camel_message_info_get_message_id (c->message);
+
                        printf (
                                "%s %p Subject: %s <%08x%08x>\n",
                                p, (gpointer) c,
                                camel_message_info_get_subject (c->message),
-                               camel_message_info_get_message_id (c->message)->id.part.hi,
-                               camel_message_info_get_message_id (c->message)->id.part.lo);
+                               message_id.id.part.hi,
+                               message_id.id.part.lo);
                        count += 1;
                } else {
                        printf ("%s %p <empty>\n", p, (gpointer) c);
@@ -464,18 +468,18 @@ sort_thread (CamelFolderThreadNode **cp)
 }
 
 static guint
-id_hash (gpointer key)
+id_hash (gconstpointer key)
 {
-       CamelSummaryMessageID *id = (CamelSummaryMessageID *) key;
+       const CamelSummaryMessageID *id = key;
 
        return id->id.part.lo;
 }
 
-static gint
-id_equal (gpointer a,
-          gpointer b)
+static gboolean
+id_equal (gconstpointer a,
+          gconstpointer b)
 {
-       return ((CamelSummaryMessageID *) a)->id.id == ((CamelSummaryMessageID *) b)->id.id;
+       return ((const CamelSummaryMessageID *) a)->id.id == ((const CamelSummaryMessageID *) b)->id.id;
 }
 
 /* perform actual threading */
@@ -493,15 +497,20 @@ thread_summary (CamelFolderThread *thread,
        gettimeofday (&start, NULL);
 #endif
 
-       id_table = g_hash_table_new ((GHashFunc) id_hash, (GCompareFunc) id_equal);
+       id_table = g_hash_table_new_full (id_hash, id_equal, g_free, NULL);
        no_id_table = g_hash_table_new (NULL, NULL);
        for (i = 0; i < summary->len; i++) {
                CamelMessageInfo *mi = summary->pdata[i];
-               const CamelSummaryMessageID *mid = camel_message_info_get_message_id (mi);
-               const CamelSummaryReferences *references = camel_message_info_get_references (mi);
+               CamelSummaryMessageID *message_id_copy, message_id;
+               const GArray *references;
+
+               camel_message_info_property_lock (mi);
 
-               if (mid != NULL && mid->id.id) {
-                       c = g_hash_table_lookup (id_table, mid);
+               message_id.id.id = camel_message_info_get_message_id (mi);
+               references = camel_message_info_get_references (mi);
+
+               if (message_id.id.id) {
+                       c = g_hash_table_lookup (id_table, &message_id);
                        /* check for duplicate messages */
                        if (c && c->order) {
                                /* if duplicate, just make out it is a no-id message,  but try and insert it
@@ -510,9 +519,11 @@ thread_summary (CamelFolderThread *thread,
                                c = camel_memchunk_alloc0 (thread->node_chunks);
                                g_hash_table_insert (no_id_table, (gpointer) mi, c);
                        } else if (!c) {
-                               d (printf ("doing : %08x%08x (%s)\n", mid->id.part.hi, mid->id.part.lo, 
camel_message_info_get_subject (mi)));
+                               d (printf ("doing : %08x%08x (%s)\n", message_id.id.part.hi, 
message_id.id.part.lo, camel_message_info_get_subject (mi)));
                                c = camel_memchunk_alloc0 (thread->node_chunks);
-                               g_hash_table_insert (id_table, (gpointer) mid, c);
+                               message_id_copy = g_new0 (CamelSummaryMessageID, 1);
+                               message_id_copy->id.id = message_id.id.id;
+                               g_hash_table_insert (id_table, message_id_copy, c);
                        }
                } else {
                        d (printf ("doing : (no message id)\n"));
@@ -524,21 +535,26 @@ thread_summary (CamelFolderThread *thread,
                c->order = i + 1;
                child = c;
                if (references) {
-                       gint j;
+                       guint jj;
 
                        d (printf ("%s (%s) references:\n", G_STRLOC, G_STRFUNC); )
-                       for (j = 0; j < references->size; j++) {
+
+                       for (jj = 0; jj < references->len; jj++) {
                                gboolean found = FALSE;
 
+                               message_id.id.id = g_array_index (references, guint64, jj);
+
                                /* should never be empty, but just incase */
-                               if (references->references[j].id.id == 0)
+                               if (!message_id.id.id)
                                        continue;
 
-                               c = g_hash_table_lookup (id_table, &references->references[j]);
+                               c = g_hash_table_lookup (id_table, &message_id);
                                if (c == NULL) {
                                        d (printf ("%s (%s) not found\n", G_STRLOC, G_STRFUNC));
                                        c = camel_memchunk_alloc0 (thread->node_chunks);
-                                       g_hash_table_insert (id_table, (gpointer) &references->references[j], 
c);
+                                       message_id_copy = g_new0 (CamelSummaryMessageID, 1);
+                                       message_id_copy->id.id = message_id.id.id;
+                                       g_hash_table_insert (id_table, message_id_copy, c);
                                } else
                                        found = TRUE;
                                if (c != child) {
@@ -552,6 +568,8 @@ thread_summary (CamelFolderThread *thread,
                                child = c;
                        }
                }
+
+               camel_message_info_property_unlock (mi);
        }
 
        d (printf ("\n\n"));
@@ -715,7 +733,7 @@ add_present_rec (CamelFolderThread *thread,
                        g_hash_table_remove (have, uid);
                        g_ptr_array_add (summary, info);
                } else {
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
 
                if (node->child)
@@ -784,7 +802,7 @@ camel_folder_thread_messages_unref (CamelFolderThread *thread)
                gint i;
 
                for (i = 0; i < thread->summary->len; i++)
-                       camel_message_info_unref (thread->summary->pdata[i]);
+                       g_clear_object (&thread->summary->pdata[i]);
                g_ptr_array_free (thread->summary, TRUE);
                g_object_unref (thread->folder);
        }
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index c9a3a71..19ba5e2 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -137,7 +137,7 @@ async_context_free (AsyncContext *async_context)
                g_object_unref (async_context->message);
 
        if (async_context->info != NULL)
-               camel_message_info_unref (async_context->info);
+               g_clear_object (&async_context->info);
 
        if (async_context->destination != NULL)
                g_object_unref (async_context->destination);
@@ -301,7 +301,7 @@ folder_filter (CamelSession *session,
                                continue;
 
                        camel_message_info_set_flags (info, CAMEL_MESSAGE_JUNK_LEARN, 0);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
        }
 
@@ -312,7 +312,7 @@ folder_filter (CamelSession *session,
                                continue;
 
                        camel_message_info_set_flags (info, CAMEL_MESSAGE_JUNK_LEARN, 0);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
        }
 
@@ -446,7 +446,7 @@ folder_filter (CamelSession *session,
                                data->driver, NULL, info, uid, data->folder,
                                store_uid, store_uid, cancellable, error);
 
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
 
                camel_operation_pop_message (cancellable);
@@ -495,8 +495,8 @@ folder_transfer_message_to (CamelFolder *source,
        /* if its deleted we poke the flags, so we need to copy the messageinfo */
        if ((source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY)
                        && (minfo = camel_folder_get_message_info (source, uid))) {
-               info = camel_message_info_clone (minfo);
-               camel_message_info_unref (minfo);
+               info = camel_message_info_clone (minfo, NULL);
+               g_clear_object (&minfo);
        } else
                info = camel_message_info_new_from_header (NULL, ((CamelMimePart *) msg)->headers);
 
@@ -519,7 +519,7 @@ folder_transfer_message_to (CamelFolder *source,
                        source, uid, CAMEL_MESSAGE_DELETED |
                        CAMEL_MESSAGE_SEEN, ~0);
 
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 }
 
 static gboolean
@@ -708,18 +708,18 @@ folder_get_message_count (CamelFolder *folder)
        return camel_folder_summary_count (folder->summary);
 }
 
-static CamelMessageFlags
+static guint32
 folder_get_permanent_flags (CamelFolder *folder)
 {
        return folder->permanent_flags;
 }
 
-static CamelMessageFlags
+static guint32
 folder_get_message_flags (CamelFolder *folder,
                           const gchar *uid)
 {
        CamelMessageInfo *info;
-       CamelMessageFlags flags;
+       guint32 flags;
 
        g_return_val_if_fail (folder->summary != NULL, 0);
 
@@ -728,7 +728,7 @@ folder_get_message_flags (CamelFolder *folder,
                return 0;
 
        flags = camel_message_info_get_flags (info);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 
        return flags;
 }
@@ -736,8 +736,8 @@ folder_get_message_flags (CamelFolder *folder,
 static gboolean
 folder_set_message_flags (CamelFolder *folder,
                           const gchar *uid,
-                          CamelMessageFlags flags,
-                          CamelMessageFlags set)
+                          guint32 mask,
+                          guint32 set)
 {
        CamelMessageInfo *info;
        gint res;
@@ -748,8 +748,8 @@ folder_set_message_flags (CamelFolder *folder,
        if (info == NULL)
                return FALSE;
 
-       res = camel_message_info_set_flags (info, flags, set);
-       camel_message_info_unref (info);
+       res = camel_message_info_set_flags (info, mask, set);
+       g_clear_object (&info);
 
        return res;
 }
@@ -769,7 +769,7 @@ folder_get_message_user_flag (CamelFolder *folder,
                return FALSE;
 
        ret = camel_message_info_get_user_flag (info, name);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 
        return ret;
 }
@@ -789,7 +789,7 @@ folder_set_message_user_flag (CamelFolder *folder,
                return;
 
        camel_message_info_set_user_flag (info, name, value);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 }
 
 static const gchar *
@@ -807,7 +807,7 @@ folder_get_message_user_tag (CamelFolder *folder,
                return NULL;
 
        ret = camel_message_info_get_user_tag (info, name);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 
        return ret;
 }
@@ -827,7 +827,7 @@ folder_set_message_user_tag (CamelFolder *folder,
                return;
 
        camel_message_info_set_user_tag (info, name, value);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 }
 
 static GPtrArray *
@@ -1115,7 +1115,7 @@ folder_changed (CamelFolder *folder,
        junk_filter = camel_session_get_junk_filter (session);
 
        if (junk_filter != NULL && info->uid_changed->len) {
-               CamelMessageFlags flags;
+               guint32 flags;
 
                for (i = 0; i < info->uid_changed->len; i++) {
                        flags = camel_folder_summary_get_info_flags (folder->summary, 
info->uid_changed->pdata[i]);
@@ -1706,7 +1706,7 @@ camel_folder_get_deleted_message_count (CamelFolder *folder)
  * stored on a message between sessions. If it includes
  * #CAMEL_FLAG_USER, then user-defined flags will be remembered.
  **/
-CamelMessageFlags
+guint32
 camel_folder_get_permanent_flags (CamelFolder *folder)
 {
        CamelFolderClass *class;
@@ -1729,7 +1729,7 @@ camel_folder_get_permanent_flags (CamelFolder *folder)
  * Returns: the #CamelMessageFlags that are set on the indicated
  * message.
  **/
-CamelMessageFlags
+guint32
 camel_folder_get_message_flags (CamelFolder *folder,
                                 const gchar *uid)
 {
@@ -1748,10 +1748,10 @@ camel_folder_get_message_flags (CamelFolder *folder,
  * camel_folder_set_message_flags:
  * @folder: a #CamelFolder
  * @uid: the UID of a message in @folder
- * @flags: a set of #CamelMessageFlag values to set
- * @set: the mask of values in @flags to use.
+ * @mask: a mask of #CamelMessageFlag bit-or values to use
+ * @set: the flags to ser, also bit-or of #CamelMessageFlag
  *
- * Sets those flags specified by @flags to the values specified by @set
+ * Sets those flags specified by @mask to the values specified by @set
  * on the indicated message. (This may or may not persist after the
  * folder or store is closed. See camel_folder_get_permanent_flags())
  *
@@ -1766,8 +1766,8 @@ camel_folder_get_message_flags (CamelFolder *folder,
 gboolean
 camel_folder_set_message_flags (CamelFolder *folder,
                                 const gchar *uid,
-                                CamelMessageFlags flags,
-                                CamelMessageFlags set)
+                                guint32 mask,
+                                guint32 set)
 {
        CamelFolderClass *class;
 
@@ -1777,12 +1777,7 @@ camel_folder_set_message_flags (CamelFolder *folder,
        class = CAMEL_FOLDER_GET_CLASS (folder);
        g_return_val_if_fail (class->set_message_flags != NULL, FALSE);
 
-       if ((flags & (CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN)) == CAMEL_MESSAGE_JUNK) {
-               flags |= CAMEL_MESSAGE_JUNK_LEARN;
-               set &= ~CAMEL_MESSAGE_JUNK_LEARN;
-       }
-
-       return class->set_message_flags (folder, uid, flags, set);
+       return class->set_message_flags (folder, uid, mask, set);
 }
 
 /**
@@ -1912,11 +1907,11 @@ camel_folder_set_message_user_tag (CamelFolder *folder,
  * @folder: a #CamelFolder
  * @uid: the uid of a message
  *
- * Retrieve the #CamelMessageInfo for the specified @uid.  This return
- * must be freed using camel_message_info_unref().
+ * Retrieve the #CamelMessageInfo for the specified @uid.
  *
- * Returns: the summary information for the indicated message, or %NULL
- * if the uid does not exist
+ * Returns: (transfer full): The summary information for the indicated message, or %NULL
+ *   if the uid does not exist. Free the returned object with g_object_unref(),
+ *   when done with it.
  **/
 CamelMessageInfo *
 camel_folder_get_message_info (CamelFolder *folder,
@@ -2809,7 +2804,7 @@ camel_folder_append_message (CamelFolder *folder,
 
        async_context = g_slice_new0 (AsyncContext);
        async_context->message = g_object_ref (message);
-       async_context->info = camel_message_info_ref (info);
+       async_context->info = g_object_ref (info);
 
        task = g_task_new (folder, cancellable, callback, user_data);
        g_task_set_source_tag (task, camel_folder_append_message);
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index df2cdbb..70d7898 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -125,7 +125,7 @@ struct _CamelFolder {
        CamelFolderSummary *summary;
 
        CamelFolderFlags folder_flags;
-       CamelMessageFlags permanent_flags;
+       guint32 permanent_flags; /* bit-or of CamelMessageFlags */
 
        /* Future ABI expansion */
        gpointer later[4];
@@ -136,15 +136,13 @@ struct _CamelFolderClass {
 
        /* Non-Blocking Methods */
        gint            (*get_message_count)    (CamelFolder *folder);
-       CamelMessageFlags
-                       (*get_permanent_flags)  (CamelFolder *folder);
-       CamelMessageFlags
-                       (*get_message_flags)    (CamelFolder *folder,
+       guint32         (*get_permanent_flags)  (CamelFolder *folder);
+       guint32         (*get_message_flags)    (CamelFolder *folder,
                                                 const gchar *uid);
        gboolean        (*set_message_flags)    (CamelFolder *folder,
                                                 const gchar *uid,
-                                                CamelMessageFlags flags,
-                                                CamelMessageFlags set);
+                                                guint32 mask,
+                                                guint32 set);
        gboolean        (*get_message_user_flag)(CamelFolder *folder,
                                                 const gchar *uid,
                                                 const gchar *name);
@@ -283,17 +281,15 @@ const gchar *     camel_folder_get_description    (CamelFolder *folder);
 gchar *                camel_folder_dup_description    (CamelFolder *folder);
 void           camel_folder_set_description    (CamelFolder *folder,
                                                 const gchar *description);
-CamelMessageFlags
-               camel_folder_get_permanent_flags
+guint32                camel_folder_get_permanent_flags
                                                (CamelFolder *folder);
 #ifndef CAMEL_DISABLE_DEPRECATED
-CamelMessageFlags
-               camel_folder_get_message_flags  (CamelFolder *folder,
+guint32                camel_folder_get_message_flags  (CamelFolder *folder,
                                                 const gchar *uid);
 gboolean       camel_folder_set_message_flags  (CamelFolder *folder,
                                                 const gchar *uid,
-                                                CamelMessageFlags flags,
-                                                CamelMessageFlags set);
+                                                guint32 mask,
+                                                guint32 set);
 gboolean       camel_folder_get_message_user_flag
                                                (CamelFolder *folder,
                                                 const gchar *uid,
diff --git a/camel/camel-message-info-base.c b/camel/camel-message-info-base.c
index ddeb031..bc214a1 100644
--- a/camel/camel-message-info-base.c
+++ b/camel/camel-message-info-base.c
@@ -26,7 +26,7 @@
 
 #include "camel-message-info-base.h"
 
-struct _xCamelMessageInfoBasePrivate {
+struct _CamelMessageInfoBasePrivate {
        guint32 flags;          /* bit-or of CamelMessageFlags */
        CamelNamedFlags *user_flags;
        CamelNameValueArray *user_tags;
@@ -44,79 +44,79 @@ struct _xCamelMessageInfoBasePrivate {
        CamelNameValueArray *headers;
 };
 
-G_DEFINE_TYPE (xCamelMessageInfoBase, xcamel_message_info_base, XCAMEL_TYPE_MESSAGE_INFO)
+G_DEFINE_TYPE (CamelMessageInfoBase, camel_message_info_base, CAMEL_TYPE_MESSAGE_INFO)
 
 static guint32
-message_info_base_get_flags (const xCamelMessageInfo *mi)
+message_info_base_get_flags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        guint32 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->flags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_flags (xCamelMessageInfo *mi,
-                            CamelMessageFlags mask,
+message_info_base_set_flags (CamelMessageInfo *mi,
+                            guint32 mask,
                             guint32 set)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        guint32 old_flags;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        old_flags = bmi->priv->flags;
        bmi->priv->flags = (old_flags & ~mask) | (set & mask);
        changed = old_flags != bmi->priv->flags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static gboolean
-message_info_base_get_user_flag (const xCamelMessageInfo *mi,
+message_info_base_get_user_flag (const CamelMessageInfo *mi,
                                 const gchar *name)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = camel_named_flags_contains (bmi->priv->user_flags, name);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_user_flag (xCamelMessageInfo *mi,
+message_info_base_set_user_flag (CamelMessageInfo *mi,
                                 const gchar *name,
                                 gboolean state)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
        g_return_val_if_fail (name != NULL, FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        if (!bmi->priv->user_flags)
                bmi->priv->user_flags = camel_named_flags_new ();
 
@@ -124,60 +124,60 @@ message_info_base_set_user_flag (xCamelMessageInfo *mi,
                changed = camel_named_flags_insert (bmi->priv->user_flags, name);
        else
                changed = camel_named_flags_remove (bmi->priv->user_flags, name);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const CamelNamedFlags *
-message_info_base_get_user_flags (const xCamelMessageInfo *mi)
+message_info_base_get_user_flags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const CamelNamedFlags *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->user_flags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static CamelNamedFlags *
-message_info_base_dup_user_flags (const xCamelMessageInfo *mi)
+message_info_base_dup_user_flags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        CamelNamedFlags *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        if (bmi->priv->user_flags)
                result = camel_named_flags_copy (bmi->priv->user_flags);
        else
                result = NULL;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_take_user_flags (xCamelMessageInfo *mi,
+message_info_base_take_user_flags (CamelMessageInfo *mi,
                                   CamelNamedFlags *user_flags)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = !camel_named_flags_equal (bmi->priv->user_flags, user_flags);
 
@@ -188,99 +188,99 @@ message_info_base_take_user_flags (xCamelMessageInfo *mi,
                camel_named_flags_free (user_flags);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_user_tag (const xCamelMessageInfo *mi,
+message_info_base_get_user_tag (const CamelMessageInfo *mi,
                                const gchar *name)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
        g_return_val_if_fail (name != NULL, NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = camel_name_value_array_get_named (bmi->priv->user_tags, TRUE, name);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_user_tag (xCamelMessageInfo *mi,
+message_info_base_set_user_tag (CamelMessageInfo *mi,
                                const gchar *name,
                                const gchar *value)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
        g_return_val_if_fail (name != NULL, FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        if (value)
                changed = camel_name_value_array_set_named (bmi->priv->user_tags, TRUE, name, value);
        else
                changed = camel_name_value_array_remove_named (bmi->priv->user_tags, TRUE, name, FALSE);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const CamelNameValueArray *
-message_info_base_get_user_tags (const xCamelMessageInfo *mi)
+message_info_base_get_user_tags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->user_tags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static CamelNameValueArray *
-message_info_base_dup_user_tags (const xCamelMessageInfo *mi)
+message_info_base_dup_user_tags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = camel_name_value_array_copy (bmi->priv->user_tags);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_take_user_tags (xCamelMessageInfo *mi,
+message_info_base_take_user_tags (CamelMessageInfo *mi,
                                  CamelNameValueArray *user_tags)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = !camel_name_value_array_equal (bmi->priv->user_tags, user_tags, TRUE);
 
@@ -291,40 +291,40 @@ message_info_base_take_user_tags (xCamelMessageInfo *mi,
                camel_name_value_array_free (user_tags);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_subject (const xCamelMessageInfo *mi)
+message_info_base_get_subject (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->subject;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_subject (xCamelMessageInfo *mi,
+message_info_base_set_subject (CamelMessageInfo *mi,
                               const gchar *subject)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (bmi->priv->subject, subject) != 0;
 
@@ -333,40 +333,40 @@ message_info_base_set_subject (xCamelMessageInfo *mi,
                bmi->priv->subject = g_strdup (subject);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_preview (const xCamelMessageInfo *mi)
+message_info_base_get_preview (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->preview;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_preview (xCamelMessageInfo *mi,
+message_info_base_set_preview (CamelMessageInfo *mi,
                               const gchar *preview)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (bmi->priv->preview, preview) != 0;
 
@@ -375,40 +375,40 @@ message_info_base_set_preview (xCamelMessageInfo *mi,
                bmi->priv->preview = g_strdup (preview);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_from (const xCamelMessageInfo *mi)
+message_info_base_get_from (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->from;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_from (xCamelMessageInfo *mi,
+message_info_base_set_from (CamelMessageInfo *mi,
                            const gchar *from)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (bmi->priv->from, from) != 0;
 
@@ -417,40 +417,40 @@ message_info_base_set_from (xCamelMessageInfo *mi,
                bmi->priv->from = g_strdup (from);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_to (const xCamelMessageInfo *mi)
+message_info_base_get_to (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->to;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_to (xCamelMessageInfo *mi,
+message_info_base_set_to (CamelMessageInfo *mi,
                          const gchar *to)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (bmi->priv->to, to) != 0;
 
@@ -459,40 +459,40 @@ message_info_base_set_to (xCamelMessageInfo *mi,
                bmi->priv->to = g_strdup (to);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_cc (const xCamelMessageInfo *mi)
+message_info_base_get_cc (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->cc;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_cc (xCamelMessageInfo *mi,
+message_info_base_set_cc (CamelMessageInfo *mi,
                          const gchar *cc)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (bmi->priv->cc, cc) != 0;
 
@@ -501,40 +501,40 @@ message_info_base_set_cc (xCamelMessageInfo *mi,
                bmi->priv->cc = g_strdup (cc);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const gchar *
-message_info_base_get_mlist (const xCamelMessageInfo *mi)
+message_info_base_get_mlist (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->mlist;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_mlist (xCamelMessageInfo *mi,
+message_info_base_set_mlist (CamelMessageInfo *mi,
                             const gchar *mlist)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (bmi->priv->mlist, mlist) != 0;
 
@@ -543,184 +543,184 @@ message_info_base_set_mlist (xCamelMessageInfo *mi,
                bmi->priv->mlist = g_strdup (mlist);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static guint32
-message_info_base_get_size (const xCamelMessageInfo *mi)
+message_info_base_get_size (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        guint32 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->size;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_size (xCamelMessageInfo *mi,
+message_info_base_set_size (CamelMessageInfo *mi,
                            guint32 size)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = bmi->priv->size != size;
 
        if (changed)
                bmi->priv->size = size;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static gint64
-message_info_base_get_date_sent (const xCamelMessageInfo *mi)
+message_info_base_get_date_sent (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gint64 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->date_sent;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_date_sent (xCamelMessageInfo *mi,
+message_info_base_set_date_sent (CamelMessageInfo *mi,
                                 gint64 date_sent)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = bmi->priv->date_sent != date_sent;
 
        if (changed)
                bmi->priv->date_sent = date_sent;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static gint64
-message_info_base_get_date_received (const xCamelMessageInfo *mi)
+message_info_base_get_date_received (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gint64 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->date_received;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_date_received (xCamelMessageInfo *mi,
+message_info_base_set_date_received (CamelMessageInfo *mi,
                                     gint64 date_received)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = bmi->priv->date_received != date_received;
 
        if (changed)
                bmi->priv->date_received = date_received;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static guint64
-message_info_base_get_message_id (const xCamelMessageInfo *mi)
+message_info_base_get_message_id (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        guint64 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), 0);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->message_id;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_set_message_id (xCamelMessageInfo *mi,
+message_info_base_set_message_id (CamelMessageInfo *mi,
                                  guint64 message_id)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = bmi->priv->message_id != message_id;
 
        if (changed)
                bmi->priv->message_id = message_id;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const GArray *
-message_info_base_get_references (const xCamelMessageInfo *mi)
+message_info_base_get_references (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const GArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->references;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
@@ -752,17 +752,17 @@ message_info_base_references_equal (const GArray *references_a,
 }
 
 static gboolean
-message_info_base_take_references (xCamelMessageInfo *mi,
+message_info_base_take_references (CamelMessageInfo *mi,
                                   GArray *references)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = !message_info_base_references_equal (bmi->priv->references, references);
 
@@ -774,40 +774,40 @@ message_info_base_take_references (xCamelMessageInfo *mi,
                g_array_unref (references);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
 
 static const CamelNameValueArray *
-message_info_base_get_headers (const xCamelMessageInfo *mi)
+message_info_base_get_headers (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        const CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), NULL);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = bmi->priv->headers;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 static gboolean
-message_info_base_take_headers (xCamelMessageInfo *mi,
+message_info_base_take_headers (CamelMessageInfo *mi,
                                CamelNameValueArray *headers)
 {
-       xCamelMessageInfoBase *bmi;
+       CamelMessageInfoBase *bmi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO_BASE (mi), FALSE);
 
-       bmi = XCAMEL_MESSAGE_INFO_BASE (mi);
+       bmi = CAMEL_MESSAGE_INFO_BASE (mi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = !camel_name_value_array_equal (bmi->priv->headers, headers, TRUE);
 
@@ -818,7 +818,7 @@ message_info_base_take_headers (xCamelMessageInfo *mi,
                camel_name_value_array_free (headers);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return changed;
 }
@@ -826,7 +826,7 @@ message_info_base_take_headers (xCamelMessageInfo *mi,
 static void
 message_info_base_dispose (GObject *object)
 {
-       xCamelMessageInfoBase *bmi = XCAMEL_MESSAGE_INFO_BASE (object);
+       CamelMessageInfoBase *bmi = CAMEL_MESSAGE_INFO_BASE (object);
 
        camel_named_flags_free (bmi->priv->user_flags);
        bmi->priv->user_flags = NULL;
@@ -854,18 +854,18 @@ message_info_base_dispose (GObject *object)
        bmi->priv->headers = NULL;
 
        /* Chain up to parent's method. */
-       G_OBJECT_CLASS (xcamel_message_info_base_parent_class)->dispose (object);
+       G_OBJECT_CLASS (camel_message_info_base_parent_class)->dispose (object);
 }
 
 static void
-xcamel_message_info_base_class_init (xCamelMessageInfoBaseClass *class)
+camel_message_info_base_class_init (CamelMessageInfoBaseClass *class)
 {
-       xCamelMessageInfoClass *mi_class;
+       CamelMessageInfoClass *mi_class;
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (xCamelMessageInfoBasePrivate));
+       g_type_class_add_private (class, sizeof (CamelMessageInfoBasePrivate));
 
-       mi_class = XCAMEL_MESSAGE_INFO_CLASS (class);
+       mi_class = CAMEL_MESSAGE_INFO_CLASS (class);
        mi_class->get_flags = message_info_base_get_flags;
        mi_class->set_flags = message_info_base_set_flags;
        mi_class->get_user_flag = message_info_base_get_user_flag;
@@ -908,7 +908,7 @@ xcamel_message_info_base_class_init (xCamelMessageInfoBaseClass *class)
 }
 
 static void
-xcamel_message_info_base_init (xCamelMessageInfoBase *bmi)
+camel_message_info_base_init (CamelMessageInfoBase *bmi)
 {
-       bmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (bmi, XCAMEL_TYPE_MESSAGE_INFO_BASE, 
xCamelMessageInfoBasePrivate);
+       bmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (bmi, CAMEL_TYPE_MESSAGE_INFO_BASE, 
CamelMessageInfoBasePrivate);
 }
diff --git a/camel/camel-message-info-base.h b/camel/camel-message-info-base.h
index dc0a975..70b8a0e 100644
--- a/camel/camel-message-info-base.h
+++ b/camel/camel-message-info-base.h
@@ -19,49 +19,49 @@
 #error "Only <camel/camel.h> can be included directly."
 #endif
 
-#ifndef XCAMEL_MESSAGE_INFO_BASE_H
-#define XCAMEL_MESSAGE_INFO_BASE_H
+#ifndef CAMEL_MESSAGE_INFO_BASE_H
+#define CAMEL_MESSAGE_INFO_BASE_H
 
 #include <glib-object.h>
 
 #include <camel/camel-message-info.h>
 
 /* Standard GObject macros */
-#define XCAMEL_TYPE_MESSAGE_INFO_BASE \
-       (xcamel_message_info_base_get_type ())
-#define XCAMEL_MESSAGE_INFO_BASE(obj) \
+#define CAMEL_TYPE_MESSAGE_INFO_BASE \
+       (camel_message_info_base_get_type ())
+#define CAMEL_MESSAGE_INFO_BASE(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), XCAMEL_TYPE_MESSAGE_INFO_BASE, xCamelMessageInfoBase))
-#define XCAMEL_MESSAGE_INFO_BASE_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO_BASE, CamelMessageInfoBase))
+#define CAMEL_MESSAGE_INFO_BASE_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), XCAMEL_TYPE_MESSAGE_INFO_BASE, xCamelMessageInfoBaseClass))
-#define XCAMEL_IS_MESSAGE_INFO_BASE(obj) \
+       ((cls), CAMEL_TYPE_MESSAGE_INFO_BASE, CamelMessageInfoBaseClass))
+#define CAMEL_IS_MESSAGE_INFO_BASE(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), XCAMEL_TYPE_MESSAGE_INFO_BASE))
-#define XCAMEL_IS_MESSAGE_INFO_BASE_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO_BASE))
+#define CAMEL_IS_MESSAGE_INFO_BASE_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), XCAMEL_TYPE_MESSAGE_INFO_BASE))
-#define XCAMEL_MESSAGE_INFO_BASE_GET_CLASS(obj) \
+       ((cls), CAMEL_TYPE_MESSAGE_INFO_BASE))
+#define CAMEL_MESSAGE_INFO_BASE_GET_CLASS(obj) \
        (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), XCAMEL_TYPE_MESSAGE_INFO_BASE, xCamelMessageInfoBaseClass))
+       ((obj), CAMEL_TYPE_MESSAGE_INFO_BASE, CamelMessageInfoBaseClass))
 
 G_BEGIN_DECLS
 
-typedef struct _xCamelMessageInfoBase xCamelMessageInfoBase;
-typedef struct _xCamelMessageInfoBaseClass xCamelMessageInfoBaseClass;
-typedef struct _xCamelMessageInfoBasePrivate xCamelMessageInfoBasePrivate;
+typedef struct _CamelMessageInfoBase CamelMessageInfoBase;
+typedef struct _CamelMessageInfoBaseClass CamelMessageInfoBaseClass;
+typedef struct _CamelMessageInfoBasePrivate CamelMessageInfoBasePrivate;
 
-struct _xCamelMessageInfoBase {
-       xCamelMessageInfo parent;
-       xCamelMessageInfoBasePrivate *priv;
+struct _CamelMessageInfoBase {
+       CamelMessageInfo parent;
+       CamelMessageInfoBasePrivate *priv;
 };
 
-struct _xCamelMessageInfoBaseClass {
-       xCamelMessageInfoClass parent_class;
+struct _CamelMessageInfoBaseClass {
+       CamelMessageInfoClass parent_class;
 };
 
-GType          xcamel_message_info_base_get_type       (void);
+GType          camel_message_info_base_get_type        (void);
 
 G_END_DECLS
 
-#endif /* XCAMEL_MESSAGE_INFO_BASE_H */
+#endif /* CAMEL_MESSAGE_INFO_BASE_H */
diff --git a/camel/camel-message-info.c b/camel/camel-message-info.c
index 3c60201..a5f1bf0 100644
--- a/camel/camel-message-info.c
+++ b/camel/camel-message-info.c
@@ -30,14 +30,16 @@
 
 #include "camel-message-info.h"
 
-struct _xCamelMessageInfoPrivate {
+struct _CamelMessageInfoPrivate {
        GRecMutex property_lock;
 
        GWeakRef summary;       /* CamelFolderSummary * */
        gboolean dirty;         /* whether requires save to local disk/summary */
        const gchar *uid;       /* allocated in the string pool */
-       gboolean loading;
-       guint dirty_stamp;
+       gboolean abort_notifications;
+       gboolean thaw_notify_folder;
+       gboolean thaw_notify_folder_with_counts;
+       guint freeze_notifications;
        guint folder_flagged_stamp;
 };
 
@@ -45,10 +47,9 @@ enum {
        PROP_0,
        PROP_SUMMARY,
        PROP_DIRTY,
-       PROP_DIRTY_STAMP,
        PROP_FOLDER_FLAGGED,
        PROP_FOLDER_FLAGGED_STAMP,
-       PROP_LOADING,
+       PROP_ABORT_NOTIFICATIONS,
        PROP_UID,
        PROP_FLAGS,
        PROP_USER_FLAGS,
@@ -67,47 +68,55 @@ enum {
        PROP_HEADERS
 };
 
-G_DEFINE_ABSTRACT_TYPE (xCamelMessageInfo, xcamel_message_info, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (CamelMessageInfo, camel_message_info, G_TYPE_OBJECT)
 
-static xCamelMessageInfo *
-message_info_clone (const xCamelMessageInfo *mi,
+static CamelMessageInfo *
+message_info_clone (const CamelMessageInfo *mi,
                    CamelFolderSummary *assign_summary)
 {
-       xCamelMessageInfo *result;
+       CamelMessageInfo *result;
        const gchar *uid;
        const GArray *references;
        const CamelNameValueArray *headers;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
        if (assign_summary)
                g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (assign_summary), NULL);
 
        /* Make sure the 'mi' doesn't change while copying the values. */
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
-       result = xcamel_message_info_new (assign_summary);
+       if (!assign_summary) {
+               CamelFolderSummary *mi_summary;
+
+               mi_summary = camel_message_info_ref_summary (mi);
+               result = camel_message_info_new (mi_summary);
+               g_clear_object (&mi_summary);
+       } else {
+               result = camel_message_info_new (assign_summary);
+       }
 
        g_object_freeze_notify (G_OBJECT (result));
-       xcamel_message_info_set_loading (result, TRUE);
+       camel_message_info_set_abort_notifications (result, TRUE);
 
-       uid = xcamel_message_info_pooldup_uid (mi);
-       xcamel_message_info_set_uid (result, uid);
+       uid = camel_message_info_pooldup_uid (mi);
+       camel_message_info_set_uid (result, uid);
        camel_pstring_free (uid);
 
-       xcamel_message_info_take_user_flags (result, xcamel_message_info_dup_user_flags (mi));
-       xcamel_message_info_take_user_tags (result, xcamel_message_info_dup_user_tags (mi));
-       xcamel_message_info_set_subject (result, xcamel_message_info_get_subject (mi));
-       xcamel_message_info_set_preview (result, xcamel_message_info_get_preview (mi));
-       xcamel_message_info_set_from (result, xcamel_message_info_get_from (mi));
-       xcamel_message_info_set_to (result, xcamel_message_info_get_to (mi));
-       xcamel_message_info_set_cc (result, xcamel_message_info_get_cc (mi));
-       xcamel_message_info_set_mlist (result, xcamel_message_info_get_mlist (mi));
-       xcamel_message_info_set_size (result, xcamel_message_info_get_size (mi));
-       xcamel_message_info_set_date_sent (result, xcamel_message_info_get_date_sent (mi));
-       xcamel_message_info_set_date_received (result, xcamel_message_info_get_date_received (mi));
-       xcamel_message_info_set_message_id (result, xcamel_message_info_get_message_id (mi));
-
-       references = xcamel_message_info_get_references (mi);
+       camel_message_info_take_user_flags (result, camel_message_info_dup_user_flags (mi));
+       camel_message_info_take_user_tags (result, camel_message_info_dup_user_tags (mi));
+       camel_message_info_set_subject (result, camel_message_info_get_subject (mi));
+       camel_message_info_set_preview (result, camel_message_info_get_preview (mi));
+       camel_message_info_set_from (result, camel_message_info_get_from (mi));
+       camel_message_info_set_to (result, camel_message_info_get_to (mi));
+       camel_message_info_set_cc (result, camel_message_info_get_cc (mi));
+       camel_message_info_set_mlist (result, camel_message_info_get_mlist (mi));
+       camel_message_info_set_size (result, camel_message_info_get_size (mi));
+       camel_message_info_set_date_sent (result, camel_message_info_get_date_sent (mi));
+       camel_message_info_set_date_received (result, camel_message_info_get_date_received (mi));
+       camel_message_info_set_message_id (result, camel_message_info_get_message_id (mi));
+
+       references = camel_message_info_get_references (mi);
        if (references && references->len) {
                GArray *copy;
                guint ii;
@@ -118,77 +127,77 @@ message_info_clone (const xCamelMessageInfo *mi,
                        g_array_append_val (copy, g_array_index (references, guint64, ii));
                }
 
-               xcamel_message_info_take_references (result, copy);
+               camel_message_info_take_references (result, copy);
        }
 
-       headers = xcamel_message_info_get_headers (mi);
+       headers = camel_message_info_get_headers (mi);
        if (headers) {
-               xcamel_message_info_take_headers (result,
+               camel_message_info_take_headers (result,
                        camel_name_value_array_copy (headers));
        }
 
        /* Set flags as the last, to not overwrite 'folder-flagged' flag by
           the "changes" when copying fields. */
-       xcamel_message_info_set_flags (result, ~0, xcamel_message_info_get_flags (mi));
+       camel_message_info_set_flags (result, ~0, camel_message_info_get_flags (mi));
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        /* Also ensure 'dirty' flag, thus it can be eventually saved. */
-       xcamel_message_info_set_dirty (result, TRUE);
+       camel_message_info_set_dirty (result, TRUE);
 
-       xcamel_message_info_set_loading (result, FALSE);
+       camel_message_info_set_abort_notifications (result, FALSE);
        g_object_thaw_notify (G_OBJECT (result));
 
        return result;
 }
 
 static gboolean
-message_info_load (xCamelMessageInfo *mi,
+message_info_load (CamelMessageInfo *mi,
                   const CamelMIRecord *record,
                   /* const */ gchar **bdata_ptr)
 {
        gint ii, count;
        gchar *part, *label;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_ptr != NULL, FALSE);
 
-       xcamel_message_info_set_uid (mi, record->uid);
-       xcamel_message_info_set_flags (mi, ~0, record->flags);
-       xcamel_message_info_set_size (mi, record->size);
-       xcamel_message_info_set_date_sent (mi, record->dsent);
-       xcamel_message_info_set_date_received (mi, record->dreceived);
+       camel_message_info_set_uid (mi, record->uid);
+       camel_message_info_set_flags (mi, ~0, record->flags);
+       camel_message_info_set_size (mi, record->size);
+       camel_message_info_set_date_sent (mi, record->dsent);
+       camel_message_info_set_date_received (mi, record->dreceived);
 
-       xcamel_message_info_set_subject (mi, record->subject);
-       xcamel_message_info_set_from (mi, record->from);
-       xcamel_message_info_set_to (mi, record->to);
-       xcamel_message_info_set_cc (mi, record->cc);
-       xcamel_message_info_set_mlist (mi, record->mlist);
+       camel_message_info_set_subject (mi, record->subject);
+       camel_message_info_set_from (mi, record->from);
+       camel_message_info_set_to (mi, record->to);
+       camel_message_info_set_cc (mi, record->cc);
+       camel_message_info_set_mlist (mi, record->mlist);
 
        /* Extract Message id & References */
        part = record->part;
        if (part) {
                CamelSummaryMessageID message_id;
 
-               message_id.id.part.hi = camel_message_info_util_bdata_get_number (&part, 0);
-               message_id.id.part.lo = camel_message_info_util_bdata_get_number (&part, 0);
+               message_id.id.part.hi = camel_util_bdata_get_number (&part, 0);
+               message_id.id.part.lo = camel_util_bdata_get_number (&part, 0);
 
-               xcamel_message_info_set_message_id (mi, message_id.id.id);
+               camel_message_info_set_message_id (mi, message_id.id.id);
 
-               count = camel_message_info_util_bdata_get_number (&part, 0);
+               count = camel_util_bdata_get_number (&part, 0);
 
                if (count > 0) {
                        GArray *references = g_array_sized_new (FALSE, FALSE, sizeof (guint64), count);
 
                        for (ii = 0; ii < count; ii++) {
-                               message_id.id.part.hi = camel_message_info_util_bdata_get_number (&part, 0);
-                               message_id.id.part.lo = camel_message_info_util_bdata_get_number (&part, 0);
+                               message_id.id.part.hi = camel_util_bdata_get_number (&part, 0);
+                               message_id.id.part.lo = camel_util_bdata_get_number (&part, 0);
 
                                g_array_append_val (references, message_id.id.id);
                        }
 
-                       xcamel_message_info_take_references (mi, references);
+                       camel_message_info_take_references (mi, references);
                }
        }
 
@@ -212,7 +221,7 @@ message_info_load (xCamelMessageInfo *mi,
                if (label && *label)
                        camel_named_flags_insert (user_flags, label);
 
-               xcamel_message_info_take_user_flags (mi, user_flags);
+               camel_message_info_take_user_flags (mi, user_flags);
        }
 
        /* Extract User tags */
@@ -220,15 +229,15 @@ message_info_load (xCamelMessageInfo *mi,
        if (part) {
                CamelNameValueArray *user_tags;
 
-               count = camel_message_info_util_bdata_get_number (&part, 0);
+               count = camel_util_bdata_get_number (&part, 0);
 
                user_tags = camel_name_value_array_new_sized (count);
 
                for (ii = 0; ii < count; ii++) {
                        gchar *name, *value;
 
-                       name = camel_message_info_util_bdata_get_string (&part, NULL);
-                       value = camel_message_info_util_bdata_get_string (&part, NULL);
+                       name = camel_util_bdata_get_string (&part, NULL);
+                       value = camel_util_bdata_get_string (&part, NULL);
 
                        if (name)
                                camel_name_value_array_set_named (user_tags, TRUE, name, value ? value : "");
@@ -237,14 +246,14 @@ message_info_load (xCamelMessageInfo *mi,
                        g_free (value);
                }
 
-               xcamel_message_info_take_user_tags (mi, user_tags);
+               camel_message_info_take_user_tags (mi, user_tags);
        }
 
        return TRUE;
 }
 
 static gboolean
-message_info_save (const xCamelMessageInfo *mi,
+message_info_save (const CamelMessageInfo *mi,
                   CamelMIRecord *record,
                   GString *bdata_str)
 {
@@ -254,14 +263,12 @@ message_info_save (const xCamelMessageInfo *mi,
        const CamelNameValueArray *user_tags;
        const GArray *references;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_str != NULL, FALSE);
 
-       #warning Change camel_db_camel_mir_free() to pstring_free only the UID and g_free() all other text 
fields
-
-       record->uid = (gchar *) camel_pstring_strdup (xcamel_message_info_get_uid (mi));
-       record->flags = xcamel_message_info_get_flags (mi);
+       record->uid = (gchar *) camel_pstring_strdup (camel_message_info_get_uid (mi));
+       record->flags = camel_message_info_get_flags (mi);
 
        record->read = ((record->flags & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_JUNK))) 
? 1 : 0;
        record->deleted = (record->flags & CAMEL_MESSAGE_DELETED) != 0 ? 1 : 0;
@@ -271,24 +278,24 @@ message_info_save (const xCamelMessageInfo *mi,
        record->dirty = (record->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0 ? 1 : 0;
        record->attachment = (record->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0 ? 1 : 0;
 
-       record->size = xcamel_message_info_get_size (mi);
-       record->dsent = xcamel_message_info_get_date_sent (mi);
-       record->dreceived = xcamel_message_info_get_date_received (mi);
+       record->size = camel_message_info_get_size (mi);
+       record->dsent = camel_message_info_get_date_sent (mi);
+       record->dreceived = camel_message_info_get_date_received (mi);
 
-       record->subject = g_strdup (xcamel_message_info_get_subject (mi));
-       record->from = g_strdup (xcamel_message_info_get_from (mi));
-       record->to = g_strdup (xcamel_message_info_get_to (mi));
-       record->cc = g_strdup (xcamel_message_info_get_cc (mi));
-       record->mlist = g_strdup (xcamel_message_info_get_mlist (mi));
+       record->subject = g_strdup (camel_message_info_get_subject (mi));
+       record->from = g_strdup (camel_message_info_get_from (mi));
+       record->to = g_strdup (camel_message_info_get_to (mi));
+       record->cc = g_strdup (camel_message_info_get_cc (mi));
+       record->mlist = g_strdup (camel_message_info_get_mlist (mi));
 
-       record->followup_flag = g_strdup (xcamel_message_info_get_user_tag (mi, "follow-up"));
-       record->followup_completed_on = g_strdup (xcamel_message_info_get_user_tag (mi, "completed-on"));
-       record->followup_due_by = g_strdup (xcamel_message_info_get_user_tag (mi, "due-by"));
+       record->followup_flag = g_strdup (camel_message_info_get_user_tag (mi, "follow-up"));
+       record->followup_completed_on = g_strdup (camel_message_info_get_user_tag (mi, "completed-on"));
+       record->followup_due_by = g_strdup (camel_message_info_get_user_tag (mi, "due-by"));
 
        tmp = g_string_new (NULL);
-       message_id.id.id = xcamel_message_info_get_message_id (mi);
+       message_id.id.id = camel_message_info_get_message_id (mi);
        g_string_append_printf (tmp, "%lu %lu ", (gulong) message_id.id.part.hi, (gulong) 
message_id.id.part.lo);
-       references = xcamel_message_info_get_references (mi);
+       references = camel_message_info_get_references (mi);
        if (references) {
                guint ii;
 
@@ -304,7 +311,7 @@ message_info_save (const xCamelMessageInfo *mi,
        record->part = g_string_free (tmp, FALSE);
 
        tmp = g_string_new (NULL);
-       user_flags = xcamel_message_info_dup_user_flags (mi);
+       user_flags = camel_message_info_dup_user_flags (mi);
        if (user_flags) {
                guint ii, count;
 
@@ -322,7 +329,7 @@ message_info_save (const xCamelMessageInfo *mi,
        record->labels = g_string_free (tmp, FALSE);
 
        tmp = g_string_new (NULL);
-       user_tags = xcamel_message_info_get_user_tags (mi);
+       user_tags = camel_message_info_get_user_tags (mi);
        if (user_tags) {
                guint ii, count;
 
@@ -355,7 +362,7 @@ message_info_set_property (GObject *object,
                           const GValue *value,
                           GParamSpec *pspec)
 {
-       xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+       CamelMessageInfo *mi = CAMEL_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_SUMMARY:
@@ -363,79 +370,79 @@ message_info_set_property (GObject *object,
                return;
 
        case PROP_DIRTY:
-               xcamel_message_info_set_dirty (mi, g_value_get_boolean (value));
+               camel_message_info_set_dirty (mi, g_value_get_boolean (value));
                return;
 
        case PROP_FOLDER_FLAGGED:
-               xcamel_message_info_set_folder_flagged (mi, g_value_get_boolean (value));
+               camel_message_info_set_folder_flagged (mi, g_value_get_boolean (value));
                return;
 
-       case PROP_LOADING:
-               xcamel_message_info_set_loading (mi, g_value_get_boolean (value));
+       case PROP_ABORT_NOTIFICATIONS:
+               camel_message_info_set_abort_notifications (mi, g_value_get_boolean (value));
                return;
 
        case PROP_UID:
-               xcamel_message_info_set_uid (mi, g_value_get_string (value));
+               camel_message_info_set_uid (mi, g_value_get_string (value));
                return;
 
        case PROP_FLAGS:
-               xcamel_message_info_set_flags (mi, ~0, g_value_get_uint (value));
+               camel_message_info_set_flags (mi, ~0, g_value_get_uint (value));
                return;
 
        case PROP_USER_FLAGS:
-               xcamel_message_info_take_user_flags (mi, g_value_dup_boxed (value));
+               camel_message_info_take_user_flags (mi, g_value_dup_boxed (value));
                return;
 
        case PROP_USER_TAGS:
-               xcamel_message_info_take_user_tags (mi, g_value_dup_boxed (value));
+               camel_message_info_take_user_tags (mi, g_value_dup_boxed (value));
                return;
 
        case PROP_SUBJECT:
-               xcamel_message_info_set_subject (mi, g_value_get_string (value));
+               camel_message_info_set_subject (mi, g_value_get_string (value));
                return;
 
        case PROP_PREVIEW:
-               xcamel_message_info_set_preview (mi, g_value_get_string (value));
+               camel_message_info_set_preview (mi, g_value_get_string (value));
                return;
 
        case PROP_FROM:
-               xcamel_message_info_set_from (mi, g_value_get_string (value));
+               camel_message_info_set_from (mi, g_value_get_string (value));
                return;
 
        case PROP_TO:
-               xcamel_message_info_set_to (mi, g_value_get_string (value));
+               camel_message_info_set_to (mi, g_value_get_string (value));
                return;
 
        case PROP_CC:
-               xcamel_message_info_set_cc (mi, g_value_get_string (value));
+               camel_message_info_set_cc (mi, g_value_get_string (value));
                return;
 
        case PROP_MLIST:
-               xcamel_message_info_set_mlist (mi, g_value_get_string (value));
+               camel_message_info_set_mlist (mi, g_value_get_string (value));
                return;
 
        case PROP_SIZE:
-               xcamel_message_info_set_size (mi, g_value_get_uint (value));
+               camel_message_info_set_size (mi, g_value_get_uint (value));
                return;
 
        case PROP_DATE_SENT:
-               xcamel_message_info_set_date_sent (mi, g_value_get_int64 (value));
+               camel_message_info_set_date_sent (mi, g_value_get_int64 (value));
                return;
 
        case PROP_DATE_RECEIVED:
-               xcamel_message_info_set_date_received (mi, g_value_get_int64 (value));
+               camel_message_info_set_date_received (mi, g_value_get_int64 (value));
                return;
 
        case PROP_MESSAGE_ID:
-               xcamel_message_info_set_message_id (mi, g_value_get_uint64 (value));
+               camel_message_info_set_message_id (mi, g_value_get_uint64 (value));
                return;
 
        case PROP_REFERENCES:
-               xcamel_message_info_take_references (mi, g_value_dup_boxed (value));
+               camel_message_info_take_references (mi, g_value_dup_boxed (value));
                return;
 
        case PROP_HEADERS:
-               xcamel_message_info_take_headers (mi, g_value_dup_boxed (value));
+               camel_message_info_take_headers (mi, g_value_dup_boxed (value));
                return;
        }
 
@@ -448,95 +455,91 @@ message_info_get_property (GObject *object,
                           GValue *value,
                           GParamSpec *pspec)
 {
-       xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+       CamelMessageInfo *mi = CAMEL_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_SUMMARY:
-               g_value_take_object (value, xcamel_message_info_ref_summary (mi));
+               g_value_take_object (value, camel_message_info_ref_summary (mi));
                return;
 
        case PROP_DIRTY:
-               g_value_set_boolean (value, xcamel_message_info_get_dirty (mi));
-               return;
-
-       case PROP_DIRTY_STAMP:
-               g_value_set_uint (value, xcamel_message_info_get_dirty_stamp (mi));
+               g_value_set_boolean (value, camel_message_info_get_dirty (mi));
                return;
 
        case PROP_FOLDER_FLAGGED:
-               g_value_set_boolean (value, xcamel_message_info_get_folder_flagged (mi));
+               g_value_set_boolean (value, camel_message_info_get_folder_flagged (mi));
                return;
 
        case PROP_FOLDER_FLAGGED_STAMP:
-               g_value_set_uint (value, xcamel_message_info_get_folder_flagged_stamp (mi));
+               g_value_set_uint (value, camel_message_info_get_folder_flagged_stamp (mi));
                return;
 
-       case PROP_LOADING:
-               g_value_set_boolean (value, xcamel_message_info_get_loading (mi));
+       case PROP_ABORT_NOTIFICATIONS:
+               g_value_set_boolean (value, camel_message_info_get_abort_notifications (mi));
                return;
 
        case PROP_UID:
-               g_value_set_string (value, xcamel_message_info_get_uid (mi));
+               g_value_set_string (value, camel_message_info_get_uid (mi));
                return;
 
        case PROP_FLAGS:
-               g_value_set_uint (value, xcamel_message_info_get_flags (mi));
+               g_value_set_uint (value, camel_message_info_get_flags (mi));
                return;
 
        case PROP_USER_FLAGS:
-               g_value_take_boxed (value, xcamel_message_info_dup_user_flags (mi));
+               g_value_take_boxed (value, camel_message_info_dup_user_flags (mi));
                return;
 
        case PROP_USER_TAGS:
-               g_value_take_boxed (value, xcamel_message_info_dup_user_tags (mi));
+               g_value_take_boxed (value, camel_message_info_dup_user_tags (mi));
                return;
 
        case PROP_SUBJECT:
-               g_value_set_string (value, xcamel_message_info_get_subject (mi));
+               g_value_set_string (value, camel_message_info_get_subject (mi));
                return;
 
        case PROP_PREVIEW:
-               g_value_set_string (value, xcamel_message_info_get_preview (mi));
+               g_value_set_string (value, camel_message_info_get_preview (mi));
                return;
 
        case PROP_FROM:
-               g_value_set_string (value, xcamel_message_info_get_from (mi));
+               g_value_set_string (value, camel_message_info_get_from (mi));
                return;
 
        case PROP_TO:
-               g_value_set_string (value, xcamel_message_info_get_to (mi));
+               g_value_set_string (value, camel_message_info_get_to (mi));
                return;
 
        case PROP_CC:
-               g_value_set_string (value, xcamel_message_info_get_cc (mi));
+               g_value_set_string (value, camel_message_info_get_cc (mi));
                return;
 
        case PROP_MLIST:
-               g_value_set_string (value, xcamel_message_info_get_mlist (mi));
+               g_value_set_string (value, camel_message_info_get_mlist (mi));
                return;
 
        case PROP_SIZE:
-               g_value_set_uint (value, xcamel_message_info_get_size (mi));
+               g_value_set_uint (value, camel_message_info_get_size (mi));
                return;
 
        case PROP_DATE_SENT:
-               g_value_set_int64 (value, xcamel_message_info_get_date_sent (mi));
+               g_value_set_int64 (value, camel_message_info_get_date_sent (mi));
                return;
 
        case PROP_DATE_RECEIVED:
-               g_value_set_int64 (value, xcamel_message_info_get_date_received (mi));
+               g_value_set_int64 (value, camel_message_info_get_date_received (mi));
                return;
 
        case PROP_MESSAGE_ID:
-               g_value_set_uint64 (value, xcamel_message_info_get_message_id (mi));
+               g_value_set_uint64 (value, camel_message_info_get_message_id (mi));
                return;
 
        case PROP_REFERENCES:
-               g_value_take_boxed (value, xcamel_message_info_dup_references (mi));
+               g_value_take_boxed (value, camel_message_info_dup_references (mi));
                return;
 
        case PROP_HEADERS:
-               g_value_take_boxed (value, xcamel_message_info_dup_headers (mi));
+               g_value_take_boxed (value, camel_message_info_dup_headers (mi));
                return;
        }
 
@@ -546,34 +549,34 @@ message_info_get_property (GObject *object,
 static void
 message_info_dispose (GObject *object)
 {
-       xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+       CamelMessageInfo *mi = CAMEL_MESSAGE_INFO (object);
 
        g_weak_ref_set (&mi->priv->summary, NULL);
        camel_pstring_free (mi->priv->uid);
        mi->priv->uid = NULL;
 
        /* Chain up to parent's method. */
-       G_OBJECT_CLASS (xcamel_message_info_parent_class)->dispose (object);
+       G_OBJECT_CLASS (camel_message_info_parent_class)->dispose (object);
 }
 
 static void
 message_info_finalize (GObject *object)
 {
-       xCamelMessageInfo *mi = XCAMEL_MESSAGE_INFO (object);
+       CamelMessageInfo *mi = CAMEL_MESSAGE_INFO (object);
 
        g_weak_ref_clear (&mi->priv->summary);
        g_rec_mutex_clear (&mi->priv->property_lock);
 
        /* Chain up to parent's method. */
-       G_OBJECT_CLASS (xcamel_message_info_parent_class)->finalize (object);
+       G_OBJECT_CLASS (camel_message_info_parent_class)->finalize (object);
 }
 
 static void
-xcamel_message_info_class_init (xCamelMessageInfoClass *class)
+camel_message_info_class_init (CamelMessageInfoClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (xCamelMessageInfoPrivate));
+       g_type_class_add_private (class, sizeof (CamelMessageInfoPrivate));
 
        class->clone = message_info_clone;
        class->load = message_info_load;
@@ -586,7 +589,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
        object_class->finalize = message_info_finalize;
 
        /**
-        * xCamelMessageInfo:summary
+        * CamelMessageInfo:summary
         *
         * The #CamelFolderSummary to which the message info belongs, or %NULL.
         * It can be set only during construction of the object.
@@ -605,7 +608,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_CONSTRUCT_ONLY));
 
        /**
-        * xCamelMessageInfo:uid
+        * CamelMessageInfo:uid
         *
         * A unique ID of the message in its folder.
         *
@@ -622,7 +625,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:dirty
+        * CamelMessageInfo:dirty
         *
         * Flag, whether the info is changed and requires save to disk.
         * Compare with CamelMessageInfo:folder-flagged
@@ -640,26 +643,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:dirty-stamp
-        *
-        * The 'dirty-stamp' is a stamp of the 'dirty' flag. This stamp changes whenever
-        * anything would mark the @mi 'dirty', regardless the @mi being already dirty.
-        * It can be used to recognize changes on the 'dirty' flag during the time.
-        *
-        * Since: 3.24
-        **/
-       g_object_class_install_property (
-               object_class,
-               PROP_DIRTY_STAMP,
-               g_param_spec_uint (
-                       "dirty-stamp",
-                       "Dirty Stamp",
-                       NULL,
-                       0, G_MAXUINT, 0,
-                       G_PARAM_READABLE));
-
-       /**
-        * xCamelMessageInfo:folder-flagged
+        * CamelMessageInfo:folder-flagged
         *
         * Flag, whether the info is changed and requires save to
         * the destination store/server. This is different from
@@ -679,7 +663,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:folder-flagged-stamp
+        * CamelMessageInfo:folder-flagged-stamp
         *
         * The 'folder-flagged-stamp' is a stamp of the 'folder-flagged' flag. This stamp
         * changes whenever anything would mark the @mi 'folder-flagged', regardless the @mi
@@ -699,25 +683,26 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READABLE));
 
        /**
-        * xCamelMessageInfo:loading
-        *
-        * Flag, whether the info is currently loading. It is used to avoid
-        * unnecessary 'folder-flagged' and 'dirty' flags changes.
+        * CamelMessageInfo:abort-notifications
         *
+        * Flag, whether the info is currently aborting notifications. It is used to avoid
+        * unnecessary 'folder-flagged' and 'dirty' flags changes and also to avoid
+        * associated folder's "changed" signal.
+        *f
         * Since: 3.24
         **/
        g_object_class_install_property (
                object_class,
-               PROP_LOADING,
+               PROP_ABORT_NOTIFICATIONS,
                g_param_spec_boolean (
-                       "loading",
-                       "Loading",
+                       "abort-notifications",
+                       "Abort Notifications",
                        NULL,
                        FALSE,
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:flags
+        * CamelMessageInfo:flags
         *
         * Bit-or of #CamelMessageFlags.
         *
@@ -734,7 +719,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:user-flags
+        * CamelMessageInfo:user-flags
         *
         * User flags for the associated message. Can be %NULL.
         * Unlike user-tags, which can contain various values, the user-flags
@@ -753,7 +738,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:user-tags
+        * CamelMessageInfo:user-tags
         *
         * User tags for the associated message. Can be %NULL.
         * Unlike user-flags, which can be set or not, the user-tags
@@ -772,7 +757,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:subject
+        * CamelMessageInfo:subject
         *
         * Subject of the associated message.
         *
@@ -789,7 +774,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:preview
+        * CamelMessageInfo:preview
         *
         * Preview of the associated message.
         *
@@ -806,7 +791,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:from
+        * CamelMessageInfo:from
         *
         * From address of the associated message.
         *
@@ -823,7 +808,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:to
+        * CamelMessageInfo:to
         *
         * To address of the associated message.
         *
@@ -840,7 +825,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:cc
+        * CamelMessageInfo:cc
         *
         * CC address of the associated message.
         *
@@ -857,7 +842,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:mlist
+        * CamelMessageInfo:mlist
         *
         * Mailing list address of the associated message.
         *
@@ -874,7 +859,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:size
+        * CamelMessageInfo:size
         *
         * Size of the associated message.
         *
@@ -891,7 +876,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:date-sent
+        * CamelMessageInfo:date-sent
         *
         * Sent Date of the associated message.
         *
@@ -908,7 +893,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:date-received
+        * CamelMessageInfo:date-received
         *
         * Received date of the associated message.
         *
@@ -925,7 +910,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:message-id
+        * CamelMessageInfo:message-id
         *
         * Encoded Message-ID of the associated message as a guint64 number,
         * partial MD5 sum. The value can be cast to #CamelSummaryMessageID.
@@ -943,7 +928,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:references
+        * CamelMessageInfo:references
         *
         * Encoded In-Reply-To and References headers of the associated message
         * as an array of guint64 numbers, partial MD5 sums. Each value can be
@@ -962,7 +947,7 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelMessageInfo:headers
+        * CamelMessageInfo:headers
         *
         * Headers of the associated message. Can be %NULL.
         *
@@ -980,28 +965,28 @@ xcamel_message_info_class_init (xCamelMessageInfoClass *class)
 }
 
 static void
-xcamel_message_info_init (xCamelMessageInfo *mi)
+camel_message_info_init (CamelMessageInfo *mi)
 {
-       mi->priv = G_TYPE_INSTANCE_GET_PRIVATE (mi, XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfoPrivate);
+       mi->priv = G_TYPE_INSTANCE_GET_PRIVATE (mi, CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfoPrivate);
 
        g_rec_mutex_init (&mi->priv->property_lock);
        g_weak_ref_init (&mi->priv->summary, NULL);
 }
 
 /**
- * xcamel_message_info_new:
+ * camel_message_info_new:
  * @summary: (nullable): parent #CamelFolderSummary object, or %NULL
  *
- * Create a new #xCamelMessageInfo object, optionally for given @summary.
+ * Create a new #CamelMessageInfo object, optionally for given @summary.
  *
- * Returns: (transfer full): a new #xCamelMessageInfo object
+ * Returns: (transfer full): a new #CamelMessageInfo object
  *
  * Since: 3.24
  **/
-xCamelMessageInfo *
-xcamel_message_info_new (CamelFolderSummary *summary)
+CamelMessageInfo *
+camel_message_info_new (CamelFolderSummary *summary)
 {
-       GType type = XCAMEL_TYPE_MESSAGE_INFO_BASE;
+       GType type = CAMEL_TYPE_MESSAGE_INFO_BASE;
 
        if (summary) {
                CamelFolderSummaryClass *klass;
@@ -1018,29 +1003,29 @@ xcamel_message_info_new (CamelFolderSummary *summary)
 }
 
 /**
- * xcamel_message_info_clone:
+ * camel_message_info_clone:
  * @mi: a #CamelMessageInfo to clone
  * @assign_summary: (nullable): parent #CamelFolderSummary object, or %NULL, to set on the clone
  *
  * Clones the @mi as a new #CamelMessageInfo and eventually assigns
- * a new #CamelFolderSummary to it. If it's not set, then the new
- * clone will not have assigned any summary.
+ * a new #CamelFolderSummary to it. If it's not set, then the same
+ * summary as the one with @mi is used.
  *
- * Returns: (transfer full): a new #xCamelMessageInfo object, clone of the @mi
+ * Returns: (transfer full): a new #CamelMessageInfo object, clone of the @mi
  *
  * Since: 3.24
  **/
-xCamelMessageInfo *
-xcamel_message_info_clone (const xCamelMessageInfo *mi,
-                          CamelFolderSummary *assign_summary)
+CamelMessageInfo *
+camel_message_info_clone (const CamelMessageInfo *mi,
+                         CamelFolderSummary *assign_summary)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
        if (assign_summary)
                g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (assign_summary), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->clone != NULL, NULL);
 
@@ -1055,9 +1040,8 @@ xcamel_message_info_clone (const xCamelMessageInfo *mi,
  *
  * Load content of @mi from the data stored in @record. The @bdata_ptr points
  * to the current position of the record->bdata, where the read can continue.
- * Use helper functions camel_message_info_util_bdata_get_number() and
- * camel_message_info_util_bdata_get_string() to read data from it and
- * also move forward the *bdata_ptr.
+ * Use helper functions camel_util_bdata_get_number() and camel_util_bdata_get_string()
+ * to read data from it and also move forward the *bdata_ptr.
  *
  * After successful load of the @mi, the 'dirty' flag is unset.
  *
@@ -1066,32 +1050,32 @@ xcamel_message_info_clone (const xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gboolean
-camel_message_info_load (xCamelMessageInfo *mi,
+camel_message_info_load (CamelMessageInfo *mi,
                         const CamelMIRecord *record,
                         /* const */ gchar **bdata_ptr)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        gboolean success;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_ptr != NULL, FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->load != NULL, FALSE);
 
        g_object_freeze_notify (G_OBJECT (mi));
-       xcamel_message_info_property_lock (mi);
-       xcamel_message_info_set_loading (mi, TRUE);
+       camel_message_info_property_lock (mi);
+       camel_message_info_set_abort_notifications (mi, TRUE);
 
        success = klass->load (mi, record, bdata_ptr);
 
        if (success)
-               xcamel_message_info_set_dirty (mi, FALSE);
+               camel_message_info_set_dirty (mi, FALSE);
 
-       xcamel_message_info_set_loading (mi, FALSE);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_set_abort_notifications (mi, FALSE);
+       camel_message_info_property_unlock (mi);
        g_object_thaw_notify (G_OBJECT (mi));
 
        return success;
@@ -1099,47 +1083,46 @@ camel_message_info_load (xCamelMessageInfo *mi,
 
 /**
  * camel_message_info_save:
- * @mi: a #xCamelMessageInfo
+ * @mi: a #CamelMessageInfo
  * @record: a #CamelMIRecord to populate
  * @bdata_str: a #GString with a string to save as backend specific data (bdata)
  *
  * Save the @mi content to the message info record @record. It can populate all
  * but the record->bdata value, which is set fro mthe @bdata_str. Use helper functions
- * camel_message_info_util_bdata_put_number() and
- * camel_message_info_util_bdata_put_string() to put data into the @bdata_str.
+ * camel_util_bdata_put_number() and camel_util_bdata_put_string() to put data into the @bdata_str.
  *
  * Returns: Whether the save succeeded.
  *
  * Since: 3.24
  **/
 gboolean
-camel_message_info_save (const xCamelMessageInfo *mi,
+camel_message_info_save (const CamelMessageInfo *mi,
                         CamelMIRecord *record,
                         GString *bdata_str)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        gboolean success;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_str != NULL, FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->save != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        success = klass->save (mi, record, bdata_str);
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return success;
 }
 
 /**
- * xcamel_message_info_ref_summary:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_ref_summary:
+ * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer full): Referenced #CamelFolderSummary to which the @mi belongs, or %NULL,
  * if there is none. Use g_object_unref() for non-NULL returned values when done with it.
@@ -1147,91 +1130,104 @@ camel_message_info_save (const xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 CamelFolderSummary *
-xcamel_message_info_ref_summary (const xCamelMessageInfo *mi)
+camel_message_info_ref_summary (const CamelMessageInfo *mi)
 {
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
        return g_weak_ref_get (&mi->priv->summary);
 }
 
 /**
- * xcamel_message_info_property_lock:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_property_lock:
+ * @mi: a #CamelMessageInfo
  *
  * Acquires a property lock, which is used to ensure thread safety
  * when properties are changing. Release the lock with
- * xcamel_message_info_property_unlock().
+ * camel_message_info_property_unlock().
  *
  * Since: 3.24
  **/
 void
-xcamel_message_info_property_lock (const xCamelMessageInfo *mi)
+camel_message_info_property_lock (const CamelMessageInfo *mi)
 {
-       g_return_if_fail (XCAMEL_IS_MESSAGE_INFO (mi));
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
 
        g_rec_mutex_lock (&mi->priv->property_lock);
 }
 
 /**
- * xcamel_message_info_property_unlock:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_property_unlock:
+ * @mi: a #CamelMessageInfo
  *
  * Releases a property lock, previously acquired with
- * xcamel_message_info_property_lock().
+ * camel_message_info_property_lock().
  *
  * Since: 3.24
  **/
 void
-xcamel_message_info_property_unlock (const xCamelMessageInfo *mi)
+camel_message_info_property_unlock (const CamelMessageInfo *mi)
 {
-       g_return_if_fail (XCAMEL_IS_MESSAGE_INFO (mi));
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
 
        g_rec_mutex_unlock (&mi->priv->property_lock);
 }
 
 static void
-xcamel_message_info_update_summary_and_folder (xCamelMessageInfo *mi,
-                                              gboolean update_counts)
+camel_message_info_update_summary_and_folder (CamelMessageInfo *mi,
+                                             gboolean update_counts)
 {
        CamelFolderSummary *summary;
 
-       g_return_if_fail (XCAMEL_IS_MESSAGE_INFO (mi));
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
+
+       camel_message_info_property_lock (mi);
+       if (camel_message_info_get_notifications_frozen (mi)) {
+               mi->priv->thaw_notify_folder = TRUE;
+               mi->priv->thaw_notify_folder_with_counts |= update_counts;
+               camel_message_info_property_unlock (mi);
+
+               return;
+       }
+       camel_message_info_property_unlock (mi);
 
-       summary = xcamel_message_info_ref_summary (mi);
+       summary = camel_message_info_ref_summary (mi);
        if (summary) {
                CamelFolder *folder;
+               const gchar *uid;
 
-               if (update_counts) {
-                       camel_folder_summary_lock (summary);
-                       g_object_freeze_notify (G_OBJECT (summary));
+               uid = camel_message_info_pooldup_uid (mi);
 
-                       camel_folder_summary_replace_flags (summary, mi);
+               /* This is for cases when a new message info had been created,
+                  but not added into the summary yet. */
+               if (uid && camel_folder_summary_check_uid (summary, uid) &&
+                   camel_folder_summary_peek_loaded (summary, uid) == mi) {
+                       if (update_counts) {
+                               camel_folder_summary_lock (summary);
+                               g_object_freeze_notify (G_OBJECT (summary));
 
-                       g_object_thaw_notify (G_OBJECT (summary));
-                       camel_folder_summary_unlock (summary);
-               }
+                               camel_folder_summary_replace_flags (summary, mi);
 
-               folder = camel_folder_summary_get_folder (summary);
-               if (folder) {
-                       const gchar *uid;
+                               g_object_thaw_notify (G_OBJECT (summary));
+                               camel_folder_summary_unlock (summary);
+                       }
 
-                       uid = xcamel_message_info_pooldup_uid (mi);
-                       if (uid) {
+                       folder = camel_folder_summary_get_folder (summary);
+                       if (folder) {
                                CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
 
                                camel_folder_change_info_change_uid (changes, uid);
                                camel_folder_changed (folder, changes);
                                camel_folder_change_info_free (changes);
-                               camel_pstring_free (uid);
                        }
                }
 
                g_clear_object (&summary);
+               camel_pstring_free (uid);
        }
 }
 
 /**
- * xcamel_message_info_get_dirty:
+ * camel_message_info_get_dirty:
  * @mi: a #CamelMessageInfo
  *
  * Returns: Whether the @mi is dirty, which means that it had been
@@ -1240,57 +1236,54 @@ xcamel_message_info_update_summary_and_folder (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_get_dirty (const xCamelMessageInfo *mi)
+camel_message_info_get_dirty (const CamelMessageInfo *mi)
 {
        gboolean result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = mi->priv->dirty;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_dirty:
+ * camel_message_info_set_dirty:
  * @mi: a #CamelMessageInfo
  * @dirty: a dirty state to set
  *
  * Marks the @mi as dirty, which means a save to the local summary
- * is required. In case the @dirty is %TRUE and the @mi is not loading,
+ * is required. In case the @dirty is %TRUE and the @mi is not aborting notifications,
  * the 'dirty-stamp' changes too.
  *
  * Since: 3.24
  **/
 void
-xcamel_message_info_set_dirty (const xCamelMessageInfo *mi,
-                              gboolean dirty)
+camel_message_info_set_dirty (const CamelMessageInfo *mi,
+                             gboolean dirty)
 {
-       gboolean changed, loading;
+       gboolean changed, abort_notifications;
 
-       g_return_if_fail (XCAMEL_IS_MESSAGE_INFO (mi));
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = (!mi->priv->dirty) != (!dirty);
        if (changed)
                mi->priv->dirty = dirty;
-       loading = mi->priv->loading;
-
-       if (dirty && !loading)
-               mi->priv->dirty_stamp++;
+       abort_notifications = mi->priv->abort_notifications;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "dirty");
 
                if (dirty) {
                        CamelFolderSummary *summary;
 
-                       summary = xcamel_message_info_ref_summary (mi);
+                       summary = camel_message_info_ref_summary (mi);
                        if (summary)
                                camel_folder_summary_touch (summary);
 
@@ -1300,33 +1293,7 @@ xcamel_message_info_set_dirty (const xCamelMessageInfo *mi,
 }
 
 /**
- * xcamel_message_info_get_dirty_stamp:
- * @mi: a #CamelMessageInfo
- *
- * The 'dirty-stamp' is a stamp of the 'dirty' flag. This stamp changes whenever
- * anything would mark the @mi 'dirty', regardless the @mi being already dirty.
- * It can be used to recognize changes on the 'dirty' flag during the time.
- *
- * Returns: Stamp of the 'dirty' flag.
- *
- * Since: 3.24
- **/
-guint
-xcamel_message_info_get_dirty_stamp (const xCamelMessageInfo *mi)
-{
-       guint result;
-
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), ~0);
-
-       xcamel_message_info_property_lock (mi);
-       result = mi->priv->dirty_stamp;
-       xcamel_message_info_property_unlock (mi);
-
-       return result;
-}
-
-/**
- * xcamel_message_info_get_folder_flagged:
+ * camel_message_info_get_folder_flagged:
  * @mi: a #CamelMessageInfo
  *
  * The folder flagged flag is used to mark the message infor as being changed
@@ -1342,20 +1309,20 @@ xcamel_message_info_get_dirty_stamp (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_get_folder_flagged (const xCamelMessageInfo *mi)
+camel_message_info_get_folder_flagged (const CamelMessageInfo *mi)
 {
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       return (xcamel_message_info_get_flags (mi) & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
+       return (camel_message_info_get_flags (mi) & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
 }
 
 /**
- * xcamel_message_info_set_folder_flagged:
+ * camel_message_info_set_folder_flagged:
  * @mi: a #CamelMessageInfo
  * folder_flagged: a value to set to
  *
  * Changes the folder-flagged flag to the @folder_flagged value. See
- * xcamel_message_info_get_folder_flagged() for more information about
+ * camel_message_info_get_folder_flagged() for more information about
  * the use of this flag.
  *
  * This is only a convenient wrapper around CAMEL_MESSAGE_FOLDER_FLAGGED flag,
@@ -1366,20 +1333,20 @@ xcamel_message_info_get_folder_flagged (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_folder_flagged (xCamelMessageInfo *mi,
-                                       gboolean folder_flagged)
+camel_message_info_set_folder_flagged (CamelMessageInfo *mi,
+                                      gboolean folder_flagged)
 {
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
        /* g_object_notify (G_OBJECT (mi), "folder-flagged");
           is called as part of the set_flags function */
 
-       return xcamel_message_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_FLAGGED,
+       return camel_message_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_FLAGGED,
                folder_flagged ? CAMEL_MESSAGE_FOLDER_FLAGGED : 0);
 }
 
 /**
- * xcamel_message_info_get_folder_flagged_stamp:
+ * camel_message_info_get_folder_flagged_stamp:
  * @mi: a #CamelMessageInfo
  *
  * The 'folder-flagged-stamp' is a stamp of the 'folder-flagged' flag. This stamp
@@ -1392,73 +1359,162 @@ xcamel_message_info_set_folder_flagged (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 guint
-xcamel_message_info_get_folder_flagged_stamp (const xCamelMessageInfo *mi)
+camel_message_info_get_folder_flagged_stamp (const CamelMessageInfo *mi)
 {
        guint result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), ~0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), ~0);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = mi->priv->folder_flagged_stamp;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_get_loading:
+ * camel_message_info_get_abort_notifications:
  * @mi: a #CamelMessageInfo
  *
- * Returns: Whether the @mi is loading, which means that it will not influence
- *   'dirty' and 'folder-flagged' flags in the set/take functions,
- *   neither it will emit any GObject::notify signals on change.
+ * Returns: Whether the @mi is aborting notifications, which means
+ *   that it will not influence 'dirty' and 'folder-flagged' flags
+ *   in the set/take functions, neither it will emit any GObject::notify
+ *   signals on change, nor associated folder's "changed" signal.
  *
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_get_loading (const xCamelMessageInfo *mi)
+camel_message_info_get_abort_notifications (const CamelMessageInfo *mi)
 {
        gboolean result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       xcamel_message_info_property_lock (mi);
-       result = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_lock (mi);
+       result = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_loading:
+ * camel_message_info_set_abort_notifications:
  * @mi: a #CamelMessageInfo
- * @loading: a loading state to set
+ * @abort_notifications: a state to set
  *
- * Marks the @mi as loading, which means that it will not influence
- * 'dirty' and 'folder-flagged' flags in the set/take functions,
- * neither it will emit any GObject::notify signals on change.
+ * Marks the @mi to abort any notifications, which means that it
+ * will not influence 'dirty' and 'folder-flagged' flags in
+ * the set/take functions, neither it will emit any GObject::notify
+ * signals on change, nor associated folder's "changed" signal.
  *
  * Since: 3.24
  **/
 void
-xcamel_message_info_set_loading (const xCamelMessageInfo *mi,
-                               gboolean loading)
+camel_message_info_set_abort_notifications (CamelMessageInfo *mi,
+                                           gboolean abort_notifications)
 {
        gboolean changed;
-       g_return_if_fail (XCAMEL_IS_MESSAGE_INFO (mi));
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
 
-       xcamel_message_info_property_lock (mi);
-       changed = (!mi->priv->loading) != (!loading);
+       camel_message_info_property_lock (mi);
+       changed = (!mi->priv->abort_notifications) != (!abort_notifications);
        if (changed)
-               mi->priv->loading = loading;
-       xcamel_message_info_property_unlock (mi);
+               mi->priv->abort_notifications = abort_notifications;
+       camel_message_info_property_unlock (mi);
 
        if (changed)
-               g_object_notify (G_OBJECT (mi), "loading");
+               g_object_notify (G_OBJECT (mi), "abort-notifications");
+}
+
+/**
+ * camel_message_info_freeze_notifications:
+ * @mi: a #CamelMessageInfo
+ *
+ * Freezes all the notifications until the camel_message_info_thaw_notifications() is called.
+ * This function can be called multiple times, where the last thaw will do the notifications.
+ *
+ * Since: 3.24
+ **/
+void
+camel_message_info_freeze_notifications (CamelMessageInfo *mi)
+{
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
+
+       camel_message_info_property_lock (mi);
+       mi->priv->freeze_notifications++;
+       if (mi->priv->freeze_notifications == 1) {
+               mi->priv->thaw_notify_folder = FALSE;
+               mi->priv->thaw_notify_folder_with_counts = FALSE;
+               g_object_freeze_notify (G_OBJECT (mi));
+       }
+       camel_message_info_property_unlock (mi);
+}
+
+/**
+ * camel_message_info_thaw_notifications:
+ * @mi: a #CamelMessageInfo
+ *
+ * Reverses the call of the camel_message_info_freeze_notifications().
+ * If this is the last freeze, then the associated folder is also notified
+ * about the change, if any happened during the freeze.
+ *
+ * Since: 3.24
+ **/
+void
+camel_message_info_thaw_notifications (CamelMessageInfo *mi)
+{
+       g_return_if_fail (CAMEL_IS_MESSAGE_INFO (mi));
+
+       camel_message_info_property_lock (mi);
+       if (!mi->priv->freeze_notifications) {
+               camel_message_info_property_unlock (mi);
+
+               g_warn_if_reached ();
+               return;
+       }
+
+       mi->priv->freeze_notifications--;
+       if (!mi->priv->freeze_notifications) {
+               gboolean notify_folder, notify_folder_with_counts;
+
+               notify_folder = mi->priv->thaw_notify_folder;
+               notify_folder_with_counts = mi->priv->thaw_notify_folder_with_counts;
+
+               camel_message_info_property_unlock (mi);
+
+               g_object_thaw_notify (G_OBJECT (mi));
+
+               if (notify_folder)
+                       camel_message_info_update_summary_and_folder (mi, notify_folder_with_counts);
+       }
+}
+
+/**
+ * camel_message_info_get_notifications_frozen:
+ * @mi: a #CamelMessageInfo
+ *
+ * Returns: Whether the notifications are frozen.
+ *
+ * See: camel_message_info_freeze_notifications()
+ *
+ * Since: 3.24
+ **/
+gboolean
+camel_message_info_get_notifications_frozen (const CamelMessageInfo *mi)
+{
+       gboolean result;
+
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
+
+       camel_message_info_property_lock (mi);
+       result = mi->priv->freeze_notifications > 0;
+       camel_message_info_property_unlock (mi);
+
+       return result;
 }
 
 /**
- * xcamel_message_info_get_uid:
+ * camel_message_info_get_uid:
  * @mi: a #CamelMessageInfo
  *
  * Get the UID of the #mi.
@@ -1468,21 +1524,21 @@ xcamel_message_info_set_loading (const xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_uid (const xCamelMessageInfo *mi)
+camel_message_info_get_uid (const CamelMessageInfo *mi)
 {
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = mi->priv->uid;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_pooldup_uid:
+ * camel_message_info_pooldup_uid:
  * @mi: a #CamelMessageInfo
  *
  * Get the UID of the #mi, duplicated on the Camel's string pool.
@@ -1494,26 +1550,26 @@ xcamel_message_info_get_uid (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_pooldup_uid (const xCamelMessageInfo *mi)
+camel_message_info_pooldup_uid (const CamelMessageInfo *mi)
 {
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = camel_pstring_strdup (mi->priv->uid);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_uid:
+ * camel_message_info_set_uid:
  * @mi: a #CamelMessageInfo
  * @uid: a UID to set
  *
  * Changes UID of the @mi to @uid. If it changes, the 'dirty' flag
- * of the @mi is set too, unless the @mi is loading. This change
+ * of the @mi is set too, unless the @mi is aborting notifications. This change
  * does not influence the 'folder-flagged' flag.
  *
  * Returns: Whether the UID changed.
@@ -1521,32 +1577,32 @@ xcamel_message_info_pooldup_uid (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_uid (xCamelMessageInfo *mi,
-                            const gchar *uid)
+camel_message_info_set_uid (CamelMessageInfo *mi,
+                           const gchar *uid)
 {
-       gboolean changed, loading;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = mi->priv->uid != uid && g_strcmp0 (mi->priv->uid, uid) != 0;
        if (changed) {
                camel_pstring_free (mi->priv->uid);
                mi->priv->uid = camel_pstring_strdup (uid);
        }
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "uid");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_flags:
+ * camel_message_info_get_flags:
  * @mi: a #CamelMessageInfo
  *
  * Returns: Bit-or of #CamelMessageFlags set on the @mi.
@@ -1554,86 +1610,87 @@ xcamel_message_info_set_uid (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 guint32
-xcamel_message_info_get_flags (const xCamelMessageInfo *mi)
+camel_message_info_get_flags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        guint32 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), 0);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, 0);
        g_return_val_if_fail (klass->get_flags != NULL, 0);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_flags (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_flags:
+ * camel_message_info_set_flags:
  * @mi: a #CamelMessageInfo
  * @mask: mask of flags to change
  * @set: state the flags should be changed to
  *
- * Change the state of the flags on the @mi.
+ * Change the state of the flags on the @mi. Both @mask and @set are bit-or
+ * of #CamelMessageFlags.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is also emitted
+ * set automatically, unless the @mi is aborting notifications. There is also emitted
  * folder's "changed" signal for this @mi, if necessary. In case
  * the CAMEL_MESSAGE_FOLDER_FLAGGED flag would be set and the @mi is
- * not loading, the 'folder-flagged-stamp' changes too.
+ * not aborting notifications, the 'folder-flagged-stamp' changes too.
  *
  * Returns: Whether the flags changed.
  *
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_flags (xCamelMessageInfo *mi,
-                              CamelMessageFlags mask,
-                              guint32 set)
+camel_message_info_set_flags (CamelMessageInfo *mi,
+                             guint32 mask,
+                             guint32 set)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_flags != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = klass->set_flags (mi, mask, set);
-       loading = mi->priv->loading;
+       abort_notifications = mi->priv->abort_notifications;
 
-       if (!loading &&
+       if (!abort_notifications &&
            (mask & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0 &&
            (set & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0)
                mi->priv->folder_flagged_stamp++;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "flags");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
 
                /* Only if the folder-flagged was not part of the change */
                if (!(mask & CAMEL_MESSAGE_FOLDER_FLAGGED))
-                       xcamel_message_info_set_folder_flagged (mi, TRUE);
+                       camel_message_info_set_folder_flagged (mi, TRUE);
                else
                        g_object_notify (G_OBJECT (mi), "folder-flagged");
 
-               xcamel_message_info_update_summary_and_folder (mi, TRUE);
+               camel_message_info_update_summary_and_folder (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_user_flag:
+ * camel_message_info_get_user_flag:
  * @mi: a #CamelMessageInfo
  * @name: user flag name
  *
@@ -1642,27 +1699,27 @@ xcamel_message_info_set_flags (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_get_user_flag (const xCamelMessageInfo *mi,
-                                  const gchar *name)
+camel_message_info_get_user_flag (const CamelMessageInfo *mi,
+                                 const gchar *name)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        gboolean result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->get_user_flag != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_user_flag (mi, name);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_user_flag:
+ * camel_message_info_set_user_flag:
  * @mi: a #CamelMessageInfo
  * @name: user flag name
  * @state: state to set for the flag
@@ -1671,7 +1728,7 @@ xcamel_message_info_get_user_flag (const xCamelMessageInfo *mi,
  * can only be set or unset, while the user tags can contain certain values.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is also emitted
+ * set automatically, unless the @mi is aborting notifications. There is also emitted
  * folder's "changed" signal for this @mi, if necessary.
  *
  * Returns: Whether the message info changed.
@@ -1679,38 +1736,38 @@ xcamel_message_info_get_user_flag (const xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_user_flag (xCamelMessageInfo *mi,
-                                  const gchar *name,
-                                  gboolean state)
+camel_message_info_set_user_flag (CamelMessageInfo *mi,
+                                 const gchar *name,
+                                 gboolean state)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (name != NULL, FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_user_flag != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_user_flag (mi, name, state);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "user-flags");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
 
-               xcamel_message_info_update_summary_and_folder (mi, FALSE);
+               camel_message_info_update_summary_and_folder (mi, FALSE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_user_flags:
+ * camel_message_info_get_user_flags:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none) (nullable): A #CamelNamedFlags with all the currently set
@@ -1719,26 +1776,26 @@ xcamel_message_info_set_user_flag (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const CamelNamedFlags *
-xcamel_message_info_get_user_flags (const xCamelMessageInfo *mi)
+camel_message_info_get_user_flags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const CamelNamedFlags *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_user_flags != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_user_flags (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_dup_user_flags:
+ * camel_message_info_dup_user_flags:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer full): A newly allocated #CamelNamedFlags with all the currently set
@@ -1748,26 +1805,26 @@ xcamel_message_info_get_user_flags (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 CamelNamedFlags *
-xcamel_message_info_dup_user_flags (const xCamelMessageInfo *mi)
+camel_message_info_dup_user_flags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        CamelNamedFlags *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->dup_user_flags != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->dup_user_flags (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_take_user_flags:
+ * camel_message_info_take_user_flags:
  * @mi: a #CamelMessageInfo
  * @user_flags: (transfer full) (nullable): user flags to set
  *
@@ -1776,7 +1833,7 @@ xcamel_message_info_dup_user_flags (const xCamelMessageInfo *mi)
  * of it. The caller should not change @user_flags afterwards.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is also emitted
+ * set automatically, unless the @mi is aborting notifications. There is also emitted
  * folder's "changed" signal for this @mi, if necessary.
  *
  * Note that it's not safe to use the @user_flags after the call to this function,
@@ -1787,36 +1844,36 @@ xcamel_message_info_dup_user_flags (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_take_user_flags (xCamelMessageInfo *mi,
-                                    CamelNamedFlags *user_flags)
+camel_message_info_take_user_flags (CamelMessageInfo *mi,
+                                   CamelNamedFlags *user_flags)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->take_user_flags != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->take_user_flags (mi, user_flags);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "user-flags");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
 
-               xcamel_message_info_update_summary_and_folder (mi, FALSE);
+               camel_message_info_update_summary_and_folder (mi, FALSE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_user_tag:
+ * camel_message_info_get_user_tag:
  * @mi: a #CamelMessageInfo
  * @name: user tag name
  *
@@ -1826,28 +1883,28 @@ xcamel_message_info_take_user_flags (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_user_tag (const xCamelMessageInfo *mi,
-                                 const gchar *name)
+camel_message_info_get_user_tag (const CamelMessageInfo *mi,
+                                const gchar *name)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
        g_return_val_if_fail (name != NULL, NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_user_tag != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_user_tag (mi, name);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_dup_user_tag:
+ * camel_message_info_dup_user_tag:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer full) (nullable): Value of the user tag as newly allocated
@@ -1856,23 +1913,23 @@ xcamel_message_info_get_user_tag (const xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gchar *
-xcamel_message_info_dup_user_tag (const xCamelMessageInfo *mi,
-                                 const gchar *name)
+camel_message_info_dup_user_tag (const CamelMessageInfo *mi,
+                                const gchar *name)
 {
        gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
        g_return_val_if_fail (name != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
-       result = g_strdup (xcamel_message_info_get_user_tag (mi, name));
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_lock (mi);
+       result = g_strdup (camel_message_info_get_user_tag (mi, name));
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_user_tag:
+ * camel_message_info_set_user_tag:
  * @mi: a #CamelMessageInfo
  * @name: user tag name
  * @value: (nullable): user tag value, or %NULL to remove the user tag
@@ -1880,7 +1937,7 @@ xcamel_message_info_dup_user_tag (const xCamelMessageInfo *mi,
  * Set user tag @name to @value, or remove it, if @value is %NULL.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is also emitted
+ * set automatically, unless the @mi is aborting notifications. There is also emitted
  * folder's "changed" signal for this @mi, if necessary.
  *
  * Returns: Whether the @mi changed.
@@ -1888,38 +1945,38 @@ xcamel_message_info_dup_user_tag (const xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_user_tag (xCamelMessageInfo *mi,
-                                 const gchar *name,
-                                 const gchar *value)
+camel_message_info_set_user_tag (CamelMessageInfo *mi,
+                                const gchar *name,
+                                const gchar *value)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (name != NULL, FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_user_tag != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_user_tag (mi, name, value);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "user-tags");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
 
-               xcamel_message_info_update_summary_and_folder (mi, FALSE);
+               camel_message_info_update_summary_and_folder (mi, FALSE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_user_tags:
+ * camel_message_info_get_user_tags:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none) (nullable): a #CamelNameValueArray containing all set
@@ -1928,26 +1985,26 @@ xcamel_message_info_set_user_tag (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const CamelNameValueArray *
-xcamel_message_info_get_user_tags (const xCamelMessageInfo *mi)
+camel_message_info_get_user_tags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_user_tags != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_user_tags (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_dup_user_tags:
+ * camel_message_info_dup_user_tags:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer full) (nullable): a newly allocated #CamelNameValueArray containing all set
@@ -1956,26 +2013,26 @@ xcamel_message_info_get_user_tags (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 CamelNameValueArray *
-xcamel_message_info_dup_user_tags (const xCamelMessageInfo *mi)
+camel_message_info_dup_user_tags (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->dup_user_tags != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->dup_user_tags (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_take_user_tags:
+ * camel_message_info_take_user_tags:
  * @mi: a #CamelMessageInfo
  * @user_tags: (transfer full) (nullable): user tags to set
  *
@@ -1984,7 +2041,7 @@ xcamel_message_info_dup_user_tags (const xCamelMessageInfo *mi)
  * of it. The caller should not change @user_tags afterwards.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is also emitted
+ * set automatically, unless the @mi is aborting notifications. There is also emitted
  * folder's "changed" signal for this @mi, if necessary.
  *
  * Note that it's not safe to use the @user_tags after the call to this function,
@@ -1995,36 +2052,36 @@ xcamel_message_info_dup_user_tags (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_take_user_tags (xCamelMessageInfo *mi,
-                                   CamelNameValueArray *user_tags)
+camel_message_info_take_user_tags (CamelMessageInfo *mi,
+                                  CamelNameValueArray *user_tags)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->take_user_tags != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->take_user_tags (mi, user_tags);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "user-tags");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
 
-               xcamel_message_info_update_summary_and_folder (mi, FALSE);
+               camel_message_info_update_summary_and_folder (mi, FALSE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_subject:
+ * camel_message_info_get_subject:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none): Subject of the #mi.
@@ -2032,27 +2089,27 @@ xcamel_message_info_take_user_tags (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_subject (const xCamelMessageInfo *mi)
+camel_message_info_get_subject (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_subject != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_subject (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_subject:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_subject:
+ * @mi: a #CamelMessageInfo
  * @subject: (nullable): a Subject to set
  *
  * Sets Subject from the associated message.
@@ -2062,7 +2119,7 @@ xcamel_message_info_get_subject (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2070,34 +2127,34 @@ xcamel_message_info_get_subject (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_subject (xCamelMessageInfo *mi,
+camel_message_info_set_subject (CamelMessageInfo *mi,
                                const gchar *subject)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_subject != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_subject (mi, subject);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "subject");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_preview:
+ * camel_message_info_get_preview:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none): Preview of the @mi.
@@ -2105,27 +2162,27 @@ xcamel_message_info_set_subject (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_preview (const xCamelMessageInfo *mi)
+camel_message_info_get_preview (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_preview != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_preview (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_preview:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_preview:
+ * @mi: a #CamelMessageInfo
  * @preview: (nullable): a preview to set
  *
  * Sets preview of the associated message.
@@ -2135,7 +2192,7 @@ xcamel_message_info_get_preview (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is abort notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2143,34 +2200,34 @@ xcamel_message_info_get_preview (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_preview (xCamelMessageInfo *mi,
+camel_message_info_set_preview (CamelMessageInfo *mi,
                                const gchar *preview)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_preview != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_preview (mi, preview);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "preview");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_from:
+ * camel_message_info_get_from:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none): From address of the @mi.
@@ -2178,27 +2235,27 @@ xcamel_message_info_set_preview (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_from (const xCamelMessageInfo *mi)
+camel_message_info_get_from (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_from != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_from (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_from:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_from:
+ * @mi: a #CamelMessageInfo
  * @from: (nullable): a From to set
  *
  * Sets From from the associated message.
@@ -2208,7 +2265,7 @@ xcamel_message_info_get_from (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2216,34 +2273,34 @@ xcamel_message_info_get_from (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_from (xCamelMessageInfo *mi,
+camel_message_info_set_from (CamelMessageInfo *mi,
                             const gchar *from)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_from != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_from (mi, from);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "from");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_to:
+ * camel_message_info_get_to:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none): To address of the @mi.
@@ -2251,27 +2308,27 @@ xcamel_message_info_set_from (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_to (const xCamelMessageInfo *mi)
+camel_message_info_get_to (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_to != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_to (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_to:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_to:
+ * @mi: a #CamelMessageInfo
  * @to: (nullable): a To to set
  *
  * Sets To from the associated message.
@@ -2281,7 +2338,7 @@ xcamel_message_info_get_to (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2289,34 +2346,34 @@ xcamel_message_info_get_to (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_to (xCamelMessageInfo *mi,
+camel_message_info_set_to (CamelMessageInfo *mi,
                           const gchar *to)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_to != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_to (mi, to);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "to");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_cc:
+ * camel_message_info_get_cc:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none): CC address of the @mi.
@@ -2324,27 +2381,27 @@ xcamel_message_info_set_to (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_cc (const xCamelMessageInfo *mi)
+camel_message_info_get_cc (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_cc != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_cc (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_cc:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_cc:
+ * @mi: a #CamelMessageInfo
  * @cc: (nullable): a CC to set
  *
  * Sets CC from the associated message.
@@ -2354,7 +2411,7 @@ xcamel_message_info_get_cc (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2362,34 +2419,34 @@ xcamel_message_info_get_cc (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_cc (xCamelMessageInfo *mi,
+camel_message_info_set_cc (CamelMessageInfo *mi,
                           const gchar *cc)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_cc != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_cc (mi, cc);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "cc");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_mlist:
+ * camel_message_info_get_mlist:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none): Mailing list address of the @mi.
@@ -2397,27 +2454,27 @@ xcamel_message_info_set_cc (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const gchar *
-xcamel_message_info_get_mlist (const xCamelMessageInfo *mi)
+camel_message_info_get_mlist (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_mlist != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_mlist (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_mlist:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_mlist:
+ * @mi: a #CamelMessageInfo
  * @mlist: (nullable): a message list address to set
  *
  * Sets mesage list address from the associated message.
@@ -2427,7 +2484,7 @@ xcamel_message_info_get_mlist (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2435,34 +2492,34 @@ xcamel_message_info_get_mlist (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_mlist (xCamelMessageInfo *mi,
+camel_message_info_set_mlist (CamelMessageInfo *mi,
                              const gchar *mlist)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_mlist != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_mlist (mi, mlist);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "mlist");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_size:
+ * camel_message_info_get_size:
  * @mi: a #CamelMessageInfo
  *
  * Returns: Size of the associated message.
@@ -2470,27 +2527,27 @@ xcamel_message_info_set_mlist (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 guint32
-xcamel_message_info_get_size (const xCamelMessageInfo *mi)
+camel_message_info_get_size (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        guint32 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), 0);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, 0);
        g_return_val_if_fail (klass->get_size != NULL, 0);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_size (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_size:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_size:
+ * @mi: a #CamelMessageInfo
  * @size: a size to set
  *
  * Sets size of the associated message.
@@ -2500,7 +2557,7 @@ xcamel_message_info_get_size (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2508,34 +2565,34 @@ xcamel_message_info_get_size (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_size (xCamelMessageInfo *mi,
+camel_message_info_set_size (CamelMessageInfo *mi,
                             guint32 size)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_size != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_size (mi, size);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "size");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_date_sent:
+ * camel_message_info_get_date_sent:
  * @mi: a #CamelMessageInfo
  *
  * Returns: time_t of the Date header of the message, encoded as gint64.
@@ -2543,27 +2600,27 @@ xcamel_message_info_set_size (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gint64
-xcamel_message_info_get_date_sent (const xCamelMessageInfo *mi)
+camel_message_info_get_date_sent (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        gint64 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), 0);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, 0);
        g_return_val_if_fail (klass->get_date_sent != NULL, 0);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_date_sent (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_date_sent:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_date_sent:
+ * @mi: a #CamelMessageInfo
  * @date_sent: a sent date to set
  *
  * Sets sent date (the Date header) of the associated message.
@@ -2573,7 +2630,7 @@ xcamel_message_info_get_date_sent (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2581,34 +2638,34 @@ xcamel_message_info_get_date_sent (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_date_sent (xCamelMessageInfo *mi,
+camel_message_info_set_date_sent (CamelMessageInfo *mi,
                                  gint64 date_sent)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_date_sent != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_date_sent (mi, date_sent);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "date-sent");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_date_received:
+ * camel_message_info_get_date_received:
  * @mi: a #CamelMessageInfo
  *
  * Returns: time_t of the Received header of the message, encoded as gint64.
@@ -2616,27 +2673,27 @@ xcamel_message_info_set_date_sent (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 gint64
-xcamel_message_info_get_date_received (const xCamelMessageInfo *mi)
+camel_message_info_get_date_received (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        gint64 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), 0);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, 0);
        g_return_val_if_fail (klass->get_date_received != NULL, 0);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_date_received (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_date_received:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_date_received:
+ * @mi: a #CamelMessageInfo
  * @date_received: a received date to set
  *
  * Sets received date (the Received header) of the associated message.
@@ -2646,7 +2703,7 @@ xcamel_message_info_get_date_received (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2654,34 +2711,34 @@ xcamel_message_info_get_date_received (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_date_received (xCamelMessageInfo *mi,
+camel_message_info_set_date_received (CamelMessageInfo *mi,
                                      gint64 date_received)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_date_received != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_date_received (mi, date_received);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "date-received");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_message_id:
+ * camel_message_info_get_message_id:
  * @mi: a #CamelMessageInfo
  *
  * Encoded Message-ID of the associated message as a guint64 number,
@@ -2692,27 +2749,27 @@ xcamel_message_info_set_date_received (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 guint64
-xcamel_message_info_get_message_id (const xCamelMessageInfo *mi)
+camel_message_info_get_message_id (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        guint64 result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), 0);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), 0);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, 0);
        g_return_val_if_fail (klass->get_message_id != NULL, 0);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_message_id (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_set_message_id:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_set_message_id:
+ * @mi: a #CamelMessageInfo
  * @message_id: a message id to set
  *
  * Sets encoded Message-ID of the associated message as a guint64 number,
@@ -2723,7 +2780,7 @@ xcamel_message_info_get_message_id (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Returns: Whether the value changed.
@@ -2731,34 +2788,34 @@ xcamel_message_info_get_message_id (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_set_message_id (xCamelMessageInfo *mi,
+camel_message_info_set_message_id (CamelMessageInfo *mi,
                                   guint64 message_id)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->set_message_id != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->set_message_id (mi, message_id);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "message-id");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_references:
+ * camel_message_info_get_references:
  * @mi: a #CamelMessageInfo
  *
  * Gets encoded In-Reply-To and References headers of the associated
@@ -2771,26 +2828,26 @@ xcamel_message_info_set_message_id (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const GArray *
-xcamel_message_info_get_references (const xCamelMessageInfo *mi)
+camel_message_info_get_references (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const GArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_references != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_references (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_dup_references:
+ * camel_message_info_dup_references:
  * @mi: a #CamelMessageInfo
  *
  * Duplicates encoded In-Reply-To and References headers of the associated
@@ -2804,15 +2861,15 @@ xcamel_message_info_get_references (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 GArray *
-xcamel_message_info_dup_references (const xCamelMessageInfo *mi)
+camel_message_info_dup_references (const CamelMessageInfo *mi)
 {
        const GArray *arr;
        GArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       xcamel_message_info_property_lock (mi);
-       arr = xcamel_message_info_get_references (mi);
+       camel_message_info_property_lock (mi);
+       arr = camel_message_info_get_references (mi);
        if (arr) {
                guint ii;
 
@@ -2823,14 +2880,14 @@ xcamel_message_info_dup_references (const xCamelMessageInfo *mi)
        } else {
                result = NULL;
        }
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_take_references:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_take_references:
+ * @mi: a #CamelMessageInfo
  * @references: (transfer full) (nullable): a references to set
  *
  * Takes encoded In-Reply-To and References headers of the associated message
@@ -2842,7 +2899,7 @@ xcamel_message_info_dup_references (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Note that it's not safe to use the @references after the call to this function,
@@ -2853,34 +2910,34 @@ xcamel_message_info_dup_references (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_take_references (xCamelMessageInfo *mi,
+camel_message_info_take_references (CamelMessageInfo *mi,
                                    GArray *references)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->take_references != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->take_references (mi, references);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "references");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * xcamel_message_info_get_headers:
+ * camel_message_info_get_headers:
  * @mi: a #CamelMessageInfo
  *
  * Returns: (transfer none) (nullable): All the message headers of the associated
@@ -2889,26 +2946,26 @@ xcamel_message_info_take_references (xCamelMessageInfo *mi,
  * Since: 3.24
  **/
 const CamelNameValueArray *
-xcamel_message_info_get_headers (const xCamelMessageInfo *mi)
+camel_message_info_get_headers (const CamelMessageInfo *mi)
 {
-       xCamelMessageInfoClass *klass;
+       CamelMessageInfoClass *klass;
        const CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, NULL);
        g_return_val_if_fail (klass->get_headers != NULL, NULL);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = klass->get_headers (mi);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_dup_headers:
+ * camel_message_info_dup_headers:
  * @mi: a #CamelMessageInfo
  *
  * Duplicates array of headers for the @mi.
@@ -2920,28 +2977,28 @@ xcamel_message_info_get_headers (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 CamelNameValueArray *
-xcamel_message_info_dup_headers (const xCamelMessageInfo *mi)
+camel_message_info_dup_headers (const CamelMessageInfo *mi)
 {
        const CamelNameValueArray *arr;
        CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), NULL);
 
-       xcamel_message_info_property_lock (mi);
-       arr = xcamel_message_info_get_headers (mi);
+       camel_message_info_property_lock (mi);
+       arr = camel_message_info_get_headers (mi);
        if (arr) {
                result = camel_name_value_array_copy (arr);
        } else {
                result = NULL;
        }
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 /**
- * xcamel_message_info_take_headers:
- * @mi: a #xCamelMessageInfo
+ * camel_message_info_take_headers:
+ * @mi: a #CamelMessageInfo
  * @headers: (transfer full) (nullable): headers to set, as #CamelNameValueArray, or %NULL
  *
  * Takes headers of the associated message.
@@ -2951,7 +3008,7 @@ xcamel_message_info_dup_headers (const xCamelMessageInfo *mi)
  * change in the associated message.
  *
  * If the @mi changed, the 'dirty' flag and the 'folder-flagged' flag are
- * set automatically, unless the @mi is loading. There is not emitted
+ * set automatically, unless the @mi is aborting notifications. There is not emitted
  * folder's "changed" signal for this @mi.
  *
  * Note that it's not safe to use the @headers after the call to this function,
@@ -2962,176 +3019,59 @@ xcamel_message_info_dup_headers (const xCamelMessageInfo *mi)
  * Since: 3.24
  **/
 gboolean
-xcamel_message_info_take_headers (xCamelMessageInfo *mi,
+camel_message_info_take_headers (CamelMessageInfo *mi,
                                 CamelNameValueArray *headers)
 {
-       xCamelMessageInfoClass *klass;
-       gboolean changed, loading;
+       CamelMessageInfoClass *klass;
+       gboolean changed, abort_notifications;
 
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
 
-       klass = XCAMEL_MESSAGE_INFO_GET_CLASS (mi);
+       klass = CAMEL_MESSAGE_INFO_GET_CLASS (mi);
        g_return_val_if_fail (klass != NULL, FALSE);
        g_return_val_if_fail (klass->take_headers != NULL, FALSE);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        changed = klass->take_headers (mi, headers);
-       loading = mi->priv->loading;
-       xcamel_message_info_property_unlock (mi);
+       abort_notifications = mi->priv->abort_notifications;
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !loading) {
+       if (changed && !abort_notifications) {
                g_object_notify (G_OBJECT (mi), "headers");
-               xcamel_message_info_set_dirty (mi, TRUE);
-               xcamel_message_info_set_folder_flagged (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_folder_flagged (mi, TRUE);
        }
 
        return changed;
 }
 
 /**
- * camel_message_info_util_bdata_get_number:
- * @bdata_ptr: a backend specific data (bdata) pointer
- * @default_value: a value to return, when no data can be read
- *
- * Reads a numeric data from the @bdata_ptr and moves the @bdata_ptr
- * after that number. If the number cannot be read, then the @default_value
- * is returned instead and the @bdata_ptr is left unchanged. The number
- * might be previously stored with the camel_message_info_util_bdata_put_number().
- *
- * Returns: The read number, or the @default_value, if the @bdata_ptr doesn't
- *    point to a number.
- *
- * Since: 3.24
- **/
-gint64
-camel_message_info_util_bdata_get_number (/* const */ gchar **bdata_ptr,
-                                         gint64 default_value)
-{
-       gint64 result;
-       gchar *endptr;
-
-       g_return_val_if_fail (bdata_ptr != NULL, default_value);
-
-       if (!bdata_ptr || !*bdata_ptr || !**bdata_ptr)
-               return default_value;
-
-       if (**bdata_ptr == ' ')
-               *bdata_ptr += 1;
-
-       if (!**bdata_ptr)
-               return default_value;
-
-       endptr = *bdata_ptr;
-
-       result = g_ascii_strtoll (*bdata_ptr, &endptr, 10);
-
-       if (endptr == *bdata_ptr)
-               result = default_value;
-       else
-               *bdata_ptr = endptr;
-
-       return result;
-}
-
-/**
- * camel_message_info_util_bdata_put_number:
- * @bdata_str: a #GString to store a backend specific data (bdata)
- * @value: a value to store
+ * camel_message_info_dump:
+ * @mi: a #CamelMessageInfo
  *
- * Puts the number @value at the end of the @bdata_str. In case the @bdata_str
- * is not empty a space is added before the numeric @value. The stored value
- * can be read back with the camel_message_info_util_bdata_get_number().
+ * Dumps the mesasge info @mi to stdout. This is meand for debugging
+ * purposes only.
  *
  * Since: 3.24
  **/
 void
-camel_message_info_util_bdata_put_number (GString *bdata_str,
-                                         gint64 value)
+camel_message_info_dump (CamelMessageInfo *mi)
 {
-       g_return_if_fail (bdata_str != NULL);
-
-       if (bdata_str->len && bdata_str->str[bdata_str->len - 1] != ' ')
-               g_string_append_c (bdata_str, ' ');
-
-       g_string_append_printf (bdata_str, "%" G_GINT64_FORMAT, value);
-}
-
-/**
- * camel_message_info_util_bdata_get_string:
- * @bdata_ptr: a backend specific data (bdata) pointer
- * @default_value: a value to return, when no data can be read
- *
- * Reads a string data from the @bdata_ptr and moves the @bdata_ptr
- * after that string. If the string cannot be read, then the @default_value
- * is returned instead and the @bdata_ptr is left unchanged. The string
- * might be previously stored with the camel_message_info_util_bdata_put_string().
- *
- * Returns: (transfer full): Newly allocated string, which was read, or
- *    dupped the @default_value, if the @bdata_ptr doesn't point to a string.
- *    Free returned pointer with g_free() when done with it.
- *
- * Since: 3.24
- **/
-gchar *
-camel_message_info_util_bdata_get_string (/* const */ gchar **bdata_ptr,
-                                         const gchar *default_value)
-{
-       gint64 length, has_length;
-       gchar *orig_bdata_ptr;
-       gchar *result;
-
-       g_return_val_if_fail (bdata_ptr != NULL, NULL);
-
-       orig_bdata_ptr = *bdata_ptr;
-
-       length = camel_message_info_util_bdata_get_number (bdata_ptr, -1);
-
-       /* might be a '-' sign */
-       if (*bdata_ptr && **bdata_ptr == '-')
-               *bdata_ptr += 1;
-       else
-               length = -1;
-
-       if (length < 0 || !*bdata_ptr || !**bdata_ptr || *bdata_ptr == orig_bdata_ptr) {
-               *bdata_ptr = orig_bdata_ptr;
-
-               return g_strdup (default_value);
+       if (!mi) {
+               printf ("No message info\n");
+               return;
        }
 
-       if (!length)
-               return g_strdup ("");
-
-       has_length = strlen (*bdata_ptr);
-       if (has_length < length)
-               length = has_length;
-
-       result = g_strndup (*bdata_ptr, length);
-       *bdata_ptr += length;
-
-       return result;
-}
-
-/**
- * camel_message_info_util_bdata_put_string:
- * @bdata_str: a #GString to store a backend specific data (bdata)
- * @value: a value to store
- *
- * Puts the string @value at the end of the @bdata_str. In case the @bdata_str
- * is not empty a space is added before the string @value. The stored value
- * can be read back with the camel_message_info_util_bdata_get_string().
- *
- * The strings are encoded as "length-value", quotes for clarity only.
- *
- * Since: 3.24
- **/
-void
-camel_message_info_util_bdata_put_string (GString *bdata_str,
-                                         const gchar *value)
-{
-       g_return_if_fail (bdata_str != NULL);
-       g_return_if_fail (value != NULL);
+       camel_message_info_property_lock (mi);
 
-       camel_message_info_util_bdata_put_number (bdata_str, strlen (value));
+       printf ("Message info %s:\n", G_OBJECT_TYPE_NAME (mi));
+       printf ("   UID: %s\n", camel_message_info_get_uid (mi));
+       printf ("   Flags: %04x\n", camel_message_info_get_flags (mi));
+       printf ("   From: %s\n", camel_message_info_get_from (mi));
+       printf ("   To: %s\n", camel_message_info_get_to (mi));
+       printf ("   Cc: %s\n", camel_message_info_get_cc (mi));
+       printf ("   Mailing list: %s\n", camel_message_info_get_mlist (mi));
+       printf ("   Subject: %s\n", camel_message_info_get_subject (mi));
 
-       g_string_append_printf (bdata_str, "-%s", value);
+       camel_message_info_property_unlock (mi);
 }
diff --git a/camel/camel-message-info.h b/camel/camel-message-info.h
index 5df819d..8af5348 100644
--- a/camel/camel-message-info.h
+++ b/camel/camel-message-info.h
@@ -19,31 +19,31 @@
 #error "Only <camel/camel.h> can be included directly."
 #endif
 
-#ifndef XCAMEL_MESSAGE_INFO_H
-#define XCAMEL_MESSAGE_INFO_H
+#ifndef CAMEL_MESSAGE_INFO_H
+#define CAMEL_MESSAGE_INFO_H
 
 #include <glib-object.h>
 
 #include <camel/camel-mime-utils.h>
 
 /* Standard GObject macros */
-#define XCAMEL_TYPE_MESSAGE_INFO \
-       (xcamel_message_info_get_type ())
-#define XCAMEL_MESSAGE_INFO(obj) \
+#define CAMEL_TYPE_MESSAGE_INFO \
+       (camel_message_info_get_type ())
+#define CAMEL_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfo))
-#define XCAMEL_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfo))
+#define CAMEL_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfoClass))
-#define XCAMEL_IS_MESSAGE_INFO(obj) \
+       ((cls), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfoClass))
+#define CAMEL_IS_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), XCAMEL_TYPE_MESSAGE_INFO))
-#define XCAMEL_IS_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MESSAGE_INFO))
+#define CAMEL_IS_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), XCAMEL_TYPE_MESSAGE_INFO))
-#define XCAMEL_MESSAGE_INFO_GET_CLASS(obj) \
+       ((cls), CAMEL_TYPE_MESSAGE_INFO))
+#define CAMEL_MESSAGE_INFO_GET_CLASS(obj) \
        (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), XCAMEL_TYPE_MESSAGE_INFO, xCamelMessageInfoClass))
+       ((obj), CAMEL_TYPE_MESSAGE_INFO, CamelMessageInfoClass))
 
 G_BEGIN_DECLS
 
@@ -93,244 +93,240 @@ typedef enum _CamelMessageFlags {
 /* Changes to system flags will NOT trigger a folder changed event */
 #define CAMEL_MESSAGE_SYSTEM_MASK (0xffff << 16)
 
-typedef struct _xCamelMessageInfo xCamelMessageInfo;
-typedef struct _xCamelMessageInfoClass xCamelMessageInfoClass;
-typedef struct _xCamelMessageInfoPrivate xCamelMessageInfoPrivate;
+typedef struct _CamelMessageInfo CamelMessageInfo;
+typedef struct _CamelMessageInfoClass CamelMessageInfoClass;
+typedef struct _CamelMessageInfoPrivate CamelMessageInfoPrivate;
 
-struct _xCamelMessageInfo {
+struct _CamelMessageInfo {
        GObject parent;
-       xCamelMessageInfoPrivate *priv;
+       CamelMessageInfoPrivate *priv;
 };
 
-struct _xCamelMessageInfoClass {
+struct _CamelMessageInfoClass {
        GObjectClass parent_class;
 
-       xCamelMessageInfo *     (* clone)       (const xCamelMessageInfo *mi,
+       CamelMessageInfo *      (* clone)       (const CamelMessageInfo *mi,
                                                 struct _CamelFolderSummary *assign_summary);
-       gboolean                (* load)        (xCamelMessageInfo *mi,
+       gboolean                (* load)        (CamelMessageInfo *mi,
                                                 const struct _CamelMIRecord *record,
                                                 /* const */ gchar **bdata_ptr);
-       gboolean                (* save)        (const xCamelMessageInfo *mi,
+       gboolean                (* save)        (const CamelMessageInfo *mi,
                                                 struct _CamelMIRecord *record,
                                                 GString *bdata_str);
-       guint32                 (* get_flags)   (const xCamelMessageInfo *mi);
-       gboolean                (* set_flags)   (xCamelMessageInfo *mi,
-                                                CamelMessageFlags mask,
+       guint32                 (* get_flags)   (const CamelMessageInfo *mi);
+       gboolean                (* set_flags)   (CamelMessageInfo *mi,
+                                                guint32 mask,
                                                 guint32 set);
        gboolean                (* get_user_flag)
-                                               (const xCamelMessageInfo *mi,
+                                               (const CamelMessageInfo *mi,
                                                 const gchar *name);
        gboolean                (* set_user_flag)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 const gchar *name,
                                                 gboolean state);
        const CamelNamedFlags * (* get_user_flags)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        CamelNamedFlags *       (* dup_user_flags)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        gboolean                (* take_user_flags)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 CamelNamedFlags *user_flags);
-       const gchar *           (* get_user_tag)(const xCamelMessageInfo *mi,
+       const gchar *           (* get_user_tag)(const CamelMessageInfo *mi,
                                                 const gchar *name);
-       gboolean                (* set_user_tag)(xCamelMessageInfo *mi,
+       gboolean                (* set_user_tag)(CamelMessageInfo *mi,
                                                 const gchar *name,
                                                 const gchar *value);
        const CamelNameValueArray *
                                (* get_user_tags)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        CamelNameValueArray *   (* dup_user_tags)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        gboolean                (* take_user_tags)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 CamelNameValueArray *user_tags);
-       const gchar *           (* get_subject) (const xCamelMessageInfo *mi);
-       gboolean                (* set_subject) (xCamelMessageInfo *mi,
+       const gchar *           (* get_subject) (const CamelMessageInfo *mi);
+       gboolean                (* set_subject) (CamelMessageInfo *mi,
                                                 const gchar *subject);
-       const gchar *           (* get_preview) (const xCamelMessageInfo *mi);
-       gboolean                (* set_preview) (xCamelMessageInfo *mi,
+       const gchar *           (* get_preview) (const CamelMessageInfo *mi);
+       gboolean                (* set_preview) (CamelMessageInfo *mi,
                                                 const gchar *preview);
-       const gchar *           (* get_from)    (const xCamelMessageInfo *mi);
-       gboolean                (* set_from)    (xCamelMessageInfo *mi,
+       const gchar *           (* get_from)    (const CamelMessageInfo *mi);
+       gboolean                (* set_from)    (CamelMessageInfo *mi,
                                                 const gchar *from);
-       const gchar *           (* get_to)      (const xCamelMessageInfo *mi);
-       gboolean                (* set_to)      (xCamelMessageInfo *mi,
+       const gchar *           (* get_to)      (const CamelMessageInfo *mi);
+       gboolean                (* set_to)      (CamelMessageInfo *mi,
                                                 const gchar *to);
-       const gchar *           (* get_cc)      (const xCamelMessageInfo *mi);
-       gboolean                (* set_cc)      (xCamelMessageInfo *mi,
+       const gchar *           (* get_cc)      (const CamelMessageInfo *mi);
+       gboolean                (* set_cc)      (CamelMessageInfo *mi,
                                                 const gchar *cc);
-       const gchar *           (* get_mlist)   (const xCamelMessageInfo *mi);
-       gboolean                (* set_mlist)   (xCamelMessageInfo *mi,
+       const gchar *           (* get_mlist)   (const CamelMessageInfo *mi);
+       gboolean                (* set_mlist)   (CamelMessageInfo *mi,
                                                 const gchar *mlist);
-       guint32                 (* get_size)    (const xCamelMessageInfo *mi);
-       gboolean                (* set_size)    (xCamelMessageInfo *mi,
+       guint32                 (* get_size)    (const CamelMessageInfo *mi);
+       gboolean                (* set_size)    (CamelMessageInfo *mi,
                                                 guint32 size);
        gint64                  (* get_date_sent)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        gboolean                (* set_date_sent)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 gint64 date_sent);
        gint64                  (* get_date_received)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        gboolean                (* set_date_received)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 gint64 date_received);
        guint64                 (* get_message_id)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        gboolean                (* set_message_id)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 guint64 message_id);
        const GArray *          (* get_references)
-                                               (const xCamelMessageInfo *mi);
+                                               (const CamelMessageInfo *mi);
        gboolean                (* take_references)
-                                               (xCamelMessageInfo *mi,
+                                               (CamelMessageInfo *mi,
                                                 GArray *references);
        const CamelNameValueArray *
-                               (* get_headers) (const xCamelMessageInfo *mi);
-       gboolean                (* take_headers)(xCamelMessageInfo *mi,
-                                               CamelNameValueArray *headers);
+                               (* get_headers) (const CamelMessageInfo *mi);
+       gboolean                (* take_headers)(CamelMessageInfo *mi,
+                                                CamelNameValueArray *headers);
 
        /* Padding for future expansion */
        gpointer reserved[20];
 };
 
-GType          xcamel_message_info_get_type    (void);
-xCamelMessageInfo *
-               xcamel_message_info_new         (struct _CamelFolderSummary *summary);
-xCamelMessageInfo *
-               xcamel_message_info_clone       (const xCamelMessageInfo *mi,
+GType          camel_message_info_get_type     (void);
+CamelMessageInfo *
+               camel_message_info_new          (struct _CamelFolderSummary *summary);
+CamelMessageInfo *
+               camel_message_info_clone        (const CamelMessageInfo *mi,
                                                 struct _CamelFolderSummary *assign_summary);
-gboolean       camel_message_info_load         (xCamelMessageInfo *mi,
+gboolean       camel_message_info_load         (CamelMessageInfo *mi,
                                                 const struct _CamelMIRecord *record,
                                                 /* const */ gchar **bdata_ptr);
-gboolean       camel_message_info_save         (const xCamelMessageInfo *mi,
+gboolean       camel_message_info_save         (const CamelMessageInfo *mi,
                                                 struct _CamelMIRecord *record,
                                                 GString *bdata_str);
 struct _CamelFolderSummary *
-               xcamel_message_info_ref_summary (const xCamelMessageInfo *mi);
-void           xcamel_message_info_property_lock
-                                               (const xCamelMessageInfo *mi);
-void           xcamel_message_info_property_unlock
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_get_dirty   (const xCamelMessageInfo *mi);
-void           xcamel_message_info_set_dirty   (const xCamelMessageInfo *mi,
+               camel_message_info_ref_summary  (const CamelMessageInfo *mi);
+void           camel_message_info_property_lock
+                                               (const CamelMessageInfo *mi);
+void           camel_message_info_property_unlock
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_get_dirty    (const CamelMessageInfo *mi);
+void           camel_message_info_set_dirty    (const CamelMessageInfo *mi,
                                                 gboolean dirty);
-guint          xcamel_message_info_get_dirty_stamp
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_get_folder_flagged
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_folder_flagged
-                                               (xCamelMessageInfo *mi,
+gboolean       camel_message_info_get_folder_flagged
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_folder_flagged
+                                               (CamelMessageInfo *mi,
                                                 gboolean folder_flagged);
-guint          xcamel_message_info_get_folder_flagged_stamp
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_get_loading (const xCamelMessageInfo *mi);
-void           xcamel_message_info_set_loading (const xCamelMessageInfo *mi,
-                                                gboolean loading);
-const gchar *  xcamel_message_info_get_uid     (const xCamelMessageInfo *mi);
-const gchar *  xcamel_message_info_pooldup_uid (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_uid     (xCamelMessageInfo *mi,
+guint          camel_message_info_get_folder_flagged_stamp
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_get_abort_notifications
+                                               (const CamelMessageInfo *mi);
+void           camel_message_info_set_abort_notifications
+                                               (CamelMessageInfo *mi,
+                                                gboolean abort_notifications);
+void           camel_message_info_freeze_notifications
+                                               (CamelMessageInfo *mi);
+void           camel_message_info_thaw_notifications
+                                               (CamelMessageInfo *mi);
+gboolean       camel_message_info_get_notifications_frozen
+                                               (const CamelMessageInfo *mi);
+const gchar *  camel_message_info_get_uid      (const CamelMessageInfo *mi);
+const gchar *  camel_message_info_pooldup_uid  (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_uid      (CamelMessageInfo *mi,
                                                 const gchar *uid);
-guint32                xcamel_message_info_get_flags   (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_flags   (xCamelMessageInfo *mi,
-                                                CamelMessageFlags mask,
+guint32                camel_message_info_get_flags    (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_flags    (CamelMessageInfo *mi,
+                                                guint32 mask,
                                                 guint32 set);
-gboolean       xcamel_message_info_get_user_flag
-                                               (const xCamelMessageInfo *mi,
+gboolean       camel_message_info_get_user_flag
+                                               (const CamelMessageInfo *mi,
                                                 const gchar *name);
-gboolean       xcamel_message_info_set_user_flag
-                                               (xCamelMessageInfo *mi,
+gboolean       camel_message_info_set_user_flag
+                                               (CamelMessageInfo *mi,
                                                 const gchar *name,
                                                 gboolean state);
 const CamelNamedFlags *
-               xcamel_message_info_get_user_flags
-                                               (const xCamelMessageInfo *mi);
+               camel_message_info_get_user_flags
+                                               (const CamelMessageInfo *mi);
 CamelNamedFlags *
-               xcamel_message_info_dup_user_flags
-                                               (const xCamelMessageInfo *mi);
+               camel_message_info_dup_user_flags
+                                               (const CamelMessageInfo *mi);
 gboolean
-               xcamel_message_info_take_user_flags
-                                               (xCamelMessageInfo *mi,
+               camel_message_info_take_user_flags
+                                               (CamelMessageInfo *mi,
                                                 CamelNamedFlags *user_flags);
-const gchar *  xcamel_message_info_get_user_tag        (const xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_user_tag (const CamelMessageInfo *mi,
                                                 const gchar *name);
-gchar *                xcamel_message_info_dup_user_tag        (const xCamelMessageInfo *mi,
+gchar *                camel_message_info_dup_user_tag (const CamelMessageInfo *mi,
                                                 const gchar *name);
-gboolean       xcamel_message_info_set_user_tag        (xCamelMessageInfo *mi,
+gboolean       camel_message_info_set_user_tag (CamelMessageInfo *mi,
                                                 const gchar *name,
                                                 const gchar *value);
 const CamelNameValueArray *
-               xcamel_message_info_get_user_tags
-                                               (const xCamelMessageInfo *mi);
+               camel_message_info_get_user_tags
+                                               (const CamelMessageInfo *mi);
 CamelNameValueArray *
-               xcamel_message_info_dup_user_tags
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_take_user_tags
-                                               (xCamelMessageInfo *mi,
+               camel_message_info_dup_user_tags
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_take_user_tags
+                                               (CamelMessageInfo *mi,
                                                 CamelNameValueArray *user_tags);
-const gchar *  xcamel_message_info_get_subject (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_subject (xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_subject  (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_subject  (CamelMessageInfo *mi,
                                                 const gchar *subject);
-const gchar *  xcamel_message_info_get_preview (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_preview (xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_preview  (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_preview  (CamelMessageInfo *mi,
                                                 const gchar *preview);
-const gchar *  xcamel_message_info_get_from    (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_from    (xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_from     (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_from     (CamelMessageInfo *mi,
                                                 const gchar *from);
-const gchar *  xcamel_message_info_get_to      (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_to      (xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_to       (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_to       (CamelMessageInfo *mi,
                                                 const gchar *to);
-const gchar *  xcamel_message_info_get_cc      (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_cc      (xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_cc       (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_cc       (CamelMessageInfo *mi,
                                                 const gchar *cc);
-const gchar *  xcamel_message_info_get_mlist   (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_mlist   (xCamelMessageInfo *mi,
+const gchar *  camel_message_info_get_mlist    (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_mlist    (CamelMessageInfo *mi,
                                                 const gchar *mlist);
-guint32                xcamel_message_info_get_size    (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_size    (xCamelMessageInfo *mi,
+guint32                camel_message_info_get_size     (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_size     (CamelMessageInfo *mi,
                                                 guint32 size);
-gint64         xcamel_message_info_get_date_sent
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_date_sent
-                                               (xCamelMessageInfo *mi,
+gint64         camel_message_info_get_date_sent
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_date_sent
+                                               (CamelMessageInfo *mi,
                                                 gint64 date_sent);
-gint64         xcamel_message_info_get_date_received
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_date_received
-                                               (xCamelMessageInfo *mi,
+gint64         camel_message_info_get_date_received
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_date_received
+                                               (CamelMessageInfo *mi,
                                                 gint64 date_received);
-guint64                xcamel_message_info_get_message_id
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_set_message_id
-                                               (xCamelMessageInfo *mi,
+guint64                camel_message_info_get_message_id
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_set_message_id
+                                               (CamelMessageInfo *mi,
                                                 guint64 message_id);
-const GArray * xcamel_message_info_get_references
-                                               (const xCamelMessageInfo *mi);
-GArray *       xcamel_message_info_dup_references
-                                               (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_take_references
-                                               (xCamelMessageInfo *mi,
+const GArray * camel_message_info_get_references
+                                               (const CamelMessageInfo *mi);
+GArray *       camel_message_info_dup_references
+                                               (const CamelMessageInfo *mi);
+gboolean       camel_message_info_take_references
+                                               (CamelMessageInfo *mi,
                                                 GArray *references);
 const CamelNameValueArray *
-               xcamel_message_info_get_headers (const xCamelMessageInfo *mi);
+               camel_message_info_get_headers  (const CamelMessageInfo *mi);
 CamelNameValueArray *
-               xcamel_message_info_dup_headers (const xCamelMessageInfo *mi);
-gboolean       xcamel_message_info_take_headers        (xCamelMessageInfo *mi,
-                                               CamelNameValueArray *headers);
+               camel_message_info_dup_headers  (const CamelMessageInfo *mi);
+gboolean       camel_message_info_take_headers (CamelMessageInfo *mi,
+                                                CamelNameValueArray *headers);
+
+/* Debugging functions */
+void           camel_message_info_dump         (CamelMessageInfo *mi);
 
-/* Utility functions */
-gint64         camel_message_info_util_bdata_get_number
-                                               (/* const */ gchar **bdata_ptr,
-                                                gint64 default_value);
-void           camel_message_info_util_bdata_put_number
-                                               (GString *bdata_str,
-                                                gint64 value);
-gchar *                camel_message_info_util_bdata_get_string
-                                               (/* const */ gchar **bdata_ptr,
-                                                const gchar *default_value);
-void           camel_message_info_util_bdata_put_string
-                                               (GString *bdata_str,
-                                                const gchar *value);
 G_END_DECLS
 
-#endif /* XCAMEL_MESSAGE_INFO_H */
+#endif /* CAMEL_MESSAGE_INFO_H */
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 8959a25..61328c4 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -193,6 +193,7 @@ camel_mime_message_build_preview (CamelMimePart *msg,
                if (camel_data_wrapper_decode_to_stream_sync (dw, mstream, NULL, NULL) > 0) {
                        gchar *line = NULL;
                        GString *str = g_string_new (NULL);
+                       gchar *preview_str;
 
                        g_seekable_seek (
                                G_SEEKABLE (mstream), 0,
@@ -228,9 +229,12 @@ camel_mime_message_build_preview (CamelMimePart *msg,
                        if (str->len > 100) {
                                g_string_insert (str, 100, "\n");
                        }
-                       /* We don't mark dirty, as we don't store these */
-                       ((CamelMessageInfoBase *) info)->preview = camel_utf8_make_valid (str->str);
+
+                       preview_str = camel_utf8_make_valid (str->str);
+
+                       camel_message_info_set_preview (info, preview_str);
                        g_string_free (str, TRUE);
+                       g_free (preview_str);
 
                        g_object_unref (bstream);
                }
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index a1e48f1..8449fce 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -180,7 +180,7 @@ camel_name_value_array_new_sized (guint reserve_size)
 
 /**
  * camel_name_value_array_copy:
- * @array: a #CamelNameValueArray
+ * @array: (nullable): a #CamelNameValueArray
  *
  * Created a new copy of the @array. The returned pointer should be freed
  * with camel_name_value_array_free() when no longer needed.
@@ -232,7 +232,7 @@ camel_name_value_array_free (CamelNameValueArray *array)
 
 /**
  * camel_name_value_array_get_length:
- * @array: a #CamelNameValueArray
+ * @array: (nullable): a #CamelNameValueArray
  *
  * Returns: Length of the @array, aka how many elements are stored in the @array.
  *
@@ -243,7 +243,8 @@ camel_name_value_array_get_length (const CamelNameValueArray *array)
 {
        GArray *arr = (GArray *) array;
 
-       g_return_val_if_fail (array != NULL, 0);
+       if (!array)
+               return 0;
 
        return arr->len;
 }
@@ -756,7 +757,7 @@ camel_named_flags_new_sized (guint reserve_size)
 
 /**
  * camel_named_flags_copy:
- * @named_flags: a #CamelNamedFlags
+ * @named_flags: (nullable): a #CamelNamedFlags
  *
  * Creates a copy of the @named_flags and returns it.
  *
@@ -929,7 +930,7 @@ camel_named_flags_clear (CamelNamedFlags *named_flags)
 
 /**
  * camel_named_flags_get_length:
- * @named_flags: a #CamelNamedFlags
+ * @named_flags: (nullable): a #CamelNamedFlags
  *
  * Returns: Length of the array, aka how many named flags are stored there.
  *
@@ -940,7 +941,8 @@ camel_named_flags_get_length (const CamelNamedFlags *named_flags)
 {
        const GPtrArray *arr = (const GPtrArray *) named_flags;
 
-       g_return_val_if_fail (named_flags != NULL, 0);
+       if (!named_flags)
+               return 0;
 
        return arr->len;
 }
@@ -1006,6 +1008,156 @@ camel_named_flags_equal (const CamelNamedFlags *named_flags_a,
 /* ------------------------------------------------------------------------ */
 
 /**
+ * camel_util_bdata_get_number:
+ * @bdata_ptr: a backend specific data (bdata) pointer
+ * @default_value: a value to return, when no data can be read
+ *
+ * Reads a numeric data from the @bdata_ptr and moves the @bdata_ptr
+ * after that number. If the number cannot be read, then the @default_value
+ * is returned instead and the @bdata_ptr is left unchanged. The number
+ * might be previously stored with the camel_util_bdata_put_number().
+ *
+ * Returns: The read number, or the @default_value, if the @bdata_ptr doesn't
+ *    point to a number.
+ *
+ * Since: 3.24
+ **/
+gint64
+camel_util_bdata_get_number (/* const */ gchar **bdata_ptr,
+                            gint64 default_value)
+{
+       gint64 result;
+       gchar *endptr;
+
+       g_return_val_if_fail (bdata_ptr != NULL, default_value);
+
+       if (!bdata_ptr || !*bdata_ptr || !**bdata_ptr)
+               return default_value;
+
+       if (**bdata_ptr == ' ')
+               *bdata_ptr += 1;
+
+       if (!**bdata_ptr)
+               return default_value;
+
+       endptr = *bdata_ptr;
+
+       result = g_ascii_strtoll (*bdata_ptr, &endptr, 10);
+
+       if (endptr == *bdata_ptr)
+               result = default_value;
+       else
+               *bdata_ptr = endptr;
+
+       return result;
+}
+
+/**
+ * camel_util_bdata_put_number:
+ * @bdata_str: a #GString to store a backend specific data (bdata)
+ * @value: a value to store
+ *
+ * Puts the number @value at the end of the @bdata_str. In case the @bdata_str
+ * is not empty a space is added before the numeric @value. The stored value
+ * can be read back with the camel_util_bdata_get_number().
+ *
+ * Since: 3.24
+ **/
+void
+camel_util_bdata_put_number (GString *bdata_str,
+                            gint64 value)
+{
+       g_return_if_fail (bdata_str != NULL);
+
+       if (bdata_str->len && bdata_str->str[bdata_str->len - 1] != ' ')
+               g_string_append_c (bdata_str, ' ');
+
+       g_string_append_printf (bdata_str, "%" G_GINT64_FORMAT, value);
+}
+
+/**
+ * camel_util_bdata_get_string:
+ * @bdata_ptr: a backend specific data (bdata) pointer
+ * @default_value: a value to return, when no data can be read
+ *
+ * Reads a string data from the @bdata_ptr and moves the @bdata_ptr
+ * after that string. If the string cannot be read, then the @default_value
+ * is returned instead and the @bdata_ptr is left unchanged. The string
+ * might be previously stored with the camel_util_bdata_put_string().
+ *
+ * Returns: (transfer full): Newly allocated string, which was read, or
+ *    dupped the @default_value, if the @bdata_ptr doesn't point to a string.
+ *    Free returned pointer with g_free() when done with it.
+ *
+ * Since: 3.24
+ **/
+gchar *
+camel_util_bdata_get_string (/* const */ gchar **bdata_ptr,
+                            const gchar *default_value)
+{
+       gint64 length, has_length;
+       gchar *orig_bdata_ptr;
+       gchar *result;
+
+       g_return_val_if_fail (bdata_ptr != NULL, NULL);
+
+       orig_bdata_ptr = *bdata_ptr;
+
+       length = camel_util_bdata_get_number (bdata_ptr, -1);
+
+       /* might be a '-' sign */
+       if (*bdata_ptr && **bdata_ptr == '-')
+               *bdata_ptr += 1;
+       else
+               length = -1;
+
+       if (length < 0 || !*bdata_ptr || !**bdata_ptr || *bdata_ptr == orig_bdata_ptr) {
+               *bdata_ptr = orig_bdata_ptr;
+
+               return g_strdup (default_value);
+       }
+
+       if (!length)
+               return g_strdup ("");
+
+       has_length = strlen (*bdata_ptr);
+       if (has_length < length)
+               length = has_length;
+
+       result = g_strndup (*bdata_ptr, length);
+       *bdata_ptr += length;
+
+       return result;
+}
+
+/**
+ * camel_util_bdata_put_string:
+ * @bdata_str: a #GString to store a backend specific data (bdata)
+ * @value: a value to store
+ *
+ * Puts the string @value at the end of the @bdata_str. In case the @bdata_str
+ * is not empty a space is added before the string @value. The stored value
+ * can be read back with the camel_util_bdata_get_string().
+ *
+ * The strings are encoded as "length-value", quotes for clarity only.
+ *
+ * Since: 3.24
+ **/
+void
+camel_util_bdata_put_string (GString *bdata_str,
+                            const gchar *value)
+{
+       g_return_if_fail (bdata_str != NULL);
+       g_return_if_fail (value != NULL);
+
+       camel_util_bdata_put_number (bdata_str, strlen (value));
+
+       g_string_append_printf (bdata_str, "-%s", value);
+}
+
+/* ------------------------------------------------------------------------ */
+
+/**
  * camel_mktime_utc:
  * @tm: the #tm to convert to a calendar time representation
  *
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
index 49135e8..cca22dd 100644
--- a/camel/camel-mime-utils.h
+++ b/camel/camel-mime-utils.h
@@ -141,6 +141,16 @@ const gchar *      camel_named_flags_get           (const CamelNamedFlags *named_flags,
 gboolean       camel_named_flags_equal         (const CamelNamedFlags *named_flags_a,
                                                 const CamelNamedFlags *named_flags_b);
 
+/* Utility functions */
+gint64         camel_util_bdata_get_number     (/* const */ gchar **bdata_ptr,
+                                                gint64 default_value);
+void           camel_util_bdata_put_number     (GString *bdata_str,
+                                                gint64 value);
+gchar *                camel_util_bdata_get_string     (/* const */ gchar **bdata_ptr,
+                                                const gchar *default_value);
+void           camel_util_bdata_put_string     (GString *bdata_str,
+                                                const gchar *value);
+
 typedef struct _camel_header_param {
        struct _camel_header_param *next;
        gchar *name;
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 1c9fcc9..1bc96e7 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -147,7 +147,7 @@ vee_folder_note_added_uid (CamelVeeFolder *vfolder,
                if (vmi) {
                        if (changes)
                                camel_folder_change_info_add_uid (changes, vuid);
-                       camel_message_info_unref (vmi);
+                       g_clear_object (&vmi);
 
                        if (vfolder->priv->parent_vee_store)
                                camel_vee_store_note_vuid_used (vfolder->priv->parent_vee_store, 
added_mi_data, vfolder);
@@ -892,9 +892,9 @@ vee_folder_get_message_sync (CamelFolder *folder,
        mi = (CamelVeeMessageInfo *) camel_folder_summary_get (folder->summary, uid);
        if (mi) {
                msg = camel_folder_get_message_sync (
-                       camel_folder_summary_get_folder (mi->orig_summary), camel_message_info_get_uid (mi) + 
8,
+                       camel_vee_message_info_get_original_folder (mi), camel_message_info_get_uid 
(CAMEL_MESSAGE_INFO (mi)) + 8,
                        cancellable, error);
-               camel_message_info_unref (mi);
+               g_clear_object (&mi);
        } else {
                g_set_error (
                        error, CAMEL_FOLDER_ERROR,
@@ -1629,25 +1629,29 @@ camel_vee_folder_get_location (CamelVeeFolder *vf,
                                gchar **realuid)
 {
        CamelFolder *folder;
+       const gchar *uid;
 
        g_return_val_if_fail (CAMEL_IS_VEE_FOLDER (vf), NULL);
        g_return_val_if_fail (vinfo != NULL, NULL);
 
-       folder = camel_folder_summary_get_folder (vinfo->orig_summary);
+       folder = camel_vee_message_info_get_original_folder (vinfo);
+       uid = camel_message_info_get_uid (CAMEL_MESSAGE_INFO (vinfo));
+
+       g_return_val_if_fail (uid != NULL && strlen (uid) > 8, NULL);
 
        /* locking?  yes?  no?  although the vfolderinfo is valid when obtained
         * the folder in it might not necessarily be so ...? */
        if (CAMEL_IS_VEE_FOLDER (folder)) {
                CamelFolder *res;
-               const CamelVeeMessageInfo *vfinfo;
+               CamelMessageInfo *vfinfo;
 
-               vfinfo = (CamelVeeMessageInfo *) camel_folder_get_message_info (folder, 
camel_message_info_get_uid (vinfo) + 8);
-               res = camel_vee_folder_get_location ((CamelVeeFolder *) folder, vfinfo, realuid);
-               camel_message_info_unref ((CamelMessageInfo *) vfinfo);
+               vfinfo = camel_folder_get_message_info (folder, uid + 8);
+               res = camel_vee_folder_get_location ((CamelVeeFolder *) folder, CAMEL_VEE_MESSAGE_INFO 
(vfinfo), realuid);
+               g_clear_object (&vfinfo);
                return res;
        } else {
                if (realuid)
-                       *realuid = g_strdup (camel_message_info_get_uid (vinfo)+8);
+                       *realuid = g_strdup (uid + 8);
 
                return folder;
        }
diff --git a/camel/camel-vee-message-info.c b/camel/camel-vee-message-info.c
index d604416..6c1e87f 100644
--- a/camel/camel-vee-message-info.c
+++ b/camel/camel-vee-message-info.c
@@ -21,36 +21,39 @@
 
 #include <stdio.h>
 
+#include "camel-folder.h"
 #include "camel-folder-summary.h"
 #include "camel-message-info.h"
 #include "camel-string-utils.h"
+#include "camel-vee-folder.h"
 #include "camel-vee-summary.h"
+#include "camel-vtrash-folder.h"
 
 #include "camel-vee-message-info.h"
 
-struct _xCamelVeeMessageInfoPrivate {
+struct _CamelVeeMessageInfoPrivate {
        CamelFolderSummary *orig_summary;
 };
 
-G_DEFINE_TYPE (xCamelVeeMessageInfo, xcamel_vee_message_info, XCAMEL_TYPE_MESSAGE_INFO)
+G_DEFINE_TYPE (CamelVeeMessageInfo, camel_vee_message_info, CAMEL_TYPE_MESSAGE_INFO)
 
-static xCamelMessageInfo *
-vee_message_info_clone (const xCamelMessageInfo *mi,
+static CamelMessageInfo *
+vee_message_info_clone (const CamelMessageInfo *mi,
                        CamelFolderSummary *assign_summary)
 {
-       xCamelMessageInfo *result;
+       CamelMessageInfo *result;
 
-       g_return_val_if_fail (XCAMEL_IS_VEE_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO (mi), NULL);
 
-       result = XCAMEL_MESSAGE_INFO_CLASS (xcamel_vee_message_info_parent_class)->clone (mi, assign_summary);
+       result = CAMEL_MESSAGE_INFO_CLASS (camel_vee_message_info_parent_class)->clone (mi, assign_summary);
        if (!result)
                return NULL;
 
-       if (XCAMEL_IS_VEE_MESSAGE_INFO (result)) {
-               xCamelVeeMessageInfo *vmi, *vmi_result;
+       if (CAMEL_IS_VEE_MESSAGE_INFO (result)) {
+               CamelVeeMessageInfo *vmi, *vmi_result;
 
-               vmi = XCAMEL_VEE_MESSAGE_INFO (mi);
-               vmi_result = XCAMEL_VEE_MESSAGE_INFO (result);
+               vmi = CAMEL_VEE_MESSAGE_INFO (mi);
+               vmi_result = CAMEL_VEE_MESSAGE_INFO (result);
 
                if (vmi->priv->orig_summary)
                        vmi_result->priv->orig_summary = g_object_ref (vmi->priv->orig_summary);
@@ -59,18 +62,36 @@ vee_message_info_clone (const xCamelMessageInfo *mi,
        return result;
 }
 
+static void
+vee_message_info_notify_mi_changed (CamelFolder *folder,
+                                   const gchar *mi_uid)
+{
+       CamelFolderChangeInfo *changes;
+
+       g_return_if_fail (CAMEL_IS_VEE_FOLDER (folder));
+       g_return_if_fail (mi_uid != NULL);
+
+       changes = camel_folder_change_info_new ();
+       camel_folder_change_info_change_uid (changes, mi_uid);
+       camel_folder_changed (folder, changes);
+       camel_folder_change_info_free (changes);
+}
+
 #define vee_call_from_parent_mi(_err_ret, _ret_type, _call_what, _call_args) G_STMT_START {    \
-               xCamelVeeMessageInfo *vmi;                                                      \
-               xCamelMessageInfo *orig_mi;                                                     \
+               CamelVeeMessageInfo *vmi;                                                       \
+               CamelMessageInfo *orig_mi;                                                      \
+               CamelFolderSummary *this_summary, *sub_summary;                                 \
+               CamelFolder *this_folder, *sub_folder;                                          \
+               gboolean ignore_changes;                                                        \
                const gchar *uid;                                                               \
                _ret_type result;                                                               \
                                                                                                \
-               g_return_val_if_fail (XCAMEL_IS_VEE_MESSAGE_INFO (mi), _err_ret);               \
+               g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO (mi), _err_ret);                \
                                                                                                \
-               vmi = XCAMEL_VEE_MESSAGE_INFO (mi);                                             \
+               vmi = CAMEL_VEE_MESSAGE_INFO (mi);                                              \
                g_return_val_if_fail (vmi->priv->orig_summary != NULL, _err_ret);               \
                                                                                                \
-               uid = xcamel_message_info_pooldup_uid (mi);                                     \
+               uid = camel_message_info_pooldup_uid (mi);                                      \
                g_return_val_if_fail (uid != NULL, _err_ret);                                   \
                                                                                                \
                if (!uid[0] || !uid[1] || !uid[2] || !uid[3] || !uid[4] ||                      \
@@ -80,258 +101,300 @@ vee_message_info_clone (const xCamelMessageInfo *mi,
                        return _err_ret;                                                        \
                }                                                                               \
                                                                                                \
-               orig_mi = (xCamelMessageInfo *)camel_folder_summary_get (vmi->priv->orig_summary, uid + 8);   
          \
+               orig_mi = (CamelMessageInfo *) camel_folder_summary_get (vmi->priv->orig_summary, uid + 8);   
          \
                if (!orig_mi) {                                                                 \
                        g_warning ("%s: Failed to get orig uid '%s'\n", G_STRFUNC, uid);        \
                        camel_pstring_free (uid);                                               \
                        return _err_ret;                                                        \
                }                                                                               \
                                                                                                \
-               camel_pstring_free (uid);                                                       \
+               this_summary = camel_message_info_ref_summary (mi);                             \
+               this_folder = this_summary ? camel_folder_summary_get_folder (this_summary) : NULL; \
+               sub_summary = camel_message_info_ref_summary (orig_mi);                         \
+               sub_folder = sub_summary ? camel_folder_summary_get_folder (sub_summary) : NULL; \
+                                                                                               \
+               ignore_changes = !CAMEL_IS_VTRASH_FOLDER (this_folder);                         \
+                                                                                               \
+               /* ignore changes done in the folder itself,                                    \
+                * unless it's a vTrash or vJunk folder */                                      \
+               if (ignore_changes)                                                             \
+                       camel_vee_folder_ignore_next_changed_event (CAMEL_VEE_FOLDER (this_folder), 
sub_folder); \
                                                                                                \
                result = _call_what _call_args;                                                 \
                                                                                                \
+               if (ignore_changes) {                                                           \
+                       if (result)                                                             \
+                               vee_message_info_notify_mi_changed (this_folder, uid);          \
+                       else                                                                    \
+                               camel_vee_folder_remove_from_ignore_changed_event (             \
+                                       CAMEL_VEE_FOLDER (this_folder), sub_folder);            \
+               }                                                                               \
+                                                                                               \
+               g_clear_object (&this_summary);                                                 \
+               g_clear_object (&sub_summary);                                                  \
                g_clear_object (&orig_mi);                                                      \
+               camel_pstring_free (uid);                                                       \
                                                                                                \
                return result;                                                                  \
        } G_STMT_END
 
 static guint32
-vee_message_info_get_flags (const xCamelMessageInfo *mi)
+vee_message_info_get_flags (const CamelMessageInfo *mi)
+{
+       vee_call_from_parent_mi (0, guint32, camel_message_info_get_flags, (orig_mi));
+}
+
+static gboolean
+vee_message_info_set_flags_real (CamelMessageInfo *mi,
+                                guint32 mask,
+                                guint32 set)
 {
-       vee_call_from_parent_mi (0, guint32, xcamel_message_info_get_flags, (orig_mi));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_flags, (orig_mi, mask, set));
 }
 
 static gboolean
-vee_message_info_set_flags (xCamelMessageInfo *mi,
-                           CamelMessageFlags mask,
+vee_message_info_set_flags (CamelMessageInfo *mi,
+                           guint32 mask,
                            guint32 set)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_flags, (orig_mi, mask, set));
+       gboolean result;
+
+       result = vee_message_info_set_flags_real (mi, mask, set);
+
+       if (result) {
+               CamelFolderSummary *summary;
+
+               summary = camel_message_info_ref_summary (mi);
+               if (summary)
+                       camel_folder_summary_replace_flags (summary, mi);
+               g_clear_object (&summary);
+       }
+
+       return result;
 }
 
 static gboolean
-vee_message_info_get_user_flag (const xCamelMessageInfo *mi,
+vee_message_info_get_user_flag (const CamelMessageInfo *mi,
                                const gchar *name)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_get_user_flag, (orig_mi, name));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_get_user_flag, (orig_mi, name));
 }
 
 static gboolean
-vee_message_info_set_user_flag (xCamelMessageInfo *mi,
+vee_message_info_set_user_flag (CamelMessageInfo *mi,
                                const gchar *name,
                                gboolean state)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_user_flag, (orig_mi, name, state));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_user_flag, (orig_mi, name, state));
 }
 
 static const CamelNamedFlags *
-vee_message_info_get_user_flags (const xCamelMessageInfo *mi)
+vee_message_info_get_user_flags (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const CamelNamedFlags *, xcamel_message_info_get_user_flags, 
(orig_mi));
+       vee_call_from_parent_mi (NULL, const CamelNamedFlags *, camel_message_info_get_user_flags, (orig_mi));
 }
 
 static CamelNamedFlags *
-vee_message_info_dup_user_flags (const xCamelMessageInfo *mi)
+vee_message_info_dup_user_flags (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, CamelNamedFlags *, xcamel_message_info_dup_user_flags, (orig_mi));
+       vee_call_from_parent_mi (NULL, CamelNamedFlags *, camel_message_info_dup_user_flags, (orig_mi));
 }
 
 static gboolean
-vee_message_info_take_user_flags (xCamelMessageInfo *mi,
+vee_message_info_take_user_flags (CamelMessageInfo *mi,
                                  CamelNamedFlags *user_flags)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_take_user_flags, (orig_mi, user_flags));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_take_user_flags, (orig_mi, user_flags));
 }
 
 static const gchar *
-vee_message_info_get_user_tag (const xCamelMessageInfo *mi,
+vee_message_info_get_user_tag (const CamelMessageInfo *mi,
                               const gchar *name)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_user_tag, (orig_mi, name));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_user_tag, (orig_mi, name));
 }
 
 static gboolean
-vee_message_info_set_user_tag (xCamelMessageInfo *mi,
+vee_message_info_set_user_tag (CamelMessageInfo *mi,
                               const gchar *name,
                               const gchar *value)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_user_tag, (orig_mi, name, value));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_user_tag, (orig_mi, name, value));
 }
 
 static CamelNameValueArray *
-vee_message_info_dup_user_tags (const xCamelMessageInfo *mi)
+vee_message_info_dup_user_tags (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, CamelNameValueArray *, xcamel_message_info_dup_user_tags, (orig_mi));
+       vee_call_from_parent_mi (NULL, CamelNameValueArray *, camel_message_info_dup_user_tags, (orig_mi));
 }
 
 static const CamelNameValueArray *
-vee_message_info_get_user_tags (const xCamelMessageInfo *mi)
+vee_message_info_get_user_tags (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const CamelNameValueArray *, xcamel_message_info_get_user_tags, 
(orig_mi));
+       vee_call_from_parent_mi (NULL, const CamelNameValueArray *, camel_message_info_get_user_tags, 
(orig_mi));
 }
 
 static gboolean
-vee_message_info_take_user_tags (xCamelMessageInfo *mi,
+vee_message_info_take_user_tags (CamelMessageInfo *mi,
                                 CamelNameValueArray *user_tags)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_take_user_tags, (orig_mi, user_tags));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_take_user_tags, (orig_mi, user_tags));
 }
 
 static const gchar *
-vee_message_info_get_subject (const xCamelMessageInfo *mi)
+vee_message_info_get_subject (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_subject, (orig_mi));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_subject, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_subject (xCamelMessageInfo *mi,
+vee_message_info_set_subject (CamelMessageInfo *mi,
                              const gchar *subject)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_subject, (orig_mi, subject));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_subject, (orig_mi, subject));
 }
 
 static const gchar *
-vee_message_info_get_preview (const xCamelMessageInfo *mi)
+vee_message_info_get_preview (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_preview, (orig_mi));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_preview, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_preview (xCamelMessageInfo *mi,
+vee_message_info_set_preview (CamelMessageInfo *mi,
                              const gchar *preview)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_preview, (orig_mi, preview));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_preview, (orig_mi, preview));
 }
 
 static const gchar *
-vee_message_info_get_from (const xCamelMessageInfo *mi)
+vee_message_info_get_from (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_from, (orig_mi));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_from, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_from (xCamelMessageInfo *mi,
+vee_message_info_set_from (CamelMessageInfo *mi,
                           const gchar *from)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_from, (orig_mi, from));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_from, (orig_mi, from));
 }
 
 static const gchar *
-vee_message_info_get_to (const xCamelMessageInfo *mi)
+vee_message_info_get_to (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_to, (orig_mi));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_to, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_to (xCamelMessageInfo *mi,
+vee_message_info_set_to (CamelMessageInfo *mi,
                         const gchar *to)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_to, (orig_mi, to));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_to, (orig_mi, to));
 }
 
 static const gchar *
-vee_message_info_get_cc (const xCamelMessageInfo *mi)
+vee_message_info_get_cc (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_cc, (orig_mi));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_cc, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_cc (xCamelMessageInfo *mi,
+vee_message_info_set_cc (CamelMessageInfo *mi,
                         const gchar *cc)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_cc, (orig_mi, cc));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_cc, (orig_mi, cc));
 }
 
 static const gchar *
-vee_message_info_get_mlist (const xCamelMessageInfo *mi)
+vee_message_info_get_mlist (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const gchar *, xcamel_message_info_get_mlist, (orig_mi));
+       vee_call_from_parent_mi (NULL, const gchar *, camel_message_info_get_mlist, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_mlist (xCamelMessageInfo *mi,
+vee_message_info_set_mlist (CamelMessageInfo *mi,
                            const gchar *mlist)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_mlist, (orig_mi, mlist));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_mlist, (orig_mi, mlist));
 }
 
 static guint32
-vee_message_info_get_size (const xCamelMessageInfo *mi)
+vee_message_info_get_size (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (0, guint32, xcamel_message_info_get_size, (orig_mi));
+       vee_call_from_parent_mi (0, guint32, camel_message_info_get_size, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_size (xCamelMessageInfo *mi,
+vee_message_info_set_size (CamelMessageInfo *mi,
                           guint32 size)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_size, (orig_mi, size));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_size, (orig_mi, size));
 }
 
 static gint64
-vee_message_info_get_date_sent (const xCamelMessageInfo *mi)
+vee_message_info_get_date_sent (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (0, gint64, xcamel_message_info_get_date_sent, (orig_mi));
+       vee_call_from_parent_mi (0, gint64, camel_message_info_get_date_sent, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_date_sent (xCamelMessageInfo *mi,
+vee_message_info_set_date_sent (CamelMessageInfo *mi,
                                gint64 date_sent)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_date_sent, (orig_mi, date_sent));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_date_sent, (orig_mi, date_sent));
 }
 
 static gint64
-vee_message_info_get_date_received (const xCamelMessageInfo *mi)
+vee_message_info_get_date_received (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (0, gint64, xcamel_message_info_get_date_received, (orig_mi));
+       vee_call_from_parent_mi (0, gint64, camel_message_info_get_date_received, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_date_received (xCamelMessageInfo *mi,
+vee_message_info_set_date_received (CamelMessageInfo *mi,
                                    gint64 date_received)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_date_received, (orig_mi, 
date_received));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_date_received, (orig_mi, 
date_received));
 }
 
 static guint64
-vee_message_info_get_message_id (const xCamelMessageInfo *mi)
+vee_message_info_get_message_id (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (0, guint64, xcamel_message_info_get_message_id, (orig_mi));
+       vee_call_from_parent_mi (0, guint64, camel_message_info_get_message_id, (orig_mi));
 }
 
 static gboolean
-vee_message_info_set_message_id (xCamelMessageInfo *mi,
+vee_message_info_set_message_id (CamelMessageInfo *mi,
                                 guint64 message_id)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_set_message_id, (orig_mi, message_id));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_set_message_id, (orig_mi, message_id));
 }
 
 static const GArray *
-vee_message_info_get_references (const xCamelMessageInfo *mi)
+vee_message_info_get_references (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const GArray *, xcamel_message_info_get_references, (orig_mi));
+       vee_call_from_parent_mi (NULL, const GArray *, camel_message_info_get_references, (orig_mi));
 }
 
 static gboolean
-vee_message_info_take_references (xCamelMessageInfo *mi,
+vee_message_info_take_references (CamelMessageInfo *mi,
                                  GArray *references)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_take_references, (orig_mi, references));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_take_references, (orig_mi, references));
 }
 
 static const CamelNameValueArray *
-vee_message_info_get_headers (const xCamelMessageInfo *mi)
+vee_message_info_get_headers (const CamelMessageInfo *mi)
 {
-       vee_call_from_parent_mi (NULL, const CamelNameValueArray *, xcamel_message_info_get_headers, 
(orig_mi));
+       vee_call_from_parent_mi (NULL, const CamelNameValueArray *, camel_message_info_get_headers, 
(orig_mi));
 }
 
 static gboolean
-vee_message_info_take_headers (xCamelMessageInfo *mi,
+vee_message_info_take_headers (CamelMessageInfo *mi,
                               CamelNameValueArray *headers)
 {
-       vee_call_from_parent_mi (FALSE, gboolean, xcamel_message_info_take_headers, (orig_mi, headers));
+       vee_call_from_parent_mi (FALSE, gboolean, camel_message_info_take_headers, (orig_mi, headers));
 }
 
 #undef vee_call_from_parent_mi
@@ -339,23 +402,23 @@ vee_message_info_take_headers (xCamelMessageInfo *mi,
 static void
 vee_message_info_dispose (GObject *object)
 {
-       xCamelVeeMessageInfo *vmi = XCAMEL_VEE_MESSAGE_INFO (object);
+       CamelVeeMessageInfo *vmi = CAMEL_VEE_MESSAGE_INFO (object);
 
        g_clear_object (&vmi->priv->orig_summary);
 
        /* Chain up to parent's method. */
-       G_OBJECT_CLASS (xcamel_vee_message_info_parent_class)->dispose (object);
+       G_OBJECT_CLASS (camel_vee_message_info_parent_class)->dispose (object);
 }
 
 static void
-xcamel_vee_message_info_class_init (xCamelVeeMessageInfoClass *class)
+camel_vee_message_info_class_init (CamelVeeMessageInfoClass *class)
 {
-       xCamelMessageInfoClass *mi_class;
+       CamelMessageInfoClass *mi_class;
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (xCamelVeeMessageInfoPrivate));
+       g_type_class_add_private (class, sizeof (CamelVeeMessageInfoPrivate));
 
-       mi_class = XCAMEL_MESSAGE_INFO_CLASS (class);
+       mi_class = CAMEL_MESSAGE_INFO_CLASS (class);
        mi_class->clone = vee_message_info_clone;
        mi_class->get_flags = vee_message_info_get_flags;
        mi_class->set_flags = vee_message_info_set_flags;
@@ -399,19 +462,19 @@ xcamel_vee_message_info_class_init (xCamelVeeMessageInfoClass *class)
 }
 
 static void
-xcamel_vee_message_info_init (xCamelVeeMessageInfo *vmi)
+camel_vee_message_info_init (CamelVeeMessageInfo *vmi)
 {
-       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, XCAMEL_TYPE_VEE_MESSAGE_INFO, 
xCamelVeeMessageInfoPrivate);
+       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, CAMEL_TYPE_VEE_MESSAGE_INFO, 
CamelVeeMessageInfoPrivate);
 }
 
 /**
- * xcamel_vee_message_info_new:
+ * camel_vee_message_info_new:
  * @summary: a #CamelVeeSummary, the "owner" of the created message info
- * @orig_mi: an original #CamelMessageInfo to reference to
+ * @original_summary: an original #CamelFolderSummary to reference to
  * @vuid: what UID to set on the resulting message info
  *
  * Creates a new instance of #CamelVeeMessageInfo which references
- * the @orig_mi internally.
+ * a message from the @original_summary internally.
  *
  * The @vuid should be encoded in a way which the vFolder understands,
  * which is like the one returned by camel_vee_message_info_data_get_vee_message_uid().
@@ -422,26 +485,63 @@ xcamel_vee_message_info_init (xCamelVeeMessageInfo *vmi)
  *
  * Since: 3.24
  **/
-xCamelMessageInfo *
-xcamel_vee_message_info_new (CamelFolderSummary *summary,
-                            const xCamelMessageInfo *orig_mi,
-                            const gchar *vuid)
+CamelMessageInfo *
+camel_vee_message_info_new (CamelFolderSummary *summary,
+                           CamelFolderSummary *original_summary,
+                           const gchar *vuid)
 {
-       xCamelMessageInfo *mi;
-       xCamelVeeMessageInfo *vmi;
+       CamelMessageInfo *mi;
+       CamelVeeMessageInfo *vmi;
 
        g_return_val_if_fail (CAMEL_IS_VEE_SUMMARY (summary), NULL);
-       g_return_val_if_fail (XCAMEL_IS_MESSAGE_INFO (orig_mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (original_summary), NULL);
        g_return_val_if_fail (vuid != NULL, NULL);
        g_return_val_if_fail (vuid[0] && vuid[1] && vuid[2] && vuid[3] && vuid[4] && vuid[5] && vuid[6] && 
vuid[7] && vuid[8], NULL);
 
-       mi = xcamel_message_info_new (summary);
-       g_return_val_if_fail (XCAMEL_IS_VEE_MESSAGE_INFO (mi), NULL);
+       mi = camel_message_info_new (summary);
+       g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO (mi), NULL);
 
-       vmi = XCAMEL_VEE_MESSAGE_INFO (mi);
-       vmi->priv->orig_summary = xcamel_message_info_ref_summary (orig_mi);
+       vmi = CAMEL_VEE_MESSAGE_INFO (mi);
+       vmi->priv->orig_summary = g_object_ref (original_summary);
 
-       xcamel_message_info_set_uid (mi, vuid);
+       camel_message_info_set_uid (mi, vuid);
 
        return mi;
 }
+
+/**
+ * camel_vee_message_info_get_original_summary:
+ * @vmi: a #CamelVeeMessageInfo
+ *
+ * Returns: (transfer none): A #CamelFolderSummary of the original
+ *   message info, which this @vmi is proxying.
+ *
+ * Since: 3.24
+ **/
+CamelFolderSummary *
+camel_vee_message_info_get_original_summary (const CamelVeeMessageInfo *vmi)
+{
+       g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO (vmi), NULL);
+
+       return vmi->priv->orig_summary;
+}
+
+/**
+ * camel_vee_message_info_get_original_folder:
+ * @vmi: a #CamelVeeMessageInfo
+ *
+ * Returns: (transfer none): A #CamelFolder of the original
+ *   message info, which this @vmi is proxying.
+ *
+ * Since: 3.24
+ **/
+CamelFolder *
+camel_vee_message_info_get_original_folder (const CamelVeeMessageInfo *vmi)
+{
+       g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO (vmi), NULL);
+
+       if (!vmi->priv->orig_summary)
+               return NULL;
+
+       return camel_folder_summary_get_folder (vmi->priv->orig_summary);
+}
diff --git a/camel/camel-vee-message-info.h b/camel/camel-vee-message-info.h
index b831ad2..469236d 100644
--- a/camel/camel-vee-message-info.h
+++ b/camel/camel-vee-message-info.h
@@ -19,53 +19,59 @@
 #error "Only <camel/camel.h> can be included directly."
 #endif
 
-#ifndef XCAMEL_VEE_MESSAGE_INFO_H
-#define XCAMEL_VEE_MESSAGE_INFO_H
+#ifndef CAMEL_VEE_MESSAGE_INFO_H
+#define CAMEL_VEE_MESSAGE_INFO_H
 
 #include <glib-object.h>
 
 #include <camel/camel-message-info.h>
 
 /* Standard GObject macros */
-#define XCAMEL_TYPE_VEE_MESSAGE_INFO \
-       (xcamel_vee_message_info_get_type ())
-#define XCAMEL_VEE_MESSAGE_INFO(obj) \
+#define CAMEL_TYPE_VEE_MESSAGE_INFO \
+       (camel_vee_message_info_get_type ())
+#define CAMEL_VEE_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), XCAMEL_TYPE_VEE_MESSAGE_INFO, xCamelVeeMessageInfo))
-#define XCAMEL_VEE_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_VEE_MESSAGE_INFO, CamelVeeMessageInfo))
+#define CAMEL_VEE_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), XCAMEL_TYPE_VEE_MESSAGE_INFO, xCamelVeeMessageInfoClass))
-#define XCAMEL_IS_VEE_MESSAGE_INFO(obj) \
+       ((cls), CAMEL_TYPE_VEE_MESSAGE_INFO, CamelVeeMessageInfoClass))
+#define CAMEL_IS_VEE_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), XCAMEL_TYPE_VEE_MESSAGE_INFO))
-#define XCAMEL_IS_VEE_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_VEE_MESSAGE_INFO))
+#define CAMEL_IS_VEE_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), XCAMEL_TYPE_VEE_MESSAGE_INFO))
-#define XCAMEL_VEE_MESSAGE_INFO_GET_CLASS(obj) \
+       ((cls), CAMEL_TYPE_VEE_MESSAGE_INFO))
+#define CAMEL_VEE_MESSAGE_INFO_GET_CLASS(obj) \
        (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), XCAMEL_TYPE_VEE_MESSAGE_INFO, xCamelVeeMessageInfoClass))
+       ((obj), CAMEL_TYPE_VEE_MESSAGE_INFO, CamelVeeMessageInfoClass))
 
 G_BEGIN_DECLS
 
-typedef struct _xCamelVeeMessageInfo xCamelVeeMessageInfo;
-typedef struct _xCamelVeeMessageInfoClass xCamelVeeMessageInfoClass;
-typedef struct _xCamelVeeMessageInfoPrivate xCamelVeeMessageInfoPrivate;
+typedef struct _CamelVeeMessageInfo CamelVeeMessageInfo;
+typedef struct _CamelVeeMessageInfoClass CamelVeeMessageInfoClass;
+typedef struct _CamelVeeMessageInfoPrivate CamelVeeMessageInfoPrivate;
 
-struct _xCamelVeeMessageInfo {
-       xCamelMessageInfo parent;
-       xCamelVeeMessageInfoPrivate *priv;
+struct _CamelVeeMessageInfo {
+       CamelMessageInfo parent;
+       CamelVeeMessageInfoPrivate *priv;
 };
 
-struct _xCamelVeeMessageInfoClass {
-       xCamelMessageInfoClass parent_class;
+struct _CamelVeeMessageInfoClass {
+       CamelMessageInfoClass parent_class;
 };
 
-GType          xcamel_vee_message_info_get_type        (void);
-xCamelMessageInfo *
-               xcamel_vee_message_info_new             (struct _CamelFolderSummary *summary,
-                                                        const xCamelMessageInfo *orig_mi,
-                                                        const gchar *vuid);
+GType          camel_vee_message_info_get_type (void);
+CamelMessageInfo *
+               camel_vee_message_info_new      (struct _CamelFolderSummary *summary,
+                                                struct _CamelFolderSummary *original_summary,
+                                                const gchar *vuid);
+struct _CamelFolderSummary *
+               camel_vee_message_info_get_original_summary
+                                               (const CamelVeeMessageInfo *vmi);
+struct _CamelFolder *
+               camel_vee_message_info_get_original_folder
+                                               (const CamelVeeMessageInfo *vmi);
 
 G_END_DECLS
 
-#endif /* XCAMEL_VEE_MESSAGE_INFO_H */
+#endif /* CAMEL_VEE_MESSAGE_INFO_H */
diff --git a/camel/camel-vee-summary.c b/camel/camel-vee-summary.c
index 65d5f6f..d1c472e 100644
--- a/camel/camel-vee-summary.c
+++ b/camel/camel-vee-summary.c
@@ -52,240 +52,6 @@ struct _CamelVeeSummaryPrivate {
 
 G_DEFINE_TYPE (CamelVeeSummary, camel_vee_summary, CAMEL_TYPE_FOLDER_SUMMARY)
 
-static void
-vee_message_info_free (CamelFolderSummary *s,
-                       CamelMessageInfo *info)
-{
-       CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *) info;
-
-       g_object_unref (mi->orig_summary);
-
-       CAMEL_FOLDER_SUMMARY_CLASS (camel_vee_summary_parent_class)->message_info_free (s, info);
-}
-
-static CamelMessageInfo *
-vee_message_info_clone (CamelFolderSummary *s,
-                        const CamelMessageInfo *mi)
-{
-       CamelVeeMessageInfo *to;
-       const CamelVeeMessageInfo *from = (const CamelVeeMessageInfo *) mi;
-
-       to = (CamelVeeMessageInfo *) camel_message_info_new (s);
-
-       to->orig_summary = g_object_ref (from->orig_summary);
-       to->info.summary = s;
-       to->info.uid = camel_pstring_strdup (from->info.uid);
-
-       return (CamelMessageInfo *) to;
-}
-
-#define HANDLE_NULL_INFO(value) if (!rmi) { d(g_warning (G_STRLOC ": real info is NULL for %s, 
safeguarding\n", mi->uid)); return value; }
-
-static gconstpointer
-vee_info_ptr (const CamelMessageInfo *mi,
-              gint id)
-{
-       CamelVeeMessageInfo *vmi = (CamelVeeMessageInfo *) mi;
-       CamelMessageInfo *rmi;
-       gpointer p;
-
-       rmi = camel_folder_summary_get (vmi->orig_summary, mi->uid + 8);
-       HANDLE_NULL_INFO (NULL);
-       p = (gpointer) camel_message_info_get_ptr (rmi, id);
-       camel_message_info_unref (rmi);
-
-       return p;
-}
-
-static guint32
-vee_info_uint32 (const CamelMessageInfo *mi,
-                 gint id)
-{
-       CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, mi->uid 
+ 8);
-       guint32 ret;
-
-       HANDLE_NULL_INFO (0);
-       ret = camel_message_info_get_uint32 (rmi, id);
-       camel_message_info_unref (rmi);
-
-       return ret;
-
-}
-
-static time_t
-vee_info_time (const CamelMessageInfo *mi,
-               gint id)
-{
-       CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, mi->uid 
+ 8);
-       time_t ret;
-
-       HANDLE_NULL_INFO (0);
-       ret = camel_message_info_get_time (rmi, id);
-       camel_message_info_unref (rmi);
-
-       return ret;
-}
-
-static gboolean
-vee_info_user_flag (const CamelMessageInfo *mi,
-                    const gchar *id)
-{
-       CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, mi->uid 
+ 8);
-       gboolean ret;
-
-       HANDLE_NULL_INFO (FALSE);
-       ret = camel_message_info_get_user_flag (rmi, id);
-       camel_message_info_unref (rmi);
-
-       return ret;
-}
-
-static const gchar *
-vee_info_user_tag (const CamelMessageInfo *mi,
-                   const gchar *id)
-{
-       CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, mi->uid 
+ 8);
-       const gchar *ret;
-
-       HANDLE_NULL_INFO ("");
-       ret = camel_message_info_get_user_tag (rmi, id);
-       camel_message_info_unref (rmi);
-
-       return ret;
-}
-
-static void
-vee_summary_notify_mi_changed (CamelVeeFolder *vfolder,
-                               CamelMessageInfo *mi)
-{
-       CamelFolderChangeInfo *changes;
-
-       g_return_if_fail (vfolder != NULL);
-       g_return_if_fail (mi != NULL);
-
-       changes = camel_folder_change_info_new ();
-
-       camel_folder_change_info_change_uid (changes, camel_message_info_get_uid (mi));
-       camel_folder_changed (CAMEL_FOLDER (vfolder), changes);
-       camel_folder_change_info_free (changes);
-}
-
-static gboolean
-vee_info_set_user_flag (CamelMessageInfo *mi,
-                        const gchar *name,
-                        gboolean value)
-{
-       gint res = FALSE;
-       CamelVeeFolder *vf = (CamelVeeFolder *) camel_folder_summary_get_folder (mi->summary);
-
-       if (mi->uid) {
-               CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, 
mi->uid + 8);
-               gboolean ignore_changes = !CAMEL_IS_VTRASH_FOLDER (vf);
-
-               HANDLE_NULL_INFO (FALSE);
-
-               /* ignore changes done in the folder itself,
-                * unless it's a vTrash or vJunk folder */
-               if (ignore_changes)
-                       camel_vee_folder_ignore_next_changed_event (vf, camel_folder_summary_get_folder 
(rmi->summary));
-
-               res = camel_message_info_set_user_flag (rmi, name, value);
-
-               if (ignore_changes) {
-                       if (res)
-                               vee_summary_notify_mi_changed (vf, mi);
-                       else
-                               camel_vee_folder_remove_from_ignore_changed_event (vf, 
camel_folder_summary_get_folder (rmi->summary));
-               }
-
-               camel_message_info_unref (rmi);
-       }
-
-       return res;
-}
-
-static gboolean
-vee_info_set_user_tag (CamelMessageInfo *mi,
-                       const gchar *name,
-                       const gchar *value)
-{
-       gint res = FALSE;
-
-       if (mi->uid) {
-               CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, 
mi->uid + 8);
-               CamelVeeFolder *vf = (CamelVeeFolder *) camel_folder_summary_get_folder (mi->summary);
-               gboolean ignore_changes = !CAMEL_IS_VTRASH_FOLDER (vf);
-
-               HANDLE_NULL_INFO (FALSE);
-
-               /* ignore changes done in the folder itself,
-                * unless it's a vTrash or vJunk folder */
-               if (ignore_changes)
-                       camel_vee_folder_ignore_next_changed_event (vf, camel_folder_summary_get_folder 
(rmi->summary));
-
-               res = camel_message_info_set_user_tag (rmi, name, value);
-
-               if (ignore_changes) {
-                       if (res)
-                               vee_summary_notify_mi_changed (vf, mi);
-                       else
-                               camel_vee_folder_remove_from_ignore_changed_event (vf, 
camel_folder_summary_get_folder (rmi->summary));
-               }
-
-               camel_message_info_unref (rmi);
-       }
-
-       return res;
-}
-
-static gboolean
-vee_info_set_flags (CamelMessageInfo *mi,
-                    guint32 flags,
-                    guint32 set)
-{
-       gint res = FALSE;
-       CamelVeeFolder *vf = CAMEL_VEE_FOLDER (camel_folder_summary_get_folder (mi->summary));
-
-       /* first update original message info... */
-       if (mi->uid) {
-               CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, 
mi->uid + 8);
-               gboolean ignore_changes = !CAMEL_IS_VTRASH_FOLDER (vf);
-
-               HANDLE_NULL_INFO (FALSE);
-
-               /* ignore changes done in the folder itself,
-                * unless it's a vTrash or vJunk folder */
-               if (ignore_changes)
-                       camel_vee_folder_ignore_next_changed_event (vf, camel_folder_summary_get_folder 
(rmi->summary));
-
-               res = camel_message_info_set_flags (rmi, flags, set);
-
-               if (res) {
-                       /* update flags on itself too */
-                       camel_folder_summary_replace_flags (mi->summary, mi);
-               }
-
-               if (ignore_changes) {
-                       if (res)
-                               vee_summary_notify_mi_changed (vf, mi);
-                       else
-                               camel_vee_folder_remove_from_ignore_changed_event (vf, 
camel_folder_summary_get_folder (rmi->summary));
-               }
-
-               camel_message_info_unref (rmi);
-       }
-
-       /* Do not call parent class' info_set_flags, to not do flood
-        * of change notifications, rather wait for a notification
-        * from original folder, and propagate the change in counts
-        * through camel_vee_summary_replace_flags().
-       */
-       /*if (res)
-               CAMEL_FOLDER_SUMMARY_CLASS (camel_vee_summary_parent_class)->info_set_flags (mi, flags, 
set);*/
-
-       return res;
-}
-
 static CamelMessageInfo *
 message_info_from_uid (CamelFolderSummary *s,
                        const gchar *uid)
@@ -294,7 +60,6 @@ message_info_from_uid (CamelFolderSummary *s,
 
        info = camel_folder_summary_peek_loaded (s, uid);
        if (!info) {
-               CamelVeeMessageInfo *vinfo;
                CamelFolder *orig_folder;
 
                /* This function isn't really nice. But no great way
@@ -309,20 +74,16 @@ message_info_from_uid (CamelFolderSummary *s,
                        return NULL;
                }
 
-               /* Create the info and load it, its so easy. */
-               info = camel_message_info_new (s);
-               info->dirty = FALSE;
-               info->uid = camel_pstring_strdup (uid);
-
                orig_folder = camel_vee_folder_get_vee_uid_folder (
                        (CamelVeeFolder *) camel_folder_summary_get_folder (s), uid);
                g_return_val_if_fail (orig_folder != NULL, NULL);
 
-               vinfo = (CamelVeeMessageInfo *) info;
-               vinfo->orig_summary = orig_folder->summary;
+               /* Create the info and load it, its so easy. */
+               info = camel_vee_message_info_new (s, orig_folder->summary, uid);
+
+               camel_message_info_set_dirty (info, FALSE);
 
-               g_object_ref (vinfo->orig_summary);
-               camel_message_info_ref (info);
+               g_object_ref (info);
 
                camel_folder_summary_insert (s, info, FALSE);
        }
@@ -355,19 +116,7 @@ camel_vee_summary_class_init (CamelVeeSummaryClass *class)
        object_class->finalize = vee_summary_finalize;
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_type = XCAMEL_TYPE_VEE_MESSAGE_INFO;
-       folder_summary_class->message_info_size = sizeof (CamelVeeMessageInfo);
-       folder_summary_class->content_info_size = 0;
-       folder_summary_class->message_info_clone = vee_message_info_clone;
-       folder_summary_class->message_info_free = vee_message_info_free;
-       folder_summary_class->info_ptr = vee_info_ptr;
-       folder_summary_class->info_uint32 = vee_info_uint32;
-       folder_summary_class->info_time = vee_info_time;
-       folder_summary_class->info_user_flag = vee_info_user_flag;
-       folder_summary_class->info_user_tag = vee_info_user_tag;
-       folder_summary_class->info_set_user_flag = vee_info_set_user_flag;
-       folder_summary_class->info_set_user_tag = vee_info_set_user_tag;
-       folder_summary_class->info_set_flags = vee_info_set_flags;
+       folder_summary_class->message_info_type = CAMEL_TYPE_VEE_MESSAGE_INFO;
        folder_summary_class->message_info_from_uid = message_info_from_uid;
 }
 
@@ -451,7 +200,7 @@ camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
        return known_uids;
 }
 
-/* unref returned pointer with camel_message_info_unref() */
+/* unref returned pointer with g_object_unref() */
 CamelVeeMessageInfo *
 camel_vee_summary_add (CamelVeeSummary *s,
                        CamelVeeMessageInfoData *mi_data)
@@ -475,19 +224,16 @@ camel_vee_summary_add (CamelVeeSummary *s,
        if (vmi) {
                /* Possible that the entry is loaded, see if it has the summary */
                d (g_message ("%s - already there\n", vuid));
-               if (!vmi->orig_summary)
-                       vmi->orig_summary = g_object_ref (orig_folder->summary);
+               g_warn_if_fail (camel_vee_message_info_get_original_summary (vmi) != NULL);
 
                camel_folder_summary_unlock (&s->summary);
 
                return vmi;
        }
 
-       vmi = (CamelVeeMessageInfo *) camel_message_info_new (&s->summary);
-       vmi->orig_summary = g_object_ref (orig_folder->summary);
-       vmi->info.uid = (gchar *) camel_pstring_strdup (vuid);
+       vmi = (CamelVeeMessageInfo *) camel_vee_message_info_new (CAMEL_FOLDER_SUMMARY (s), 
orig_folder->summary, vuid);
 
-       camel_message_info_ref (vmi);
+       g_object_ref (vmi);
 
        vuids = g_hash_table_lookup (s->priv->vuids_by_subfolder, orig_folder);
        if (vuids) {
@@ -539,8 +285,8 @@ camel_vee_summary_remove (CamelVeeSummary *summary,
        if (mi) {
                /* under twice, the first for camel_folder_summary_peek_loaded(),
                 * the second to actually free the mi */
-               camel_message_info_unref (mi);
-               camel_message_info_unref (mi);
+               g_clear_object (&mi);
+               g_clear_object (&mi);
        }
 
        camel_folder_summary_unlock (&summary->summary);
@@ -575,7 +321,7 @@ camel_vee_summary_replace_flags (CamelVeeSummary *summary,
        }
 
        camel_folder_summary_replace_flags (&summary->summary, mi);
-       camel_message_info_unref (mi);
+       g_clear_object (&mi);
 
        camel_folder_summary_unlock (&summary->summary);
 }
diff --git a/camel/camel-vee-summary.h b/camel/camel-vee-summary.h
index 9003561..ed073c5 100644
--- a/camel/camel-vee-summary.h
+++ b/camel/camel-vee-summary.h
@@ -25,6 +25,7 @@
 #define CAMEL_VEE_SUMMARY_H
 
 #include <camel/camel-folder-summary.h>
+#include <camel/camel-vee-message-info.h>
 
 /* Standard GObject macros */
 #define CAMEL_TYPE_VEE_SUMMARY \
@@ -55,13 +56,6 @@ typedef struct _CamelVeeSummary CamelVeeSummary;
 typedef struct _CamelVeeSummaryClass CamelVeeSummaryClass;
 typedef struct _CamelVeeSummaryPrivate CamelVeeSummaryPrivate;
 
-typedef struct _CamelVeeMessageInfo CamelVeeMessageInfo;
-
-struct _CamelVeeMessageInfo {
-       CamelMessageInfoBase info;
-       CamelFolderSummary *orig_summary;
-};
-
 struct _CamelVeeSummary {
        CamelFolderSummary summary;
 
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c
index 7362009..6ea7b18 100644
--- a/camel/camel-vtrash-folder.c
+++ b/camel/camel-vtrash-folder.c
@@ -81,7 +81,7 @@ transfer_messages (CamelFolder *folder,
                CamelMessageInfo *mi = camel_folder_get_message_info (md->source_folder, 
md->source_uids->pdata[i]);
                if (mi) {
                        camel_message_info_set_flags (mi, md->sbit, md->sbit);
-                       camel_message_info_unref (mi);
+                       g_clear_object (&mi);
                }
        }
 
@@ -168,18 +168,18 @@ vtrash_folder_transfer_messages_to_sync (CamelFolder *source,
                        continue;
                }
 
-               if (dest == camel_folder_summary_get_folder (mi->orig_summary)) {
+               if (dest == camel_vee_message_info_get_original_folder (mi)) {
                        /* Just unset the flag on the original message */
                        camel_folder_set_message_flags (
                                source, uids->pdata[i], sbit, 0);
                } else {
                        if (batch == NULL)
                                batch = g_hash_table_new (NULL, NULL);
-                       md = g_hash_table_lookup (batch, camel_folder_summary_get_folder (mi->orig_summary));
+                       md = g_hash_table_lookup (batch, camel_vee_message_info_get_original_folder (mi));
                        if (md == NULL) {
                                md = g_malloc0 (sizeof (*md));
                                md->cancellable = cancellable;
-                               md->folder = g_object_ref (camel_folder_summary_get_folder 
(mi->orig_summary));
+                               md->folder = g_object_ref (camel_vee_message_info_get_original_folder (mi));
                                md->uids = g_ptr_array_new ();
                                md->dest = dest;
                                md->delete = delete_originals;
@@ -189,7 +189,7 @@ vtrash_folder_transfer_messages_to_sync (CamelFolder *source,
                                if (cancellable != NULL)
                                        g_object_ref (cancellable);
                                camel_folder_freeze (md->folder);
-                               g_hash_table_insert (batch, camel_folder_summary_get_folder 
(mi->orig_summary), md);
+                               g_hash_table_insert (batch, camel_vee_message_info_get_original_folder (mi), 
md);
                        }
 
                        /* unset the bit temporarily */
@@ -201,7 +201,7 @@ vtrash_folder_transfer_messages_to_sync (CamelFolder *source,
                        g_ptr_array_add (md->uids, g_strdup (tuid));
                        g_ptr_array_add (md->source_uids, uids->pdata[i]);
                }
-               camel_message_info_unref (mi);
+               g_clear_object (&mi);
        }
 
        if (batch) {
diff --git a/camel/providers/imapx/camel-imapx-command.c b/camel/providers/imapx/camel-imapx-command.c
index e56dd6a..1aaac91 100644
--- a/camel/providers/imapx/camel-imapx-command.c
+++ b/camel/providers/imapx/camel-imapx-command.c
@@ -187,7 +187,7 @@ camel_imapx_command_addv (CamelIMAPXCommand *ic,
        gint d;
        glong l;
        guint32 f;
-       CamelFlag *F;
+       const CamelNamedFlags *F;
        CamelDataWrapper *D;
        CamelSasl *A;
        gchar literal_format[16];
@@ -306,7 +306,7 @@ camel_imapx_command_addv (CamelIMAPXCommand *ic,
                                goto output_string;
                        case 'F': /* IMAP flags set */
                                f = va_arg (ap, guint32);
-                               F = va_arg (ap, CamelFlag *);
+                               F = va_arg (ap, const CamelNamedFlags *);
                                imapx_write_flags (buffer, f, F);
                                break;
                        case 'c':
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index 1002a30..d853302 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -500,7 +500,7 @@ imapx_expunge_sync (CamelFolder *folder,
                                info = camel_folder_summary_get (folder->summary, g_ptr_array_index 
(known_uids, ii));
                                if (info) {
                                        camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED, 
CAMEL_MESSAGE_DELETED);
-                                       camel_message_info_unref (info);
+                                       g_clear_object (&info);
                                }
                        }
 
@@ -651,7 +651,7 @@ imapx_get_message_sync (CamelFolder *folder,
                                        has_attachment ? CAMEL_MESSAGE_ATTACHMENTS : 0);
                        }
 
-                       camel_message_info_unref (mi);
+                       g_clear_object (&mi);
                }
        }
 
diff --git a/camel/providers/imapx/camel-imapx-message-info.c 
b/camel/providers/imapx/camel-imapx-message-info.c
index 609b83f..45f9f00 100644
--- a/camel/providers/imapx/camel-imapx-message-info.c
+++ b/camel/providers/imapx/camel-imapx-message-info.c
@@ -26,7 +26,7 @@
 
 #include "camel-imapx-message-info.h"
 
-struct _xCamelIMAPXMessageInfoPrivate {
+struct _CamelIMAPXMessageInfoPrivate {
        guint32 server_flags;
        CamelNamedFlags *server_user_flags;
        CamelNameValueArray *server_user_tags;
@@ -39,55 +39,55 @@ enum {
        PROP_SERVER_USER_TAGS
 };
 
-G_DEFINE_TYPE (xCamelIMAPXMessageInfo, xcamel_imapx_message_info, XCAMEL_TYPE_MESSAGE_INFO_BASE)
+G_DEFINE_TYPE (CamelIMAPXMessageInfo, camel_imapx_message_info, CAMEL_TYPE_MESSAGE_INFO_BASE)
 
-static xCamelMessageInfo *
-imapx_message_info_clone (const xCamelMessageInfo *mi,
+static CamelMessageInfo *
+imapx_message_info_clone (const CamelMessageInfo *mi,
                          CamelFolderSummary *assign_summary)
 {
-       xCamelMessageInfo *result;
+       CamelMessageInfo *result;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (mi), NULL);
 
-       result = XCAMEL_MESSAGE_INFO_CLASS (xcamel_imapx_message_info_parent_class)->clone (mi, 
assign_summary);
+       result = CAMEL_MESSAGE_INFO_CLASS (camel_imapx_message_info_parent_class)->clone (mi, assign_summary);
        if (!result)
                return NULL;
 
-       if (XCAMEL_IS_IMAPX_MESSAGE_INFO (result)) {
-               xCamelIMAPXMessageInfo *imi, *imi_result;
+       if (CAMEL_IS_IMAPX_MESSAGE_INFO (result)) {
+               CamelIMAPXMessageInfo *imi, *imi_result;
 
-               imi = XCAMEL_IMAPX_MESSAGE_INFO (mi);
-               imi_result = XCAMEL_IMAPX_MESSAGE_INFO (result);
+               imi = CAMEL_IMAPX_MESSAGE_INFO (mi);
+               imi_result = CAMEL_IMAPX_MESSAGE_INFO (result);
 
-               xcamel_imapx_message_info_set_server_flags (imi_result, 
xcamel_imapx_message_info_get_server_flags (imi));
-               xcamel_imapx_message_info_take_server_user_flags (imi_result, 
xcamel_imapx_message_info_dup_server_user_flags (imi));
-               xcamel_imapx_message_info_take_server_user_tags (imi_result, 
xcamel_imapx_message_info_dup_server_user_tags (imi));
+               camel_imapx_message_info_set_server_flags (imi_result, 
camel_imapx_message_info_get_server_flags (imi));
+               camel_imapx_message_info_take_server_user_flags (imi_result, 
camel_imapx_message_info_dup_server_user_flags (imi));
+               camel_imapx_message_info_take_server_user_tags (imi_result, 
camel_imapx_message_info_dup_server_user_tags (imi));
        }
 
        return result;
 }
 
 static gboolean
-imapx_message_info_load (xCamelMessageInfo *mi,
+imapx_message_info_load (CamelMessageInfo *mi,
                         const CamelMIRecord *record,
                         /* const */ gchar **bdata_ptr)
 {
-       xCamelIMAPXMessageInfo *imi;
+       CamelIMAPXMessageInfo *imi;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_ptr != NULL, FALSE);
 
-       if (!XCAMEL_MESSAGE_INFO_CLASS (xcamel_imapx_message_info_parent_class)->load ||
-           !XCAMEL_MESSAGE_INFO_CLASS (xcamel_imapx_message_info_parent_class)->load (mi, record, bdata_ptr))
+       if (!CAMEL_MESSAGE_INFO_CLASS (camel_imapx_message_info_parent_class)->load ||
+           !CAMEL_MESSAGE_INFO_CLASS (camel_imapx_message_info_parent_class)->load (mi, record, bdata_ptr))
                return FALSE;
 
-       imi = XCAMEL_IMAPX_MESSAGE_INFO (mi);
+       imi = CAMEL_IMAPX_MESSAGE_INFO (mi);
 
        /* Reset server-side information, which is not saved into the summary anyway. */
-       xcamel_imapx_message_info_set_server_flags (imi, 0);
-       xcamel_imapx_message_info_take_server_user_flags (imi, NULL);
-       xcamel_imapx_message_info_take_server_user_tags (imi, NULL);
+       camel_imapx_message_info_set_server_flags (imi, 0);
+       camel_imapx_message_info_take_server_user_flags (imi, NULL);
+       camel_imapx_message_info_take_server_user_tags (imi, NULL);
 
        return TRUE;
 }
@@ -98,19 +98,19 @@ imapx_message_info_set_property (GObject *object,
                                 const GValue *value,
                                 GParamSpec *pspec)
 {
-       xCamelIMAPXMessageInfo *imi = XCAMEL_IMAPX_MESSAGE_INFO (object);
+       CamelIMAPXMessageInfo *imi = CAMEL_IMAPX_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_SERVER_FLAGS:
-               xcamel_imapx_message_info_set_server_flags (imi, g_value_get_uint (value));
+               camel_imapx_message_info_set_server_flags (imi, g_value_get_uint (value));
                return;
 
        case PROP_SERVER_USER_FLAGS:
-               xcamel_imapx_message_info_take_server_user_flags (imi, g_value_dup_boxed (value));
+               camel_imapx_message_info_take_server_user_flags (imi, g_value_dup_boxed (value));
                return;
 
        case PROP_SERVER_USER_TAGS:
-               xcamel_imapx_message_info_take_server_user_tags (imi, g_value_dup_boxed (value));
+               camel_imapx_message_info_take_server_user_tags (imi, g_value_dup_boxed (value));
                return;
        }
 
@@ -123,19 +123,19 @@ imapx_message_info_get_property (GObject *object,
                                 GValue *value,
                                 GParamSpec *pspec)
 {
-       xCamelIMAPXMessageInfo *imi = XCAMEL_IMAPX_MESSAGE_INFO (object);
+       CamelIMAPXMessageInfo *imi = CAMEL_IMAPX_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_SERVER_FLAGS:
-               g_value_set_uint (value, xcamel_imapx_message_info_get_server_flags (imi));
+               g_value_set_uint (value, camel_imapx_message_info_get_server_flags (imi));
                return;
 
        case PROP_SERVER_USER_FLAGS:
-               g_value_take_boxed (value, xcamel_imapx_message_info_dup_server_user_flags (imi));
+               g_value_take_boxed (value, camel_imapx_message_info_dup_server_user_flags (imi));
                return;
 
        case PROP_SERVER_USER_TAGS:
-               g_value_take_boxed (value, xcamel_imapx_message_info_dup_server_user_tags (imi));
+               g_value_take_boxed (value, camel_imapx_message_info_dup_server_user_tags (imi));
                return;
        }
 
@@ -145,7 +145,7 @@ imapx_message_info_get_property (GObject *object,
 static void
 imapx_message_info_dispose (GObject *object)
 {
-       xCamelIMAPXMessageInfo *imi = XCAMEL_IMAPX_MESSAGE_INFO (object);
+       CamelIMAPXMessageInfo *imi = CAMEL_IMAPX_MESSAGE_INFO (object);
 
        camel_named_flags_free (imi->priv->server_user_flags);
        imi->priv->server_user_flags = NULL;
@@ -154,18 +154,18 @@ imapx_message_info_dispose (GObject *object)
        imi->priv->server_user_tags = NULL;
 
        /* Chain up to parent's method. */
-       G_OBJECT_CLASS (xcamel_imapx_message_info_parent_class)->dispose (object);
+       G_OBJECT_CLASS (camel_imapx_message_info_parent_class)->dispose (object);
 }
 
 static void
-xcamel_imapx_message_info_class_init (xCamelIMAPXMessageInfoClass *class)
+camel_imapx_message_info_class_init (CamelIMAPXMessageInfoClass *class)
 {
-       xCamelMessageInfoClass *mi_class;
+       CamelMessageInfoClass *mi_class;
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (xCamelIMAPXMessageInfoPrivate));
+       g_type_class_add_private (class, sizeof (CamelIMAPXMessageInfoPrivate));
 
-       mi_class = XCAMEL_MESSAGE_INFO_CLASS (class);
+       mi_class = CAMEL_MESSAGE_INFO_CLASS (class);
        mi_class->clone = imapx_message_info_clone;
        mi_class->load = imapx_message_info_load;
 
@@ -175,7 +175,7 @@ xcamel_imapx_message_info_class_init (xCamelIMAPXMessageInfoClass *class)
        object_class->dispose = imapx_message_info_dispose;
 
        /**
-        * xCamelIMAPXMessageInfo:server-flags
+        * CamelIMAPXMessageInfo:server-flags
         *
         * Bit-or of #CamelMessageFlags of the flags stored on the server.
         *
@@ -192,7 +192,7 @@ xcamel_imapx_message_info_class_init (xCamelIMAPXMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelIMAPXMessageInfo:server-user-flags
+        * CamelIMAPXMessageInfo:server-user-flags
         *
         * User flags for the associated message, as stored on the server.
         * Can be %NULL.
@@ -210,7 +210,7 @@ xcamel_imapx_message_info_class_init (xCamelIMAPXMessageInfoClass *class)
                        G_PARAM_READWRITE));
 
        /**
-        * xCamelIMAPXMessageInfo:server-user-tags
+        * CamelIMAPXMessageInfo:server-user-tags
         *
         * User tags for the associated message, as stored on the server.
         * Can be %NULL.
@@ -229,101 +229,101 @@ xcamel_imapx_message_info_class_init (xCamelIMAPXMessageInfoClass *class)
 }
 
 static void
-xcamel_imapx_message_info_init (xCamelIMAPXMessageInfo *vmi)
+camel_imapx_message_info_init (CamelIMAPXMessageInfo *vmi)
 {
-       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, XCAMEL_TYPE_IMAPX_MESSAGE_INFO, 
xCamelIMAPXMessageInfoPrivate);
+       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, CAMEL_TYPE_IMAPX_MESSAGE_INFO, 
CamelIMAPXMessageInfoPrivate);
 }
 
 guint32
-xcamel_imapx_message_info_get_server_flags (const xCamelIMAPXMessageInfo *imi)
+camel_imapx_message_info_get_server_flags (const CamelIMAPXMessageInfo *imi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        guint32 result;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), 0);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), 0);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = imi->priv->server_flags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 gboolean
-xcamel_imapx_message_info_set_server_flags (xCamelIMAPXMessageInfo *imi,
-                                           guint32 server_flags)
+camel_imapx_message_info_set_server_flags (CamelIMAPXMessageInfo *imi,
+                                          guint32 server_flags)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), FALSE);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = imi->priv->server_flags != server_flags;
        if (changed)
                imi->priv->server_flags = server_flags;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !xcamel_message_info_get_loading (mi)) {
+       if (changed && !camel_message_info_get_abort_notifications (mi)) {
                g_object_notify (G_OBJECT (imi), "server-flags");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
        }
 
        return changed;
 }
 
 const CamelNamedFlags *
-xcamel_imapx_message_info_get_server_user_flags (const xCamelIMAPXMessageInfo *imi)
+camel_imapx_message_info_get_server_user_flags (const CamelIMAPXMessageInfo *imi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        const CamelNamedFlags *result;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = imi->priv->server_user_flags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 CamelNamedFlags *
-xcamel_imapx_message_info_dup_server_user_flags (const xCamelIMAPXMessageInfo *imi)
+camel_imapx_message_info_dup_server_user_flags (const CamelIMAPXMessageInfo *imi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        CamelNamedFlags *result;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = camel_named_flags_copy (imi->priv->server_user_flags);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 gboolean
-xcamel_imapx_message_info_take_server_user_flags (xCamelIMAPXMessageInfo *imi,
-                                                 CamelNamedFlags *server_user_flags)
+camel_imapx_message_info_take_server_user_flags (CamelIMAPXMessageInfo *imi,
+                                                CamelNamedFlags *server_user_flags)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), FALSE);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = !camel_named_flags_equal (imi->priv->server_user_flags, server_user_flags);
 
@@ -334,62 +334,62 @@ xcamel_imapx_message_info_take_server_user_flags (xCamelIMAPXMessageInfo *imi,
                camel_named_flags_free (server_user_flags);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !xcamel_message_info_get_loading (mi)) {
+       if (changed && !camel_message_info_get_abort_notifications (mi)) {
                g_object_notify (G_OBJECT (imi), "server-user-flags");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
        }
 
        return changed;
 }
 
 const CamelNameValueArray *
-xcamel_imapx_message_info_get_server_user_tags (const xCamelIMAPXMessageInfo *imi)
+camel_imapx_message_info_get_server_user_tags (const CamelIMAPXMessageInfo *imi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        const CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = imi->priv->server_user_tags;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 CamelNameValueArray *
-xcamel_imapx_message_info_dup_server_user_tags (const xCamelIMAPXMessageInfo *imi)
+camel_imapx_message_info_dup_server_user_tags (const CamelIMAPXMessageInfo *imi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        CamelNameValueArray *result;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), NULL);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = camel_name_value_array_copy (imi->priv->server_user_tags);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 gboolean
-xcamel_imapx_message_info_take_server_user_tags (xCamelIMAPXMessageInfo *imi,
-                                                CamelNameValueArray *server_user_tags)
+camel_imapx_message_info_take_server_user_tags (CamelIMAPXMessageInfo *imi,
+                                               CamelNameValueArray *server_user_tags)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_IMAPX_MESSAGE_INFO (imi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_IMAPX_MESSAGE_INFO (imi), FALSE);
 
-       mi = XCAMEL_MESSAGE_INFO (imi);
+       mi = CAMEL_MESSAGE_INFO (imi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = !camel_name_value_array_equal (imi->priv->server_user_tags, server_user_tags, TRUE);
 
@@ -400,11 +400,11 @@ xcamel_imapx_message_info_take_server_user_tags (xCamelIMAPXMessageInfo *imi,
                camel_name_value_array_free (server_user_tags);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !xcamel_message_info_get_loading (mi)) {
+       if (changed && !camel_message_info_get_abort_notifications (mi)) {
                g_object_notify (G_OBJECT (imi), "server-user-tags");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
        }
 
        return changed;
diff --git a/camel/providers/imapx/camel-imapx-message-info.h 
b/camel/providers/imapx/camel-imapx-message-info.h
index ee6a147..748c75b 100644
--- a/camel/providers/imapx/camel-imapx-message-info.h
+++ b/camel/providers/imapx/camel-imapx-message-info.h
@@ -15,73 +15,73 @@
  * along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef XCAMEL_IMAPX_MESSAGE_INFO_H
-#define XCAMEL_IMAPX_MESSAGE_INFO_H
+#ifndef CAMEL_IMAPX_MESSAGE_INFO_H
+#define CAMEL_IMAPX_MESSAGE_INFO_H
 
 #include <glib-object.h>
 
 #include <camel/camel.h>
 
 /* Standard GObject macros */
-#define XCAMEL_TYPE_IMAPX_MESSAGE_INFO \
-       (xcamel_imapx_message_info_get_type ())
-#define XCAMEL_IMAPX_MESSAGE_INFO(obj) \
+#define CAMEL_TYPE_IMAPX_MESSAGE_INFO \
+       (camel_imapx_message_info_get_type ())
+#define CAMEL_IMAPX_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), XCAMEL_TYPE_IMAPX_MESSAGE_INFO, xCamelIMAPXMessageInfo))
-#define XCAMEL_IMAPX_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_IMAPX_MESSAGE_INFO, CamelIMAPXMessageInfo))
+#define CAMEL_IMAPX_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), XCAMEL_TYPE_IMAPX_MESSAGE_INFO, xCamelIMAPXMessageInfoClass))
-#define XCAMEL_IS_IMAPX_MESSAGE_INFO(obj) \
+       ((cls), CAMEL_TYPE_IMAPX_MESSAGE_INFO, CamelIMAPXMessageInfoClass))
+#define CAMEL_IS_IMAPX_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), XCAMEL_TYPE_IMAPX_MESSAGE_INFO))
-#define XCAMEL_IS_IMAPX_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_IMAPX_MESSAGE_INFO))
+#define CAMEL_IS_IMAPX_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), XCAMEL_TYPE_IMAPX_MESSAGE_INFO))
-#define XCAMEL_IMAPX_MESSAGE_INFO_GET_CLASS(obj) \
+       ((cls), CAMEL_TYPE_IMAPX_MESSAGE_INFO))
+#define CAMEL_IMAPX_MESSAGE_INFO_GET_CLASS(obj) \
        (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), XCAMEL_TYPE_IMAPX_MESSAGE_INFO, xCamelIMAPXMessageInfoClass))
+       ((obj), CAMEL_TYPE_IMAPX_MESSAGE_INFO, CamelIMAPXMessageInfoClass))
 
 G_BEGIN_DECLS
 
-typedef struct _xCamelIMAPXMessageInfo xCamelIMAPXMessageInfo;
-typedef struct _xCamelIMAPXMessageInfoClass xCamelIMAPXMessageInfoClass;
-typedef struct _xCamelIMAPXMessageInfoPrivate xCamelIMAPXMessageInfoPrivate;
+typedef struct _CamelIMAPXMessageInfo CamelIMAPXMessageInfo;
+typedef struct _CamelIMAPXMessageInfoClass CamelIMAPXMessageInfoClass;
+typedef struct _CamelIMAPXMessageInfoPrivate CamelIMAPXMessageInfoPrivate;
 
-struct _xCamelIMAPXMessageInfo {
-       xCamelMessageInfoBase parent;
-       xCamelIMAPXMessageInfoPrivate *priv;
+struct _CamelIMAPXMessageInfo {
+       CamelMessageInfoBase parent;
+       CamelIMAPXMessageInfoPrivate *priv;
 };
 
-struct _xCamelIMAPXMessageInfoClass {
-       xCamelMessageInfoBaseClass parent_class;
+struct _CamelIMAPXMessageInfoClass {
+       CamelMessageInfoBaseClass parent_class;
 };
 
-GType          xcamel_imapx_message_info_get_type      (void);
+GType          camel_imapx_message_info_get_type       (void);
 
-guint32                xcamel_imapx_message_info_get_server_flags
-                                                       (const xCamelIMAPXMessageInfo *imi);
-gboolean       xcamel_imapx_message_info_set_server_flags
-                                                       (xCamelIMAPXMessageInfo *imi,
+guint32                camel_imapx_message_info_get_server_flags
+                                                       (const CamelIMAPXMessageInfo *imi);
+gboolean       camel_imapx_message_info_set_server_flags
+                                                       (CamelIMAPXMessageInfo *imi,
                                                         guint32 server_flags);
 const CamelNamedFlags *
-               xcamel_imapx_message_info_get_server_user_flags
-                                                       (const xCamelIMAPXMessageInfo *imi);
+               camel_imapx_message_info_get_server_user_flags
+                                                       (const CamelIMAPXMessageInfo *imi);
 CamelNamedFlags *
-               xcamel_imapx_message_info_dup_server_user_flags
-                                                       (const xCamelIMAPXMessageInfo *imi);
-gboolean       xcamel_imapx_message_info_take_server_user_flags
-                                                       (xCamelIMAPXMessageInfo *imi,
+               camel_imapx_message_info_dup_server_user_flags
+                                                       (const CamelIMAPXMessageInfo *imi);
+gboolean       camel_imapx_message_info_take_server_user_flags
+                                                       (CamelIMAPXMessageInfo *imi,
                                                         CamelNamedFlags *server_user_flags);
 const CamelNameValueArray *
-               xcamel_imapx_message_info_get_server_user_tags
-                                                       (const xCamelIMAPXMessageInfo *imi);
+               camel_imapx_message_info_get_server_user_tags
+                                                       (const CamelIMAPXMessageInfo *imi);
 CamelNameValueArray *
-               xcamel_imapx_message_info_dup_server_user_tags
-                                                       (const xCamelIMAPXMessageInfo *imi);
-gboolean       xcamel_imapx_message_info_take_server_user_tags
-                                                       (xCamelIMAPXMessageInfo *imi,
+               camel_imapx_message_info_dup_server_user_tags
+                                                       (const CamelIMAPXMessageInfo *imi);
+gboolean       camel_imapx_message_info_take_server_user_tags
+                                                       (CamelIMAPXMessageInfo *imi,
                                                         CamelNameValueArray *server_user_tags);
 
 G_END_DECLS
 
-#endif /* XCAMEL_IMAPX_MESSAGE_INFO_H */
+#endif /* CAMEL_IMAPX_MESSAGE_INFO_H */
diff --git a/camel/providers/imapx/camel-imapx-search.c b/camel/providers/imapx/camel-imapx-search.c
index a14ba6e..5f0af2f 100644
--- a/camel/providers/imapx/camel-imapx-search.c
+++ b/camel/providers/imapx/camel-imapx-search.c
@@ -260,8 +260,7 @@ imapx_search_match_all (CamelSExp *sexp,
                if (search->current) {
                        result = camel_sexp_term_eval (sexp, argv[0]);
                        camel_sexp_result_free (sexp, result);
-                       camel_message_info_unref (search->current);
-                       search->current = NULL;
+                       g_clear_object (&search->current);
                        break;
                }
        }
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index f2bd005..d3d0f71 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -43,6 +43,7 @@
 #include "camel-imapx-input-stream.h"
 #include "camel-imapx-job.h"
 #include "camel-imapx-logger.h"
+#include "camel-imapx-message-info.h"
 #include "camel-imapx-settings.h"
 #include "camel-imapx-store.h"
 #include "camel-imapx-summary.h"
@@ -364,7 +365,7 @@ G_DEFINE_TYPE (CamelIMAPXServer, camel_imapx_server, G_TYPE_OBJECT)
 
 typedef struct _FetchChangesInfo {
        guint32 server_flags;
-       CamelFlag *server_user_flags;
+       CamelNamedFlags *server_user_flags;
 } FetchChangesInfo;
 
 static void
@@ -373,7 +374,7 @@ fetch_changes_info_free (gpointer ptr)
        FetchChangesInfo *nfo = ptr;
 
        if (nfo) {
-               camel_flag_list_free (&nfo->server_user_flags);
+               camel_named_flags_free (nfo->server_user_flags);
                g_free (nfo);
        }
 }
@@ -1284,8 +1285,7 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
                                g_mutex_unlock (&is->priv->changes_lock);
                        }
 
-                       if (mi)
-                               camel_message_info_unref (mi);
+                       g_clear_object (&mi);
 
                        g_object_unref (select_folder);
                }
@@ -1339,11 +1339,12 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
 
                if (mi != NULL) {
                        guint32 server_flags;
-                       CamelFlag *server_user_flags;
-                       CamelMessageInfoBase *binfo;
+                       CamelNamedFlags *server_user_flags;
                        gboolean free_user_flags = FALSE;
 
-                       mi->uid = camel_pstring_strdup (finfo->uid);
+                       camel_message_info_set_abort_notifications (mi, TRUE);
+
+                       camel_message_info_set_uid (mi, finfo->uid);
 
                        if (!(finfo->got & FETCH_FLAGS) && is->priv->fetch_changes_infos) {
                                FetchChangesInfo *nfo;
@@ -1369,29 +1370,29 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
                        if (!(server_flags & CAMEL_MESSAGE_SEEN)) {
                                guint64 uidl;
 
-                               uidl = strtoull (mi->uid, NULL, 10);
+                               uidl = strtoull (finfo->uid, NULL, 10);
 
                                if (uidl >= uidnext) {
-                                       c (is->priv->tagprefix, "Updating unseen count for new message %s\n", 
mi->uid);
+                                       c (is->priv->tagprefix, "Updating unseen count for new message %s\n", 
finfo->uid);
                                        camel_imapx_mailbox_set_unseen (mailbox, unseen + 1);
                                } else {
-                                       c (is->priv->tagprefix, "Not updating unseen count for new message 
%s\n", mi->uid);
+                                       c (is->priv->tagprefix, "Not updating unseen count for new message 
%s\n", finfo->uid);
                                }
                        }
 
-                       binfo = (CamelMessageInfoBase *) mi;
-                       binfo->size = finfo->size;
+                       camel_message_info_set_size (mi, finfo->size);
+                       camel_message_info_set_abort_notifications (mi, FALSE);
 
                        camel_folder_summary_lock (folder->summary);
 
-                       if (!camel_folder_summary_check_uid (folder->summary, mi->uid)) {
+                       if (!camel_folder_summary_check_uid (folder->summary, finfo->uid)) {
                                imapx_set_message_info_flags_for_new_message (mi, server_flags, 
server_user_flags, FALSE, NULL, camel_imapx_mailbox_get_permanentflags (mailbox));
                                camel_folder_summary_add (folder->summary, mi);
 
                                g_mutex_lock (&is->priv->changes_lock);
 
-                               camel_folder_change_info_add_uid (is->priv->changes, mi->uid);
-                               camel_folder_change_info_recent_uid (is->priv->changes, mi->uid);
+                               camel_folder_change_info_add_uid (is->priv->changes, finfo->uid);
+                               camel_folder_change_info_recent_uid (is->priv->changes, finfo->uid);
 
                                g_mutex_unlock (&is->priv->changes_lock);
 
@@ -1401,13 +1402,13 @@ imapx_untagged_fetch (CamelIMAPXServer *is,
                                        camel_operation_progress (cancellable, cnt ? cnt : 1);
                                }
                        } else {
-                               camel_message_info_unref (mi);
+                               g_clear_object (&mi);
                        }
 
                        camel_folder_summary_unlock (folder->summary);
 
-                       if (free_user_flags && server_user_flags)
-                               camel_flag_list_free (&server_user_flags);
+                       if (free_user_flags)
+                               camel_named_flags_free (server_user_flags);
                }
 
                g_clear_object (&mailbox);
@@ -4082,12 +4083,12 @@ camel_imapx_server_get_message_sync (CamelIMAPXServer *is,
 
        cache_stream = camel_data_cache_add (message_cache, "tmp", message_uid, error);
        if (cache_stream == NULL) {
-               camel_message_info_unref (mi);
+               g_clear_object (&mi);
                return NULL;
        }
 
        settings = camel_imapx_server_ref_settings (is);
-       data_size = ((CamelMessageInfoBase *) mi)->size;
+       data_size = camel_message_info_get_size (mi);
        use_multi_fetch = data_size > MULTI_SIZE && camel_imapx_settings_get_use_multi_fetch (settings);
        g_object_unref (settings);
 
@@ -4318,7 +4319,7 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
                g_mutex_unlock (&is->priv->stream_lock);
        }
 
-       source_infos = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, camel_message_info_unref);
+       source_infos = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
        data_uids = g_ptr_array_new ();
 
        for (ii = 0; ii < uids->len; ii++) {
@@ -4397,20 +4398,20 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
 
                                                if (!destination_info) {
                                                        is_new = TRUE;
-                                                       destination_info = camel_message_info_clone 
(source_info);
-                                                       destination_info->summary = 
destination_folder->summary;
-                                                       camel_pstring_free (destination_info->uid);
-                                                       destination_info->uid = camel_pstring_strdup (uid);
+                                                       destination_info = camel_message_info_clone 
(source_info, destination_folder->summary);
+                                                       camel_message_info_set_uid (destination_info, uid);
                                                }
 
                                                g_free (uid);
 
+                                               camel_message_info_property_lock (source_info);
+
                                                imapx_set_message_info_flags_for_new_message (
                                                        destination_info,
-                                                       ((CamelMessageInfoBase *) source_info)->flags,
-                                                       ((CamelMessageInfoBase *) source_info)->user_flags,
+                                                       camel_message_info_get_flags (source_info),
+                                                       camel_message_info_get_user_flags (source_info),
                                                        TRUE,
-                                                       ((CamelMessageInfoBase *) source_info)->user_tags,
+                                                       camel_message_info_get_user_tags (source_info),
                                                        camel_imapx_mailbox_get_permanentflags (destination));
                                                if (remove_deleted_flags)
                                                        camel_message_info_set_flags (destination_info, 
CAMEL_MESSAGE_DELETED, 0);
@@ -4418,10 +4419,12 @@ camel_imapx_server_copy_message_sync (CamelIMAPXServer *is,
                                                        camel_message_info_set_flags (destination_info, 
CAMEL_MESSAGE_JUNK, 0);
                                                if (is_new)
                                                        camel_folder_summary_add 
(destination_folder->summary, destination_info);
-                                               camel_folder_change_info_add_uid (changes, 
destination_info->uid);
+                                               camel_folder_change_info_add_uid (changes, 
camel_message_info_get_uid (destination_info));
+
+                                               camel_message_info_property_unlock (source_info);
 
                                                if (!is_new)
-                                                       camel_message_info_unref (destination_info);
+                                                       g_clear_object (&destination_info);
                                        }
 
                                        if (camel_folder_change_info_changed (changes)) {
@@ -4573,34 +4576,21 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
        date_time = camel_mime_message_get_date (message, NULL);
        path = camel_data_cache_get_filename (message_cache, "new", uid);
        info = camel_folder_summary_info_new_from_message (summary, message, NULL);
-       info->uid = camel_pstring_strdup (uid);
+
+       camel_message_info_set_abort_notifications (info, TRUE);
+       camel_message_info_set_uid (info, uid);
 
        if (mi != NULL) {
                struct icaltimetype icaltime;
-               CamelMessageInfoBase *base_info = (CamelMessageInfoBase *) info;
-               const CamelFlag *flag;
-               const CamelTag *tag;
-
-               base_info->flags = camel_message_info_get_flags (mi);
-               base_info->size = camel_message_info_get_size (mi);
-
-               flag = camel_message_info_get_user_flags (mi);
-               while (flag != NULL) {
-                       if (*flag->name != '\0')
-                               camel_flag_set (
-                                       &base_info->user_flags,
-                                       flag->name, TRUE);
-                       flag = flag->next;
-               }
 
-               tag = camel_message_info_get_user_tags (mi);
-               while (tag != NULL) {
-                       if (*tag->name != '\0')
-                               camel_tag_set (
-                                       &base_info->user_tags,
-                                       tag->name, tag->value);
-                       tag = tag->next;
-               }
+               camel_message_info_property_lock (mi);
+
+               camel_message_info_set_flags (info, ~0, camel_message_info_get_flags (mi));
+               camel_message_info_set_size (info, camel_message_info_get_size (mi));
+               camel_message_info_take_user_flags (info,
+                       camel_named_flags_copy (camel_message_info_get_user_flags (mi)));
+               camel_message_info_take_user_tags (info,
+                       camel_name_value_array_copy (camel_message_info_get_user_tags (mi)));
 
                if (date_time > 0) {
                        icaltime = icaltime_from_timet (date_time, FALSE);
@@ -4616,6 +4606,8 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
                        if (!icaltime_is_valid_time (icaltime))
                                date_time = -1;
                }
+
+               camel_message_info_property_unlock (mi);
        }
 
        if (!camel_message_info_get_size (info)) {
@@ -4624,14 +4616,14 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
                camel_data_wrapper_write_to_stream_sync (
                        CAMEL_DATA_WRAPPER (message),
                        CAMEL_STREAM (sn), NULL, NULL);
-               ((CamelMessageInfoBase *) info)->size = sn->written;
+               camel_message_info_set_size (info, sn->written);
                g_object_unref (sn);
        }
 
        g_free (uid);
 
        if (camel_mime_message_has_attachment (message))
-               ((CamelMessageInfoBase *) info)->flags |= CAMEL_MESSAGE_ATTACHMENTS;
+               camel_message_info_set_flags (info, CAMEL_MESSAGE_ATTACHMENTS, CAMEL_MESSAGE_ATTACHMENTS);
 
        if (date_time > 0) {
                gchar *date_time_str;
@@ -4651,8 +4643,8 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
 
                ic = camel_imapx_command_new (is, CAMEL_IMAPX_JOB_APPEND_MESSAGE, "APPEND %M %F %t %P",
                        mailbox,
-                       ((CamelMessageInfoBase *) info)->flags,
-                       ((CamelMessageInfoBase *) info)->user_flags,
+                       camel_message_info_get_flags (info),
+                       camel_message_info_get_user_flags (info),
                        date_time_str,
                        path);
 
@@ -4660,11 +4652,13 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
        } else {
                ic = camel_imapx_command_new (is, CAMEL_IMAPX_JOB_APPEND_MESSAGE, "APPEND %M %F %P",
                        mailbox,
-                       ((CamelMessageInfoBase *) info)->flags,
-                       ((CamelMessageInfoBase *) info)->user_flags,
+                       camel_message_info_get_flags (info),
+                       camel_message_info_get_user_flags (info),
                        path);
        }
 
+       camel_message_info_set_abort_notifications (info, FALSE);
+
        success = camel_imapx_server_process_command_sync (is, ic, _("Error appending message"), cancellable, 
error);
 
        if (success) {
@@ -4687,35 +4681,41 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
                 * numbered MessageInfo, without losing any information.  Otherwise
                 * we have to wait for the server to let us know it was appended. */
 
-               mi = camel_message_info_clone (info);
-               old_uid = g_strdup (info->uid);
+               mi = camel_message_info_clone (info, NULL);
+               old_uid = g_strdup (camel_message_info_get_uid (info));
 
                if (ic->status && ic->status->condition == IMAPX_APPENDUID) {
                        c (is->priv->tagprefix, "Got appenduid %d %d\n", (gint) 
ic->status->u.appenduid.uidvalidity, (gint) ic->status->u.appenduid.uid);
                        if (ic->status->u.appenduid.uidvalidity == uidvalidity) {
-                               if (appended_uid)
-                                       *appended_uid = g_strdup_printf ("%u", (guint) 
ic->status->u.appenduid.uid);
-                               mi->uid = camel_pstring_add (g_strdup_printf ("%u", (guint) 
ic->status->u.appenduid.uid), TRUE);
+                               gchar *uid;
+
+                               uid = g_strdup_printf ("%u", (guint) ic->status->u.appenduid.uid);
+                               camel_message_info_set_uid (mi, uid);
 
-                               cur = camel_data_cache_get_filename  (imapx_folder->cache, "cur", mi->uid);
+                               cur = camel_data_cache_get_filename  (imapx_folder->cache, "cur", uid);
                                if (g_rename (path, cur) == -1 && errno != ENOENT) {
                                        g_warning ("%s: Failed to rename '%s' to '%s': %s", G_STRFUNC, path, 
cur, g_strerror (errno));
                                }
 
                                imapx_set_message_info_flags_for_new_message (
                                        mi,
-                                       ((CamelMessageInfoBase *) info)->flags,
-                                       ((CamelMessageInfoBase *) info)->user_flags,
+                                       camel_message_info_get_flags (info),
+                                       camel_message_info_get_user_flags (info),
                                        TRUE,
-                                       ((CamelMessageInfoBase *) info)->user_tags,
+                                       camel_message_info_get_user_tags (info),
                                        camel_imapx_mailbox_get_permanentflags (mailbox));
 
                                camel_folder_summary_add (folder->summary, mi);
 
                                g_mutex_lock (&is->priv->changes_lock);
-                               camel_folder_change_info_add_uid (is->priv->changes, mi->uid);
+                               camel_folder_change_info_add_uid (is->priv->changes, 
camel_message_info_get_uid (mi));
                                g_mutex_unlock (&is->priv->changes_lock);
 
+                               if (appended_uid)
+                                       *appended_uid = uid;
+                               else
+                                       g_free (uid);
+
                                mi = NULL;
 
                                g_free (cur);
@@ -4728,8 +4728,7 @@ camel_imapx_server_append_message_sync (CamelIMAPXServer *is,
                g_free (old_uid);
 
                camel_imapx_command_unref (ic);
-               if (mi)
-                       camel_message_info_unref (mi);
+               g_clear_object (&mi);
                g_object_unref (folder);
        }
 
@@ -4862,7 +4861,7 @@ imapx_server_process_fetch_changes_infos (CamelIMAPXServer *is,
                        g_mutex_unlock (&is->priv->changes_lock);
                }
 
-               camel_message_info_unref (minfo);
+               g_clear_object (&minfo);
        }
 }
 
@@ -5169,7 +5168,7 @@ imapx_sync_free_user (GArray *user_set)
 
                for (j = 0; j < infos->len; j++) {
                        CamelMessageInfo *info = g_ptr_array_index (infos, j);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
 
                g_ptr_array_free (infos, TRUE);
@@ -5194,17 +5193,14 @@ imapx_unset_folder_flagged_flag (CamelFolderSummary *summary,
                info = camel_folder_summary_get (summary, changed_uids->pdata[ii]);
 
                if (info) {
-                       CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
-
                        /* some infos could be only 'dirty' (needed to save into summary) */
-                       if ((mi->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0 &&
-                          (!except_deleted_messages || (mi->flags & CAMEL_MESSAGE_DELETED) == 0)) {
-                               mi->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
-                               mi->dirty = TRUE;
+                       if (camel_message_info_get_folder_flagged (info) &&
+                          (!except_deleted_messages || (camel_message_info_get_flags (info) & 
CAMEL_MESSAGE_DELETED) == 0)) {
+                               camel_message_info_set_folder_flagged (info, FALSE);
                                changed = TRUE;
                        }
 
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
        }
 
@@ -5214,25 +5210,6 @@ imapx_unset_folder_flagged_flag (CamelFolderSummary *summary,
        }
 }
 
-static void
-imapx_server_info_changed_cb (CamelIMAPXSummary *summary,
-                             CamelMessageInfo *info,
-                             gpointer user_data)
-{
-       GHashTable *changed_meanwhile = user_data;
-
-       g_return_if_fail (info != NULL);
-       g_return_if_fail (changed_meanwhile != NULL);
-
-       /* The UID can be NULL in case of a newly fetched message, for example when creating
-          the message info in imapx_untagged_fetch() by camel_folder_summary_info_new_from_parser() */
-       if (camel_message_info_get_uid (info)) {
-               g_hash_table_insert (changed_meanwhile,
-                       (gpointer) camel_pstring_strdup (camel_message_info_get_uid (info)),
-                       GINT_TO_POINTER (1));
-       }
-}
-
 gboolean
 camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                                      CamelIMAPXMailbox *mailbox,
@@ -5244,9 +5221,8 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
        GPtrArray *changed_uids;
        GArray *on_user = NULL, *off_user = NULL;
        CamelFolder *folder;
-       CamelIMAPXMessageInfo *info;
-       GHashTable *changed_meanwhile;
-       gulong changed_meanwhile_handler_id;
+       CamelMessageInfo *info;
+       GHashTable *stamps;
        guint32 permanentflags;
        struct _uidset_state uidset;
        gint unread_change = 0;
@@ -5280,9 +5256,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                return TRUE;
        }
 
-       changed_meanwhile = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) 
camel_pstring_free, NULL);
-       changed_meanwhile_handler_id = g_signal_connect (folder->summary, "info-changed",
-               G_CALLBACK (imapx_server_info_changed_cb), changed_meanwhile);
+       stamps = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) camel_pstring_free, NULL);
 
        if (can_influence_flags) {
                CamelIMAPXSettings *settings;
@@ -5316,26 +5290,34 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
 
        off_orset = on_orset = 0;
        for (i = 0; i < changed_uids->len; i++) {
+               CamelIMAPXMessageInfo *xinfo;
                guint32 flags, sflags;
-               CamelFlag *uflags, *suflags;
+               const CamelNamedFlags *local_uflags, *server_uflags;
                const gchar *uid;
                guint j = 0;
 
                uid = g_ptr_array_index (changed_uids, i);
 
-               info = (CamelIMAPXMessageInfo *)
-                       camel_folder_summary_get (folder->summary, uid);
+               info = camel_folder_summary_get (folder->summary, uid);
+               xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
 
-               if (info == NULL)
+               if (!info || !xinfo) {
+                       g_clear_object (&info);
                        continue;
+               }
 
-               if (!(info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                       camel_message_info_unref (info);
+               if (!camel_message_info_get_folder_flagged (info)) {
+                       g_clear_object (&info);
                        continue;
                }
 
-               flags = info->info.flags & CAMEL_IMAPX_SERVER_FLAGS;
-               sflags = info->server_flags & CAMEL_IMAPX_SERVER_FLAGS;
+               camel_message_info_property_lock (info);
+
+               g_hash_table_insert (stamps, (gpointer) camel_message_info_pooldup_uid (info),
+                       GUINT_TO_POINTER (camel_message_info_get_folder_flagged_stamp (info)));
+
+               flags = camel_message_info_get_flags (info) & CAMEL_IMAPX_SERVER_FLAGS;
+               sflags = camel_imapx_message_info_get_server_flags (xinfo) & CAMEL_IMAPX_SERVER_FLAGS;
 
                if (can_influence_flags) {
                        gboolean move_to_real_junk;
@@ -5363,63 +5345,76 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                        on_orset |= (flags ^ sflags) & flags;
                }
 
-               uflags = info->info.user_flags;
-               suflags = info->server_user_flags;
-               while (uflags || suflags) {
-                       gint res;
-
-                       if (uflags) {
-                               if (suflags)
-                                       res = strcmp (uflags->name, suflags->name);
-                               else if (*uflags->name)
-                                       res = -1;
-                               else {
-                                       uflags = uflags->next;
-                                       continue;
-                               }
-                       } else {
-                               res = 1;
-                       }
+               local_uflags = camel_message_info_get_user_flags (info);
+               server_uflags = camel_imapx_message_info_get_server_user_flags (xinfo);
 
-                       if (res == 0) {
-                               uflags = uflags->next;
-                               suflags = suflags->next;
-                       } else {
-                               GArray *user_set;
-                               CamelFlag *user_flag;
-                               struct _imapx_flag_change *change = NULL, add = { 0 };
-
-                               if (res < 0) {
-                                       if (on_user == NULL)
-                                               on_user = g_array_new (FALSE, FALSE, sizeof (struct 
_imapx_flag_change));
-                                       user_set = on_user;
-                                       user_flag = uflags;
-                                       uflags = uflags->next;
+               if (!camel_named_flags_equal (local_uflags, server_uflags)) {
+                       guint ii, jj, llen, slen;
+
+                       llen = local_uflags ? camel_named_flags_get_length (local_uflags) : 0;
+                       slen = server_uflags ? camel_named_flags_get_length (server_uflags) : 0;
+                       for (ii = 0, jj = 0; ii < llen || jj < slen;) {
+                               gint res;
+
+                               if (ii < llen) {
+                                       const gchar *local_name = camel_named_flags_get (local_uflags, ii);
+
+                                       if (jj < slen) {
+                                               const gchar *server_name = camel_named_flags_get 
(server_uflags, jj);
+
+                                               res = g_strcmp0 (local_name, server_name);
+                                       } else if (local_name && *local_name)
+                                               res = -1;
+                                       else {
+                                               ii++;
+                                               continue;
+                                       }
                                } else {
-                                       if (off_user == NULL)
-                                               off_user = g_array_new (FALSE, FALSE, sizeof (struct 
_imapx_flag_change));
-                                       user_set = off_user;
-                                       user_flag = suflags;
-                                       suflags = suflags->next;
+                                       res = 1;
                                }
 
-                               /* Could sort this and binary search */
-                               for (j = 0; j < user_set->len; j++) {
-                                       change = &g_array_index (user_set, struct _imapx_flag_change, j);
-                                       if (strcmp (change->name, user_flag->name) == 0)
-                                               goto found;
+                               if (res == 0) {
+                                       ii++;
+                                       jj++;
+                               } else {
+                                       GArray *user_set;
+                                       const gchar *user_flag_name;
+                                       struct _imapx_flag_change *change = NULL, add = { 0 };
+
+                                       if (res < 0) {
+                                               if (on_user == NULL)
+                                                       on_user = g_array_new (FALSE, FALSE, sizeof (struct 
_imapx_flag_change));
+                                               user_set = on_user;
+                                               user_flag_name = camel_named_flags_get (local_uflags, ii);
+                                               ii++;
+                                       } else {
+                                               if (off_user == NULL)
+                                                       off_user = g_array_new (FALSE, FALSE, sizeof (struct 
_imapx_flag_change));
+                                               user_set = off_user;
+                                               user_flag_name = camel_named_flags_get (server_uflags, jj);
+                                               jj++;
+                                       }
+
+                                       /* Could sort this and binary search */
+                                       for (j = 0; j < user_set->len; j++) {
+                                               change = &g_array_index (user_set, struct _imapx_flag_change, 
j);
+                                               if (g_strcmp0 (change->name, user_flag_name) == 0)
+                                                       goto found;
+                                       }
+                                       add.name = g_strdup (user_flag_name);
+                                       add.infos = g_ptr_array_new ();
+                                       g_array_append_val (user_set, add);
+                                       change = &add;
+                               found:
+                                       g_object_ref (info);
+                                       g_ptr_array_add (change->infos, info);
                                }
-                               add.name = g_strdup (user_flag->name);
-                               add.infos = g_ptr_array_new ();
-                               g_array_append_val (user_set, add);
-                               change = &add;
-                       found:
-                               camel_message_info_ref (info);
-                               g_ptr_array_add (change->infos, info);
                        }
                }
 
-               camel_message_info_unref (info);
+               camel_message_info_property_unlock (info);
+
+               g_clear_object (&info);
        }
 
        nothing_to_do =
@@ -5429,24 +5424,20 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                (off_user == NULL);
 
        if (nothing_to_do) {
-               g_signal_handler_disconnect (folder->summary, changed_meanwhile_handler_id);
-
                imapx_sync_free_user (on_user);
                imapx_sync_free_user (off_user);
                imapx_unset_folder_flagged_flag (folder->summary, changed_uids, remove_deleted_flags);
                camel_folder_free_uids (folder, changed_uids);
-               g_hash_table_destroy (changed_meanwhile);
+               g_hash_table_destroy (stamps);
                g_object_unref (folder);
                return TRUE;
        }
 
        if (!camel_imapx_server_ensure_selected_sync (is, mailbox, cancellable, error)) {
-               g_signal_handler_disconnect (folder->summary, changed_meanwhile_handler_id);
-
                imapx_sync_free_user (on_user);
                imapx_sync_free_user (off_user);
                camel_folder_free_uids (folder, changed_uids);
-               g_hash_table_destroy (changed_meanwhile);
+               g_hash_table_destroy (stamps);
                g_object_unref (folder);
                return FALSE;
        }
@@ -5468,22 +5459,23 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                        c (is->priv->tagprefix, "checking/storing %s flags '%s'\n", on ? "on" : "off", 
flags_table[jj].name);
                        imapx_uidset_init (&uidset, 0, 100);
                        for (i = 0; i < changed_uids->len && success; i++) {
-                               CamelIMAPXMessageInfo *info;
+                               CamelMessageInfo *info;
+                               CamelIMAPXMessageInfo *xinfo;
                                gboolean remove_deleted_flag;
                                guint32 flags;
                                guint32 sflags;
                                gint send;
 
-                               info = (CamelIMAPXMessageInfo *)
-                                       camel_folder_summary_get (
-                                               folder->summary,
-                                               changed_uids->pdata[i]);
+                               info = camel_folder_summary_get (folder->summary, changed_uids->pdata[i]);
+                               xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
 
-                               if (info == NULL)
+                               if (!info || !xinfo) {
+                                       g_clear_object (&info);
                                        continue;
+                               }
 
-                               flags = (info->info.flags & CAMEL_IMAPX_SERVER_FLAGS) & permanentflags;
-                               sflags = (info->server_flags & CAMEL_IMAPX_SERVER_FLAGS) & permanentflags;
+                               flags = (camel_message_info_get_flags (info) & CAMEL_IMAPX_SERVER_FLAGS) & 
permanentflags;
+                               sflags = (camel_imapx_message_info_get_server_flags (xinfo) & 
CAMEL_IMAPX_SERVER_FLAGS) & permanentflags;
                                send = 0;
 
                                remove_deleted_flag =
@@ -5527,10 +5519,11 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                                /* The second round and the server doesn't support saving user flags,
                                   thus store them at least locally */
                                if (on && (permanentflags & CAMEL_MESSAGE_USER) == 0) {
-                                       camel_flag_list_copy (&info->server_user_flags, 
&info->info.user_flags);
+                                       camel_imapx_message_info_take_server_user_flags (xinfo,
+                                               camel_message_info_dup_user_flags (info));
                                }
 
-                               camel_message_info_unref (info);
+                               g_clear_object (&info);
                        }
 
                        g_warn_if_fail (ic == NULL);
@@ -5544,7 +5537,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
 
                                imapx_uidset_init (&uidset, 0, 100);
                                for (i = 0; i < c->infos->len; i++) {
-                                       CamelIMAPXMessageInfo *info = c->infos->pdata[i];
+                                       CamelMessageInfo *info = c->infos->pdata[i];
 
                                        if (ic == NULL)
                                                ic = camel_imapx_command_new (is, 
CAMEL_IMAPX_JOB_SYNC_CHANGES, "UID STORE ");
@@ -5572,8 +5565,6 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                }
        }
 
-       g_signal_handler_disconnect (folder->summary, changed_meanwhile_handler_id);
-
        if (success) {
                CamelStore *parent_store;
                guint32 unseen;
@@ -5583,31 +5574,50 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
                camel_folder_summary_lock (folder->summary);
 
                for (i = 0; i < changed_uids->len; i++) {
-                       CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) camel_folder_summary_get 
(folder->summary,
-                                       changed_uids->pdata[i]);
+                       CamelMessageInfo *info;
+                       CamelIMAPXMessageInfo *xinfo;
+                       gboolean set_folder_flagged;
+                       guint32 has_flags, set_server_flags;
+                       gboolean changed_meanwhile;
+
+                       info = camel_folder_summary_get (folder->summary, changed_uids->pdata[i]);
+                       xinfo = info ? CAMEL_IMAPX_MESSAGE_INFO (info) : NULL;
 
-                       if (!xinfo)
+                       if (!info || !xinfo) {
+                               g_clear_object (&info);
                                continue;
+                       }
+
+                       camel_message_info_property_lock (info);
+
+                       changed_meanwhile = camel_message_info_get_folder_flagged_stamp (info) !=
+                               GPOINTER_TO_UINT (g_hash_table_lookup (stamps, changed_uids->pdata[i]));
 
-                       xinfo->server_flags = xinfo->info.flags & CAMEL_IMAPX_SERVER_FLAGS;
+                       has_flags = camel_message_info_get_flags (info);
+                       set_server_flags = has_flags & CAMEL_IMAPX_SERVER_FLAGS;
                        if (!remove_deleted_flags ||
-                           !(xinfo->info.flags & CAMEL_MESSAGE_DELETED)) {
-                               xinfo->info.flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
+                           !(has_flags & CAMEL_MESSAGE_DELETED)) {
+                               set_folder_flagged = FALSE;
                        } else {
                                /* to stare back the \Deleted flag */
-                               xinfo->server_flags &= ~CAMEL_MESSAGE_DELETED;
-                               xinfo->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+                               set_server_flags &= ~CAMEL_MESSAGE_DELETED;
+                               set_folder_flagged = TRUE;
                        }
-                       xinfo->info.dirty = TRUE;
+
                        if ((permanentflags & CAMEL_MESSAGE_USER) != 0 ||
-                           camel_flag_list_size (&xinfo->server_user_flags) == 0)
-                               camel_flag_list_copy (&xinfo->server_user_flags, &xinfo->info.user_flags);
+                           !camel_named_flags_get_length (camel_imapx_message_info_get_server_user_flags 
(xinfo))) {
+                               camel_imapx_message_info_take_server_user_flags (xinfo, 
camel_message_info_dup_user_flags (info));
+                       }
+
+                       if (changed_meanwhile)
+                               set_folder_flagged = TRUE;
 
-                       if (g_hash_table_lookup (changed_meanwhile, changed_uids->pdata[i]))
-                               xinfo->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+                       camel_imapx_message_info_set_server_flags (xinfo, set_server_flags);
+                       camel_message_info_set_folder_flagged (info, set_folder_flagged);
 
+                       camel_message_info_property_unlock (info);
                        camel_folder_summary_touch (folder->summary);
-                       camel_message_info_unref (xinfo);
+                       g_clear_object (&info);
                }
 
                camel_folder_summary_unlock (folder->summary);
@@ -5642,7 +5652,7 @@ camel_imapx_server_sync_changes_sync (CamelIMAPXServer *is,
        imapx_sync_free_user (on_user);
        imapx_sync_free_user (off_user);
        camel_folder_free_uids (folder, changed_uids);
-       g_hash_table_destroy (changed_meanwhile);
+       g_hash_table_destroy (stamps);
        g_object_unref (folder);
 
        return success;
diff --git a/camel/providers/imapx/camel-imapx-summary.c b/camel/providers/imapx/camel-imapx-summary.c
index 671f4b7..f348c30 100644
--- a/camel/providers/imapx/camel-imapx-summary.c
+++ b/camel/providers/imapx/camel-imapx-summary.c
@@ -35,13 +35,6 @@
 
 #define CAMEL_IMAPX_SUMMARY_VERSION (4)
 
-enum {
-       INFO_CHANGED,
-       LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
 G_DEFINE_TYPE (
        CamelIMAPXSummary,
        camel_imapx_summary,
@@ -64,12 +57,12 @@ imapx_summary_summary_header_from_db (CamelFolderSummary *s,
 
                ims = CAMEL_IMAPX_SUMMARY (s);
 
-               ims->version = bdata_extract_digit (&part);
-               ims->validity = bdata_extract_digit (&part);
+               ims->version = camel_util_bdata_get_number (&part, 0);
+               ims->validity = camel_util_bdata_get_number (&part, 0);
 
                if (ims->version >= 4) {
-                       ims->uidnext = bdata_extract_digit (&part);
-                       ims->modseq = bdata_extract_digit (&part);
+                       ims->uidnext = camel_util_bdata_get_number (&part, 0);
+                       ims->modseq = camel_util_bdata_get_number (&part, 0);
                }
 
                if (ims->version > CAMEL_IMAPX_SUMMARY_VERSION) {
@@ -112,237 +105,15 @@ imapx_summary_summary_header_to_db (CamelFolderSummary *s,
        return fir;
 }
 
-static CamelMessageInfo *
-imapx_summary_message_info_from_db (CamelFolderSummary *s,
-                                    CamelMIRecord *mir)
-{
-       CamelMessageInfo *info;
-
-       /* Chain up parent's message_info_from_db() method. */
-       info = CAMEL_FOLDER_SUMMARY_CLASS (
-               camel_imapx_summary_parent_class)->
-               message_info_from_db (s, mir);
-
-       if (info != NULL) {
-               CamelIMAPXMessageInfo *imapx_info;
-               gchar *part = mir->bdata;
-
-               imapx_info = (CamelIMAPXMessageInfo *) info;
-               imapx_info->server_flags = bdata_extract_digit (&part);
-       }
-
-       return info;
-}
-
-static CamelMIRecord *
-imapx_summary_message_info_to_db (CamelFolderSummary *s,
-                                  CamelMessageInfo *info)
-{
-       struct _CamelMIRecord *mir;
-
-       /* Chain up to parent's message_info_to_db() method. */
-       mir = CAMEL_FOLDER_SUMMARY_CLASS (
-               camel_imapx_summary_parent_class)->
-               message_info_to_db (s, info);
-
-       if (mir != NULL) {
-               CamelIMAPXMessageInfo *imapx_info;
-
-               imapx_info = (CamelIMAPXMessageInfo *) info;
-               mir->bdata = g_strdup_printf ("%u", imapx_info->server_flags);
-       }
-
-       return mir;
-}
-
-static CamelMessageContentInfo *
-imapx_summary_content_info_from_db (CamelFolderSummary *summary,
-                                    CamelMIRecord *mir)
-{
-       gchar *part = mir->cinfo;
-       guint32 type = 0;
-
-       if (part != NULL) {
-               if (*part == ' ')
-                       part++;
-               if (part != NULL)
-                       type = bdata_extract_digit (&part);
-       }
-       mir->cinfo = part;
-
-       if (type) {
-               /* Chain up to parent's content_info_from_db() method. */
-               return CAMEL_FOLDER_SUMMARY_CLASS (
-                       camel_imapx_summary_parent_class)->
-                       content_info_from_db (summary, mir);
-       } else {
-               return camel_folder_summary_content_info_new (summary);
-       }
-}
-
-static gboolean
-imapx_summary_content_info_to_db (CamelFolderSummary *summary,
-                                  CamelMessageContentInfo *info,
-                                  CamelMIRecord *mir)
-{
-       gchar *oldr;
-
-       if (info->type) {
-               oldr = mir->cinfo;
-               if (oldr != NULL)
-                       mir->cinfo = g_strdup_printf ("%s 1", oldr);
-               else
-                       mir->cinfo = g_strdup ("1");
-               g_free (oldr);
-
-               /* Chain up to parent's content_info_to_db() method. */
-               return CAMEL_FOLDER_SUMMARY_CLASS (
-                       camel_imapx_summary_parent_class)->
-                       content_info_to_db (summary, info, mir);
-
-       } else {
-               oldr = mir->cinfo;
-               if (oldr != NULL)
-                       mir->cinfo = g_strdup_printf ("%s 0", oldr);
-               else
-                       mir->cinfo = g_strdup ("0");
-               g_free (oldr);
-
-               return TRUE;
-       }
-}
-
-static void
-imapx_summary_message_info_free (CamelFolderSummary *summary,
-                                 CamelMessageInfo *info)
-{
-       CamelIMAPXMessageInfo *imapx_info;
-
-       imapx_info = (CamelIMAPXMessageInfo *) info;
-       camel_flag_list_free (&imapx_info->server_user_flags);
-
-       /* Chain up to parent's message_info_free() method. */
-       CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->
-               message_info_free (summary, info);
-}
-
-static CamelMessageInfo *
-imapx_summary_message_info_clone (CamelFolderSummary *summary,
-                                  const CamelMessageInfo *info)
-{
-       CamelMessageInfo *copy;
-       CamelIMAPXMessageInfo *imapx_copy;
-       CamelIMAPXMessageInfo *imapx_info;
-
-       /* Chain up to parent's message_info_clone() method. */
-       copy = CAMEL_FOLDER_SUMMARY_CLASS (
-               camel_imapx_summary_parent_class)->
-               message_info_clone (summary, info);
-
-       imapx_info = (CamelIMAPXMessageInfo *) info;
-       imapx_copy = (CamelIMAPXMessageInfo *) copy;
-
-       if (imapx_info->server_user_flags) {
-               camel_flag_list_copy (
-                       &imapx_copy->server_user_flags,
-                       &imapx_info->server_user_flags);
-       }
-
-       imapx_copy->server_flags = imapx_info->server_flags;
-
-       /* FIXME: parent clone should do this */
-       imapx_copy->info.content =
-               camel_folder_summary_content_info_new (summary);
-
-       return copy;
-}
-
-static void
-imapx_summary_emit_info_changed (CamelMessageInfo *info)
-{
-       g_return_if_fail (info != NULL);
-       g_return_if_fail (CAMEL_IS_IMAPX_SUMMARY (info->summary));
-
-       g_signal_emit (info->summary, signals[INFO_CHANGED], 0, info);
-}
-
-static gboolean
-imapx_summary_info_set_user_flag (CamelMessageInfo *info,
-                                  const gchar *id,
-                                  gboolean state)
-{
-       gboolean changed;
-
-       /* Chain up to parent's method. */
-       changed = CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->info_set_user_flag (info, 
id, state);
-
-       if (changed)
-               imapx_summary_emit_info_changed (info);
-
-       return changed;
-}
-
-static gboolean
-imapx_summary_info_set_user_tag (CamelMessageInfo *info,
-                                const gchar *name,
-                                const gchar *value)
-{
-       gboolean changed;
-
-       /* Chain up to parent's method. */
-       changed = CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->info_set_user_tag (info, 
name, value);
-
-       if (changed)
-               imapx_summary_emit_info_changed (info);
-
-       return changed;
-}
-
-static gboolean
-imapx_summary_info_set_flags (CamelMessageInfo *info,
-                             guint32 flags,
-                             guint32 set)
-{
-       gboolean changed;
-
-       /* Chain up to parent's method. */
-       changed = CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->info_set_flags (info, flags, 
set);
-
-       if (changed)
-               imapx_summary_emit_info_changed (info);
-
-       return changed;
-}
-
 static void
 camel_imapx_summary_class_init (CamelIMAPXSummaryClass *class)
 {
        CamelFolderSummaryClass *folder_summary_class;
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_type = XCAMEL_TYPE_IMAPX_MESSAGE_INFO;
-       folder_summary_class->message_info_size = sizeof (CamelIMAPXMessageInfo);
-       folder_summary_class->content_info_size = sizeof (CamelIMAPXMessageContentInfo);
+       folder_summary_class->message_info_type = CAMEL_TYPE_IMAPX_MESSAGE_INFO;
        folder_summary_class->summary_header_from_db = imapx_summary_summary_header_from_db;
        folder_summary_class->summary_header_to_db = imapx_summary_summary_header_to_db;
-       folder_summary_class->message_info_from_db = imapx_summary_message_info_from_db;
-       folder_summary_class->message_info_to_db = imapx_summary_message_info_to_db;
-       folder_summary_class->content_info_from_db = imapx_summary_content_info_from_db;
-       folder_summary_class->content_info_to_db = imapx_summary_content_info_to_db;
-       folder_summary_class->message_info_free = imapx_summary_message_info_free;
-       folder_summary_class->message_info_clone = imapx_summary_message_info_clone;
-       folder_summary_class->info_set_user_flag = imapx_summary_info_set_user_flag;
-       folder_summary_class->info_set_user_tag = imapx_summary_info_set_user_tag;
-       folder_summary_class->info_set_flags = imapx_summary_info_set_flags;
-
-       signals[INFO_CHANGED] = g_signal_new (
-               "info-changed",
-               G_OBJECT_CLASS_TYPE (class),
-               G_SIGNAL_RUN_LAST,
-               0 /* G_STRUCT_OFFSET (CamelIMAPXSummaryClass, info_changed) */,
-               NULL, NULL, NULL,
-               G_TYPE_NONE, 1,
-               G_TYPE_POINTER /* CamelMessageInfo * */);
 }
 
 static void
@@ -418,4 +189,3 @@ camel_imapx_summary_new (CamelFolder *folder)
 
        return summary;
 }
-
diff --git a/camel/providers/imapx/camel-imapx-summary.h b/camel/providers/imapx/camel-imapx-summary.h
index c515c19..0db09fa 100644
--- a/camel/providers/imapx/camel-imapx-summary.h
+++ b/camel/providers/imapx/camel-imapx-summary.h
@@ -55,20 +55,6 @@ G_BEGIN_DECLS
 typedef struct _CamelIMAPXSummary CamelIMAPXSummary;
 typedef struct _CamelIMAPXSummaryClass CamelIMAPXSummaryClass;
 
-typedef struct _CamelIMAPXMessageInfo CamelIMAPXMessageInfo;
-typedef struct _CamelIMAPXMessageContentInfo CamelIMAPXMessageContentInfo;
-
-struct _CamelIMAPXMessageContentInfo {
-       CamelMessageContentInfo info;
-};
-
-struct _CamelIMAPXMessageInfo {
-       CamelMessageInfoBase info;
-
-       guint32 server_flags;
-       CamelFlag *server_user_flags;
-};
-
 struct _CamelIMAPXSummary {
        CamelFolderSummary parent;
 
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index e94e123..136f8e2 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -26,6 +26,7 @@
 
 #include "camel-imapx-command.h"
 #include "camel-imapx-folder.h"
+#include "camel-imapx-message-info.h"
 #include "camel-imapx-settings.h"
 #include "camel-imapx-summary.h"
 #include "camel-imapx-store.h"
@@ -103,7 +104,7 @@ static struct {
 gboolean
 imapx_parse_flags (CamelIMAPXInputStream *stream,
                    guint32 *flagsp,
-                   CamelFlag **user_flagsp,
+                   CamelNamedFlags *user_flags,
                    GCancellable *cancellable,
                    GError **error)
 {
@@ -151,7 +152,7 @@ imapx_parse_flags (CamelIMAPXInputStream *stream,
                                }
                        }
 
-                       if (!match_found && user_flagsp != NULL) {
+                       if (!match_found && user_flags) {
                                const gchar *flag_name;
                                gchar *utf8;
 
@@ -165,7 +166,7 @@ imapx_parse_flags (CamelIMAPXInputStream *stream,
                                        utf8 = NULL;
                                }
 
-                               camel_flag_set (user_flagsp, utf8 ? utf8 : flag_name, TRUE);
+                               camel_named_flags_insert (user_flags, utf8 ? utf8 : flag_name);
 
                                g_free (utf8);
                        }
@@ -227,44 +228,50 @@ rename_label_flag (const gchar *flag,
 void
 imapx_write_flags (GString *string,
                    guint32 flags,
-                   CamelFlag *user_flags)
+                   const CamelNamedFlags *user_flags)
 {
-       gint i;
+       guint ii;
        gboolean first = TRUE;
 
        g_string_append_c (string, '(');
 
-       for (i = 0; flags != 0 && i< G_N_ELEMENTS (flag_table); i++) {
-               if (flag_table[i].flag & flags) {
-                       if (flag_table[i].flag & CAMEL_IMAPX_MESSAGE_RECENT)
+       for (ii = 0; flags != 0 && ii < G_N_ELEMENTS (flag_table); ii++) {
+               if (flag_table[ii].flag & flags) {
+                       if (flag_table[ii].flag & CAMEL_IMAPX_MESSAGE_RECENT)
                                continue;
                        if (!first)
                                g_string_append_c (string, ' ');
                        first = FALSE;
-                       g_string_append (string, flag_table[i].name);
+                       g_string_append (string, flag_table[ii].name);
 
-                       flags &= ~flag_table[i].flag;
+                       flags &= ~flag_table[ii].flag;
                }
        }
 
-       while (user_flags) {
-               const gchar *flag_name;
-               gchar *utf7;
+       if (user_flags) {
+               guint len = camel_named_flags_get_length (user_flags);
+
+               for (ii = 0; ii < len; ii++) {
+                       const gchar *name = camel_named_flags_get (user_flags, ii);
+                       const gchar *flag_name;
+                       gchar *utf7;
 
-               flag_name = rename_label_flag (
-                       user_flags->name, strlen (user_flags->name), FALSE);
+                       if (!name || !*name)
+                               continue;
 
-               if (!first)
-                       g_string_append_c (string, ' ');
-               first = FALSE;
 
-               utf7 = camel_utf8_utf7 (flag_name);
+                       flag_name = rename_label_flag (name, strlen (name), FALSE);
+
+                       if (!first)
+                               g_string_append_c (string, ' ');
+                       first = FALSE;
 
-               g_string_append (string, utf7 ? utf7 : flag_name);
+                       utf7 = camel_utf8_utf7 (flag_name);
 
-               g_free (utf7);
+                       g_string_append (string, utf7 ? utf7 : flag_name);
 
-               user_flags = user_flags->next;
+                       g_free (utf7);
+               }
        }
 
        g_string_append_c (string, ')');
@@ -272,26 +279,38 @@ imapx_write_flags (GString *string,
 
 static gboolean
 imapx_update_user_flags (CamelMessageInfo *info,
-                         CamelFlag *server_user_flags)
+                        const CamelNamedFlags *server_user_flags)
 {
        gboolean changed = FALSE;
-       CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info;
-       CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info;
+       const CamelNamedFlags *mi_user_flags;
        gboolean set_cal = FALSE, set_note = FALSE;
 
-       if (camel_flag_get (&binfo->user_flags, "$has_cal"))
+       mi_user_flags = camel_message_info_get_user_flags (info);
+       if (camel_named_flags_equal (mi_user_flags, server_user_flags)) {
+               mi_user_flags = camel_imapx_message_info_get_server_user_flags (CAMEL_IMAPX_MESSAGE_INFO 
(info));
+
+               if (!camel_named_flags_equal (mi_user_flags, server_user_flags)) {
+                       camel_imapx_message_info_take_server_user_flags (CAMEL_IMAPX_MESSAGE_INFO (info),
+                               camel_named_flags_copy (server_user_flags));
+               }
+
+               return FALSE;
+       }
+
+       if (mi_user_flags && camel_named_flags_contains (mi_user_flags, "$has_cal"))
                set_cal = TRUE;
-       if (camel_flag_get (&binfo->user_flags, "$has_note"))
+       if (mi_user_flags && camel_named_flags_contains (mi_user_flags, "$has_note"))
                set_note = TRUE;
 
-       changed = camel_flag_list_copy (&binfo->user_flags, &server_user_flags);
-       camel_flag_list_copy (&xinfo->server_user_flags, &server_user_flags);
+       changed = camel_message_info_take_user_flags (info, camel_named_flags_copy (server_user_flags));
+       camel_imapx_message_info_take_server_user_flags (CAMEL_IMAPX_MESSAGE_INFO (info),
+               camel_named_flags_copy (server_user_flags));
 
        /* reset the flags as they were set in messageinfo before */
        if (set_cal)
-               camel_flag_set (&binfo->user_flags, "$has_cal", TRUE);
+               camel_message_info_set_user_flag (info, "$has_cal", TRUE);
        if (set_note)
-               camel_flag_set (&binfo->user_flags, "$has_note", TRUE);
+               camel_message_info_set_user_flag (info, "$has_note", TRUE);
 
        return changed;
 }
@@ -299,16 +318,16 @@ imapx_update_user_flags (CamelMessageInfo *info,
 gboolean
 imapx_update_message_info_flags (CamelMessageInfo *info,
                                  guint32 server_flags,
-                                 CamelFlag *server_user_flags,
+                                 const CamelNamedFlags *server_user_flags,
                                  guint32 permanent_flags,
                                  CamelFolder *folder,
                                  gboolean unsolicited)
 {
        gboolean changed = FALSE;
-       CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info;
+       CamelIMAPXMessageInfo *xinfo = CAMEL_IMAPX_MESSAGE_INFO (info);
 
        /* Locally made changes should not be overwritten, it'll be (re)saved later */
-       if ((camel_message_info_get_flags (info) & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0) {
+       if (camel_message_info_get_folder_flagged (info)) {
                d ('?', "Skipping update of locally changed uid:'%s'\n", camel_message_info_get_uid (info));
                return FALSE;
        }
@@ -316,15 +335,21 @@ imapx_update_message_info_flags (CamelMessageInfo *info,
        /* This makes sure that server flags has precedence from locally stored flags,
         * thus a user actually sees what is stored on the server */
        if ((camel_message_info_get_flags (info) & CAMEL_IMAPX_SERVER_FLAGS) != (server_flags & 
CAMEL_IMAPX_SERVER_FLAGS)) {
-               xinfo->server_flags = (xinfo->server_flags & ~CAMEL_IMAPX_SERVER_FLAGS) |
-                                     (camel_message_info_get_flags (info) & CAMEL_IMAPX_SERVER_FLAGS);
+               guint32 old_server_flags;
+
+               old_server_flags = camel_imapx_message_info_get_server_flags (xinfo);
+
+               camel_imapx_message_info_set_server_flags (xinfo,
+                       (old_server_flags & ~CAMEL_IMAPX_SERVER_FLAGS) |
+                       (camel_message_info_get_flags (info) & CAMEL_IMAPX_SERVER_FLAGS));
        }
 
-       if (server_flags != xinfo->server_flags) {
-               guint32 server_set, server_cleared;
+       if (server_flags != camel_imapx_message_info_get_server_flags (xinfo)) {
+               guint32 server_set, server_cleared, old_server_flags;
 
-               server_set = server_flags & ~xinfo->server_flags;
-               server_cleared = xinfo->server_flags & ~server_flags;
+               old_server_flags = camel_imapx_message_info_get_server_flags (xinfo);
+               server_set = server_flags & ~old_server_flags;
+               server_cleared = old_server_flags & ~server_flags;
 
                /* Don't clear non-permanent server-side flags.
                 * This avoids overwriting local flags that we
@@ -332,13 +357,11 @@ imapx_update_message_info_flags (CamelMessageInfo *info,
                if (permanent_flags > 0)
                        server_cleared &= permanent_flags;
 
-               changed = camel_message_info_set_flags ((
-                       CamelMessageInfo *) xinfo,
+               changed = camel_message_info_set_flags (info,
                        server_set | server_cleared,
-                       (xinfo->info.flags | server_set) & ~server_cleared);
+                       (camel_message_info_get_flags (info) | server_set) & ~server_cleared);
 
-               xinfo->server_flags = server_flags;
-               xinfo->info.dirty = TRUE;
+               camel_imapx_message_info_set_server_flags (xinfo, server_flags);
        }
 
        if ((permanent_flags & CAMEL_MESSAGE_USER) != 0 && imapx_update_user_flags (info, server_user_flags))
@@ -350,29 +373,22 @@ imapx_update_message_info_flags (CamelMessageInfo *info,
 void
 imapx_set_message_info_flags_for_new_message (CamelMessageInfo *info,
                                               guint32 server_flags,
-                                              CamelFlag *server_user_flags,
+                                              const CamelNamedFlags *server_user_flags,
                                              gboolean force_user_flags,
-                                             CamelTag *user_tags,
+                                             const CamelNameValueArray *user_tags,
                                              guint32 permanent_flags)
 {
-       CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info;
-       CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) info;
-
-       binfo->flags |= server_flags;
-       camel_message_info_set_flags (info, server_flags, binfo->flags | server_flags);
+       CamelIMAPXMessageInfo *xinfo = CAMEL_IMAPX_MESSAGE_INFO (info);
 
-       xinfo->server_flags = server_flags;
+       camel_message_info_set_flags (info, server_flags, camel_message_info_get_flags (info) | server_flags);
+       camel_imapx_message_info_set_server_flags (xinfo, server_flags);
 
        if (force_user_flags || (permanent_flags & CAMEL_MESSAGE_USER) != 0)
                imapx_update_user_flags (info, server_user_flags);
 
-       while (user_tags) {
-               camel_message_info_set_user_tag (info, user_tags->name, user_tags->value);
-               user_tags = user_tags->next;
-       }
+       camel_message_info_take_user_tags (info, camel_name_value_array_copy (user_tags));
 
-       binfo->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
-       binfo->dirty = TRUE;
+       camel_message_info_set_folder_flagged (info, FALSE);
 }
 
 void
@@ -1152,7 +1168,7 @@ imapx_parse_address_list (CamelIMAPXInputStream *stream,
        return list;
 }
 
-struct _CamelMessageInfo *
+CamelMessageInfo *
 imapx_parse_envelope (CamelIMAPXInputStream *stream,
                       GCancellable *cancellable,
                       GError **error)
@@ -1162,7 +1178,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        guchar *token;
        CamelHeaderAddress *addr, *addr_from;
        gchar *addrstr;
-       struct _CamelMessageInfoBase *minfo = NULL;
+       CamelMessageInfo *info;
        GError *local_error = NULL;
 
        /* envelope        ::= "(" env_date SPACE env_subject SPACE env_from
@@ -1170,7 +1186,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
         * SPACE env_cc SPACE env_bcc SPACE env_in_reply_to
         * SPACE env_message_id ")" */
 
-       minfo = (CamelMessageInfoBase *) camel_message_info_new (NULL);
+       info = camel_message_info_new (NULL);
 
        tok = camel_imapx_input_stream_token (
                stream, &token, &len, cancellable, &local_error);
@@ -1180,7 +1196,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
 
        if (tok != '(') {
                g_clear_error (&local_error);
-               camel_message_info_unref (minfo);
+               g_clear_object (&info);
                g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED, 
"envelope: expecting '('");
                return NULL;
        }
@@ -1190,14 +1206,14 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        if (local_error)
                goto error;
 
-       minfo->date_sent = camel_header_decode_date ((gchar *) token, NULL);
+       camel_message_info_set_date_sent (info, camel_header_decode_date ((gchar *) token, NULL));
 
        /* env_subject     ::= nstring */
        camel_imapx_input_stream_nstring (stream, &token, cancellable, &local_error);
        if (local_error)
                goto error;
 
-       minfo->subject = camel_pstring_strdup ((gchar *) token);
+       camel_message_info_set_subject (info, (const gchar *) token);
 
        /* we merge from/sender into from, append should probably merge more smartly? */
 
@@ -1220,7 +1236,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
 
        if (addr_from) {
                addrstr = camel_header_address_list_format (addr_from);
-               minfo->from = camel_pstring_strdup (addrstr);
+               camel_message_info_set_from (info, addrstr);
                g_free (addrstr);
                camel_header_address_list_clear (&addr_from);
        }
@@ -1238,7 +1254,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        addr = imapx_parse_address_list (stream, cancellable, &local_error);
        if (addr) {
                addrstr = camel_header_address_list_format (addr);
-               minfo->to = camel_pstring_strdup (addrstr);
+               camel_message_info_set_to (info, addrstr);
                g_free (addrstr);
                camel_header_address_list_clear (&addr);
        }
@@ -1250,7 +1266,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        addr = imapx_parse_address_list (stream, cancellable, &local_error);
        if (addr) {
                addrstr = camel_header_address_list_format (addr);
-               minfo->cc = camel_pstring_strdup (addrstr);
+               camel_message_info_set_cc (info, addrstr);
                g_free (addrstr);
                camel_header_address_list_clear (&addr);
        }
@@ -1287,7 +1303,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
 
        if (tok != ')') {
                g_clear_error (&local_error);
-               camel_message_info_unref (minfo);
+               g_clear_object (&info);
                g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED, 
"expecting ')'");
                return NULL;
        }
@@ -1296,15 +1312,14 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        /* CHEN TODO handle exceptions better */
        if (local_error != NULL) {
                g_propagate_error (error, local_error);
-               if (minfo)
-                       camel_message_info_unref (minfo);
+               g_clear_object (&info);
                return NULL;
        }
 
-       return (CamelMessageInfo *) minfo;
+       return info;
 }
 
-struct _CamelMessageContentInfo *
+CamelMessageContentInfo *
 imapx_parse_body (CamelIMAPXInputStream *stream,
                   GCancellable *cancellable,
                   GError **error)
@@ -1451,7 +1466,7 @@ imapx_parse_body (CamelIMAPXInputStream *stream,
 
                        /* what do we do with the message content info?? */
                        //((CamelMessageInfoBase *) minfo)->content = imapx_parse_body (stream);
-                       camel_message_info_unref (minfo);
+                       g_clear_object (&minfo);
                        minfo = NULL;
                }
 
@@ -1675,11 +1690,10 @@ imapx_free_fetch (struct _fetch_info *finfo)
                g_bytes_unref (finfo->text);
        if (finfo->header)
                g_bytes_unref (finfo->header);
-       if (finfo->minfo)
-               camel_message_info_unref (finfo->minfo);
        if (finfo->cinfo)
                imapx_free_body (finfo->cinfo);
-       camel_flag_list_free (&finfo->user_flags);
+       camel_named_flags_free (finfo->user_flags);
+       g_clear_object (&finfo->minfo);
        g_free (finfo->date);
        g_free (finfo->section);
        g_free (finfo->uid);
@@ -1855,7 +1869,7 @@ imapx_parse_fetch_flags (CamelIMAPXInputStream *stream,
        gboolean success;
 
        success = imapx_parse_flags (
-               stream, &finfo->flags, &finfo->user_flags,
+               stream, &finfo->flags, finfo->user_flags,
                cancellable, error);
 
        if (success)
@@ -2005,6 +2019,7 @@ imapx_parse_fetch (CamelIMAPXInputStream *stream,
        struct _fetch_info *finfo;
 
        finfo = g_malloc0 (sizeof (*finfo));
+       finfo->user_flags = camel_named_flags_new ();
 
        tok = camel_imapx_input_stream_token (
                stream, &token, &len, cancellable, error);
diff --git a/camel/providers/imapx/camel-imapx-utils.h b/camel/providers/imapx/camel-imapx-utils.h
index 7fc055b..d9d7e34 100644
--- a/camel/providers/imapx/camel-imapx-utils.h
+++ b/camel/providers/imapx/camel-imapx-utils.h
@@ -30,7 +30,6 @@ G_BEGIN_DECLS
  *       enum/struct definitions and helper macros, so we don't
  *       have these conflicting header dependencies. */
 struct _CamelIMAPXCommand;
-struct _CamelFlag;
 struct _CamelIMAPXStore;
 
 /* list of strings we know about that can be *quickly* tokenised */
@@ -136,24 +135,24 @@ GArray *  imapx_parse_uids                (CamelIMAPXInputStream *stream,
                                                 GError **error);
 gboolean       imapx_parse_flags               (CamelIMAPXInputStream *stream,
                                                 guint32 *flagsp,
-                                                struct _CamelFlag **user_flagsp,
+                                                CamelNamedFlags *user_flags,
                                                 GCancellable *cancellable,
                                                 GError **error);
 void           imapx_write_flags               (GString *string,
                                                 guint32 flags,
-                                                struct _CamelFlag *user_flags);
+                                                const CamelNamedFlags *user_flags);
 gboolean       imapx_update_message_info_flags (CamelMessageInfo *info,
                                                 guint32 server_flags,
-                                                CamelFlag *server_user_flags,
+                                                const CamelNamedFlags *server_user_flags,
                                                 guint32 permanent_flags,
                                                 CamelFolder *folder,
                                                 gboolean unsolicited);
 void           imapx_set_message_info_flags_for_new_message
                                                (CamelMessageInfo *info,
                                                 guint32 server_flags,
-                                                CamelFlag *server_user_flags,
+                                                const CamelNamedFlags *server_user_flags,
                                                 gboolean force_user_flags,
-                                                CamelTag *user_tags,
+                                                const CamelNameValueArray *user_tags,
                                                 guint32 permanent_flags);
 void           imapx_update_store_summary      (CamelFolder *folder);
 
@@ -218,11 +217,11 @@ CamelHeaderAddress *
                imapx_parse_address_list        (CamelIMAPXInputStream *stream,
                                                 GCancellable *cancellable,
                                                 GError **error);
-struct _CamelMessageInfo *
+CamelMessageInfo *
                imapx_parse_envelope            (CamelIMAPXInputStream *stream,
                                                 GCancellable *cancellable,
                                                 GError **error);
-struct _CamelMessageContentInfo *
+CamelMessageContentInfo *
                imapx_parse_body                (CamelIMAPXInputStream *stream,
                                                 GCancellable *cancellable,
                                                 GError **error);
@@ -245,7 +244,7 @@ struct _fetch_info {
        guint32 offset;         /* start offset of a BODY[]<offset.length> request */
        guint32 flags;          /* FLAGS */
        guint64 modseq;         /* MODSEQ */
-       CamelFlag *user_flags;
+       CamelNamedFlags *user_flags;
        gchar *date;            /* INTERNALDATE */
        gchar *section;         /* section for a BODY[section] request */
        gchar *uid;             /* UID */
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 11caeed..079daf4 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -39,8 +39,6 @@
 
 #define CAMEL_LOCAL_SUMMARY_VERSION (1)
 
-#define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
-
 static CamelFIRecord *
                summary_header_to_db            (CamelFolderSummary *,
                                                 GError **error);
@@ -54,10 +52,10 @@ static CamelMessageInfo *
 static gint    local_summary_decode_x_evolution
                                                (CamelLocalSummary *cls,
                                                 const gchar *xev,
-                                                CamelLocalMessageInfo *mi);
+                                                CamelMessageInfo *mi);
 static gchar * local_summary_encode_x_evolution
                                                (CamelLocalSummary *cls,
-                                                const CamelLocalMessageInfo *mi);
+                                                const CamelMessageInfo *mi);
 
 static gint    local_summary_load              (CamelLocalSummary *cls,
                                                 gint forceindex,
@@ -121,8 +119,6 @@ camel_local_summary_class_init (CamelLocalSummaryClass *class)
        object_class->finalize = local_summary_finalize;
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_size = sizeof (CamelLocalMessageInfo);
-       folder_summary_class->content_info_size = sizeof (CamelMessageContentInfo);
        folder_summary_class->summary_header_from_db = summary_header_from_db;
        folder_summary_class->summary_header_to_db = summary_header_to_db;
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
@@ -197,7 +193,7 @@ void camel_local_summary_check_force (CamelLocalSummary *cls)
 
 gchar *
 camel_local_summary_encode_x_evolution (CamelLocalSummary *cls,
-                                        const CamelLocalMessageInfo *info)
+                                        const CamelMessageInfo *info)
 {
        return CAMEL_LOCAL_SUMMARY_GET_CLASS (cls)->encode_x_evolution (cls, info);
 }
@@ -205,7 +201,7 @@ camel_local_summary_encode_x_evolution (CamelLocalSummary *cls,
 gint
 camel_local_summary_decode_x_evolution (CamelLocalSummary *cls,
                                         const gchar *xev,
-                                        CamelLocalMessageInfo *info)
+                                        CamelMessageInfo *info)
 {
        return CAMEL_LOCAL_SUMMARY_GET_CLASS (cls)->decode_x_evolution (cls, xev, info);
 }
@@ -317,7 +313,7 @@ camel_local_summary_check (CamelLocalSummary *cls,
                for (i = 0; i < camel_folder_summary_count (s); i++) {
                        CamelMessageInfo *info = camel_folder_summary_get (s, g_ptr_array_index (known_uids, 
i));
                        do_stat_mi (cls, &stats, info);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
                camel_folder_summary_free_array (known_uids);
 
@@ -518,7 +514,6 @@ local_summary_add (CamelLocalSummary *cls,
 {
        CamelFolderSummary *summary;
        CamelMessageInfo *mi;
-       CamelMessageInfoBase *mi_base;
        gchar *xev;
 
        d (printf ("Adding message to summary\n"));
@@ -526,26 +521,13 @@ local_summary_add (CamelLocalSummary *cls,
        summary = CAMEL_FOLDER_SUMMARY (cls);
 
        mi = camel_folder_summary_info_new_from_message (summary, msg, NULL);
-       camel_folder_summary_add (summary, mi);
-
-       mi_base = (CamelMessageInfoBase *) mi;
+       camel_message_info_set_abort_notifications (mi, TRUE);
 
        if (info) {
-               const CamelTag *tag = camel_message_info_get_user_tags (info);
-               const CamelFlag *flag = camel_message_info_get_user_flags (info);
-
-               while (flag) {
-                       camel_message_info_set_user_flag (mi, flag->name, TRUE);
-                       flag = flag->next;
-               }
-
-               while (tag) {
-                       camel_message_info_set_user_tag (mi, tag->name, tag->value);
-                       tag = tag->next;
-               }
-
-               camel_message_info_set_flags (mi, 0xffff, camel_message_info_get_flags (info));
-               mi_base->size = camel_message_info_get_size (info);
+               camel_message_info_take_user_flags (mi, camel_message_info_dup_user_flags (info));
+               camel_message_info_take_user_tags (mi, camel_message_info_dup_user_tags (info));
+               camel_message_info_set_flags (mi, ~0, camel_message_info_get_flags (info));
+               camel_message_info_set_size (mi, camel_message_info_get_size (info));
        }
 
        /* we need to calculate the size ourselves */
@@ -555,15 +537,17 @@ local_summary_add (CamelLocalSummary *cls,
                camel_data_wrapper_write_to_stream_sync (
                        (CamelDataWrapper *) msg,
                        (CamelStream *) sn, NULL, NULL);
-               mi_base->size = sn->written;
+               camel_message_info_set_size (mi, sn->written);
                g_object_unref (sn);
        }
 
-       mi_base->flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV);
-       xev = camel_local_summary_encode_x_evolution (
-               cls, (CamelLocalMessageInfo *) mi);
+       camel_message_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_NOXEV, 0);
+       xev = camel_local_summary_encode_x_evolution (cls, mi);
        camel_medium_set_header ((CamelMedium *) msg, "X-Evolution", xev);
        g_free (xev);
+
+       camel_message_info_set_abort_notifications (mi, FALSE);
+       camel_folder_summary_add (summary, mi);
        camel_folder_change_info_add_uid (ci, camel_message_info_get_uid (mi));
 
        return mi;
@@ -571,65 +555,86 @@ local_summary_add (CamelLocalSummary *cls,
 
 static gchar *
 local_summary_encode_x_evolution (CamelLocalSummary *cls,
-                                  const CamelLocalMessageInfo *mi)
+                                  const CamelMessageInfo *mi)
 {
        GString *out = g_string_new ("");
        struct _camel_header_param *params = NULL;
-       CamelFlag *flag = mi->info.user_flags;
-       CamelTag *tag = mi->info.user_tags;
+       guint32 flags;
+       const CamelNamedFlags *user_flags;
+       const CamelNameValueArray *user_tags;
        gchar *ret;
        const gchar *p, *uidstr;
        guint32 uid;
 
+       camel_message_info_property_lock (mi);
+
        /* FIXME: work out what to do with uid's that aren't stored here? */
        /* FIXME: perhaps make that a mbox folder only issue?? */
        p = uidstr = camel_message_info_get_uid (mi);
+       flags = camel_message_info_get_flags (mi);
        while (*p && isdigit (*p))
                p++;
        if (*p == 0 && sscanf (uidstr, "%u", &uid) == 1) {
-               g_string_printf (out, "%08x-%04x", uid, mi->info.flags & 0xffff);
+               g_string_printf (out, "%08x-%04x", uid, flags & 0xffff);
        } else {
-               g_string_printf (out, "%s-%04x", uidstr, mi->info.flags & 0xffff);
+               g_string_printf (out, "%s-%04x", uidstr, flags & 0xffff);
        }
 
-       if (flag || tag) {
+       user_flags = camel_message_info_get_user_flags (mi);
+       user_tags = camel_message_info_get_user_tags (mi);
+
+       if (user_flags || user_tags) {
                GString *val = g_string_new ("");
+               const gchar *name, *value;
+               guint ii, len;
+
+               len = camel_named_flags_get_length (user_flags);
+               if (len) {
+                       for (ii = 0; ii < len; ii++) {
+                               name = camel_named_flags_get (user_flags, ii);
+                               if (!name)
+                                       continue;
 
-               if (flag) {
-                       while (flag) {
-                               g_string_append (val, flag->name);
-                               if (flag->next)
+                               if (val->len)
                                        g_string_append_c (val, ',');
-                               flag = flag->next;
+                               g_string_append (val, name);
                        }
                        camel_header_set_param (&params, "flags", val->str);
                        g_string_truncate (val, 0);
                }
-               if (tag) {
-                       while (tag) {
-                               g_string_append (val, tag->name);
-                               g_string_append_c (val, '=');
-                               g_string_append (val, tag->value);
-                               if (tag->next)
+
+               len = camel_name_value_array_get_length (user_tags);
+               if (len) {
+                       for (ii = 0; ii < len; ii++) {
+                               if (!camel_name_value_array_get (user_tags, ii, &name, &value))
+                                       continue;
+
+                               if (val->len)
                                        g_string_append_c (val, ',');
-                               tag = tag->next;
+
+                               g_string_append (val, name);
+                               g_string_append_c (val, '=');
+                               g_string_append (val, value);
                        }
                        camel_header_set_param (&params, "tags", val->str);
                }
                g_string_free (val, TRUE);
+
                camel_header_param_list_format_append (out, params);
                camel_header_param_list_free (params);
        }
        ret = out->str;
        g_string_free (out, FALSE);
 
+       camel_message_info_property_unlock (mi);
+
        return ret;
 }
 
 static gint
 local_summary_decode_x_evolution (CamelLocalSummary *cls,
                                   const gchar *xev,
-                                  CamelLocalMessageInfo *mi)
+                                  CamelMessageInfo *mi)
 {
        struct _camel_header_param *params, *scan;
        guint32 uid, flags;
@@ -664,7 +669,7 @@ local_summary_decode_x_evolution (CamelLocalSummary *cls,
                                gchar **flagv = g_strsplit (scan->value, ",", 1000);
 
                                for (i = 0; flagv[i]; i++)
-                                       camel_message_info_set_user_flag ((CamelMessageInfo *) mi, flagv[i], 
TRUE);
+                                       camel_message_info_set_user_flag (mi, flagv[i], TRUE);
                                g_strfreev (flagv);
                        } else if (!g_ascii_strcasecmp (scan->name, "tags")) {
                                gchar **tagv = g_strsplit (scan->value, ",", 10000);
@@ -674,7 +679,7 @@ local_summary_decode_x_evolution (CamelLocalSummary *cls,
                                        val = strchr (tagv[i], '=');
                                        if (val) {
                                                *val++ = 0;
-                                               camel_message_info_set_user_tag ((CamelMessageInfo *) mi, 
tagv[i], val);
+                                               camel_message_info_set_user_tag (mi, tagv[i], val);
                                                val[-1]='=';
                                        }
                                }
@@ -685,8 +690,8 @@ local_summary_decode_x_evolution (CamelLocalSummary *cls,
                camel_header_param_list_free (params);
        }
 
-       mi->info.uid = camel_pstring_strdup (uidstr);
-       mi->info.flags = flags;
+       camel_message_info_set_uid (mi, uidstr);
+       camel_message_info_set_flags (mi, ~0, flags);
 
        return 0;
 }
@@ -705,7 +710,7 @@ summary_header_from_db (CamelFolderSummary *s,
 
        part = fir->bdata;
        if (part) {
-               EXTRACT_FIRST_DIGIT (cls->version)
+               cls->version = camel_util_bdata_get_number (&part, 0);
        }
 
        /* keep only the rest of the bdata there (strip our version digit) */
@@ -736,21 +741,25 @@ static CamelMessageInfo *
 message_info_new_from_header (CamelFolderSummary *s,
                               struct _camel_header_raw *h)
 {
-       CamelLocalMessageInfo *mi;
+       CamelMessageInfo *mi;
        CamelLocalSummary *cls = (CamelLocalSummary *) s;
 
-       mi = (CamelLocalMessageInfo *) CAMEL_FOLDER_SUMMARY_CLASS 
(camel_local_summary_parent_class)->message_info_new_from_header (s, h);
+       mi = CAMEL_FOLDER_SUMMARY_CLASS (camel_local_summary_parent_class)->message_info_new_from_header (s, 
h);
        if (mi) {
                const gchar *xev;
                gint doindex = FALSE;
 
                xev = camel_header_raw_find (&h, "X-Evolution", NULL);
                if (xev == NULL || camel_local_summary_decode_x_evolution (cls, xev, mi) == -1) {
+                       gchar *uid;
+
+                       uid = camel_folder_summary_next_uid_string (s);
+
                        /* to indicate it has no xev header */
-                       mi->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
-                       mi->info.dirty = TRUE;
-                       camel_pstring_free (mi->info.uid);
-                       mi->info.uid = camel_pstring_add (camel_folder_summary_next_uid_string (s), TRUE);
+                       camel_message_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_FLAGGED | 
CAMEL_MESSAGE_FOLDER_NOXEV, CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV);
+                       camel_message_info_set_uid (mi, uid);
+
+                       g_free (uid);
 
                        /* shortcut, no need to look it up in the index library */
                        doindex = TRUE;
@@ -768,5 +777,5 @@ message_info_new_from_header (CamelFolderSummary *s,
                }
        }
 
-       return (CamelMessageInfo *) mi;
+       return mi;
 }
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
index 496b787..f6c5c7f 100644
--- a/camel/providers/local/camel-local-summary.h
+++ b/camel/providers/local/camel-local-summary.h
@@ -52,12 +52,6 @@ enum {
        CAMEL_MESSAGE_FOLDER_NOTSEEN = 1 << 19 /* have we seen this in processing this loop? */
 };
 
-typedef struct _CamelLocalMessageInfo CamelLocalMessageInfo;
-
-struct _CamelLocalMessageInfo {
-       CamelMessageInfoBase info;
-};
-
 struct _CamelLocalSummary {
        CamelFolderSummary parent;
 
@@ -78,8 +72,8 @@ struct _CamelLocalSummaryClass {
        gint (*sync)(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, 
GCancellable *cancellable, GError **error);
        CamelMessageInfo *(*add)(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, 
CamelFolderChangeInfo *, GError **error);
 
-       gchar *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
-       gint (*decode_x_evolution)(CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo *info);
+       gchar *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelMessageInfo *info);
+       gint (*decode_x_evolution)(CamelLocalSummary *cls, const gchar *xev, CamelMessageInfo *info);
        gint (*need_index)(void);
 };
 
@@ -99,8 +93,8 @@ CamelMessageInfo *camel_local_summary_add (CamelLocalSummary *cls, CamelMimeMess
 void camel_local_summary_check_force (CamelLocalSummary *cls);
 
 /* generate an X-Evolution header line */
-gchar *camel_local_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
-gint camel_local_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo 
*info);
+gchar *camel_local_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelMessageInfo *info);
+gint camel_local_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, CamelMessageInfo 
*info);
 
 /* utility functions - write headers to a file with optional X-Evolution header and/or status header */
 gint camel_local_summary_write_headers (gint fd, struct _camel_header_raw *header, const gchar *xevline, 
const gchar *status, const gchar *xstatus);
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index 5ff9a13..047b637 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -58,9 +58,9 @@ maildir_folder_cmp_uids (CamelFolder *folder,
        if (!a || !b) {
                /* It's not a problem when one of the messages is not in the summary */
                if (a)
-                       camel_message_info_unref (a);
+                       g_object_unref (a);
                if (b)
-                       camel_message_info_unref (b);
+                       g_object_unref (b);
 
                if (a == b)
                        return 0;
@@ -72,8 +72,8 @@ maildir_folder_cmp_uids (CamelFolder *folder,
        tma = camel_message_info_get_date_received (a);
        tmb = camel_message_info_get_date_received (b);
 
-       camel_message_info_unref (a);
-       camel_message_info_unref (b);
+       g_clear_object (&a);
+       g_clear_object (&b);
 
        return tma < tmb ? -1 : tma == tmb ? 0 : 1;
 }
@@ -110,13 +110,13 @@ maildir_folder_get_filename (CamelFolder *folder,
                return NULL;
        }
 
-       mdi = (CamelMaildirMessageInfo *) info;
+       mdi = CAMEL_MAILDIR_MESSAGE_INFO (info);
 
        /* If filename is NULL, it means folder_summary_check is not yet executed.
         * Try to find the file in the folder and use it, otherwise construct its
         * name based on actual flags.
        */
-       if (!camel_maildir_info_filename (mdi)) {
+       if (!camel_maildir_message_info_get_filename (mdi)) {
                const gchar *uid = camel_message_info_get_uid (info);
 
                if (uid) {
@@ -133,7 +133,7 @@ maildir_folder_get_filename (CamelFolder *folder,
 
                                while (filename = g_dir_read_name (dir), filename) {
                                        if (g_str_has_prefix (filename, uid) && (filename[uid_len] == '\0' || 
filename[uid_len] == CAMEL_MAILDIR_FLAG_SEP)) {
-                                               camel_maildir_info_set_filename (mdi, g_strdup (filename));
+                                               camel_maildir_message_info_take_filename (mdi, g_strdup 
(filename));
                                                break;
                                        }
                                }
@@ -142,14 +142,14 @@ maildir_folder_get_filename (CamelFolder *folder,
                        }
                }
 
-               if (!camel_maildir_info_filename (mdi)) {
-                       camel_maildir_info_set_filename (mdi, camel_maildir_summary_info_to_name (mdi));
+               if (!camel_maildir_message_info_get_filename (mdi)) {
+                       camel_maildir_message_info_take_filename (mdi, camel_maildir_summary_info_to_name 
(info));
                }
        }
 
-       res = g_strdup_printf ("%s/cur/%s", lf->folder_path, camel_maildir_info_filename (mdi));
+       res = g_strdup_printf ("%s/cur/%s", lf->folder_path, camel_maildir_message_info_get_filename (mdi));
 
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 
        return res;
 }
@@ -205,7 +205,7 @@ maildir_folder_append_message_sync (CamelFolder *folder,
                goto fail_write;
 
        /* now move from tmp to cur (bypass new, does it matter?) */
-       dest = g_strdup_printf ("%s/cur/%s", lf->folder_path, camel_maildir_info_filename (mdi));
+       dest = g_strdup_printf ("%s/cur/%s", lf->folder_path, camel_maildir_message_info_get_filename (mdi));
        if (g_rename (name, dest) == -1) {
                g_set_error (
                        error, G_IO_ERROR,
@@ -346,10 +346,10 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
                        }
 
                        mdi = (CamelMaildirMessageInfo *) info;
-                       new_filename = camel_maildir_summary_info_to_name (mdi);
+                       new_filename = camel_maildir_summary_info_to_name (info);
 
                        d_filename = g_strdup_printf ("%s/cur/%s", df->folder_path, new_filename);
-                       s_filename = g_strdup_printf ("%s/cur/%s", lf->folder_path, 
camel_maildir_info_filename (mdi));
+                       s_filename = g_strdup_printf ("%s/cur/%s", lf->folder_path, 
camel_maildir_message_info_get_filename (mdi));
 
                        if (g_rename (s_filename, d_filename) != 0) {
                                if (errno == EXDEV) {
@@ -361,7 +361,7 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
                                                g_io_error_from_errno (errno),
                                                _("Cannot transfer message to destination folder: %s"),
                                                g_strerror (errno));
-                                       camel_message_info_unref (info);
+                                       g_clear_object (&info);
                                        g_free (s_filename);
                                        g_free (d_filename);
                                        g_free (new_filename);
@@ -369,15 +369,10 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
                                }
                        } else {
                                CamelMessageInfo *clone;
-                               CamelMaildirMessageInfo *mclone;
 
-                               clone = camel_message_info_clone (info);
-                               clone->summary = dest->summary;
+                               clone = camel_message_info_clone (info, dest->summary);
 
-                               mclone = (CamelMaildirMessageInfo *) clone;
-                               /* preserve also UID, as it matches the file name */
-                               mclone->info.info.uid = camel_pstring_strdup (camel_message_info_get_uid 
(info));
-                               camel_maildir_info_set_filename (clone, g_strdup (new_filename));
+                               camel_maildir_message_info_set_filename (CAMEL_MAILDIR_MESSAGE_INFO (clone), 
new_filename);
                                /* unset deleted flag when transferring from trash folder */
                                if ((source->folder_flags & CAMEL_FOLDER_IS_TRASH) != 0)
                                        camel_message_info_set_flags (info, CAMEL_MESSAGE_DELETED, 0);
@@ -395,7 +390,7 @@ maildir_folder_transfer_messages_to_sync (CamelFolder *source,
                                camel_folder_summary_remove (source->summary, info);
                        }
 
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                        g_free (s_filename);
                        g_free (d_filename);
                        g_free (new_filename);
diff --git a/camel/providers/local/camel-maildir-message-info.c 
b/camel/providers/local/camel-maildir-message-info.c
index 84badca..e769d60 100644
--- a/camel/providers/local/camel-maildir-message-info.c
+++ b/camel/providers/local/camel-maildir-message-info.c
@@ -26,7 +26,7 @@
 
 #include "camel-maildir-message-info.h"
 
-struct _xCamelMaildirMessageInfoPrivate {
+struct _CamelMaildirMessageInfoPrivate {
        gchar *filename;
 };
 
@@ -35,70 +35,70 @@ enum {
        PROP_FILENAME
 };
 
-G_DEFINE_TYPE (xCamelMaildirMessageInfo, xcamel_maildir_message_info, XCAMEL_TYPE_MESSAGE_INFO_BASE)
+G_DEFINE_TYPE (CamelMaildirMessageInfo, camel_maildir_message_info, CAMEL_TYPE_MESSAGE_INFO_BASE)
 
-static xCamelMessageInfo *
-maildir_message_info_clone (const xCamelMessageInfo *mi,
+static CamelMessageInfo *
+maildir_message_info_clone (const CamelMessageInfo *mi,
                            CamelFolderSummary *assign_summary)
 {
-       xCamelMessageInfo *result;
+       CamelMessageInfo *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MAILDIR_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MAILDIR_MESSAGE_INFO (mi), NULL);
 
-       result = XCAMEL_MESSAGE_INFO_CLASS (xcamel_maildir_message_info_parent_class)->clone (mi, 
assign_summary);
+       result = CAMEL_MESSAGE_INFO_CLASS (camel_maildir_message_info_parent_class)->clone (mi, 
assign_summary);
        if (!result)
                return NULL;
 
-       if (XCAMEL_IS_MAILDIR_MESSAGE_INFO (result)) {
-               xCamelMaildirMessageInfo *mmi, *mmi_result;
+       if (CAMEL_IS_MAILDIR_MESSAGE_INFO (result)) {
+               CamelMaildirMessageInfo *mmi, *mmi_result;
 
-               mmi = XCAMEL_MAILDIR_MESSAGE_INFO (mi);
-               mmi_result = XCAMEL_MAILDIR_MESSAGE_INFO (result);
+               mmi = CAMEL_MAILDIR_MESSAGE_INFO (mi);
+               mmi_result = CAMEL_MAILDIR_MESSAGE_INFO (result);
 
                /* safe-guard that the mmi's filename doesn't change before it's copied to mmi_result */
-               xcamel_message_info_property_lock (mi);
+               camel_message_info_property_lock (mi);
 
-               xcamel_maildir_message_info_set_filename (mmi_result, 
xcamel_maildir_message_info_get_filename (mmi));
+               camel_maildir_message_info_set_filename (mmi_result, camel_maildir_message_info_get_filename 
(mmi));
 
-               xcamel_message_info_property_unlock (mi);
+               camel_message_info_property_unlock (mi);
        }
 
        return result;
 }
 
 static gboolean
-maildir_message_info_load (xCamelMessageInfo *mi,
+maildir_message_info_load (CamelMessageInfo *mi,
                           const CamelMIRecord *record,
                           /* const */ gchar **bdata_ptr)
 {
-       xCamelMaildirMessageInfo *mmi;
+       CamelMaildirMessageInfo *mmi;
 
-       g_return_val_if_fail (XCAMEL_IS_MAILDIR_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MAILDIR_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_ptr != NULL, FALSE);
 
-       if (!XCAMEL_MESSAGE_INFO_CLASS (xcamel_maildir_message_info_parent_class)->load ||
-           !XCAMEL_MESSAGE_INFO_CLASS (xcamel_maildir_message_info_parent_class)->load (mi, record, 
bdata_ptr))
+       if (!CAMEL_MESSAGE_INFO_CLASS (camel_maildir_message_info_parent_class)->load ||
+           !CAMEL_MESSAGE_INFO_CLASS (camel_maildir_message_info_parent_class)->load (mi, record, bdata_ptr))
                return FALSE;
 
-       mmi = XCAMEL_MAILDIR_MESSAGE_INFO (mi);
+       mmi = CAMEL_MAILDIR_MESSAGE_INFO (mi);
 
-       xcamel_maildir_message_info_take_filename (mmi, camel_maildir_summary_info_to_name (mmi));
+       camel_maildir_message_info_take_filename (mmi, camel_maildir_summary_info_to_name (mi));
 
        return TRUE;
 }
 
 static void
 maildir_message_info_set_property (GObject *object,
-                                guint property_id,
-                                const GValue *value,
-                                GParamSpec *pspec)
+                                  guint property_id,
+                                  const GValue *value,
+                                  GParamSpec *pspec)
 {
-       xCamelMaildirMessageInfo *mmi = XCAMEL_MAILDIR_MESSAGE_INFO (object);
+       CamelMaildirMessageInfo *mmi = CAMEL_MAILDIR_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_FILENAME:
-               xcamel_maildir_message_info_set_filename (mmi, g_value_get_string (value));
+               camel_maildir_message_info_set_filename (mmi, g_value_get_string (value));
                return;
        }
 
@@ -107,15 +107,15 @@ maildir_message_info_set_property (GObject *object,
 
 static void
 maildir_message_info_get_property (GObject *object,
-                                guint property_id,
-                                GValue *value,
-                                GParamSpec *pspec)
+                                  guint property_id,
+                                  GValue *value,
+                                  GParamSpec *pspec)
 {
-       xCamelMaildirMessageInfo *mmi = XCAMEL_MAILDIR_MESSAGE_INFO (object);
+       CamelMaildirMessageInfo *mmi = CAMEL_MAILDIR_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_FILENAME:
-               g_value_set_string (value, xcamel_maildir_message_info_get_filename (mmi));
+               g_value_set_string (value, camel_maildir_message_info_get_filename (mmi));
                return;
        }
 
@@ -125,24 +125,24 @@ maildir_message_info_get_property (GObject *object,
 static void
 maildir_message_info_dispose (GObject *object)
 {
-       xCamelMaildirMessageInfo *mmi = XCAMEL_MAILDIR_MESSAGE_INFO (object);
+       CamelMaildirMessageInfo *mmi = CAMEL_MAILDIR_MESSAGE_INFO (object);
 
        g_free (mmi->priv->filename);
        mmi->priv->filename = NULL;
 
        /* Chain up to parent's method. */
-       G_OBJECT_CLASS (xcamel_maildir_message_info_parent_class)->dispose (object);
+       G_OBJECT_CLASS (camel_maildir_message_info_parent_class)->dispose (object);
 }
 
 static void
-xcamel_maildir_message_info_class_init (xCamelMaildirMessageInfoClass *class)
+camel_maildir_message_info_class_init (CamelMaildirMessageInfoClass *class)
 {
-       xCamelMessageInfoClass *mi_class;
+       CamelMessageInfoClass *mi_class;
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (xCamelMaildirMessageInfoPrivate));
+       g_type_class_add_private (class, sizeof (CamelMaildirMessageInfoPrivate));
 
-       mi_class = XCAMEL_MESSAGE_INFO_CLASS (class);
+       mi_class = CAMEL_MESSAGE_INFO_CLASS (class);
        mi_class->clone = maildir_message_info_clone;
        mi_class->load = maildir_message_info_load;
 
@@ -152,7 +152,7 @@ xcamel_maildir_message_info_class_init (xCamelMaildirMessageInfoClass *class)
        object_class->dispose = maildir_message_info_dispose;
 
        /**
-        * xCamelMaildirMessageInfo:filename
+        * CamelMaildirMessageInfo:filename
         *
         * File name of the message on the disk.
         *
@@ -170,66 +170,66 @@ xcamel_maildir_message_info_class_init (xCamelMaildirMessageInfoClass *class)
 }
 
 static void
-xcamel_maildir_message_info_init (xCamelMaildirMessageInfo *vmi)
+camel_maildir_message_info_init (CamelMaildirMessageInfo *vmi)
 {
-       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, XCAMEL_TYPE_MAILDIR_MESSAGE_INFO, 
xCamelMaildirMessageInfoPrivate);
+       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, CAMEL_TYPE_MAILDIR_MESSAGE_INFO, 
CamelMaildirMessageInfoPrivate);
 }
 
 const gchar *
-xcamel_maildir_message_info_get_filename (const xCamelMaildirMessageInfo *mmi)
+camel_maildir_message_info_get_filename (const CamelMaildirMessageInfo *mmi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        const gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), NULL);
 
-       mi = XCAMEL_MESSAGE_INFO (mmi);
+       mi = CAMEL_MESSAGE_INFO (mmi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = mmi->priv->filename;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 gchar *
-xcamel_maildir_message_info_dup_filename (const xCamelMaildirMessageInfo *mmi)
+camel_maildir_message_info_dup_filename (const CamelMaildirMessageInfo *mmi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        gchar *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), NULL);
 
-       mi = XCAMEL_MESSAGE_INFO (mmi);
+       mi = CAMEL_MESSAGE_INFO (mmi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = g_strdup (mmi->priv->filename);
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 gboolean
-xcamel_maildir_message_info_set_filename (xCamelMaildirMessageInfo *mmi,
-                                         const gchar *filename)
+camel_maildir_message_info_set_filename (CamelMaildirMessageInfo *mmi,
+                                        const gchar *filename)
 {
-       g_return_val_if_fail (XCAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), FALSE);
 
-       return xcamel_maildir_message_info_take_filename (mmi, g_strdup (filename));
+       return camel_maildir_message_info_take_filename (mmi, g_strdup (filename));
 }
 
 gboolean
-xcamel_maildir_message_info_take_filename (xCamelMaildirMessageInfo *mmi,
+camel_maildir_message_info_take_filename (CamelMaildirMessageInfo *mmi,
                                          gchar *filename)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MAILDIR_MESSAGE_INFO (mmi), FALSE);
 
-       mi = XCAMEL_MESSAGE_INFO (mmi);
+       mi = CAMEL_MESSAGE_INFO (mmi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = g_strcmp0 (mmi->priv->filename, filename) != 0;
 
@@ -240,11 +240,11 @@ xcamel_maildir_message_info_take_filename (xCamelMaildirMessageInfo *mmi,
                g_free (filename);
        }
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !xcamel_message_info_get_loading (mi)) {
+       if (changed && !camel_message_info_get_abort_notifications (mi)) {
                g_object_notify (G_OBJECT (mmi), "filename");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
        }
 
        return changed;
diff --git a/camel/providers/local/camel-maildir-message-info.h 
b/camel/providers/local/camel-maildir-message-info.h
index bd1840a..226bf50 100644
--- a/camel/providers/local/camel-maildir-message-info.h
+++ b/camel/providers/local/camel-maildir-message-info.h
@@ -15,60 +15,57 @@
  * along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef XCAMEL_MAILDIR_MESSAGE_INFO_H
-#define XCAMEL_MAILDIR_MESSAGE_INFO_H
+#ifndef CAMEL_MAILDIR_MESSAGE_INFO_H
+#define CAMEL_MAILDIR_MESSAGE_INFO_H
 
 #include <glib-object.h>
 
 #include <camel/camel.h>
 
 /* Standard GObject macros */
-#define XCAMEL_TYPE_MAILDIR_MESSAGE_INFO \
-       (xcamel_maildir_message_info_get_type ())
-#define XCAMEL_MAILDIR_MESSAGE_INFO(obj) \
+#define CAMEL_TYPE_MAILDIR_MESSAGE_INFO \
+       (camel_maildir_message_info_get_type ())
+#define CAMEL_MAILDIR_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), XCAMEL_TYPE_MAILDIR_MESSAGE_INFO, xCamelMaildirMessageInfo))
-#define XCAMEL_MAILDIR_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MAILDIR_MESSAGE_INFO, CamelMaildirMessageInfo))
+#define CAMEL_MAILDIR_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), XCAMEL_TYPE_MAILDIR_MESSAGE_INFO, xCamelMaildirMessageInfoClass))
-#define XCAMEL_IS_MAILDIR_MESSAGE_INFO(obj) \
+       ((cls), CAMEL_TYPE_MAILDIR_MESSAGE_INFO, CamelMaildirMessageInfoClass))
+#define CAMEL_IS_MAILDIR_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), XCAMEL_TYPE_MAILDIR_MESSAGE_INFO))
-#define XCAMEL_IS_MAILDIR_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MAILDIR_MESSAGE_INFO))
+#define CAMEL_IS_MAILDIR_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), XCAMEL_TYPE_MAILDIR_MESSAGE_INFO))
-#define XCAMEL_MAILDIR_MESSAGE_INFO_GET_CLASS(obj) \
+       ((cls), CAMEL_TYPE_MAILDIR_MESSAGE_INFO))
+#define CAMEL_MAILDIR_MESSAGE_INFO_GET_CLASS(obj) \
        (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), XCAMEL_TYPE_MAILDIR_MESSAGE_INFO, xCamelMaildirMessageInfoClass))
+       ((obj), CAMEL_TYPE_MAILDIR_MESSAGE_INFO, CamelMaildirMessageInfoClass))
 
 G_BEGIN_DECLS
 
-typedef struct _xCamelMaildirMessageInfo xCamelMaildirMessageInfo;
-typedef struct _xCamelMaildirMessageInfoClass xCamelMaildirMessageInfoClass;
-typedef struct _xCamelMaildirMessageInfoPrivate xCamelMaildirMessageInfoPrivate;
+typedef struct _CamelMaildirMessageInfo CamelMaildirMessageInfo;
+typedef struct _CamelMaildirMessageInfoClass CamelMaildirMessageInfoClass;
+typedef struct _CamelMaildirMessageInfoPrivate CamelMaildirMessageInfoPrivate;
 
-struct _xCamelMaildirMessageInfo {
-       xCamelMessageInfoBase parent;
-       xCamelMaildirMessageInfoPrivate *priv;
+struct _CamelMaildirMessageInfo {
+       CamelMessageInfoBase parent;
+       CamelMaildirMessageInfoPrivate *priv;
 };
 
-struct _xCamelMaildirMessageInfoClass {
-       xCamelMessageInfoBaseClass parent_class;
+struct _CamelMaildirMessageInfoClass {
+       CamelMessageInfoBaseClass parent_class;
 };
 
-GType          xcamel_maildir_message_info_get_type    (void);
+GType          camel_maildir_message_info_get_type     (void);
 
-const gchar *  xcamel_maildir_message_info_get_filename
-                                                       (const xCamelMaildirMessageInfo *mmi);
-gchar *                xcamel_maildir_message_info_dup_filename
-                                                       (const xCamelMaildirMessageInfo *mmi);
-gboolean       xcamel_maildir_message_info_set_filename
-                                                       (xCamelMaildirMessageInfo *mmi,
+const gchar *  camel_maildir_message_info_get_filename (const CamelMaildirMessageInfo *mmi);
+gchar *                camel_maildir_message_info_dup_filename (const CamelMaildirMessageInfo *mmi);
+gboolean       camel_maildir_message_info_set_filename (CamelMaildirMessageInfo *mmi,
                                                         const gchar *filename);
-gboolean       xcamel_maildir_message_info_take_filename
-                                                       (xCamelMaildirMessageInfo *mmi,
+gboolean       camel_maildir_message_info_take_filename
+                                                       (CamelMaildirMessageInfo *mmi,
                                                         gchar *filename);
 
 G_END_DECLS
 
-#endif /* XCAMEL_MAILDIR_MESSAGE_INFO_H */
+#endif /* CAMEL_MAILDIR_MESSAGE_INFO_H */
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 25e0729..5145e5f 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -52,12 +52,6 @@
 static CamelMessageInfo *
                message_info_new_from_header    (CamelFolderSummary *,
                                                 struct _camel_header_raw *);
-static CamelMessageInfo *
-               maildir_message_info_from_db    (CamelFolderSummary *summary,
-                                                CamelMIRecord *record);
-static void    message_info_free               (CamelFolderSummary *,
-                                                CamelMessageInfo *mi);
-
 static gint    maildir_summary_load            (CamelLocalSummary *cls,
                                                 gint forceindex,
                                                 GError **error);
@@ -81,10 +75,10 @@ static gchar *      maildir_summary_next_uid_string (CamelFolderSummary *s);
 static gint    maildir_summary_decode_x_evolution
                                                (CamelLocalSummary *cls,
                                                 const gchar *xev,
-                                                CamelLocalMessageInfo *mi);
+                                                CamelMessageInfo *mi);
 static gchar * maildir_summary_encode_x_evolution
                                                (CamelLocalSummary *cls,
-                                                const CamelLocalMessageInfo *mi);
+                                                const CamelMessageInfo *mi);
 
 typedef struct _CamelMaildirMessageContentInfo CamelMaildirMessageContentInfo;
 
@@ -132,12 +126,8 @@ camel_maildir_summary_class_init (CamelMaildirSummaryClass *class)
        object_class->finalize = maildir_summary_finalize;
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_type = XCAMEL_TYPE_MAILDIR_MESSAGE_INFO;
-       folder_summary_class->message_info_size = sizeof (CamelMaildirMessageInfo);
-       folder_summary_class->content_info_size = sizeof (CamelMaildirMessageContentInfo);
+       folder_summary_class->message_info_type = CAMEL_TYPE_MAILDIR_MESSAGE_INFO;
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
-       folder_summary_class->message_info_from_db = maildir_message_info_from_db;
-       folder_summary_class->message_info_free = message_info_free;
        folder_summary_class->next_uid_string = maildir_summary_next_uid_string;
 
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (class);
@@ -212,17 +202,20 @@ static struct {
 };
 
 /* convert the uid + flags into a unique:info maildir format */
-gchar *camel_maildir_summary_info_to_name (const CamelMaildirMessageInfo *info)
+gchar *
+camel_maildir_summary_info_to_name (const CamelMessageInfo *info)
 {
        const gchar *uid;
+       guint32 flags;
        gchar *p, *buf;
        gint i;
 
        uid = camel_message_info_get_uid (info);
        buf = g_alloca (strlen (uid) + strlen (CAMEL_MAILDIR_FLAG_SEP_S "2,") + G_N_ELEMENTS (flagbits) + 1);
        p = buf + sprintf (buf, "%s" CAMEL_MAILDIR_FLAG_SEP_S "2,", uid);
+       flags = camel_message_info_get_flags (info);
        for (i = 0; i < G_N_ELEMENTS (flagbits); i++) {
-               if (info->info.info.flags & flagbits[i].flagbit)
+               if ((flags & flagbits[i].flagbit) != 0)
                        *p++ = flagbits[i].flag;
        }
 
@@ -231,48 +224,48 @@ gchar *camel_maildir_summary_info_to_name (const CamelMaildirMessageInfo *info)
        return g_strdup (buf);
 }
 
-/* returns 0 if the info matches (or there was none), otherwise we changed it */
-gint camel_maildir_summary_name_to_info (CamelMaildirMessageInfo *info, const gchar *name)
+/* returns whether the @info changed */
+gboolean
+camel_maildir_summary_name_to_info (CamelMessageInfo *info,
+                                   const gchar *name)
 {
        gchar *p, c;
        guint32 set = 0;        /* what we set */
-       /*guint32 all = 0;*/    /* all flags */
        gint i;
 
        p = strstr (name, CAMEL_MAILDIR_FLAG_SEP_S "2,");
 
        if (p) {
-               p+=3;
+               guint32 flags;
+
+               flags = camel_message_info_get_flags (info);
+
+               p += 3;
                while ((c = *p++)) {
                        /* we could assume that the flags are in order, but its just as easy not to require */
                        for (i = 0; i < G_N_ELEMENTS (flagbits); i++) {
-                               if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 
0) {
+                               if (flagbits[i].flag == c && (flags & flagbits[i].flagbit) == 0) {
                                        set |= flagbits[i].flagbit;
                                }
-                               /*all |= flagbits[i].flagbit;*/
                        }
                }
 
                /* changed? */
-               /*if ((info->flags & all) != set) {*/
-               if ((info->info.info.flags & set) != set) {
-                       /* ok, they did change, only add the new flags ('merge flags'?) */
-                       /*info->flags &= all;  if we wanted to set only the new flags, which we probably dont 
*/
-                       info->info.info.flags |= set;
-                       return 1;
+               if ((flags & set) != set) {
+                       return camel_message_info_set_flags (info, set, set);
                }
        }
 
-       return 0;
+       return FALSE;
 }
 
 /* for maildir, x-evolution isn't used, so dont try and get anything out of it */
-static gint maildir_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, 
CamelLocalMessageInfo *mi)
+static gint maildir_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, CamelMessageInfo 
*mi)
 {
        return -1;
 }
 
-static gchar *maildir_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi)
+static gchar *maildir_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelMessageInfo *mi)
 {
        return NULL;
 }
@@ -288,16 +281,17 @@ maildir_summary_add (CamelLocalSummary *cls,
                      GError **error)
 {
        CamelLocalSummaryClass *local_summary_class;
-       CamelMaildirMessageInfo *mi;
+       CamelMessageInfo *mi;
 
        /* Chain up to parent's add() method. */
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_maildir_summary_parent_class);
-       mi = (CamelMaildirMessageInfo *) local_summary_class->add (
-               cls, msg, info, changes, error);
+       mi = local_summary_class->add (cls, msg, info, changes, error);
        if (mi) {
                if (info) {
-                       camel_maildir_info_set_filename (mi, camel_maildir_summary_info_to_name (mi));
-                       d (printf ("Setting filename to %s\n", camel_maildir_info_filename (mi)));
+                       CamelMaildirMessageInfo *mdi = CAMEL_MAILDIR_MESSAGE_INFO (mi);
+
+                       camel_maildir_message_info_take_filename (mdi, camel_maildir_summary_info_to_name 
(mi));
+                       d (printf ("Setting filename to %s\n", camel_maildir_message_info_get_filename 
(mdi)));
 
                        /* Inherit the Received date from the passed-in info only if it is set and
                           the new message info doesn't have it set or it's set to the default
@@ -306,11 +300,11 @@ maildir_summary_add (CamelLocalSummary *cls,
                            (camel_message_info_get_date_received (mi) <= 0 ||
                            (camel_message_info_get_uid (mi) &&
                             camel_message_info_get_date_received (mi) == strtoul (camel_message_info_get_uid 
(mi), NULL, 10))))
-                               mi->info.info.date_received = camel_message_info_get_date_received (info);
+                               camel_message_info_set_date_received (mi, 
camel_message_info_get_date_received (info));
                }
        }
 
-       return (CamelMessageInfo *) mi;
+       return mi;
 }
 
 static CamelMessageInfo *
@@ -319,29 +313,30 @@ message_info_new_from_header (CamelFolderSummary *s,
 {
        CamelMessageInfo *mi, *info;
        CamelMaildirSummary *mds = (CamelMaildirSummary *) s;
-       CamelMaildirMessageInfo *mdi;
        const gchar *uid;
 
        mi = ((CamelFolderSummaryClass *) camel_maildir_summary_parent_class)->message_info_new_from_header 
(s, h);
        /* assign the uid and new filename */
        if (mi) {
-               mdi = (CamelMaildirMessageInfo *) mi;
-
                uid = camel_message_info_get_uid (mi);
-               if (uid == NULL || uid[0] == 0)
-                       mdi->info.info.uid = camel_pstring_add (camel_folder_summary_next_uid_string (s), 
TRUE);
+               if (uid == NULL || uid[0] == 0) {
+                       gchar *new_uid = camel_folder_summary_next_uid_string (s);
+
+                       camel_message_info_set_uid (mi, new_uid);
+                       g_free (new_uid);
+               }
 
                /* handle 'duplicates' */
-               info = camel_folder_summary_peek_loaded (s, uid);
+               info = (uid && *uid) ? camel_folder_summary_peek_loaded (s, uid) : NULL;
                if (info) {
                        d (printf ("already seen uid '%s', just summarising instead\n", uid));
-                       camel_message_info_unref (mi);
-                       mdi = (CamelMaildirMessageInfo *)(mi = info);
+                       g_clear_object (&mi);
+                       mi = info;
                }
 
-               if (mdi->info.info.date_received <= 0) {
+               if (camel_message_info_get_date_received (mi) <= 0) {
                        /* with maildir we know the real received date, from the filename */
-                       mdi->info.info.date_received = strtoul (camel_message_info_get_uid (mi), NULL, 10);
+                       camel_message_info_set_date_received (mi, strtoul (camel_message_info_get_uid (mi), 
NULL, 10));
                }
 
                if (mds->priv->current_file) {
@@ -350,8 +345,8 @@ message_info_new_from_header (CamelFolderSummary *s,
                        gulong uid;
 #endif
                        /* if setting from a file, grab the flags from it */
-                       camel_maildir_info_set_filename (mi, g_strdup (mds->priv->current_file));
-                       camel_maildir_summary_name_to_info (mdi, mds->priv->current_file);
+                       camel_maildir_message_info_take_filename (CAMEL_MAILDIR_MESSAGE_INFO (mi), g_strdup 
(mds->priv->current_file));
+                       camel_maildir_summary_name_to_info (mi, mds->priv->current_file);
 
 #if 0
                        /* Actually, I dont think all this effort is worth it at all ... */
@@ -371,42 +366,16 @@ message_info_new_from_header (CamelFolderSummary *s,
 #endif
                } else {
                        /* if creating a file, set its name from the flags we have */
-                       camel_maildir_info_set_filename (mdi, camel_maildir_summary_info_to_name (mdi));
-                       d (printf ("Setting filename to %s\n", camel_maildir_info_filename (mi)));
+                       camel_maildir_message_info_take_filename (CAMEL_MAILDIR_MESSAGE_INFO (mi), 
camel_maildir_summary_info_to_name (mi));
+                       d (printf ("Setting filename to %s\n", camel_maildir_message_info_get_filename 
(CAMEL_MAILDIR_MESSAGE_INFO (mi))));
                }
        }
 
        return mi;
 }
 
-static CamelMessageInfo *
-maildir_message_info_from_db (CamelFolderSummary *summary,
-                              CamelMIRecord *record)
-{
-       CamelMessageInfo *mi;
-
-       mi = ((CamelFolderSummaryClass *) camel_maildir_summary_parent_class)->message_info_from_db (summary, 
record);
-       if (mi) {
-               CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *) mi;
-
-               camel_maildir_info_set_filename (mdi, camel_maildir_summary_info_to_name (mdi));
-       }
-
-       return mi;
-}
-
-static void
-message_info_free (CamelFolderSummary *s,
-                   CamelMessageInfo *mi)
-{
-       CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *) mi;
-
-       g_free (mdi->filename);
-
-       ((CamelFolderSummaryClass *) camel_maildir_summary_parent_class)->message_info_free (s, mi);
-}
-
-static gchar *maildir_summary_next_uid_string (CamelFolderSummary *s)
+static gchar *
+maildir_summary_next_uid_string (CamelFolderSummary *s)
 {
        CamelMaildirSummary *mds = (CamelMaildirSummary *) s;
 
@@ -575,7 +544,7 @@ remove_summary (gchar *key,
        if (rd->changes)
                camel_folder_change_info_remove_uid (rd->changes, key);
        camel_folder_summary_remove ((CamelFolderSummary *) rd->cls, info);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 }
 
 static gint
@@ -671,7 +640,7 @@ maildir_summary_check (CamelLocalSummary *cls,
                info = g_hash_table_lookup (left, uid);
                if (info) {
                        g_hash_table_remove (left, uid);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
 
                info = camel_folder_summary_get ((CamelFolderSummary *) cls, uid);
@@ -689,13 +658,12 @@ maildir_summary_check (CamelLocalSummary *cls,
                        }
 
                        mdi = (CamelMaildirMessageInfo *) info;
-                       filename = camel_maildir_info_filename (mdi);
+                       filename = camel_maildir_message_info_get_filename (mdi);
                        /* TODO: only store the extension in the mdi->filename struct, not the whole lot */
                        if (filename == NULL || strcmp (filename, d->d_name) != 0) {
-                               g_free (mdi->filename);
-                               mdi->filename = g_strdup (d->d_name);
+                               camel_maildir_message_info_set_filename (mdi, d->d_name);
                        }
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                }
                g_free (uid);
        }
@@ -738,7 +706,7 @@ maildir_summary_check (CamelLocalSummary *cls,
 
                        /* already in summary?  shouldn't happen, but just incase ... */
                        if ((info = camel_folder_summary_get ((CamelFolderSummary *) cls, name))) {
-                               camel_message_info_unref (info);
+                               g_clear_object (&info);
                                newname = destname = camel_folder_summary_next_uid_string (s);
                        } else {
                                gchar *nm;
@@ -817,9 +785,9 @@ maildir_summary_sync (CamelLocalSummary *cls,
                camel_operation_progress (cancellable, (known_uids->len - i) * 100 / known_uids->len);
 
                info = camel_folder_summary_get ((CamelFolderSummary *) cls, g_ptr_array_index (known_uids, 
i));
-               mdi = (CamelMaildirMessageInfo *) info;
-               if (mdi && (mdi->info.info.flags & CAMEL_MESSAGE_DELETED) && expunge) {
-                       name = g_strdup_printf ("%s/cur/%s", cls->folder_path, camel_maildir_info_filename 
(mdi));
+               mdi = CAMEL_MAILDIR_MESSAGE_INFO (info);
+               if (mdi && (camel_message_info_get_flags (info) & CAMEL_MESSAGE_DELETED) != 0 && expunge) {
+                       name = g_strdup_printf ("%s/cur/%s", cls->folder_path, 
camel_maildir_message_info_get_filename (mdi));
                        d (printf ("deleting %s\n", name));
                        if (unlink (name) == 0 || errno == ENOENT) {
 
@@ -831,16 +799,16 @@ maildir_summary_sync (CamelLocalSummary *cls,
                                removed_uids = g_list_prepend (removed_uids, (gpointer) camel_pstring_strdup 
(camel_message_info_get_uid (info)));
                        }
                        g_free (name);
-               } else if (mdi && (mdi->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                       gchar *newname = camel_maildir_summary_info_to_name (mdi);
+               } else if (mdi && camel_message_info_get_folder_flagged (info)) {
+                       gchar *newname = camel_maildir_summary_info_to_name (info);
                        gchar *dest;
 
                        /* do we care about additional metainfo stored inside the message? */
                        /* probably should all go in the filename? */
 
                        /* have our flags/ i.e. name changed? */
-                       if (strcmp (newname, camel_maildir_info_filename (mdi))) {
-                               name = g_strdup_printf ("%s/cur/%s", cls->folder_path, 
camel_maildir_info_filename (mdi));
+                       if (strcmp (newname, camel_maildir_message_info_get_filename (mdi))) {
+                               name = g_strdup_printf ("%s/cur/%s", cls->folder_path, 
camel_maildir_message_info_get_filename (mdi));
                                dest = g_strdup_printf ("%s/cur/%s", cls->folder_path, newname);
                                if (g_rename (name, dest) == -1) {
                                        g_warning ("%s: Failed to rename '%s' to '%s': %s", G_STRFUNC, name, 
dest, g_strerror (errno));
@@ -852,19 +820,18 @@ maildir_summary_sync (CamelLocalSummary *cls,
                                        /* TODO: If this is made mt-safe, then this code could be a problem, 
since
                                         * the estrv is being modified.
                                         * Sigh, this may mean the maildir name has to be cached another way 
*/
-                                       g_free (mdi->filename);
-                                       mdi->filename = newname;
+                                       camel_maildir_message_info_set_filename (mdi, newname);
                                }
                                g_free (name);
                                g_free (dest);
-                       } else {
-                               g_free (newname);
                        }
 
+                       g_free (newname);
+
                        /* strip FOLDER_MESSAGE_FLAGED, etc */
-                       mdi->info.info.flags &= 0xffff;
+                       camel_message_info_set_flags (info, 0xffff, camel_message_info_get_flags (info));
                }
-               camel_message_info_unref (info);
+               g_clear_object (&info);
        }
 
        if (removed_uids) {
@@ -879,4 +846,3 @@ maildir_summary_sync (CamelLocalSummary *cls,
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_maildir_summary_parent_class);
        return local_summary_class->sync (cls, expunge, changes, cancellable, error);
 }
-
diff --git a/camel/providers/local/camel-maildir-summary.h b/camel/providers/local/camel-maildir-summary.h
index 77cbdd3..61040d4 100644
--- a/camel/providers/local/camel-maildir-summary.h
+++ b/camel/providers/local/camel-maildir-summary.h
@@ -19,6 +19,7 @@
 #ifndef CAMEL_MAILDIR_SUMMARY_H
 #define CAMEL_MAILDIR_SUMMARY_H
 
+#include "camel-maildir-message-info.h"
 #include "camel-local-summary.h"
 
 /* Standard GObject macros */
@@ -54,12 +55,6 @@ typedef struct _CamelMaildirSummary CamelMaildirSummary;
 typedef struct _CamelMaildirSummaryClass CamelMaildirSummaryClass;
 typedef struct _CamelMaildirSummaryPrivate CamelMaildirSummaryPrivate;
 
-typedef struct _CamelMaildirMessageInfo {
-       CamelLocalMessageInfo info;
-
-       gchar *filename;                /* maildir has this annoying status on the end of the filename, use 
this to get the real message id */
-} CamelMaildirMessageInfo;
-
 struct _CamelMaildirSummary {
        CamelLocalSummary parent;
        CamelMaildirSummaryPrivate *priv;
@@ -73,12 +68,8 @@ GType         camel_maildir_summary_get_type (void);
 CamelMaildirSummary    *camel_maildir_summary_new      (struct _CamelFolder *folder, const gchar 
*maildirdir, CamelIndex *index);
 
 /* convert some info->flags to/from the messageinfo */
-gchar *camel_maildir_summary_info_to_name (const CamelMaildirMessageInfo *info);
-gint camel_maildir_summary_name_to_info (CamelMaildirMessageInfo *info, const gchar *name);
-
-/* TODO: could proably use get_string stuff */
-#define camel_maildir_info_filename(x) (((CamelMaildirMessageInfo *)x)->filename)
-#define camel_maildir_info_set_filename(x, s) (g_free(((CamelMaildirMessageInfo 
*)x)->filename),((CamelMaildirMessageInfo *)x)->filename = s)
+gchar *camel_maildir_summary_info_to_name (const CamelMessageInfo *info);
+gboolean camel_maildir_summary_name_to_info (CamelMessageInfo *info, const gchar *name);
 
 G_END_DECLS
 
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index 478ec31..c9b7e8b 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -35,6 +35,7 @@
 #include <glib/gstdio.h>
 
 #include "camel-mbox-folder.h"
+#include "camel-mbox-message-info.h"
 #include "camel-mbox-store.h"
 #include "camel-mbox-summary.h"
 
@@ -52,6 +53,7 @@ mbox_folder_cmp_uids (CamelFolder *folder,
                       const gchar *uid2)
 {
        CamelMboxMessageInfo *a, *b;
+       goffset aoffset, boffset;
        gint res;
 
        g_return_val_if_fail (folder != NULL, 0);
@@ -63,9 +65,9 @@ mbox_folder_cmp_uids (CamelFolder *folder,
        if (!a || !b) {
                /* It's not a problem when one of the messages is not in the summary */
                if (a)
-                       camel_message_info_unref (a);
+                       g_object_unref (a);
                if (b)
-                       camel_message_info_unref (b);
+                       g_object_unref (b);
 
                if (a == b)
                        return 0;
@@ -74,10 +76,13 @@ mbox_folder_cmp_uids (CamelFolder *folder,
                return 1;
        }
 
-       res = a->frompos < b->frompos ? -1 : a->frompos == b->frompos ? 0 : 1;
+       aoffset = camel_mbox_message_info_get_offset (a);
+       boffset = camel_mbox_message_info_get_offset (b);
 
-       camel_message_info_unref (a);
-       camel_message_info_unref (b);
+       res = aoffset < boffset ? -1 : aoffset == boffset ? 0 : 1;
+
+       g_clear_object (&a);
+       g_clear_object (&b);
 
        return res;
 }
@@ -102,7 +107,6 @@ mbox_folder_get_filename (CamelFolder *folder,
 {
        CamelLocalFolder *lf = (CamelLocalFolder *) folder;
        CamelMboxMessageInfo *info;
-       goffset frompos;
        gchar *filename = NULL;
 
        d (printf ("Getting message %s\n", uid));
@@ -124,20 +128,16 @@ mbox_folder_get_filename (CamelFolder *folder,
                set_cannot_get_message_ex (
                        error, CAMEL_FOLDER_ERROR_INVALID_UID,
                        uid, lf->folder_path, _("No such message"));
-               goto fail;
-       }
-
-       if (info->frompos == -1) {
-               camel_message_info_unref (info);
-               goto fail;
-       }
+       } else {
+               goffset frompos;
 
-       frompos = info->frompos;
-       camel_message_info_unref (info);
+               frompos = camel_mbox_message_info_get_offset (info);
+               g_clear_object (&info);
 
-       filename = g_strdup_printf ("%s%s!%" PRId64, lf->folder_path, G_DIR_SEPARATOR_S, (gint64) frompos);
+               if (frompos != -1)
+                       filename = g_strdup_printf ("%s%s!%" G_GINT64_FORMAT, lf->folder_path, 
G_DIR_SEPARATOR_S, (gint64) frompos);
+       }
 
-fail:
        /* and unlock now we're finished with it */
        camel_local_folder_unlock (lf);
 
@@ -199,13 +199,13 @@ mbox_folder_append_message_sync (CamelFolder *folder,
        }
 
        /* and we need to set the frompos/XEV explicitly */
-       ((CamelMboxMessageInfo *) mi)->frompos = mbs->folder_size;
+       camel_mbox_message_info_set_offset (CAMEL_MBOX_MESSAGE_INFO (mi), mbs->folder_size);
 #if 0
        xev = camel_local_summary_encode_x_evolution ((CamelLocalSummary *) folder->summary, mi);
        if (xev) {
                /* the x-ev header should match the 'current' flags, no problem, so store as much */
                camel_medium_set_header ((CamelMedium *) message, "X-Evolution", xev);
-               mi->flags &= ~ CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED;
+               camel_mesage_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED, 
0);
                g_free (xev);
        }
 #endif
@@ -232,8 +232,8 @@ mbox_folder_append_message_sync (CamelFolder *folder,
        g_object_unref (output_stream);
        g_free (fromline);
 
-       if (!((CamelMessageInfoBase *) mi)->preview && camel_folder_summary_get_need_preview 
(folder->summary)) {
-               if (camel_mime_message_build_preview ((CamelMimePart *) message, mi) && 
((CamelMessageInfoBase *) mi)->preview)
+       if (camel_folder_summary_get_need_preview (folder->summary) && !camel_message_info_get_preview (mi)) {
+               if (camel_mime_message_build_preview ((CamelMimePart *) message, mi) && 
camel_message_info_get_preview (mi))
                        camel_folder_summary_add_preview (folder->summary, mi);
        }
 
@@ -340,13 +340,11 @@ retry:
                goto fail;
        }
 
-       if (info->frompos == -1) {
-               camel_message_info_unref (info);
-               goto fail;
-       }
+       frompos = camel_mbox_message_info_get_offset (CAMEL_MBOX_MESSAGE_INFO (info));
+       g_clear_object (&info);
 
-       frompos = info->frompos;
-       camel_message_info_unref (info);
+       if (frompos == -1)
+               goto fail;
 
        /* we use an fd instead of a normal stream here - the reason is subtle, camel_mime_part will cache
         * the whole message in memory if the stream is non-seekable (which it is when built from a parser
diff --git a/camel/providers/local/camel-mbox-message-info.c b/camel/providers/local/camel-mbox-message-info.c
index 38ed6a0..3a66f7e 100644
--- a/camel/providers/local/camel-mbox-message-info.c
+++ b/camel/providers/local/camel-mbox-message-info.c
@@ -26,7 +26,7 @@
 
 #include "camel-mbox-message-info.h"
 
-struct _xCamelMboxMessageInfoPrivate {
+struct _CamelMboxMessageInfoPrivate {
        goffset offset;
 };
 
@@ -35,92 +35,115 @@ enum {
        PROP_OFFSET
 };
 
-G_DEFINE_TYPE (xCamelMboxMessageInfo, xcamel_mbox_message_info, XCAMEL_TYPE_MESSAGE_INFO_BASE)
+G_DEFINE_TYPE (CamelMboxMessageInfo, camel_mbox_message_info, CAMEL_TYPE_MESSAGE_INFO_BASE)
 
-static xCamelMessageInfo *
-mbox_message_info_clone (const xCamelMessageInfo *mi,
+static CamelMessageInfo *
+mbox_message_info_clone (const CamelMessageInfo *mi,
                         CamelFolderSummary *assign_summary)
 {
-       xCamelMessageInfo *result;
+       CamelMessageInfo *result;
 
-       g_return_val_if_fail (XCAMEL_IS_MBOX_MESSAGE_INFO (mi), NULL);
+       g_return_val_if_fail (CAMEL_IS_MBOX_MESSAGE_INFO (mi), NULL);
 
-       result = XCAMEL_MESSAGE_INFO_CLASS (xcamel_mbox_message_info_parent_class)->clone (mi, 
assign_summary);
+       result = CAMEL_MESSAGE_INFO_CLASS (camel_mbox_message_info_parent_class)->clone (mi, assign_summary);
        if (!result)
                return NULL;
 
-       if (XCAMEL_IS_MBOX_MESSAGE_INFO (result)) {
-               xCamelMboxMessageInfo *mmi, *mmi_result;
+       if (CAMEL_IS_MBOX_MESSAGE_INFO (result)) {
+               CamelMboxMessageInfo *mmi, *mmi_result;
 
-               mmi = XCAMEL_MBOX_MESSAGE_INFO (mi);
-               mmi_result = XCAMEL_MBOX_MESSAGE_INFO (result);
+               mmi = CAMEL_MBOX_MESSAGE_INFO (mi);
+               mmi_result = CAMEL_MBOX_MESSAGE_INFO (result);
 
-               xcamel_mbox_message_info_set_offset (mmi_result, xcamel_mbox_message_info_get_offset (mmi));
+               camel_mbox_message_info_set_offset (mmi_result, camel_mbox_message_info_get_offset (mmi));
        }
 
        return result;
 }
 
 static gboolean
-mbox_message_info_load (xCamelMessageInfo *mi,
+mbox_message_info_load (CamelMessageInfo *mi,
                        const CamelMIRecord *record,
                        /* const */ gchar **bdata_ptr)
 {
-       xCamelMboxMessageInfo *mmi;
+       CamelMboxMessageInfo *mmi;
        gint64 offset;
 
-       g_return_val_if_fail (XCAMEL_IS_MBOX_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MBOX_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_ptr != NULL, FALSE);
 
-       if (!XCAMEL_MESSAGE_INFO_CLASS (xcamel_mbox_message_info_parent_class)->load ||
-           !XCAMEL_MESSAGE_INFO_CLASS (xcamel_mbox_message_info_parent_class)->load (mi, record, bdata_ptr))
+       if (!CAMEL_MESSAGE_INFO_CLASS (camel_mbox_message_info_parent_class)->load ||
+           !CAMEL_MESSAGE_INFO_CLASS (camel_mbox_message_info_parent_class)->load (mi, record, bdata_ptr))
                return FALSE;
 
-       mmi = XCAMEL_MBOX_MESSAGE_INFO (mi);
+       mmi = CAMEL_MBOX_MESSAGE_INFO (mi);
 
-       offset = camel_message_info_util_bdata_get_number (bdata_ptr, -1);
+       offset = camel_util_bdata_get_number (bdata_ptr, -1);
        if (offset < 0)
                return FALSE;
 
-       xcamel_mbox_message_info_set_offset (mmi, offset);
+       camel_mbox_message_info_set_offset (mmi, offset);
 
        return TRUE;
 }
 
 static gboolean
-mbox_message_info_save (const xCamelMessageInfo *mi,
+mbox_message_info_save (const CamelMessageInfo *mi,
                        CamelMIRecord *record,
                        GString *bdata_str)
 {
-       xCamelMboxMessageInfo *mmi;
+       CamelMboxMessageInfo *mmi;
 
-       g_return_val_if_fail (XCAMEL_IS_MBOX_MESSAGE_INFO (mi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MBOX_MESSAGE_INFO (mi), FALSE);
        g_return_val_if_fail (record != NULL, FALSE);
        g_return_val_if_fail (bdata_str != NULL, FALSE);
 
-       if (!XCAMEL_MESSAGE_INFO_CLASS (xcamel_mbox_message_info_parent_class)->save ||
-           !XCAMEL_MESSAGE_INFO_CLASS (xcamel_mbox_message_info_parent_class)->save (mi, record, bdata_str))
+       if (!CAMEL_MESSAGE_INFO_CLASS (camel_mbox_message_info_parent_class)->save ||
+           !CAMEL_MESSAGE_INFO_CLASS (camel_mbox_message_info_parent_class)->save (mi, record, bdata_str))
                return FALSE;
 
-       mmi = XCAMEL_MBOX_MESSAGE_INFO (mi);
+       mmi = CAMEL_MBOX_MESSAGE_INFO (mi);
 
-       camel_message_info_util_bdata_put_number (bdata_str, xcamel_mbox_message_info_get_offset (mmi));
+       camel_util_bdata_put_number (bdata_str, camel_mbox_message_info_get_offset (mmi));
 
        return TRUE;
 }
 
+static gboolean
+mbox_message_info_set_flags (CamelMessageInfo *mi,
+                            guint32 mask,
+                            guint32 set)
+{
+       CamelFolderSummary *summary;
+       CamelMboxSummary *mbox_summary;
+
+       summary = camel_message_info_ref_summary (mi);
+       mbox_summary = summary ? CAMEL_MBOX_SUMMARY (summary) : NULL;
+
+       /* Basically, if anything could change the Status line, presume it does */
+       if (mbox_summary && mbox_summary->xstatus
+           && (mask & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_ANSWERED | 
CAMEL_MESSAGE_DELETED))) {
+               mask |= CAMEL_MESSAGE_FOLDER_XEVCHANGE | CAMEL_MESSAGE_FOLDER_FLAGGED;
+               set |= CAMEL_MESSAGE_FOLDER_XEVCHANGE | CAMEL_MESSAGE_FOLDER_FLAGGED;
+       }
+
+       g_clear_object (&summary);
+
+       return CAMEL_MESSAGE_INFO_CLASS (camel_mbox_message_info_parent_class)->set_flags (mi, mask, set);
+}
+
 static void
 mbox_message_info_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
                                GParamSpec *pspec)
 {
-       xCamelMboxMessageInfo *mmi = XCAMEL_MBOX_MESSAGE_INFO (object);
+       CamelMboxMessageInfo *mmi = CAMEL_MBOX_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_OFFSET:
-               xcamel_mbox_message_info_set_offset (mmi, g_value_get_int64 (value));
+               camel_mbox_message_info_set_offset (mmi, g_value_get_int64 (value));
                return;
        }
 
@@ -133,11 +156,11 @@ mbox_message_info_get_property (GObject *object,
                                GValue *value,
                                GParamSpec *pspec)
 {
-       xCamelMboxMessageInfo *mmi = XCAMEL_MBOX_MESSAGE_INFO (object);
+       CamelMboxMessageInfo *mmi = CAMEL_MBOX_MESSAGE_INFO (object);
 
        switch (property_id) {
        case PROP_OFFSET:
-               g_value_set_int64 (value, xcamel_mbox_message_info_get_offset (mmi));
+               g_value_set_int64 (value, camel_mbox_message_info_get_offset (mmi));
                return;
        }
 
@@ -145,24 +168,25 @@ mbox_message_info_get_property (GObject *object,
 }
 
 static void
-xcamel_mbox_message_info_class_init (xCamelMboxMessageInfoClass *class)
+camel_mbox_message_info_class_init (CamelMboxMessageInfoClass *class)
 {
-       xCamelMessageInfoClass *mi_class;
+       CamelMessageInfoClass *mi_class;
        GObjectClass *object_class;
 
-       g_type_class_add_private (class, sizeof (xCamelMboxMessageInfoPrivate));
+       g_type_class_add_private (class, sizeof (CamelMboxMessageInfoPrivate));
 
-       mi_class = XCAMEL_MESSAGE_INFO_CLASS (class);
+       mi_class = CAMEL_MESSAGE_INFO_CLASS (class);
        mi_class->clone = mbox_message_info_clone;
        mi_class->load = mbox_message_info_load;
        mi_class->save = mbox_message_info_save;
+       mi_class->set_flags = mbox_message_info_set_flags;
 
        object_class = G_OBJECT_CLASS (class);
        object_class->set_property = mbox_message_info_set_property;
        object_class->get_property = mbox_message_info_get_property;
 
        /**
-        * xCamelMboxMessageInfo:offset
+        * CamelMboxMessageInfo:offset
         *
         * Offset in the file to the related message.
         *
@@ -180,51 +204,51 @@ xcamel_mbox_message_info_class_init (xCamelMboxMessageInfoClass *class)
 }
 
 static void
-xcamel_mbox_message_info_init (xCamelMboxMessageInfo *vmi)
+camel_mbox_message_info_init (CamelMboxMessageInfo *vmi)
 {
-       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, XCAMEL_TYPE_MBOX_MESSAGE_INFO, 
xCamelMboxMessageInfoPrivate);
+       vmi->priv = G_TYPE_INSTANCE_GET_PRIVATE (vmi, CAMEL_TYPE_MBOX_MESSAGE_INFO, 
CamelMboxMessageInfoPrivate);
 }
 
 goffset
-xcamel_mbox_message_info_get_offset (const xCamelMboxMessageInfo *mmi)
+camel_mbox_message_info_get_offset (const CamelMboxMessageInfo *mmi)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        goffset result;
 
-       g_return_val_if_fail (XCAMEL_IS_MBOX_MESSAGE_INFO (mmi), 0);
+       g_return_val_if_fail (CAMEL_IS_MBOX_MESSAGE_INFO (mmi), 0);
 
-       mi = XCAMEL_MESSAGE_INFO (mmi);
+       mi = CAMEL_MESSAGE_INFO (mmi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
        result = mmi->priv->offset;
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
        return result;
 }
 
 gboolean
-xcamel_mbox_message_info_set_offset (xCamelMboxMessageInfo *mmi,
+camel_mbox_message_info_set_offset (CamelMboxMessageInfo *mmi,
                                    goffset offset)
 {
-       xCamelMessageInfo *mi;
+       CamelMessageInfo *mi;
        gboolean changed;
 
-       g_return_val_if_fail (XCAMEL_IS_MBOX_MESSAGE_INFO (mmi), FALSE);
+       g_return_val_if_fail (CAMEL_IS_MBOX_MESSAGE_INFO (mmi), FALSE);
 
-       mi = XCAMEL_MESSAGE_INFO (mmi);
+       mi = CAMEL_MESSAGE_INFO (mmi);
 
-       xcamel_message_info_property_lock (mi);
+       camel_message_info_property_lock (mi);
 
        changed = mmi->priv->offset != offset;
 
        if (changed)
                mmi->priv->offset = offset;
 
-       xcamel_message_info_property_unlock (mi);
+       camel_message_info_property_unlock (mi);
 
-       if (changed && !xcamel_message_info_get_loading (mi)) {
+       if (changed && !camel_message_info_get_abort_notifications (mi)) {
                g_object_notify (G_OBJECT (mmi), "offset");
-               xcamel_message_info_set_dirty (mi, TRUE);
+               camel_message_info_set_dirty (mi, TRUE);
        }
 
        return changed;
diff --git a/camel/providers/local/camel-mbox-message-info.h b/camel/providers/local/camel-mbox-message-info.h
index 1f86958..89d894d 100644
--- a/camel/providers/local/camel-mbox-message-info.h
+++ b/camel/providers/local/camel-mbox-message-info.h
@@ -15,53 +15,53 @@
  * along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef XCAMEL_MBOX_MESSAGE_INFO_H
-#define XCAMEL_MBOX_MESSAGE_INFO_H
+#ifndef CAMEL_MBOX_MESSAGE_INFO_H
+#define CAMEL_MBOX_MESSAGE_INFO_H
 
 #include <glib-object.h>
 
 #include <camel/camel.h>
 
 /* Standard GObject macros */
-#define XCAMEL_TYPE_MBOX_MESSAGE_INFO \
-       (xcamel_mbox_message_info_get_type ())
-#define XCAMEL_MBOX_MESSAGE_INFO(obj) \
+#define CAMEL_TYPE_MBOX_MESSAGE_INFO \
+       (camel_mbox_message_info_get_type ())
+#define CAMEL_MBOX_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), XCAMEL_TYPE_MBOX_MESSAGE_INFO, xCamelMboxMessageInfo))
-#define XCAMEL_MBOX_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MBOX_MESSAGE_INFO, CamelMboxMessageInfo))
+#define CAMEL_MBOX_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), XCAMEL_TYPE_MBOX_MESSAGE_INFO, xCamelMboxMessageInfoClass))
-#define XCAMEL_IS_MBOX_MESSAGE_INFO(obj) \
+       ((cls), CAMEL_TYPE_MBOX_MESSAGE_INFO, CamelMboxMessageInfoClass))
+#define CAMEL_IS_MBOX_MESSAGE_INFO(obj) \
        (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), XCAMEL_TYPE_MBOX_MESSAGE_INFO))
-#define XCAMEL_IS_MBOX_MESSAGE_INFO_CLASS(cls) \
+       ((obj), CAMEL_TYPE_MBOX_MESSAGE_INFO))
+#define CAMEL_IS_MBOX_MESSAGE_INFO_CLASS(cls) \
        (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), XCAMEL_TYPE_MBOX_MESSAGE_INFO))
-#define XCAMEL_MBOX_MESSAGE_INFO_GET_CLASS(obj) \
+       ((cls), CAMEL_TYPE_MBOX_MESSAGE_INFO))
+#define CAMEL_MBOX_MESSAGE_INFO_GET_CLASS(obj) \
        (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), XCAMEL_TYPE_MBOX_MESSAGE_INFO, xCamelMboxMessageInfoClass))
+       ((obj), CAMEL_TYPE_MBOX_MESSAGE_INFO, CamelMboxMessageInfoClass))
 
 G_BEGIN_DECLS
 
-typedef struct _xCamelMboxMessageInfo xCamelMboxMessageInfo;
-typedef struct _xCamelMboxMessageInfoClass xCamelMboxMessageInfoClass;
-typedef struct _xCamelMboxMessageInfoPrivate xCamelMboxMessageInfoPrivate;
+typedef struct _CamelMboxMessageInfo CamelMboxMessageInfo;
+typedef struct _CamelMboxMessageInfoClass CamelMboxMessageInfoClass;
+typedef struct _CamelMboxMessageInfoPrivate CamelMboxMessageInfoPrivate;
 
-struct _xCamelMboxMessageInfo {
-       xCamelMessageInfoBase parent;
-       xCamelMboxMessageInfoPrivate *priv;
+struct _CamelMboxMessageInfo {
+       CamelMessageInfoBase parent;
+       CamelMboxMessageInfoPrivate *priv;
 };
 
-struct _xCamelMboxMessageInfoClass {
-       xCamelMessageInfoBaseClass parent_class;
+struct _CamelMboxMessageInfoClass {
+       CamelMessageInfoBaseClass parent_class;
 };
 
-GType          xcamel_mbox_message_info_get_type       (void);
+GType          camel_mbox_message_info_get_type        (void);
 
-goffset                xcamel_mbox_message_info_get_offset     (const xCamelMboxMessageInfo *mmi);
-gboolean       xcamel_mbox_message_info_set_offset     (xCamelMboxMessageInfo *mmi,
+goffset                camel_mbox_message_info_get_offset      (const CamelMboxMessageInfo *mmi);
+gboolean       camel_mbox_message_info_set_offset      (CamelMboxMessageInfo *mmi,
                                                         goffset offset);
 
 G_END_DECLS
 
-#endif /* XCAMEL_MBOX_MESSAGE_INFO_H */
+#endif /* CAMEL_MBOX_MESSAGE_INFO_H */
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 5bdafd9..bae6c0e 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -40,8 +40,7 @@
 #define io(x)
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
 
-/* Enable the use of elm/pine style "Status" & "X-Status" headers */
-#define STATUS_PINE
+/* This uses elm/pine style "Status" & "X-Status" headers */
 
 #define CAMEL_MBOX_SUMMARY_VERSION (1)
 
@@ -63,13 +62,6 @@ static CamelFIRecord *
 static gboolean        summary_header_from_db          (CamelFolderSummary *,
                                                 CamelFIRecord *);
 static CamelMessageInfo *
-               message_info_from_db            (CamelFolderSummary *s,
-                                                CamelMIRecord *record);
-static CamelMIRecord *
-               message_info_to_db              (CamelFolderSummary *s,
-                                                CamelMessageInfo *info);
-
-static CamelMessageInfo *
                message_info_new_from_header    (CamelFolderSummary *,
                                                 struct _camel_header_raw *);
 static CamelMessageInfo *
@@ -77,7 +69,7 @@ static CamelMessageInfo *
                                                 CamelMimeParser *);
 
 static gchar * mbox_summary_encode_x_evolution (CamelLocalSummary *cls,
-                                                const CamelLocalMessageInfo *mi);
+                                                const CamelMessageInfo *mi);
 
 static gint    mbox_summary_check              (CamelLocalSummary *cls,
                                                 CamelFolderChangeInfo *changeinfo,
@@ -88,15 +80,12 @@ static gint mbox_summary_sync               (CamelLocalSummary *cls,
                                                 CamelFolderChangeInfo *changeinfo,
                                                 GCancellable *cancellable,
                                                 GError **error);
-#ifdef STATUS_PINE
 static CamelMessageInfo *
                mbox_summary_add                (CamelLocalSummary *cls,
                                                 CamelMimeMessage *msg,
                                                 const CamelMessageInfo *info,
                                                 CamelFolderChangeInfo *ci,
                                                 GError **error);
-#endif
-
 static gint    mbox_summary_sync_quick         (CamelMboxSummary *cls,
                                                 gboolean expunge,
                                                 CamelFolderChangeInfo *changeinfo,
@@ -108,7 +97,6 @@ static gint  mbox_summary_sync_full          (CamelMboxSummary *cls,
                                                 GCancellable *cancellable,
                                                 GError **error);
 
-#ifdef STATUS_PINE
 /* Which status flags are stored in each separate header */
 #define STATUS_XSTATUS \
        (CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED)
@@ -116,59 +104,12 @@ static gint       mbox_summary_sync_full          (CamelMboxSummary *cls,
 
 static void encode_status (guint32 flags, gchar status[8]);
 static guint32 decode_status (const gchar *status);
-#endif
 
 G_DEFINE_TYPE (
        CamelMboxSummary,
        camel_mbox_summary,
        CAMEL_TYPE_LOCAL_SUMMARY)
 
-static gboolean
-mbox_info_set_user_flag (CamelMessageInfo *mi,
-                         const gchar *name,
-                         gboolean value)
-{
-       gint res;
-
-       res = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->info_set_user_flag (mi, name, 
value);
-       if (res)
-               ((CamelLocalMessageInfo *) mi)->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-
-       return res;
-}
-
-static gboolean
-mbox_info_set_user_tag (CamelMessageInfo *mi,
-                        const gchar *name,
-                        const gchar *value)
-{
-       gint res;
-
-       res = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->info_set_user_tag (mi, name, 
value);
-       if (res)
-               ((CamelLocalMessageInfo *) mi)->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-
-       return res;
-}
-
-#ifdef STATUS_PINE
-static gboolean
-mbox_info_set_flags (CamelMessageInfo *mi,
-                     guint32 flags,
-                     guint32 set)
-{
-       /* Basically, if anything could change the Status line, presume it does */
-       if (((CamelMboxSummary *) mi->summary)->xstatus
-           && (flags & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_ANSWERED | 
CAMEL_MESSAGE_DELETED))) {
-               flags |= CAMEL_MESSAGE_FOLDER_XEVCHANGE | CAMEL_MESSAGE_FOLDER_FLAGGED;
-               set |= CAMEL_MESSAGE_FOLDER_XEVCHANGE | CAMEL_MESSAGE_FOLDER_FLAGGED;
-       }
-
-       return CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->
-               info_set_flags (mi, flags, set);
-}
-#endif
-
 static void
 camel_mbox_summary_class_init (CamelMboxSummaryClass *class)
 {
@@ -176,28 +117,17 @@ camel_mbox_summary_class_init (CamelMboxSummaryClass *class)
        CamelLocalSummaryClass *local_summary_class;
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_type = XCAMEL_TYPE_MBOX_MESSAGE_INFO;
-       folder_summary_class->message_info_size = sizeof (CamelMboxMessageInfo);
-       folder_summary_class->content_info_size = sizeof (CamelMboxMessageContentInfo);
+       folder_summary_class->message_info_type = CAMEL_TYPE_MBOX_MESSAGE_INFO;
        folder_summary_class->summary_header_from_db = summary_header_from_db;
        folder_summary_class->summary_header_to_db = summary_header_to_db;
-       folder_summary_class->message_info_from_db = message_info_from_db;
-       folder_summary_class->message_info_to_db = message_info_to_db;
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
        folder_summary_class->message_info_new_from_parser = message_info_new_from_parser;
-       folder_summary_class->info_set_user_flag = mbox_info_set_user_flag;
-       folder_summary_class->info_set_user_tag = mbox_info_set_user_tag;
-#ifdef STATUS_PINE
-       folder_summary_class->info_set_flags = mbox_info_set_flags;
-#endif
 
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (class);
        local_summary_class->encode_x_evolution = mbox_summary_encode_x_evolution;
        local_summary_class->check = mbox_summary_check;
        local_summary_class->sync = mbox_summary_sync;
-#ifdef STATUS_PINE
        local_summary_class->add = mbox_summary_add;
-#endif
 
        class->sync_quick = mbox_summary_sync_quick;
        class->sync_full = mbox_summary_sync_full;
@@ -252,20 +182,22 @@ void camel_mbox_summary_xstatus (CamelMboxSummary *mbs, gint state)
 
 static gchar *
 mbox_summary_encode_x_evolution (CamelLocalSummary *cls,
-                                 const CamelLocalMessageInfo *mi)
+                                 const CamelMessageInfo *mi)
 {
        const gchar *p, *uidstr;
-       guint32 uid;
+       guint32 uid, flags;
 
        /* This is busted, it is supposed to encode ALL DATA */
        p = uidstr = camel_message_info_get_uid (mi);
        while (*p && isdigit (*p))
                p++;
 
+       flags = camel_message_info_get_flags (mi);
+
        if (*p == 0 && sscanf (uidstr, "%u", &uid) == 1) {
-               return g_strdup_printf ("%08x-%04x", uid, mi->info.flags & 0xffff);
+               return g_strdup_printf ("%08x-%04x", uid, flags & 0xffff);
        } else {
-               return g_strdup_printf ("%s-%04x", uidstr, mi->info.flags & 0xffff);
+               return g_strdup_printf ("%s-%04x", uidstr, flags & 0xffff);
        }
 }
 
@@ -281,8 +213,8 @@ summary_header_from_db (CamelFolderSummary *s,
 
        part = fir->bdata;
        if (part) {
-               mbs->version = bdata_extract_digit (&part);
-               mbs->folder_size = bdata_extract_digit (&part);
+               mbs->version = camel_util_bdata_get_number (&part, 0);
+               mbs->folder_size = camel_util_bdata_get_number (&part, 0);
        }
 
        return TRUE;
@@ -313,15 +245,14 @@ static CamelMessageInfo *
 message_info_new_from_header (CamelFolderSummary *s,
                               struct _camel_header_raw *h)
 {
-       CamelMboxMessageInfo *mi;
+       CamelMessageInfo *mi;
        CamelMboxSummary *mbs = (CamelMboxSummary *) s;
 
-       mi = (CamelMboxMessageInfo *) CAMEL_FOLDER_SUMMARY_CLASS 
(camel_mbox_summary_parent_class)->message_info_new_from_header (s, h);
+       mi = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->message_info_new_from_header (s, 
h);
        if (mi) {
                const gchar *xev, *uid;
-               CamelMboxMessageInfo *info = NULL;
+               CamelMessageInfo *info = NULL;
                gint add = 0;   /* bitmask of things to add, 1 assign uid, 2, just add as new, 4 = recent */
-#ifdef STATUS_PINE
                const gchar *status = NULL, *xstatus = NULL;
                guint32 flags = 0;
 
@@ -334,24 +265,24 @@ message_info_new_from_header (CamelFolderSummary *s,
                        if (xstatus)
                                flags |= decode_status (xstatus);
                }
-#endif
+
                /* if we have an xev header, use it, else assign a new one */
                xev = camel_header_raw_find (&h, "X-Evolution", NULL);
                if (xev != NULL
-                   && camel_local_summary_decode_x_evolution ((CamelLocalSummary *) s, xev, &mi->info) == 0) 
{
+                   && camel_local_summary_decode_x_evolution ((CamelLocalSummary *) s, xev, mi) == 0) {
                        uid = camel_message_info_get_uid (mi);
                        d (printf ("found valid x-evolution: %s\n", uid));
                        /* If one is there, it should be there already */
-                       info = (CamelMboxMessageInfo *) camel_folder_summary_peek_loaded (s, uid);
+                       info = camel_folder_summary_peek_loaded (s, uid);
                        if (info) {
-                               if ((info->info.info.flags & CAMEL_MESSAGE_FOLDER_NOTSEEN)) {
-                                       info->info.info.flags &= ~CAMEL_MESSAGE_FOLDER_NOTSEEN;
-                                       camel_message_info_unref (mi);
+                               if ((camel_message_info_get_flags (info) & CAMEL_MESSAGE_FOLDER_NOTSEEN)) {
+                                       camel_message_info_set_flags (info, CAMEL_MESSAGE_FOLDER_NOTSEEN, 0);
+                                       g_clear_object (&mi);
                                        mi = info;
                                } else {
                                        add = 7;
                                        d (printf ("seen '%s' before, adding anew\n", uid));
-                                       camel_message_info_unref (info);
+                                       g_clear_object (&info);
                                }
                        } else {
                                add = 2;
@@ -362,22 +293,25 @@ message_info_new_from_header (CamelFolderSummary *s,
                        add = 7;
                }
 
-               if (add&1) {
-                       mi->info.info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
-                       camel_pstring_free (mi->info.info.uid);
-                       mi->info.info.uid = camel_pstring_add (camel_folder_summary_next_uid_string (s), 
TRUE);
+               if ((add & 1) != 0) {
+                       gchar *new_uid = camel_folder_summary_next_uid_string (s);
+
+                       camel_message_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_FLAGGED | 
CAMEL_MESSAGE_FOLDER_NOXEV, CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV);
+                       camel_message_info_set_uid (mi, new_uid);
+
+                       g_free (new_uid);
                } else {
                        camel_folder_summary_set_next_uid (s, strtoul (camel_message_info_get_uid (mi), NULL, 
10));
                }
-#ifdef STATUS_PINE
-               if (mbs->xstatus && add&2) {
+
+               if (mbs->xstatus && (add & 2) != 0) {
                        /* use the status as the flags when we read it the first time */
                        if (status)
-                               mi->info.info.flags = (mi->info.info.flags & ~(STATUS_STATUS)) | (flags & 
STATUS_STATUS);
+                               camel_message_info_set_flags (mi, STATUS_STATUS, flags);
                        if (xstatus)
-                               mi->info.info.flags = (mi->info.info.flags & ~(STATUS_XSTATUS)) | (flags & 
STATUS_XSTATUS);
+                               camel_message_info_set_flags (mi, STATUS_XSTATUS, flags);
                }
-#endif
+
                if (mbs->changes) {
                        if (add&2)
                                camel_folder_change_info_add_uid (mbs->changes, camel_message_info_get_uid 
(mi));
@@ -385,7 +319,7 @@ message_info_new_from_header (CamelFolderSummary *s,
                                camel_folder_change_info_recent_uid (mbs->changes, camel_message_info_get_uid 
(mi));
                }
 
-               mi->frompos = -1;
+               camel_mbox_message_info_set_offset (CAMEL_MBOX_MESSAGE_INFO (mi), -1);
        }
 
        return (CamelMessageInfo *) mi;
@@ -399,46 +333,12 @@ message_info_new_from_parser (CamelFolderSummary *s,
 
        mi = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->message_info_new_from_parser (s, 
mp);
        if (mi) {
-               CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) mi;
-
-               mbi->frompos = camel_mime_parser_tell_start_from (mp);
+               camel_mbox_message_info_set_offset (CAMEL_MBOX_MESSAGE_INFO (mi), 
camel_mime_parser_tell_start_from (mp));
        }
 
        return mi;
 }
 
-static CamelMessageInfo *
-message_info_from_db (CamelFolderSummary *s,
-                      struct _CamelMIRecord *mir)
-{
-       CamelMessageInfo *mi;
-
-       mi = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->message_info_from_db (s, mir);
-
-       if (mi) {
-               CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) mi;
-               gchar *part = mir->bdata;
-               if (part) {
-                       mbi->frompos = bdata_extract_digit (&part);
-               }
-       }
-
-       return mi;
-}
-
-static struct _CamelMIRecord *
-message_info_to_db (CamelFolderSummary *s,
-                    CamelMessageInfo *info)
-{
-       CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *) info;
-       struct _CamelMIRecord *mir;
-
-       mir = CAMEL_FOLDER_SUMMARY_CLASS (camel_mbox_summary_parent_class)->message_info_to_db (s, info);
-       mir->bdata = g_strdup_printf ("%" G_GOFFSET_FORMAT, mbi->frompos);
-
-       return mir;
-}
-
 /* like summary_rebuild, but also do changeinfo stuff (if supplied) */
 static gint
 summary_update (CamelLocalSummary *cls,
@@ -451,7 +351,7 @@ summary_update (CamelLocalSummary *cls,
        CamelFolderSummary *s = (CamelFolderSummary *) cls;
        CamelMboxSummary *mbs = (CamelMboxSummary *) cls;
        CamelMimeParser *mp;
-       CamelMboxMessageInfo *mi;
+       CamelMessageInfo *mi;
        CamelStore *parent_store;
        const gchar *full_name;
        gint fd;
@@ -507,12 +407,9 @@ summary_update (CamelLocalSummary *cls,
        camel_folder_summary_prepare_fetch_all (s, NULL);
        known_uids = camel_folder_summary_get_array (s);
        for (i = 0; known_uids && i < known_uids->len; i++) {
-               mi = (CamelMboxMessageInfo *) camel_folder_summary_get (s, g_ptr_array_index (known_uids, i));
-               if (offset == 0)
-                       mi->info.info.flags |= CAMEL_MESSAGE_FOLDER_NOTSEEN;
-               else
-                       mi->info.info.flags &= ~CAMEL_MESSAGE_FOLDER_NOTSEEN;
-               camel_message_info_unref (mi);
+               mi = camel_folder_summary_get (s, g_ptr_array_index (known_uids, i));
+               camel_message_info_set_flags (mi, CAMEL_MESSAGE_FOLDER_NOTSEEN, offset == 0 ? 
CAMEL_MESSAGE_FOLDER_NOTSEEN : 0);
+               g_clear_object (&mi);
        }
        camel_folder_summary_free_array (known_uids);
        mbs->changes = changeinfo;
@@ -545,19 +442,18 @@ summary_update (CamelLocalSummary *cls,
                if (!uid)
                        continue;
 
-               mi = (CamelMboxMessageInfo *) camel_folder_summary_get (s, uid);
+               mi = camel_folder_summary_get (s, uid);
                /* must've dissapeared from the file? */
-               if (!mi || mi->info.info.flags & CAMEL_MESSAGE_FOLDER_NOTSEEN) {
+               if (!mi || (camel_message_info_get_flags (mi) & CAMEL_MESSAGE_FOLDER_NOTSEEN) != 0) {
                        d (printf ("uid '%s' vanished, removing", uid));
                        if (changeinfo)
                                camel_folder_change_info_remove_uid (changeinfo, uid);
                        del = g_list_prepend (del, (gpointer) camel_pstring_strdup (uid));
                        if (mi)
-                               camel_folder_summary_remove (s, (CamelMessageInfo *) mi);
+                               camel_folder_summary_remove (s, mi);
                }
 
-               if (mi)
-                       camel_message_info_unref (mi);
+               g_clear_object (&mi);
        }
 
        if (known_uids)
@@ -631,7 +527,7 @@ mbox_summary_check (CamelLocalSummary *cls,
 
                        if (info) {
                                camel_folder_change_info_remove_uid (changes, camel_message_info_get_uid 
(info));
-                               camel_message_info_unref (info);
+                               g_clear_object (&info);
                        }
                }
                camel_folder_summary_free_array (known_uids);
@@ -794,20 +690,25 @@ cms_sort_frompos (gconstpointer a,
 {
        CamelFolderSummary *summary = (CamelFolderSummary *) data;
        CamelMboxMessageInfo *info1, *info2;
+       goffset afrompos, bfrompos;
        gint ret = 0;
 
        /* Things are in memory already. Sorting speeds up syncing, if things are sorted by from pos. */
        info1 = (CamelMboxMessageInfo *) camel_folder_summary_get (summary, *(gchar **) a);
        info2 = (CamelMboxMessageInfo *) camel_folder_summary_get (summary, *(gchar **) b);
 
-       if (info1->frompos > info2->frompos)
+       afrompos = camel_mbox_message_info_get_offset (info1);
+       bfrompos = camel_mbox_message_info_get_offset (info2);
+
+       if (afrompos > bfrompos)
                ret = 1;
-       else if  (info1->frompos < info2->frompos)
+       else if  (afrompos < bfrompos)
                ret = -1;
        else
                ret = 0;
-       camel_message_info_unref (info1);
-       camel_message_info_unref (info2);
+
+       g_clear_object (&info1);
+       g_clear_object (&info2);
 
        return ret;
 
@@ -825,7 +726,7 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
        CamelFolderSummary *s = (CamelFolderSummary *) mbs;
        CamelMimeParser *mp = NULL;
        gint i;
-       CamelMboxMessageInfo *info = NULL;
+       CamelMessageInfo *info = NULL;
        gint fd = -1, pfd;
        gchar *xevnew, *xevtmp;
        const gchar *xev;
@@ -875,24 +776,26 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
                g_ptr_array_sort_with_data (summary, cms_sort_frompos, mbs);
 
        for (i = 0; i < summary->len; i++) {
+               goffset frompos;
                gint xevoffset;
                gint pc = (i + 1) * 100 / summary->len;
 
                camel_operation_progress (cancellable, pc);
 
-               info = (CamelMboxMessageInfo *) camel_folder_summary_get (s, summary->pdata[i]);
+               info = camel_folder_summary_get (s, summary->pdata[i]);
 
-               d (printf ("Checking message %s %08x\n", camel_message_info_get_uid (info), 
((CamelMessageInfoBase *) info)->flags));
+               d (printf ("Checking message %s %08x\n", camel_message_info_get_uid (info), 
camel_message_info_get_flags (info)));
 
-               if ((info->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
-                       camel_message_info_unref (info);
-                       info = NULL;
+               if (!camel_message_info_get_folder_flagged (info)) {
+                       g_clear_object (&info);
                        continue;
                }
 
-               d (printf ("Updating message %s: %d\n", camel_message_info_get_uid (info), (gint) 
info->frompos));
+               frompos = camel_mbox_message_info_get_offset (CAMEL_MBOX_MESSAGE_INFO (info));
 
-               camel_mime_parser_seek (mp, info->frompos, SEEK_SET);
+               d (printf ("Updating message %s: %d\n", camel_message_info_get_uid (info), (gint) frompos));
+
+               camel_mime_parser_seek (mp, frompos, SEEK_SET);
 
                if (camel_mime_parser_step (mp, NULL, NULL) != CAMEL_MIME_PARSER_STATE_FROM) {
                        g_set_error (
@@ -901,10 +804,10 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
                        goto error;
                }
 
-               if (camel_mime_parser_tell_start_from (mp) != info->frompos) {
+               if (camel_mime_parser_tell_start_from (mp) != frompos) {
                        g_warning (
                                "Didn't get the next message where I expected (%d) got %d instead",
-                               (gint) info->frompos, (gint) camel_mime_parser_tell_start_from (mp));
+                               (gint) frompos, (gint) camel_mime_parser_tell_start_from (mp));
                        g_set_error (
                                error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                                _("Summary and folder mismatch, even after a sync"));
@@ -921,7 +824,7 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
                        g_warning ("We're supposed to have a valid x-ev header, but we dont");
                        goto error;
                }
-               xevnew = camel_local_summary_encode_x_evolution (cls, &info->info);
+               xevnew = camel_local_summary_encode_x_evolution (cls, info);
                /* SIGH: encode_param_list is about the only function which folds headers by itself.
                 * This should be fixed somehow differently (either parser doesn't fold headers,
                 * or param_list doesn't, or something */
@@ -953,10 +856,8 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
                camel_mime_parser_drop_step (mp);
                camel_mime_parser_drop_step (mp);
 
-               info->info.info.flags &= 0xffff;
-               info->info.info.dirty = TRUE;
-               camel_message_info_unref (info);
-               info = NULL;
+               camel_message_info_set_flags (info, 0xffff, camel_message_info_get_flags (info));
+               g_clear_object (&info);
        }
 
        d (printf ("Closing folders\n"));
@@ -987,7 +888,7 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
        if (fd != -1)
                close (fd);
        if (info)
-               camel_message_info_unref (info);
+               g_clear_object (&info);
 
        camel_operation_pop_message (cancellable);
        camel_folder_summary_unlock (s);
@@ -1027,14 +928,14 @@ mbox_summary_sync (CamelLocalSummary *cls,
 
        summary = camel_folder_summary_get_changed ((CamelFolderSummary *) mbs);
        for (i = 0; i < summary->len; i++) {
-               CamelMboxMessageInfo *info = (CamelMboxMessageInfo *) camel_folder_summary_get (s, 
summary->pdata[i]);
+               CamelMessageInfo *info = camel_folder_summary_get (s, summary->pdata[i]);
 
-               if ((expunge && (info->info.info.flags & CAMEL_MESSAGE_DELETED)) ||
-                   (info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_XEVCHANGE)))
+               if ((expunge && (camel_message_info_get_flags (info) & CAMEL_MESSAGE_DELETED) != 0) ||
+                   (camel_message_info_get_flags (info) & (CAMEL_MESSAGE_FOLDER_NOXEV | 
CAMEL_MESSAGE_FOLDER_XEVCHANGE)) != 0)
                        quick = FALSE;
                else
-                       work |= (info->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
-               camel_message_info_unref (info);
+                       work |= camel_message_info_get_folder_flagged (info);
+               g_clear_object (&info);
        }
 
        g_ptr_array_foreach (summary, (GFunc) camel_pstring_free, NULL);
@@ -1108,7 +1009,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
        CamelStore *parent_store;
        const gchar *full_name;
        gint i;
-       CamelMboxMessageInfo *info = NULL;
+       CamelMessageInfo *info = NULL;
        gchar *buffer, *xevnew = NULL;
        gsize len;
        const gchar *fromline;
@@ -1116,9 +1017,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
        gboolean touched = FALSE;
        GList *del = NULL;
        GPtrArray *known_uids = NULL;
-#ifdef STATUS_PINE
        gchar statnew[8], xstatnew[8];
-#endif
 
        d (printf ("performing full summary/sync\n"));
 
@@ -1148,10 +1047,11 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                g_ptr_array_sort_with_data (known_uids, cms_sort_frompos, mbs);
        for (i = 0; known_uids && i < known_uids->len; i++) {
                gint pc = (i + 1) * 100 / known_uids->len;
+               goffset frompos;
 
                camel_operation_progress (cancellable, pc);
 
-               info = (CamelMboxMessageInfo *) camel_folder_summary_get (s, g_ptr_array_index (known_uids, 
i));
+               info = camel_folder_summary_get (s, g_ptr_array_index (known_uids, i));
 
                if (!info)
                        continue;
@@ -1160,13 +1060,15 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                        "Looking at message %s\n",
                        camel_message_info_get_uid (info)));
 
+               frompos = camel_mbox_message_info_get_offset (CAMEL_MBOX_MESSAGE_INFO (info));
+
                d (printf (
                        "seeking (%s) to %d\n",
-                       ((CamelMessageInfo *) info)->uid,
-                       (gint) info->frompos));
+                       camel_message_info_get_uid (info),
+                       (gint) frompos));
 
                if (lastdel)
-                       camel_mime_parser_seek (mp, info->frompos, SEEK_SET);
+                       camel_mime_parser_seek (mp, frompos, SEEK_SET);
 
                if (camel_mime_parser_step (mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_FROM) {
                        g_set_error (
@@ -1176,10 +1078,10 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                        goto error;
                }
 
-               if (camel_mime_parser_tell_start_from (mp) != info->frompos) {
+               if (camel_mime_parser_tell_start_from (mp) != frompos) {
                        g_warning (
                                "Didn't get the next message where I expected (%d) got %d instead",
-                               (gint) info->frompos,
+                               (gint) frompos,
                                (gint) camel_mime_parser_tell_start_from (mp));
                        g_set_error (
                                error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
@@ -1188,7 +1090,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                }
 
                lastdel = FALSE;
-               if ((flags&1) && info->info.info.flags & CAMEL_MESSAGE_DELETED) {
+               if ((flags & 1) && (camel_message_info_get_flags (info) & CAMEL_MESSAGE_DELETED) != 0) {
                        const gchar *uid = camel_message_info_get_uid (info);
                        d (printf ("Deleting %s\n", uid));
 
@@ -1199,8 +1101,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                        camel_folder_change_info_remove_uid (changeinfo, uid);
                        camel_folder_summary_remove (s, (CamelMessageInfo *) info);
                        del = g_list_prepend (del, (gpointer) camel_pstring_strdup (uid));
-                       camel_message_info_unref (info);
-                       info = NULL;
+                       g_clear_object (&info);
                        lastdel = TRUE;
                        touched = TRUE;
                } else {
@@ -1209,33 +1110,33 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                        if (i > 0)
                                write (fdout, "\n", 1);
 #endif
-                       info->frompos = lseek (fdout, 0, SEEK_CUR);
-                       ((CamelMessageInfo *) info)->dirty = TRUE;
+                       frompos = lseek (fdout, 0, SEEK_CUR);
+                       camel_mbox_message_info_set_offset (CAMEL_MBOX_MESSAGE_INFO (info), frompos);
+                       camel_message_info_set_dirty (info, TRUE);
                        fromline = camel_mime_parser_from_line (mp);
-                       d (printf ("Saving %s:%d\n", camel_message_info_get_uid (info), info->frompos));
+                       d (printf ("Saving %s:%d\n", camel_message_info_get_uid (info), frompos));
                        g_warn_if_fail (write (fdout, fromline, strlen (fromline)) != -1);
                }
 
-               if (info && info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | 
CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                       d (printf ("Updating header for %s flags = %08x\n", camel_message_info_get_uid 
(info), info->info.flags));
+               if (info && (camel_message_info_get_flags (info) & (CAMEL_MESSAGE_FOLDER_NOXEV | 
CAMEL_MESSAGE_FOLDER_FLAGGED)) != 0) {
+                       d (printf ("Updating header for %s flags = %08x\n", camel_message_info_get_uid 
(info), camel_message_info_get_flags (info)));
 
                        if (camel_mime_parser_step (mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_FROM_END) {
                                g_warning ("camel_mime_parser_step failed (2)");
                                goto error;
                        }
 
-                       xevnew = camel_local_summary_encode_x_evolution ((CamelLocalSummary *) cls, 
&info->info);
-#ifdef STATUS_PINE
+                       xevnew = camel_local_summary_encode_x_evolution ((CamelLocalSummary *) cls, info);
                        if (mbs->xstatus) {
-                               encode_status (info->info.info.flags & STATUS_STATUS, statnew);
-                               encode_status (info->info.info.flags & STATUS_XSTATUS, xstatnew);
+                               guint32 flags = camel_message_info_get_flags (info);
+
+                               encode_status (flags & STATUS_STATUS, statnew);
+                               encode_status (flags & STATUS_XSTATUS, xstatnew);
                                len = camel_local_summary_write_headers (fdout, camel_mime_parser_headers_raw 
(mp), xevnew, statnew, xstatnew);
                        } else {
-#endif
                                len = camel_local_summary_write_headers (fdout, camel_mime_parser_headers_raw 
(mp), xevnew, NULL, NULL);
-#ifdef STATUS_PINE
                        }
-#endif
+
                        if (len == -1) {
                                d (printf ("Error writing to temporary mailbox\n"));
                                g_set_error (
@@ -1245,7 +1146,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                                        g_strerror (errno));
                                goto error;
                        }
-                       info->info.info.flags &= 0xffff;
+                       camel_message_info_set_flags (info, 0xffff, camel_message_info_get_flags (info));
                        g_free (xevnew);
                        xevnew = NULL;
                        camel_mime_parser_drop_step (mp);
@@ -1281,8 +1182,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
                                (gint) camel_mime_parser_tell (mp),
                                (gint) camel_mime_parser_tell_start_from (mp)));
                        camel_mime_parser_unstep (mp);
-                       camel_message_info_unref (info);
-                       info = NULL;
+                       g_clear_object (&info);
                }
        }
 
@@ -1302,17 +1202,10 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
 
        /* clear working flags */
        for (i = 0; known_uids && i < known_uids->len; i++) {
-               info = (CamelMboxMessageInfo *) camel_folder_summary_get (s, g_ptr_array_index (known_uids, 
i));
+               info = camel_folder_summary_get (s, g_ptr_array_index (known_uids, i));
                if (info) {
-                       if (info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | 
CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_XEVCHANGE)) {
-                               info->info.info.flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV
-                                                          |CAMEL_MESSAGE_FOLDER_FLAGGED
-                                                          |CAMEL_MESSAGE_FOLDER_XEVCHANGE);
-                               ((CamelMessageInfo *) info)->dirty = TRUE;
-                               camel_folder_summary_touch (s);
-                       }
-                       camel_message_info_unref (info);
-                       info = NULL;
+                       camel_message_info_set_flags (info, CAMEL_MESSAGE_FOLDER_NOXEV | 
CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_XEVCHANGE, 0);
+                       g_clear_object (&info);
                }
        }
 
@@ -1327,9 +1220,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
  error:
        g_free (xevnew);
        g_object_unref (mp);
-
-       if (info)
-               camel_message_info_unref (info);
+       g_clear_object (&info);
 
        camel_folder_summary_free_array (known_uids);
        camel_folder_summary_unlock (s);
@@ -1337,7 +1228,6 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
        return -1;
 }
 
-#ifdef STATUS_PINE
 static CamelMessageInfo *
 mbox_summary_add (CamelLocalSummary *cls,
                   CamelMimeMessage *msg,
@@ -1346,23 +1236,23 @@ mbox_summary_add (CamelLocalSummary *cls,
                   GError **error)
 {
        CamelLocalSummaryClass *local_summary_class;
-       CamelMboxMessageInfo *mi;
+       CamelMessageInfo *mi;
 
        /* Chain up to parent's add() method. */
        local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_mbox_summary_parent_class);
-       mi = (CamelMboxMessageInfo *) local_summary_class->add (
-               cls, msg, info, ci, error);
+       mi = local_summary_class->add (cls, msg, info, ci, error);
        if (mi && ((CamelMboxSummary *) cls)->xstatus) {
                gchar status[8];
+               guint32 flags = camel_message_info_get_flags (mi);
 
                /* we snoop and add status/x-status headers to suit */
-               encode_status (mi->info.info.flags & STATUS_STATUS, status);
+               encode_status (flags & STATUS_STATUS, status);
                camel_medium_set_header ((CamelMedium *) msg, "Status", status);
-               encode_status (mi->info.info.flags & STATUS_XSTATUS, status);
+               encode_status (flags & STATUS_XSTATUS, status);
                camel_medium_set_header ((CamelMedium *) msg, "X-Status", status);
        }
 
-       return (CamelMessageInfo *) mi;
+       return mi;
 }
 
 static struct {
@@ -1407,5 +1297,3 @@ decode_status (const gchar *status)
 
        return flags;
 }
-
-#endif /* STATUS_PINE */
diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h
index 37f6bad..594cca4 100644
--- a/camel/providers/local/camel-mbox-summary.h
+++ b/camel/providers/local/camel-mbox-summary.h
@@ -45,12 +45,6 @@ G_BEGIN_DECLS
 typedef struct _CamelMboxSummary CamelMboxSummary;
 typedef struct _CamelMboxSummaryClass CamelMboxSummaryClass;
 
-typedef struct _CamelMboxMessageInfo {
-       CamelLocalMessageInfo info;
-
-       goffset frompos;
-} CamelMboxMessageInfo;
-
 struct _CamelMboxSummary {
        CamelLocalSummary parent;
 
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index 2a745e6..b47c04e 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -159,7 +159,7 @@ mh_folder_get_message_sync (CamelFolder *folder,
        }
 
        /* we only need it to check the message exists */
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 
        name = g_strdup_printf ("%s/%s", lf->folder_path, uid);
        message_stream = camel_stream_fs_new_with_name (
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index 09372e5..acbd2c2 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -45,7 +45,7 @@
 
 static gint mh_summary_check (CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GCancellable 
*cancellable, GError **error);
 static gint mh_summary_sync (CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, 
GCancellable *cancellable, GError **error);
-static gint mh_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo 
*info);
+static gint mh_summary_decode_x_evolution (CamelLocalSummary *cls, const gchar *xev, CamelMessageInfo *info);
 /*static gint mh_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, CamelMessageInfo *info, 
CamelFolderChangeInfo *, GError **error);*/
 
 static gchar *mh_summary_next_uid_string (CamelFolderSummary *s);
@@ -204,7 +204,7 @@ remove_summary (gchar *key,
        if (cls->index)
                camel_index_delete_name (cls->index, camel_message_info_get_uid (info));
        camel_folder_summary_remove ((CamelFolderSummary *) cls, info);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 }
 
 static gint
@@ -267,11 +267,11 @@ mh_summary_check (CamelLocalSummary *cls,
 
                                        if (old) {
                                                g_hash_table_remove (left, camel_message_info_get_uid (info));
-                                               camel_message_info_unref (old);
+                                               g_clear_object (&old);
                                        }
 
                                        camel_folder_summary_remove ((CamelFolderSummary *) cls, info);
-                                       camel_message_info_unref (info);
+                                       g_clear_object (&info);
                                }
                                camel_mh_summary_add (cls, d->d_name, forceindex, cancellable);
                        } else {
@@ -280,9 +280,9 @@ mh_summary_check (CamelLocalSummary *cls,
 
                                if (old) {
                                        g_hash_table_remove (left, uid);
-                                       camel_message_info_unref (old);
+                                       g_clear_object (&old);
                                }
-                               camel_message_info_unref (info);
+                               g_clear_object (&info);
                        }
                }
        }
@@ -304,7 +304,7 @@ mh_summary_sync (CamelLocalSummary *cls,
        CamelLocalSummaryClass *local_summary_class;
        gint i;
        GPtrArray *known_uids;
-       CamelLocalMessageInfo *info;
+       CamelMessageInfo *info;
        gchar *name;
        const gchar *uid;
 
@@ -320,9 +320,9 @@ mh_summary_sync (CamelLocalSummary *cls,
        camel_folder_summary_prepare_fetch_all ((CamelFolderSummary *) cls, error);
        known_uids = camel_folder_summary_get_array ((CamelFolderSummary *) cls);
        for (i = (known_uids ? known_uids->len : 0) - 1; i >= 0; i--) {
-               info = (CamelLocalMessageInfo *) camel_folder_summary_get ((CamelFolderSummary *) cls, 
g_ptr_array_index (known_uids, i));
+               info = camel_folder_summary_get ((CamelFolderSummary *) cls, g_ptr_array_index (known_uids, 
i));
                g_return_val_if_fail (info, -1);
-               if (expunge && (info->info.flags & CAMEL_MESSAGE_DELETED)) {
+               if (expunge && (camel_message_info_get_flags (info) & CAMEL_MESSAGE_DELETED) != 0) {
                        uid = camel_message_info_get_uid (info);
                        name = g_strdup_printf ("%s/%s", cls->folder_path, uid);
                        d (printf ("deleting %s\n", name));
@@ -336,10 +336,10 @@ mh_summary_sync (CamelLocalSummary *cls,
                                camel_folder_summary_remove ((CamelFolderSummary *) cls, (CamelMessageInfo *) 
info);
                        }
                        g_free (name);
-               } else if (info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                       info->info.flags &= 0xffff;
+               } else if ((camel_message_info_get_flags (info) & (CAMEL_MESSAGE_FOLDER_NOXEV | 
CAMEL_MESSAGE_FOLDER_FLAGGED)) != 0) {
+                       camel_message_info_set_flags (info, 0xffff, camel_message_info_get_flags (info));
                }
-               camel_message_info_unref (info);
+               g_clear_object (&info);
        }
 
        camel_folder_summary_free_array (known_uids);
@@ -352,7 +352,7 @@ mh_summary_sync (CamelLocalSummary *cls,
 static gint
 mh_summary_decode_x_evolution (CamelLocalSummary *cls,
                                const gchar *xev,
-                               CamelLocalMessageInfo *info)
+                               CamelMessageInfo *info)
 {
        CamelLocalSummaryClass *local_summary_class;
        CamelMhSummary *mh_summary;
@@ -367,8 +367,7 @@ mh_summary_decode_x_evolution (CamelLocalSummary *cls,
        /* do not use UID from the header, rather use the one provided, if any */
        mh_summary = CAMEL_MH_SUMMARY (cls);
        if (mh_summary->priv->current_uid) {
-               camel_pstring_free (info->info.uid);
-               info->info.uid = camel_pstring_strdup (mh_summary->priv->current_uid);
+               camel_message_info_set_uid (info, mh_summary->priv->current_uid);
        }
 
        return ret;
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index 1b6c835..e82a6bc 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -33,10 +33,11 @@
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
-#include "camel-spool-summary.h"
 #include "camel-local-private.h"
 #include "camel-win32.h"
 
+#include "camel-spool-summary.h"
+
 #define io(x)
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
 
@@ -334,10 +335,10 @@ spool_summary_check (CamelLocalSummary *cls,
        camel_folder_summary_prepare_fetch_all (s, error);
        known_uids = camel_folder_summary_get_array (s);
        for (i = 0; !work && known_uids && i < known_uids->len; i++) {
-               CamelMboxMessageInfo *info = (CamelMboxMessageInfo *) camel_folder_summary_get (s, 
g_ptr_array_index (known_uids, i));
+               CamelMessageInfo *info = camel_folder_summary_get (s, g_ptr_array_index (known_uids, i));
                g_return_val_if_fail (info, -1);
-               work = (info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV)) != 0;
-               camel_message_info_unref (info);
+               work = (camel_message_info_get_flags (info) & (CAMEL_MESSAGE_FOLDER_NOXEV)) != 0;
+               g_clear_object (&info);
        }
        camel_folder_summary_free_array (known_uids);
 
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index ad65baf..490348e 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -191,14 +191,8 @@ unset_flagged_flag (const gchar *uid,
 
        info = camel_folder_summary_get (summary, uid);
        if (info) {
-               CamelMessageInfoBase *base = (CamelMessageInfoBase *) info;
-
-               if ((base->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0) {
-                       base->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
-                       base->dirty = TRUE;
-               }
-
-               camel_message_info_unref (info);
+               camel_message_info_set_folder_flagged (info, FALSE);
+               g_clear_object (&info);
        }
 }
 
@@ -551,7 +545,7 @@ nntp_folder_expunge_sync (CamelFolder *folder,
                        camel_folder_summary_remove (summary, info);
                }
 
-               camel_message_info_unref (info);
+               g_clear_object (&info);
        }
 
        camel_folder_summary_save_to_db (summary, NULL);
diff --git a/camel/providers/nntp/camel-nntp-summary.c b/camel/providers/nntp/camel-nntp-summary.c
index 32b15a8..563059c 100644
--- a/camel/providers/nntp/camel-nntp-summary.c
+++ b/camel/providers/nntp/camel-nntp-summary.c
@@ -67,8 +67,6 @@ camel_nntp_summary_class_init (CamelNNTPSummaryClass *class)
        g_type_class_add_private (class, sizeof (CamelNNTPSummaryPrivate));
 
        folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_size = sizeof (CamelMessageInfoBase);
-       folder_summary_class->content_info_size = sizeof (CamelMessageContentInfo);
        folder_summary_class->message_info_new_from_header = message_info_new_from_header;
        folder_summary_class->summary_header_from_db = summary_header_from_db;
        folder_summary_class->summary_header_to_db = summary_header_to_db;
@@ -101,22 +99,21 @@ static CamelMessageInfo *
 message_info_new_from_header (CamelFolderSummary *s,
                               struct _camel_header_raw *h)
 {
-       CamelMessageInfoBase *mi;
+       CamelMessageInfo *mi;
        CamelNNTPSummary *cns = (CamelNNTPSummary *) s;
 
        /* error to call without this setup */
        if (cns->priv->uid == NULL)
                return NULL;
 
-       mi = (CamelMessageInfoBase *) CAMEL_FOLDER_SUMMARY_CLASS 
(camel_nntp_summary_parent_class)->message_info_new_from_header (s, h);
+       mi = CAMEL_FOLDER_SUMMARY_CLASS (camel_nntp_summary_parent_class)->message_info_new_from_header (s, 
h);
        if (mi) {
-               camel_pstring_free (mi->uid);
-               mi->uid = camel_pstring_strdup (cns->priv->uid);
+               camel_message_info_set_uid (mi, cns->priv->uid);
                g_free (cns->priv->uid);
                cns->priv->uid = NULL;
        }
 
-       return (CamelMessageInfo *) mi;
+       return mi;
 }
 
 static gboolean
@@ -131,9 +128,9 @@ summary_header_from_db (CamelFolderSummary *s,
 
        part = mir->bdata;
 
-       cns->version = bdata_extract_digit (&part);
-       cns->high = bdata_extract_digit (&part);
-       cns->low = bdata_extract_digit (&part);
+       cns->version = camel_util_bdata_get_number (&part, 0);
+       cns->high = camel_util_bdata_get_number (&part, 0);
+       cns->low = camel_util_bdata_get_number (&part, 0);
 
        return TRUE;
 }
@@ -270,7 +267,7 @@ add_range_xover (CamelNNTPSummary *cns,
                                CamelMessageInfo *mi;
 
                                mi = camel_folder_summary_info_new_from_header (s, headers);
-                               ((CamelMessageInfoBase *) mi)->size = size;
+                               camel_message_info_set_size (mi, size);
                                camel_folder_summary_add (s, mi);
 
                                cns->high = n;
@@ -506,7 +503,7 @@ camel_nntp_summary_check (CamelNNTPSummary *cns,
                                        mi = camel_folder_summary_peek_loaded (s, uid);
                                        if (mi) {
                                                camel_folder_summary_remove (s, mi);
-                                               camel_message_info_unref (mi);
+                                               g_clear_object (&mi);
                                        } else {
                                                camel_folder_summary_remove_uid (s, uid);
                                        }
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 8f91e1c..6e9b17b 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -374,8 +374,8 @@ pop3_folder_get_filename (CamelFolder *folder,
 static gboolean
 pop3_folder_set_message_flags (CamelFolder *folder,
                                const gchar *uid,
-                               CamelMessageFlags flags,
-                               CamelMessageFlags set)
+                               guint32 flags,
+                               guint32 set)
 {
        CamelPOP3Folder *pop3_folder = CAMEL_POP3_FOLDER (folder);
        CamelPOP3FolderInfo *fi;
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index 4db8c89..a2edadb 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -52,7 +52,7 @@ test_folder_counts (CamelFolder *folder,
                info = camel_folder_get_message_info (folder, s->pdata[i]);
                if (camel_message_info_get_flags (info) & CAMEL_MESSAGE_SEEN)
                        myunread--;
-               camel_message_info_unref (info);
+               g_clear_object (&info);
        }
        check (unread == myunread);
        camel_folder_free_uids (folder, s);
@@ -109,7 +109,7 @@ test_folder_message (CamelFolder *folder,
        info = camel_folder_get_message_info (folder, uid);
        check (info != NULL);
        check (strcmp (camel_message_info_get_uid (info), uid) == 0);
-       camel_message_info_unref (info);
+       g_clear_object (&info);
 
        /* then, getting message */
        msg = camel_folder_get_message_sync (folder, uid, NULL, &error);
@@ -462,7 +462,7 @@ test_folder_message_ops (CamelSession *session,
                                check_msg (
                                        strcmp (camel_message_info_get_subject (info), subject) == 0,
                                        "info->subject %s", camel_message_info_get_subject (info));
-                               camel_message_info_unref (info);
+                               g_clear_object (&info);
                        }
                        camel_folder_free_uids (folder, uids);
                        pull ();
@@ -515,7 +515,7 @@ test_folder_message_ops (CamelSession *session,
                                strcmp (camel_message_info_get_subject (info), subject) == 0,
                                "info->subject %s", camel_message_info_get_subject (info));
                        test_free (subject);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                        pull ();
                }
 
@@ -544,7 +544,7 @@ test_folder_message_ops (CamelSession *session,
                                strcmp (camel_message_info_get_subject (info), subject) == 0,
                                "info->subject %s", camel_message_info_get_subject (info));
                        test_free (subject);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                        pull ();
                }
                pull ();
@@ -575,7 +575,7 @@ test_folder_message_ops (CamelSession *session,
                                strcmp (camel_message_info_get_subject (info), subject) == 0,
                                "info->subject %s", camel_message_info_get_subject (info));
                        test_free (subject);
-                       camel_message_info_unref (info);
+                       g_clear_object (&info);
                        pull ();
                }
                pull ();



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