[evolution-data-server] Remove camel_folder_summary_add_from_message().



commit 51ef37bd191995ad8ee643af339e7551efb1f516
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Sep 19 16:02:37 2013 -0400

    Remove camel_folder_summary_add_from_message().
    
    Trivial function, not worth the API bloat.  Do this instead:
    
      info = camel_folder_summary_info_new_from_message (summary, message, NULL);
      camel_folder_summary_add (summary, info);

 camel/camel-folder-summary.c                |   20 -------
 camel/camel-folder-summary.h                |    6 --
 camel/providers/local/camel-local-summary.c |   76 ++++++++++++++-------------
 docs/reference/camel/camel-sections.txt     |    1 -
 4 files changed, 39 insertions(+), 64 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index a3668cd..ffdc074 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -2994,26 +2994,6 @@ camel_folder_summary_insert (CamelFolderSummary *summary,
 }
 
 /**
- * camel_folder_summary_add_from_message:
- * @summary: a #CamelFolderSummary object
- * @message: a #CamelMimeMessage object
- *
- * Add a summary item from an existing message.
- *
- * Returns: the newly added record
- **/
-CamelMessageInfo *
-camel_folder_summary_add_from_message (CamelFolderSummary *summary,
-                                       CamelMimeMessage *msg)
-{
-       CamelMessageInfo *info = camel_folder_summary_info_new_from_message (summary, msg, NULL);
-
-       camel_folder_summary_add (summary, info);
-
-       return info;
-}
-
-/**
  * camel_folder_summary_info_new_from_header:
  * @summary: a #CamelFolderSummary object
  * @headers: rfc822 headers
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 25bda2b..546383b 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -454,12 +454,6 @@ void               camel_folder_summary_add_preview
                                                (CamelFolderSummary *summary,
                                                 CamelMessageInfo *info);
 
-/* build/add raw summary items */
-CamelMessageInfo *
-               camel_folder_summary_add_from_message
-                                               (CamelFolderSummary *summary,
-                                                CamelMimeMessage *message);
-
 /* add a new raw summary item */
 void           camel_folder_summary_add        (CamelFolderSummary *summary,
                                                 CamelMessageInfo *info);
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 36fc3e1..0ee829f 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -518,55 +518,57 @@ local_summary_add (CamelLocalSummary *cls,
                    CamelFolderChangeInfo *ci,
                    GError **error)
 {
-       CamelLocalMessageInfo *mi;
+       CamelFolderSummary *summary;
+       CamelMessageInfo *mi;
+       CamelMessageInfoBase *mi_base;
        gchar *xev;
 
        d (printf ("Adding message to summary\n"));
 
-       mi = (CamelLocalMessageInfo *) camel_folder_summary_add_from_message ((CamelFolderSummary *) cls, 
msg);
-       if (mi) {
-               /*d(printf("Added, uid = %s\n", mi->uid));*/
-               if (info) {
-                       const CamelTag *tag = camel_message_info_user_tags (info);
-                       const CamelFlag *flag = camel_message_info_user_flags (info);
+       summary = CAMEL_FOLDER_SUMMARY (cls);
 
-                       while (flag) {
-                               camel_message_info_set_user_flag ((CamelMessageInfo *) mi, flag->name, TRUE);
-                               flag = flag->next;
-                       }
+       mi = camel_folder_summary_info_new_from_message (summary, msg, NULL);
+       camel_folder_summary_add (summary, mi);
 
-                       while (tag) {
-                               camel_message_info_set_user_tag ((CamelMessageInfo *) mi, tag->name, 
tag->value);
-                               tag = tag->next;
-                       }
+       mi_base = (CamelMessageInfoBase *) mi;
 
-                       camel_message_info_set_flags ((CamelMessageInfo *) mi, 0xffff, 
camel_message_info_flags (info));
-                       mi->info.size = camel_message_info_size (info);
-               }
+       if (info) {
+               const CamelTag *tag = camel_message_info_user_tags (info);
+               const CamelFlag *flag = camel_message_info_user_flags (info);
 
-               /* we need to calculate the size ourselves */
-               if (mi->info.size == 0) {
-                       CamelStreamNull *sn = (CamelStreamNull *) camel_stream_null_new ();
+               while (flag) {
+                       camel_message_info_set_user_flag (mi, flag->name, TRUE);
+                       flag = flag->next;
+               }
 
-                       camel_data_wrapper_write_to_stream_sync (
-                               (CamelDataWrapper *) msg,
-                               (CamelStream *) sn, NULL, NULL);
-                       mi->info.size = sn->written;
-                       g_object_unref (sn);
+               while (tag) {
+                       camel_message_info_set_user_tag (mi, tag->name, tag->value);
+                       tag = tag->next;
                }
 
-               mi->info.flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV);
-               xev = camel_local_summary_encode_x_evolution (cls, mi);
-               camel_medium_set_header ((CamelMedium *) msg, "X-Evolution", xev);
-               g_free (xev);
-               camel_folder_change_info_add_uid (ci, camel_message_info_uid (mi));
-       } else {
-               d (printf ("Failed!\n"));
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Unable to add message to summary: unknown reason"));
+               camel_message_info_set_flags (mi, 0xffff, camel_message_info_flags (info));
+               mi_base->size = camel_message_info_size (info);
        }
-       return (CamelMessageInfo *) mi;
+
+       /* we need to calculate the size ourselves */
+       if (camel_message_info_size (mi) == 0) {
+               CamelStreamNull *sn = (CamelStreamNull *) camel_stream_null_new ();
+
+               camel_data_wrapper_write_to_stream_sync (
+                       (CamelDataWrapper *) msg,
+                       (CamelStream *) sn, NULL, NULL);
+               mi_base->size = sn->written;
+               g_object_unref (sn);
+       }
+
+       mi_base->flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV);
+       xev = camel_local_summary_encode_x_evolution (
+               cls, (CamelLocalMessageInfo *) mi);
+       camel_medium_set_header ((CamelMedium *) msg, "X-Evolution", xev);
+       g_free (xev);
+       camel_folder_change_info_add_uid (ci, camel_message_info_uid (mi));
+
+       return mi;
 }
 
 static gchar *
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index d6e9911..387256a 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -607,7 +607,6 @@ camel_folder_summary_info_new_from_message
 camel_folder_summary_content_info_new
 camel_folder_summary_content_info_free
 camel_folder_summary_add_preview
-camel_folder_summary_add_from_message
 camel_folder_summary_add
 camel_folder_summary_insert
 camel_folder_summary_remove


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