~ubuntu-branches/ubuntu/saucy/evolution-data-server/saucy

« back to all changes in this revision

Viewing changes to camel/camel-folder-summary.c

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-10-08 12:58:16 UTC
  • mfrom: (181.1.7 quantal)
  • Revision ID: package-import@ubuntu.com-20121008125816-i3n76e8c0m64e7xp
Tags: 3.6.0-0ubuntu2
* Fix LP: #1038047 part 1 - Don't abort in e_source_registry_new* when a
  problem occurs connecting to the Dbus service
  - add debian/patches/dont-abort-in-e_source_registry_new.patch
  - update debian/patches/series
* Fix LP: #1038047 part 2 - libedataserver depends on
  evolution-data-server-common to ensure that the GSettings schemas are
  present
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
 
168
168
G_DEFINE_TYPE (CamelFolderSummary, camel_folder_summary, CAMEL_TYPE_OBJECT)
169
169
 
 
170
static gboolean
 
171
remove_each_item (gpointer uid,
 
172
                  gpointer mi,
 
173
                  gpointer user_data)
 
174
{
 
175
        GSList **to_remove_infos = user_data;
 
176
 
 
177
        *to_remove_infos = g_slist_prepend (*to_remove_infos, mi);
 
178
 
 
179
        return TRUE;
 
180
}
 
181
 
 
182
static void
 
183
remove_all_loaded (CamelFolderSummary *summary)
 
184
{
 
185
        GSList *to_remove_infos = NULL;
 
186
 
 
187
        g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
 
188
 
 
189
        camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
190
 
 
191
        camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_REF_LOCK);
 
192
        g_hash_table_foreach_remove (summary->priv->loaded_infos, remove_each_item, &to_remove_infos);
 
193
        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_REF_LOCK);
 
194
 
 
195
        g_slist_foreach (to_remove_infos, (GFunc) camel_message_info_free, NULL);
 
196
        g_slist_free (to_remove_infos);
 
197
 
 
198
        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
199
}
 
200
 
170
201
static void
171
202
free_o_name (gpointer key,
172
203
             gpointer value,
184
215
        priv = CAMEL_FOLDER_SUMMARY_GET_PRIVATE (object);
185
216
 
186
217
        if (priv->timeout_handle) {
 
218
                /* this should not happen, because the release timer
 
219
                 * holds a reference on object */
187
220
                g_source_remove (priv->timeout_handle);
188
221
                priv->timeout_handle = 0;
189
222
        }
228
261
                priv->index = NULL;
229
262
        }
230
263
 
 
264
        if (priv->folder) {
 
265
                g_object_weak_unref (G_OBJECT (priv->folder), (GWeakNotify) g_nullify_pointer, &priv->folder);
 
266
                priv->folder = NULL;
 
267
        }
 
268
 
231
269
        /* Chain up to parent's dispose() method. */
232
270
        G_OBJECT_CLASS (camel_folder_summary_parent_class)->dispose (object);
233
271
}
239
277
        CamelFolderSummaryPrivate *priv = summary->priv;
240
278
 
241
279
        g_hash_table_destroy (priv->uids);
 
280
        remove_all_loaded (summary);
242
281
        g_hash_table_destroy (priv->loaded_infos);
243
282
 
244
283
        g_hash_table_foreach (priv->filter_charset, free_o_name, NULL);
265
304
        /* folder can be NULL in certain cases, see maildir-store */
266
305
 
267
306
        summary->priv->folder = folder;
 
307
        if (folder)
 
308
                g_object_weak_ref (G_OBJECT (folder), (GWeakNotify) g_nullify_pointer, &summary->priv->folder);
268
309
}
269
310
 
270
311
static void
406
447
        if (flags & CAMEL_MESSAGE_JUNK)
407
448
                junk = subtract ? -1 : 1;
408
449
 
409
 
        dd(printf("%p: %d %d %d | %d %d %d \n", (gpointer) summary, unread, deleted, junk, summary->priv->unread_count, summary->priv->visible_count, summary->priv->saved_count));
 
450
        dd (printf ("%p: %d %d %d | %d %d %d \n", (gpointer) summary, unread, deleted, junk, summary->priv->unread_count, summary->priv->visible_count, summary->priv->saved_count));
410
451
 
411
452
        g_object_freeze_notify (summary_object);
412
453
 
456
497
 
457
498
        g_object_thaw_notify (summary_object);
458
499
 
459
 
        dd(printf("%p: %d %d %d | %d %d %d\n", (gpointer) summary, unread, deleted, junk, summary->priv->unread_count, summary->priv->visible_count, summary->priv->saved_count));
 
500
        dd (printf ("%p: %d %d %d | %d %d %d\n", (gpointer) summary, unread, deleted, junk, summary->priv->unread_count, summary->priv->visible_count, summary->priv->saved_count));
460
501
 
461
502
        return changed;
462
503
}
465
506
summary_header_from_db (CamelFolderSummary *summary,
466
507
                        CamelFIRecord *record)
