~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to camel/providers/local/camel-maildir-summary.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
        s->message_info_size = sizeof(CamelMaildirMessageInfo);
133
133
        s->content_info_size = sizeof(CamelMaildirMessageContentInfo);
134
134
 
135
 
#if defined (DOEPOOLV) || defined (DOESTRV)
136
 
        s->message_info_strings = CAMEL_MAILDIR_INFO_LAST;
137
 
#endif
138
 
 
139
135
        if (gethostname(hostname, 256) == 0) {
140
136
                o->priv->hostname = g_strdup(hostname);
141
137
        } else {
162
158
 *
163
159
 * Create a new CamelMaildirSummary object.
164
160
 *
165
 
 * Return value: A new #CamelMaildirSummary object.
 
161
 * Returns: A new #CamelMaildirSummary object.
166
162
 **/
167
163
CamelMaildirSummary
168
164
*camel_maildir_summary_new(struct _CamelFolder *folder, const gchar *filename, const gchar *maildirdir, CamelIndex *index)
200
196
        gint i;
201
197
 
202
198
        uid = camel_message_info_uid (info);
203
 
        buf = g_alloca (strlen (uid) + strlen (":2,") +  (sizeof (flagbits) / sizeof (flagbits[0])) + 1);
 
199
        buf = g_alloca (strlen (uid) + strlen (":2,") + G_N_ELEMENTS (flagbits) + 1);
204
200
        p = buf + sprintf (buf, "%s:2,", uid);
205
 
        for (i = 0; i < sizeof (flagbits) / sizeof (flagbits[0]); i++) {
 
201
        for (i = 0; i < G_N_ELEMENTS (flagbits); i++) {
206
202
                if (info->info.info.flags & flagbits[i].flagbit)
207
203
                        *p++ = flagbits[i].flag;
208
204
        }
226
222
                p+=3;
227
223
                while ((c = *p++)) {
228
224
                        /* we could assume that the flags are in order, but its just as easy not to require */
229
 
                        for (i=0; i < sizeof(flagbits)/sizeof(flagbits[0]);i++) {
 
225
                        for (i = 0; i < G_N_ELEMENTS (flagbits); i++) {
230
226
                                if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 0) {
231
227
                                        set |= flagbits[i].flagbit;
232
228
                                }
342
338
static void
343
339
message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
344
340
{
345
 
#if !defined (DOEPOOLV) && !defined (DOESTRV)
346
341
        CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi;
347
342
 
348
343
        g_free(mdi->filename);
349
 
#endif
 
344
 
350
345
        ((CamelFolderSummaryClass *) parent_class)->message_info_free(s, mi);
351
346
}
352
347
 
443
438
        mds->priv->load_map = g_hash_table_new(g_str_hash, g_str_equal);
444
439
        pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE);
445
440
 
446
 
        while ( (d = readdir(dir)) ) {
 
441
        while ((d = readdir(dir))) {
447
442
                if (d->d_name[0] == '.')
448
443
                        continue;
449
444
 
580
575
        /* joy, use this to pre-count the total, so we can report progress meaningfully */
581
576
        total = 0;
582
577
        count = 0;
583
 
        while ( (d = readdir(dir)) )
 
578
        while ((d = readdir(dir)))
584
579
                total++;
585
580
        rewinddir(dir);
586
581
 
587
 
        while ( (d = readdir(dir)) ) {
 
582
        while ((d = readdir(dir))) {
588
583
                gint pc = count * 100 / total;
589
584
 
590
585
                camel_operation_progress(NULL, pc);
626
621
                        filename = camel_maildir_info_filename(mdi);
627
622
                        /* TODO: only store the extension in the mdi->filename struct, not the whole lot */
628
623
                        if (filename == NULL || strcmp(filename, d->d_name) != 0) {
629
 
#ifdef DOESTRV
630
 
/* FIXME[disk-summary] cannot modify the estrv after its been setup,
631
 
 * for mt-safe code */
632
 
                                CAMEL_SUMMARY_LOCK(s, summary_lock);
633
 
                                /* need to update the summary hash ref */
634
 
                                g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
635
 
                                info->strings = e_strv_set_ref(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name);
636
 
                                info->strings = e_strv_pack(info->strings);
637
 
                                g_hash_table_insert(s->messages_uid, (gchar *)camel_message_info_uid(info), info);
638
 
                                CAMEL_SUMMARY_UNLOCK(s, summary_lock);
639
 
#else
640
 
# ifdef DOEPOOLV
641
 
                                info->strings = e_poolv_set(info->strings, CAMEL_MAILDIR_INFO_FILENAME, d->d_name, FALSE);
642
 
# else
643
624
                                g_free(mdi->filename);
644
625
                                mdi->filename = g_strdup(d->d_name);
645
 
# endif
646
 
#endif
647
626
                        }
648
627
                        camel_message_info_free(info);
649
628
                }
662
641
        if (dir != NULL) {
663
642
                total = 0;
664
643
                count = 0;
665
 
                while ( (d = readdir(dir)) )
 
644
                while ((d = readdir(dir)))
666
645
                        total++;
667
646
                rewinddir(dir);
668
647
 
669
 
                while ( (d = readdir(dir)) ) {
 
648
                while ((d = readdir(dir))) {
670
649
                        gchar *name, *newname, *destname, *destfilename;
671
650
                        gchar *src, *dest;
672
651
                        gint pc = count * 100 / total;
734
713
        gint count, i;
735
714
        CamelMessageInfo *info;
736
715
        CamelMaildirMessageInfo *mdi;
737
 
#ifdef DOESTRV
738
 
        CamelFolderSummary *s = (CamelFolderSummary *)cls;
739
 
#endif
740
716
        gchar *name;
741
717
        struct stat st;
742
718
 
785
761
                                        /* TODO: If this is made mt-safe, then this code could be a problem, since
786
762
                                           the estrv is being modified.
787
763
                                           Sigh, this may mean the maildir name has to be cached another way */
788
 
#ifdef DOESTRV
789
 
/* FIXME[disk-summary] cannot modify the estrv after its been setup, for mt-safe code */
790
 
                                        CAMEL_SUMMARY_LOCK(s, summary_lock);
791
 
                                        /* need to update the summary hash ref */
792
 
                                        g_hash_table_remove(s->messages_uid, camel_message_info_uid(info));
793
 
                                        info->strings = e_strv_set_ref_free(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname);
794
 
                                        info->strings = e_strv_pack(info->strings);
795
 
                                        g_hash_table_insert(s->messages_uid, (gchar *)camel_message_info_uid(info), info);
796
 
                                        CAMEL_SUMMARY_UNLOCK(s, summary_lock);
797
 
#else
798
 
# ifdef DOEPOOLV
799
 
                                        info->strings = e_poolv_set(info->strings, CAMEL_MAILDIR_INFO_FILENAME, newname, TRUE);
800
 
# else
801
764
                                        g_free(mdi->filename);
802
765
                                        mdi->filename = newname;
803
 
# endif
804
 
#endif
805
766
                                }
806
767
                                g_free(name);
807
768
                                g_free(dest);