467
508
{
468
 
        io(printf("Loading header from db \n"));
 
509
        io (printf ("Loading header from db \n"));
469
510
 
470
511
        summary->version = record->version;
471
512
 
473
514
#if 0
474
515
        /* Legacy version check, before version 12 we have no upgrade knowledge */
475
516
        if ((summary->version > 0xff) && (summary->version & 0xff) < 12) {
476
 
                io(printf ("Summary header version mismatch"));
 
517
                io (printf ("Summary header version mismatch"));
477
518
                errno = EINVAL;
478
519
                return FALSE;
479
520
        }
480
521
 
481
522
        if (!(summary->version < 0x100 && summary->version >= 13))
482
 
                io(printf("Loading legacy summary\n"));
 
523
                io (printf ("Loading legacy summary\n"));
483
524
        else
484
 
                io(printf("loading new-format summary\n"));
 
525
                io (printf ("loading new-format summary\n"));
485
526
#endif
486
527
 
487
528
        summary->flags = record->flags;
513
554
        parent_store = camel_folder_get_parent_store (summary->priv->folder);
514
555
        db = parent_store->cdb_w;
515
556
 
516
 
        io(printf("Savining header to db\n"));
 
557
        io (printf ("Savining header to db\n"));
517
558
 
518
559
        record->folder_name = g_strdup (table_name);
519
560
 
559
600
 
560
601
        mi = (CamelMessageInfoBase *) camel_message_info_new (summary);
561
602
 
562
 
        io(printf("Loading message info from db\n"));
 
603
        io (printf ("Loading message info from db\n"));
563
604
 
564
605
        mi->flags = record->flags;
565
606
        mi->size = record->size;
661
702
        record->cc = (gchar *) camel_pstring_strdup (camel_message_info_cc (mi));
662
703
        record->mlist = (gchar *) camel_pstring_strdup (camel_message_info_mlist (mi));
663
704
 
664
 
        record->followup_flag = (gchar *) camel_pstring_strdup(camel_message_info_user_tag(info, "follow-up"));
665
 
        record->followup_completed_on = (gchar *) camel_pstring_strdup(camel_message_info_user_tag(info, "completed-on"));
666
 
        record->followup_due_by = (gchar *) camel_pstring_strdup(camel_message_info_user_tag(info, "due-by"));
 
705
        record->followup_flag = (gchar *) camel_pstring_strdup (camel_message_info_user_tag (info, "follow-up"));
 
706
        record->followup_completed_on = (gchar *) camel_pstring_strdup (camel_message_info_user_tag (info, "completed-on"));
 
707
        record->followup_due_by = (gchar *) camel_pstring_strdup (camel_message_info_user_tag (info, "due-by"));
667
708
 
668
709
        record->bodystructure = mi->bodystructure ? g_strdup (mi->bodystructure) : NULL;
669
710
 
670
711
        tmp = g_string_new (NULL);
671
712
        if (mi->references) {
672
 
                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);
 
713
                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);
673
714
                for (i = 0; i < mi->references->size; i++)
674
 
                        g_string_append_printf (tmp, " %lu %lu", (gulong)mi->references->references[i].id.part.hi, (gulong)mi->references->references[i].id.part.lo);
 
715
                        g_string_append_printf (tmp, " %lu %lu", (gulong) mi->references->references[i].id.part.hi, (gulong) mi->references->references[i].id.part.lo);
675
716
        } else {
676
 
                g_string_append_printf (tmp, "%lu %lu %lu", (gulong)mi->message_id.id.part.hi, (gulong)mi->message_id.id.part.lo, (gulong) 0);
 
717
                g_string_append_printf (tmp, "%lu %lu %lu", (gulong) mi->message_id.id.part.hi, (gulong) mi->message_id.id.part.lo, (gulong) 0);
677
718
        }
678
719
        record->part = tmp->str;
679
720
        g_string_free (tmp, FALSE);
694
735
 
695
736
        tmp = g_string_new (NULL);
696
737
        count = camel_tag_list_size (&mi->user_tags);
697
 
        g_string_append_printf (tmp, "%lu", (gulong)count);
 
738
        g_string_append_printf (tmp, "%lu", (gulong) count);
698
739
        tag = mi->user_tags;
699
740
        while (tag) {
700
741
                /* FIXME: Should we handle empty tags? Can it be empty? If it potential crasher ahead*/
701
 
                g_string_append_printf (tmp, " %lu-%s %lu-%s", (gulong)strlen(tag->name), tag->name, (gulong)strlen(tag->value), tag->value);
 
742
                g_string_append_printf (tmp, " %lu-%s %lu-%s", (gulong) strlen (tag->name), tag->name, (gulong) strlen (tag->value), tag->value);
702
743
                tag = tag->next;
703
744
        }
704
745
        record->usertags = tmp->str;
717
758
        CamelContentType *ct;
718
759
        gchar *part = record->cinfo;
719
760
 
720
 
        io(printf("Loading content info from db\n"));
 
761
        io (printf ("Loading content info from db\n"));
721
762
 
722
763
        if (!part)
723
764
                return NULL;
767
808
        GString *str = g_string_new (NULL);
768
809
        gchar *oldr;
769
810
 
770
 
        io(printf("Saving content info to db\n"));
 
811
        io (printf ("Saving content info to db\n"));
771
812
 
772
813
        ct = ci->type;
773
814
        if (ct) {
779
820
                        g_string_append_printf (str, " %d-%s", (gint) strlen (ct->subtype), ct->subtype);
780
821
                else
781
822
                        g_string_append_printf (str, " 0-");
782
 
                g_string_append_printf (str, " %d", my_list_size((struct _node **)&ct->params));
 
823
                g_string_append_printf (str, " %d", my_list_size ((struct _node **) &ct->params));
783
824
                hp = ct->params;
784
825
                while (hp) {
785
826
                        if (hp->name)
786
 
                                g_string_append_printf (str, " %d-%s", (gint)strlen(hp->name), hp->name);
 
827
                                g_string_append_printf (str, " %d-%s", (gint) strlen (hp->name), hp->name);
787
828
                        else
788
829
                                g_string_append_printf (str, " 0-");
789
830
                        if (hp->value)
790
 
                                g_string_append_printf (str, " %d-%s", (gint)strlen (hp->value), hp->value);
 
831
                                g_string_append_printf (str, " %d-%s", (gint) strlen (hp->value), hp->value);
791
832
                        else
792
833
                                g_string_append_printf (str, " 0-");
793
834
                        hp = hp->next;
799
840
        }
800
841
 
801
842
        if (ci->id)
802
 
                g_string_append_printf (str, " %d-%s", (gint)strlen (ci->id), ci->id);
 
843
                g_string_append_printf (str, " %d-%s", (gint) strlen (ci->id), ci->id);
803
844
        else
804
845
                g_string_append_printf (str, " 0-");
805
846
        if (ci->description)
806
 
                g_string_append_printf (str, " %d-%s", (gint)strlen (ci->description), ci->description);
 
847
                g_string_append_printf (str, " %d-%s", (gint) strlen (ci->description), ci->description);
807
848
        else
808
849
                g_string_append_printf (str, " 0-");
809
850
        if (ci->encoding)
810
 
                g_string_append_printf (str, " %d-%s", (gint)strlen (ci->encoding), ci->encoding);
 
851
                g_string_append_printf (str, " %d-%s", (gint) strlen (ci->encoding), ci->encoding);
811
852
        else
812
853
                g_string_append_printf (str, " 0-");
813
854
        g_string_append_printf (str, " %u", ci->size);
840
881
                                    CamelMessageInfo *info)
841
882
{
842
883
        guint32 old_flags, new_flags, added_flags, removed_flags;
 
884
        gboolean is_junk_folder = FALSE, is_trash_folder = FALSE;
843
885
        GObject *summary_object;
844
886
        gboolean changed = FALSE;
845
887
 
864
906
                return FALSE;
865
907
        }
866
908
 
 
909
        if (summary->priv->folder && CAMEL_IS_VTRASH_FOLDER (summary->priv->folder)) {
 
910
                CamelVTrashFolder *vtrash = CAMEL_VTRASH_FOLDER (summary->priv->folder);
 
911
 
 
912
                is_junk_folder = vtrash && vtrash->type == CAMEL_VTRASH_FOLDER_JUNK;
 
913
                is_trash_folder = vtrash && vtrash->type == CAMEL_VTRASH_FOLDER_TRASH;
 
914
        }
 
915
 
867
916
        added_flags = new_flags & (~(old_flags & new_flags));
868
917
        removed_flags = old_flags & (~(old_flags & new_flags));
869
918
 
874
923
                 * on unread counts */
875
924
                added_flags |= CAMEL_MESSAGE_SEEN;
876
925
                removed_flags |= CAMEL_MESSAGE_SEEN;
 
926
        } else if ((!is_junk_folder && (new_flags & CAMEL_MESSAGE_JUNK) != 0 &&
 
927
                   (old_flags & CAMEL_MESSAGE_JUNK) == (new_flags & CAMEL_MESSAGE_JUNK)) ||
 
928
                   (!is_trash_folder && (new_flags & CAMEL_MESSAGE_DELETED) != 0 &&
 
929
                   (old_flags & CAMEL_MESSAGE_DELETED) == (new_flags & CAMEL_MESSAGE_DELETED))) {
 
930
                /* The message was set read or unread, but it is a junk or deleted message,
 
931
                 * in a non-Junk/non-Trash folder, thus it doesn't influence an unread count
 
932
                 * there, thus pretend unread didn't change */
 
933
                added_flags |= CAMEL_MESSAGE_SEEN;
 
934
                removed_flags |= CAMEL_MESSAGE_SEEN;
877
935
        }
878
936
 
879
937
        /* decrement counts with removed flags */
882
940
        changed = folder_summary_update_counts_by_flags (summary, added_flags, UPDATE_COUNTS_ADD_WITHOUT_TOTAL) || changed;
883
941
 
884
942
        /* update current flags on the summary */
885
 
        g_hash_table_insert (summary->priv->uids,
 
943
        g_hash_table_insert (
 
944
                summary->priv->uids,
886
945
                (gpointer) camel_pstring_strdup (camel_message_info_uid (info)),
887
946
                GUINT_TO_POINTER (new_flags));
888
947
 
1512
1571
{
1513
1572
        g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
1514
1573
 
1515
 
        if ((summary->priv->build_content ? 1 : 0) == (state ? 1 : 0))
 
1574
        if (summary->priv->build_content == state)
1516
1575
                return;
1517
1576
 
1518
1577
        summary->priv->build_content = state;
1846
1905
                folder_name = camel_folder_get_full_name (summary->priv->folder);
1847
1906
 
1848
1907
                if (is_in_memory_summary (summary)) {
1849
 
                        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
1850
 
                        g_warning ("%s: Tried to load uid '%s' from DB on in-memory summary of '%s'",
 
1908
                        camel_folder_summary_unlock (
 
1909
                                summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
1910
                        g_warning (
 
1911
                                "%s: Tried to load uid '%s' "
 
1912
                                "from DB on in-memory summary of '%s'",
1851
1913
                                G_STRFUNC, uid, folder_name);
1852
1914
                        return NULL;
1853
1915
                }
1854
1916
 
1855
 
                parent_store = camel_folder_get_parent_store (summary->priv->folder);
 
1917
                parent_store =
 
1918
                        camel_folder_get_parent_store (summary->priv->folder);
1856
1919
                cdb = parent_store->cdb_r;
1857
1920
 
1858
1921
                data.columns_hash = NULL;
1866
1929
                        g_hash_table_destroy (data.columns_hash);
1867
1930
 
1868
1931
                if (ret != 0) {
1869
 
                        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
1932
                        camel_folder_summary_unlock (
 
1933
                                summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
1870
1934
                        return NULL;
1871
1935
                }
1872
1936
 
1938
2002
                        my_list_append ((struct _node **) &ci->childs, (struct _node *) pci);
1939
2003
                        pci->parent = ci;
1940
2004
                } else {
1941
 
                        d(fprintf (stderr, "Summary file format messed up?"));
 
2005
                        d (fprintf (stderr, "Summary file format messed up?"));
1942
2006
                        camel_folder_summary_content_info_free (summary, ci);
1943
2007
                        return NULL;
1944
2008
                }
2049
2113
            is_in_memory_summary (summary)) {
2050
2114
                summary->priv->cache_load_time = 0;
2051
2115
                summary->priv->timeout_handle = 0;
 
2116
                g_object_unref (summary);
 
2117
 
2052
2118
                return FALSE;
2053
2119
        }
2054
2120
 
2084
2150
                }
2085
2151
 
2086
2152
                /* FIXME[disk-summary] LRU please and not timeouts */
2087
 
                if (can_do)
2088
 
                        summary->priv->timeout_handle = g_timeout_add_seconds (SUMMARY_CACHE_DROP, (GSourceFunc) cfs_try_release_memory, summary);
 
2153
                if (can_do) {
 
2154
                        summary->priv->timeout_handle = g_timeout_add_seconds (
 
2155
                                SUMMARY_CACHE_DROP,
 
2156
                                (GSourceFunc) cfs_try_release_memory,
 
2157
                                g_object_ref (summary));
 
2158
                }
2089
2159
        }
2090
2160
 
2091
2161
        /* update also cache load time to the actual, to not release something just loaded */
2224
2294
 
2225
2295
        /* FIXME[disk-summary] baseclass this, and vfolders we may have to
2226
2296
         * load better. */
2227
 
        d(printf ("\ncamel_folder_summary_reload_from_db called \n"));
 
2297
        d (printf ("\ncamel_folder_summary_reload_from_db called \n"));
2228
2298
 
2229
2299
        if (is_in_memory_summary (summary))
2230
2300
                return 0;
2325
2395
        if (is_in_memory_summary (summary))
2326
2396
                return TRUE;
2327
2397
 
 
2398
        camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2328
2399
        camel_folder_summary_save_to_db (summary, NULL);
2329
2400
 
2330
2401
        /* struct _db_pass_data data; */
2331
 
        d(printf ("\ncamel_folder_summary_load_from_db called \n"));
 
2402
        d (printf ("\ncamel_folder_summary_load_from_db called \n"));
2332
2403
 
2333
2404
        full_name = camel_folder_get_full_name (summary->priv->folder);
2334
2405
        parent_store = camel_folder_get_parent_store (summary->priv->folder);
2335
 
        if (!camel_folder_summary_header_load_from_db (summary, parent_store, full_name, error))
 
2406
        if (!camel_folder_summary_header_load_from_db (summary, parent_store, full_name, error)) {
 
2407
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2336
2408
                return FALSE;
 
2409
        }
2337
2410
 
2338
2411
        cdb = parent_store->cdb_r;
2339
2412
 
2350
2423
        } else if (local_error != NULL)
2351
2424
                g_propagate_error (error, local_error);
2352
2425
 
 
2426
        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
2427
 
2353
2428
        return ret == 0;
2354
2429
}
2355
2430
 
2526
2601
                return FALSE;
2527
2602
 
2528
2603
        oldr = record->cinfo;
2529
 
        record->cinfo = g_strdup_printf ("%s %d", oldr, my_list_size ((struct _node **)&ci->childs));
 
2604
        record->cinfo = g_strdup_printf ("%s %d", oldr, my_list_size ((struct _node **) &ci->childs));
2530
2605
        g_free (oldr);
2531
2606
 
2532
2607
        part = ci->childs;
2683
2758
        parent_store = camel_folder_get_parent_store (summary->priv->folder);
2684
2759
        cdb = parent_store->cdb_w;
2685
2760
 
2686
 
        d(printf ("\ncamel_folder_summary_save_to_db called \n"));
 
2761
        camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
2762
 
 
2763
        d (printf ("\ncamel_folder_summary_save_to_db called \n"));
2687
2764
        if (summary->priv->need_preview && g_hash_table_size (summary->priv->preview_updates)) {
2688
 
                camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2689
 
 
2690
2765
                camel_db_begin_transaction (parent_store->cdb_w, NULL);
2691
2766
                g_hash_table_foreach (summary->priv->preview_updates, (GHFunc) msg_save_preview, summary->priv->folder);
2692
2767
                g_hash_table_remove_all (summary->priv->preview_updates);
2693
2768
                camel_db_end_transaction (parent_store->cdb_w, NULL);
2694
 
 
2695
 
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2696
2769
        }
2697
2770
 
2698
2771
        summary->flags &= ~CAMEL_FOLDER_SUMMARY_DIRTY;
2699
2772
 
2700
2773
        count = cfs_count_dirty (summary);
2701
 
        if (!count)
2702
 
                return camel_folder_summary_header_save_to_db (summary, error);
 
2774
        if (!count) {
 
2775
                gboolean res = camel_folder_summary_header_save_to_db (summary, error);
 
2776
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
2777
                return res;
 
2778
        }
2703
2779
 
2704
2780
        ret = save_message_infos_to_db (summary, FALSE, error);
2705
2781
        if (ret != 0) {
2706
2782
                /* Failed, so lets reset the flag */
2707
2783
                summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
 
2784
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2708
2785
                return FALSE;
2709
2786
        }
2710
2787
 
2725
2802
                ret = save_message_infos_to_db (summary, FALSE, error);
2726
2803
                if (ret != 0) {
2727
2804
                        summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
 
2805
                        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2728
2806
                        return FALSE;
2729
2807
                }
2730
2808
        }
2732
2810
        record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_to_db (summary, error);
2733
2811
        if (!record) {
2734
2812
                summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
 
2813
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2735
2814
                return FALSE;
2736
2815
        }
2737
2816
 
2744
2823
        if (ret != 0) {
2745
2824
                camel_db_abort_transaction (cdb, NULL);
2746
2825
                summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
 
2826
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2747
2827
                return FALSE;
2748
2828
        }
2749
2829
 
2750
2830
        camel_db_end_transaction (cdb, NULL);
 
2831
        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2751
2832
 
2752
2833
        return ret == 0;
2753
2834
}
2771
2852
 
2772
2853
        parent_store = camel_folder_get_parent_store (summary->priv->folder);
2773
2854
        cdb = parent_store->cdb_w;
 
2855
        camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2774
2856
 
2775
 
        d(printf ("\ncamel_folder_summary_header_save_to_db called \n"));
 
2857
        d (printf ("\ncamel_folder_summary_header_save_to_db called \n"));
2776
2858
 
2777
2859
        record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_to_db (summary, error);
2778
2860
        if (!record) {
 
2861
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2779
2862
                return FALSE;
2780
2863
        }
2781
2864
 
2787
2870
 
2788
2871
        if (ret != 0) {
2789
2872
                camel_db_abort_transaction (cdb, NULL);
 
2873
                camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2790
2874
                return FALSE;
2791
2875
        }
2792
2876
 
2793
2877
        camel_db_end_transaction (cdb, NULL);
 
2878
        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2794
2879
 
2795
2880
        return ret == 0;
2796
2881
}
2810
2895
        CamelFIRecord *record;
2811
2896
        gboolean ret = FALSE;
2812
2897
 
2813
 
        d(printf ("\ncamel_folder_summary_header_load_from_db called \n"));
 
2898
        d (printf ("\ncamel_folder_summary_header_load_from_db called \n"));
2814
2899
 
2815
2900
        if (is_in_memory_summary (summary))
2816
2901
                return TRUE;
2817
2902
 
 
2903
        camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
2818
2904
        camel_folder_summary_save_to_db (summary, NULL);
2819
2905
 
2820
2906
        cdb = store->cdb_r;
2824
2910
 
2825
2911
        ret = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_from_db (summary, record);
2826
2912
 
 
2913
        camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
 
2914
 
2827
2915
        g_free (record->folder_name);
2828
2916
        g_free (record->bdata);
2829
2917
        g_free (record);
2853
2941
                if (mi == info)
2854
2942
                        return FALSE;
2855
2943
 
2856
 
                d(printf ("Trying to insert message with clashing uid (%s).  new uid re-assigned", camel_message_info_uid (info)));
 
2944
                d (printf ("Trying to insert message with clashing uid (%s).  new uid re-assigned", camel_message_info_uid (info)));
2857
2945
 
2858
2946
                camel_pstring_free (info->uid);
2859
2947
                uid = info->uid = camel_pstring_add (camel_folder_summary_next_uid_string (summary), TRUE);
2902
2990
        base_info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
2903
2991
        base_info->dirty = TRUE;
2904
2992
 
2905
 
        g_hash_table_insert (summary->priv->uids,
 
2993
        g_hash_table_insert (
 
2994
                summary->priv->uids,
2906
2995
                (gpointer) camel_pstring_strdup (camel_message_info_uid (info)),
2907
2996
                GUINT_TO_POINTER (camel_message_info_flags (info)));
2908
2997
 
2938
3027
                base_info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
2939
3028
                base_info->dirty = TRUE;
2940
3029
 
2941
 
                g_hash_table_insert (summary->priv->uids,
 
3030
                g_hash_table_insert (
 
3031
                        summary->priv->uids,
2942
3032
                        (gpointer) camel_pstring_strdup (camel_message_info_uid (info)),
2943
3033
                        GUINT_TO_POINTER (camel_message_info_flags (info)));
2944
3034
 
3245
3335
        }
3246
3336
 
3247
3337
        g_hash_table_remove_all (summary->priv->uids);
 
3338
        remove_all_loaded (summary);
3248
3339
        g_hash_table_remove_all (summary->priv->loaded_infos);
3249
3340
 
3250
3341
        summary->priv->saved_count = 0;
3362
3453
 *
3363
3454
 * Returns: Whether the @uid was found and removed from the @summary.
3364
3455
 *
3365
 
 * Since: 3.4.3
 
3456
 * Since: 3.6
3366
3457
 **/
3367
3458
gboolean
3368
3459
camel_folder_summary_remove_uids (CamelFolderSummary *summary,
3383
3474
                gpointer ptr_uid = NULL, ptr_flags = NULL;
3384
3475
                if (g_hash_table_lookup_extended (summary->priv->uids, l->data, &ptr_uid, &ptr_flags)) {
3385
3476
                        const gchar *uid_copy = camel_pstring_strdup (l->data);
 
3477
                        CamelMessageInfo *mi;
 
3478
 
3386
3479
                        folder_summary_update_counts_by_flags (summary, GPOINTER_TO_UINT (ptr_flags), UPDATE_COUNTS_SUB);
3387
3480
                        g_hash_table_remove (summary->priv->uids, uid_copy);
 
3481
 
 
3482
                        mi = g_hash_table_lookup (summary->priv->loaded_infos, uid_copy);
3388
3483
                        g_hash_table_remove (summary->priv->loaded_infos, uid_copy);
 
3484
 
 
3485
                        if (mi)
 
3486
                                camel_message_info_free (mi);
3389
3487
                        camel_pstring_free (uid_copy);
3390
3488
                }
3391
3489
        }
3392
3490
 
3393
 
        if (is_in_memory_summary (summary)) {
 
3491
        if (!is_in_memory_summary (summary)) {
3394
3492
                full_name = camel_folder_get_full_name (summary->priv->folder);
3395
3493
                parent_store = camel_folder_get_parent_store (summary->priv->folder);
3396
3494
                if (camel_db_delete_uids (parent_store->cdb_w, full_name, uids, NULL) != 0)
3450
3548
                mi = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->message_info_new_from_header (summary, camel_mime_parser_headers_raw (mp));
3451
3549
                break;
3452
3550
        default:
3453
 
                g_error("Invalid parser state");
 
3551
                g_error ("Invalid parser state");
3454
3552
        }
3455
3553
 
3456
3554
        return mi;
3468
3566
        case CAMEL_MIME_PARSER_STATE_MULTIPART:
3469
3567
                ci = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->content_info_new_from_header (summary, camel_mime_parser_headers_raw (mp));
3470
3568
                if (ci) {
 
3569
                        if (ci->type)
 
3570
                                camel_content_type_unref (ci->type);
3471
3571
                        ci->type = camel_mime_parser_content_type (mp);
3472
3572
                        camel_content_type_ref (ci->type);
3473
3573
                }
3474
3574
                break;
3475
3575
        default:
3476
 
                g_error("Invalid parser state");
 
3576
                g_error ("Invalid parser state");
3477
3577
        }
3478
3578
 
3479
3579
        return ci;
3593
3693
 
3594
3694
        mi = (CamelMessageInfoBase *) camel_message_info_new (summary);
3595
3695
 
3596
 
        if ((content = camel_header_raw_find(&h, "Content-Type", NULL))
 
3696
        if ((content = camel_header_raw_find (&h, "Content-Type", NULL))
3597
3697
             && (ct = camel_content_type_decode (content))
3598
 
             && (charset = camel_content_type_param(ct, "charset"))
3599
 
             && (g_ascii_strcasecmp(charset, "us-ascii") == 0))
 
3698
             && (charset = camel_content_type_param (ct, "charset"))
 
3699
             && (g_ascii_strcasecmp (charset, "us-ascii") == 0))
3600
3700
                charset = NULL;
3601
3701
 
3602
3702
        charset = charset ? camel_iconv_charset_name (charset) : NULL;
3603
3703
 
3604
 
        subject = summary_format_string(h, "subject", charset);
3605
 
        from = summary_format_address(h, "from", charset);
3606
 
        to = summary_format_address(h, "to", charset);
3607
 
        cc = summary_format_address(h, "cc", charset);
 
3704
        subject = summary_format_string (h, "subject", charset);
 
3705
        from = summary_format_address (h, "from", charset);
 
3706
        to = summary_format_address (h, "to", charset);
 
3707
        cc = summary_format_address (h, "cc", charset);
3608
3708
        mlist = camel_header_raw_check_mailing_list (&h);
3609
3709
 
3610
3710
        if (ct)
3624
3724
        else
3625
3725
                mi->date_sent = 0;
3626
3726
 
3627
 
        received = camel_header_raw_find(&h, "received", NULL);
 
3727
        received = camel_header_raw_find (&h, "received", NULL);
3628
3728
        if (received)
3629
3729
                received = strrchr (received, ';');
3630
3730
        if (received)
3632
3732
        else
3633
3733
                mi->date_received = 0;
3634
3734
 
3635
 
        msgid = camel_header_msgid_decode(camel_header_raw_find(&h, "message-id", NULL));
 
3735
        msgid = camel_header_msgid_decode (camel_header_raw_find (&h, "message-id", NULL));
3636
3736
        if (msgid) {
3637
3737
                GChecksum *checksum;
3638
3738
 
3733
3833
        ci->id = camel_header_msgid_decode (camel_header_raw_find (&h, "content-id", NULL));
3734
3834
        ci->description = camel_header_decode_string (camel_header_raw_find (&h, "content-description", NULL), charset);
3735
3835
        ci->encoding = camel_content_transfer_encoding_decode (camel_header_raw_find (&h, "content-transfer-encoding", NULL));
3736
 
        ci->type = camel_content_type_decode(camel_header_raw_find(&h, "content-type", NULL));
 
3836
        ci->type = camel_content_type_decode (camel_header_raw_find (&h, "content-type", NULL));
3737
3837
 
3738
3838
        return ci;
3739
3839
}
3756
3856
static gchar *
3757
3857
next_uid_string (CamelFolderSummary *summary)
3758
3858
{
3759
 
        return g_strdup_printf("%u", camel_folder_summary_next_uid(summary));
 
3859
        return g_strdup_printf ("%u", camel_folder_summary_next_uid (summary));
3760
3860
}
3761
3861
 
3762
3862
/*
3782
3882
        CamelMessageContentInfo *part;
3783
3883
        const gchar *calendar_header;
3784
3884
 
3785
 
        d(printf("building content info\n"));
 
3885
        d (printf ("building content info\n"));
3786
3886
 
3787
3887
        /* start of this part */
3788
3888
        state = camel_mime_parser_step (mp, &buffer, &len);
3795
3895
                /* check content type for indexing, then read body */
3796
3896
                ct = camel_mime_parser_content_type (mp);
3797
3897
                /* update attachments flag as we go */
3798
 
                if (camel_content_type_is(ct, "application", "pgp-signature")
 
3898
                if (camel_content_type_is (ct, "application", "pgp-signature")
3799
3899
#ifdef ENABLE_SMIME
3800
 
                    || camel_content_type_is(ct, "application", "x-pkcs7-signature")
3801
 
                    || camel_content_type_is(ct, "application", "pkcs7-signature")
 
3900
                    || camel_content_type_is (ct, "application", "x-pkcs7-signature")
 
3901
                    || camel_content_type_is (ct, "application", "pkcs7-signature")
3802
3902
#endif
3803
3903
                        )
3804
3904
                        camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_SECURE, CAMEL_MESSAGE_SECURE);
3813
3913
                if (calendar_header || camel_content_type_is (ct, "text", "calendar"))
3814
3914
                        camel_message_info_set_user_flag (msginfo, "$has_cal", TRUE);
3815
3915
 
3816
 
                if (p->index && camel_content_type_is(ct, "text", "*")) {
 
3916
                if (p->index && camel_content_type_is (ct, "text", "*")) {
3817
3917
                        gchar *encoding;
3818
3918
                        const gchar *charset;
3819
3919
 
3820
 
                        d(printf("generating index:\n"));
 
3920
                        d (printf ("generating index:\n"));
3821
3921
 
3822
 
                        encoding = camel_content_transfer_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL));
 
3922
                        encoding = camel_content_transfer_encoding_decode (camel_mime_parser_header (mp, "content-transfer-encoding", NULL));
3823
3923
                        if (encoding) {
3824
 
                                if (!g_ascii_strcasecmp(encoding, "base64")) {
3825
 
                                        d(printf(" decoding base64\n"));
 
3924
                                if (!g_ascii_strcasecmp (encoding, "base64")) {
 
3925
                                        d (printf (" decoding base64\n"));
3826
3926
                                        if (p->filter_64 == NULL)
3827
3927
                                                p->filter_64 = camel_mime_filter_basic_new (CAMEL_MIME_FILTER_BASIC_BASE64_DEC);
3828
3928
                                        else
3829
3929
                                                camel_mime_filter_reset (p->filter_64);
3830
3930
                                        enc_id = camel_mime_parser_filter_add (mp, p->filter_64);
3831
 
                                } else if (!g_ascii_strcasecmp(encoding, "quoted-printable")) {
3832
 
                                        d(printf(" decoding quoted-printable\n"));
 
3931
                                } else if (!g_ascii_strcasecmp (encoding, "quoted-printable")) {
 
3932
                                        d (printf (" decoding quoted-printable\n"));
3833
3933
                                        if (p->filter_qp == NULL)
3834
3934
                                                p->filter_qp = camel_mime_filter_basic_new (CAMEL_MIME_FILTER_BASIC_QP_DEC);
3835
3935
                                        else
3836
3936
                                                camel_mime_filter_reset (p->filter_qp);
3837
3937
                                        enc_id = camel_mime_parser_filter_add (mp, p->filter_qp);
3838
3938
                                } else if (!g_ascii_strcasecmp (encoding, "x-uuencode")) {
3839
 
                                        d(printf(" decoding x-uuencode\n"));
 
3939
                                        d (printf (" decoding x-uuencode\n"));
3840
3940
                                        if (p->filter_uu == NULL)
3841
3941
                                                p->filter_uu = camel_mime_filter_basic_new (CAMEL_MIME_FILTER_BASIC_UU_DEC);
3842
3942
                                        else
3843
3943
                                                camel_mime_filter_reset (p->filter_uu);
3844
3944
                                        enc_id = camel_mime_parser_filter_add (mp, p->filter_uu);
3845
3945
                                } else {
3846
 
                                        d(printf(" ignoring encoding %s\n", encoding));
 
3946
                                        d (printf (" ignoring encoding %s\n", encoding));
3847
3947
                                }
3848
3948
                                g_free (encoding);
3849
3949
                        }
3850
3950
 
3851
 
                        charset = camel_content_type_param(ct, "charset");
 
3951
                        charset = camel_content_type_param (ct, "charset");
3852
3952
                        if (charset != NULL
3853
 
                            && !(g_ascii_strcasecmp(charset, "us-ascii")==0
3854
 
                                 || g_ascii_strcasecmp(charset, "utf-8")==0)) {
3855
 
                                d(printf(" Adding conversion filter from %s to UTF-8\n", charset));
 
3953
                            && !(g_ascii_strcasecmp (charset, "us-ascii") == 0
 
3954
                                 || g_ascii_strcasecmp (charset, "utf-8") == 0)) {
 
3955
                                d (printf (" Adding conversion filter from %s to UTF-8\n", charset));
3856
3956
                                mfc = g_hash_table_lookup (p->filter_charset, charset);
3857
3957
                                if (mfc == NULL) {
3858
3958
                                        mfc = camel_mime_filter_charset_new (charset, "UTF-8");
3864
3964
                                if (mfc) {
3865
3965
                                        chr_id = camel_mime_parser_filter_add (mp, mfc);
3866
3966
                                } else {
3867
 
                                        w(g_warning("Cannot convert '%s' to 'UTF-8', message index may be corrupt", charset));
 
3967
                                        w (g_warning ("Cannot convert '%s' to 'UTF-8', message index may be corrupt", charset));
3868
3968
                                }
3869
3969
                        }
3870
3970
 
3871
3971
                        /* we do charset conversions before this filter, which isn't strictly correct,
3872
3972
                         * but works in most cases */
3873
 
                        if (camel_content_type_is(ct, "text", "html")) {
 
3973
                        if (camel_content_type_is (ct, "text", "html")) {
3874
3974
                                if (p->filter_html == NULL)
3875
3975
                                        p->filter_html = camel_mime_filter_html_new ();
3876
3976
                                else
3891
3991
                camel_mime_parser_filter_remove (mp, idx_id);
3892
3992
                break;
3893
3993
        case CAMEL_MIME_PARSER_STATE_MULTIPART:
3894
 
                d(printf("Summarising multipart\n"));
 
3994
                d (printf ("Summarising multipart\n"));
3895
3995
                /* update attachments flag as we go */
3896
3996
                ct = camel_mime_parser_content_type (mp);
3897
 
                if (camel_content_type_is(ct, "multipart", "mixed"))
 
3997
                if (camel_content_type_is (ct, "multipart", "mixed"))
3898
3998
                        camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_ATTACHMENTS, CAMEL_MESSAGE_ATTACHMENTS);
3899
 
                if (camel_content_type_is(ct, "multipart", "signed")
3900
 
                    || camel_content_type_is(ct, "multipart", "encrypted"))
 
3999
                if (camel_content_type_is (ct, "multipart", "signed")
 
4000
                    || camel_content_type_is (ct, "multipart", "encrypted"))
3901
4001
                        camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_SECURE, CAMEL_MESSAGE_SECURE);
3902
4002
 
3903
4003
                while (camel_mime_parser_step (mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_MULTIPART_END) {
3910
4010
                }
3911
4011
                break;
3912
4012
        case CAMEL_MIME_PARSER_STATE_MESSAGE:
3913
 
                d(printf("Summarising message\n"));
 
4013
                d (printf ("Summarising message\n"));
3914
4014
                /* update attachments flag as we go */
3915
4015
                camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_ATTACHMENTS, CAMEL_MESSAGE_ATTACHMENTS);
3916
4016
 
3921
4021
                }
3922
4022
                state = camel_mime_parser_step (mp, &buffer, &len);
3923
4023
                if (state != CAMEL_MIME_PARSER_STATE_MESSAGE_END) {
3924
 
                        g_error("Bad parser state: Expecing MESSAGE_END or MESSAGE_EOF, got: %d", state);
 
4024
                        g_error ("Bad parser state: Expecing MESSAGE_END or MESSAGE_EOF, got: %d", state);
3925
4025
                        camel_mime_parser_unstep (mp);
3926
4026
                }
3927
4027
                break;
3928
4028
        }
3929
4029
 
3930
 
        d(printf("finished building content info\n"));
 
4030
        d (printf ("finished building content info\n"));
3931
4031
 
3932
4032
        return info;
3933
4033
}
3959
4059
 
3960
4060
        /* check for attachments */
3961
4061
        ct = ((CamelDataWrapper *) containee)->mime_type;
3962
 
        if (camel_content_type_is(ct, "multipart", "*")) {
3963
 
                if (camel_content_type_is(ct, "multipart", "mixed"))
 
4062
        if (camel_content_type_is (ct, "multipart", "*")) {
 
4063
                if (camel_content_type_is (ct, "multipart", "mixed"))
3964
4064
                        camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_ATTACHMENTS, CAMEL_MESSAGE_ATTACHMENTS);
3965
 
                if (camel_content_type_is(ct, "multipart", "signed")
3966
 
                    || camel_content_type_is(ct, "multipart", "encrypted"))
 
4065
                if (camel_content_type_is (ct, "multipart", "signed")
 
4066
                    || camel_content_type_is (ct, "multipart", "encrypted"))
3967
4067
                        camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_SECURE, CAMEL_MESSAGE_SECURE);
3968
 
        } else if (camel_content_type_is(ct, "application", "pgp-signature")
 
4068
        } else if (camel_content_type_is (ct, "application", "pgp-signature")
3969
4069
#ifdef ENABLE_SMIME
3970
 
                    || camel_content_type_is(ct, "application", "x-pkcs7-signature")
3971
 
                    || camel_content_type_is(ct, "application", "pkcs7-signature")
 
4070
                    || camel_content_type_is (ct, "application", "x-pkcs7-signature")
 
4071
                    || camel_content_type_is (ct, "application", "pkcs7-signature")
3972
4072
#endif
3973
4073
                ) {
3974
4074
                camel_message_info_set_flags (msginfo, CAMEL_MESSAGE_SECURE, CAMEL_MESSAGE_SECURE);
4011
4111
                        my_list_append ((struct _node **) &info->childs, (struct _node *) child);
4012
4112
                }
4013
4113
        } else if (p->filter_stream
4014
 
                   && camel_content_type_is(ct, "text", "*")) {
 
4114
                   && camel_content_type_is (ct, "text", "*")) {
4015
4115
                gint html_id = -1, idx_id = -1;
4016
4116
 
4017
4117
                /* pre-attach html filter if required, otherwise just index filter */
4018
 
                if (camel_content_type_is(ct, "text", "html")) {
 
4118
                if (camel_content_type_is (ct, "text", "html")) {
4019
4119
                        if (p->filter_html == NULL)
4020
4120
                                p->filter_html = camel_mime_filter_html_new ();
4021
4121
                        else
4519
4619
                if (mi->summary->priv->build_content
4520
4620
                    && ((CamelMessageInfoBase *) mi)->content) {
4521
4621
                        camel_folder_summary_content_info_free (mi->summary, ((CamelMessageInfoBase *) mi)->content);
 
4622
                        ((CamelMessageInfoBase *) mi)->content = NULL;
4522
4623
                }
4523
4624
 
4524
4625
                CAMEL_FOLDER_SUMMARY_GET_CLASS (mi->summary)->message_info_free (mi->summary, mi);
4728
4829
        }
4729
4830
 
4730
4831
        if (ci->type)
4731
 
                printf ("%scontent-type: %s/%s\n", p, ci->type->type ? ci->type->type : "(null)",
 
4832
                printf (
 
4833
                        "%scontent-type: %s/%s\n",
 
4834
                        p, ci->type->type ? ci->type->type : "(null)",
4732
4835
                        ci->type->subtype ? ci->type->subtype : "(null)");
4733
4836
        else
4734
4837
                printf ("%scontent-type: <unset>\n", p);
4735
 
        printf ("%scontent-transfer-encoding: %s\n", p, ci->encoding ? ci->encoding : "(null)");
4736
 
        printf ("%scontent-description: %s\n", p, ci->description ? ci->description : "(null)");
 
4838
        printf (
 
4839
                "%scontent-transfer-encoding: %s\n",
 
4840
                p, ci->encoding ? ci->encoding : "(null)");
 
4841
        printf (
 
4842
                "%scontent-description: %s\n",
 
4843
                p, ci->description ? ci->description : "(null)");
4737
4844
        printf ("%ssize: %lu\n", p, (gulong) ci->size);
4738
4845
        ci = ci->childs;
4739
4846
        while (ci) {
4746
4853
camel_message_info_dump (CamelMessageInfo *mi)
4747
4854
{
4748
4855
        if (mi == NULL) {
4749
 
                printf("No message?\n");
 
4856
                printf ("No message?\n");
4750
4857
                return;
4751
4858
        }
4752
4859
 
4753
 
        printf("Subject: %s\n", camel_message_info_subject(mi));
4754
 
        printf("To: %s\n", camel_message_info_to(mi));
4755
 
        printf("Cc: %s\n", camel_message_info_cc(mi));
4756
 
        printf("mailing list: %s\n", camel_message_info_mlist(mi));
4757
 
        printf("From: %s\n", camel_message_info_from(mi));
4758
 
        printf("UID: %s\n", camel_message_info_uid(mi));
4759
 
        printf("Flags: %04x\n", camel_message_info_flags(mi));
 
4860
        printf ("Subject: %s\n", camel_message_info_subject (mi));
 
4861
        printf ("To: %s\n", camel_message_info_to (mi));
 
4862
        printf ("Cc: %s\n", camel_message_info_cc (mi));
 
4863
        printf ("mailing list: %s\n", camel_message_info_mlist (mi));
 
4864
        printf ("From: %s\n", camel_message_info_from (mi));
 
4865
        printf ("UID: %s\n", camel_message_info_uid (mi));
 
4866
        printf ("Flags: %04x\n", camel_message_info_flags (mi));
4760
4867
        camel_content_info_dump (((CamelMessageInfoBase *) mi)->content, 0);
4761
4868
}
4762
4869