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

« back to all changes in this revision

Viewing changes to camel/camel-imapx-store-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:
124
124
{
125
125
        gint count, i;
126
126
        CamelIMAPXStoreInfo *info;
 
127
        gboolean is_inbox = g_ascii_strcasecmp (full_name, "INBOX") == 0;
127
128
 
128
129
        count = camel_store_summary_count ((CamelStoreSummary *) s);
129
130
        for (i = 0; i < count; i++) {
130
131
                info = (CamelIMAPXStoreInfo *) camel_store_summary_index ((CamelStoreSummary *) s, i);
131
132
                if (info) {
132
 
                        if (strcmp (info->full_name, full_name) == 0)
 
133
                        if (strcmp (info->full_name, full_name) == 0 ||
 
134
                            (is_inbox && g_ascii_strcasecmp (info->full_name, full_name) == 0))
133
135
                                return info;
134
136
                        camel_store_summary_info_free ((CamelStoreSummary *) s, (CamelStoreInfo *) info);
135
137
                }
212
214
        /* merge old path part if required */
213
215
        f = full;
214
216
        if (si) {
215
 
                full = g_strdup_printf("%s%s", camel_imapx_store_info_full_name(s, si), f);
 
217
                full = g_strdup_printf ("%s%s", camel_imapx_store_info_full_name (s, si), f);
216
218
                g_free (f);
217
219
                camel_store_summary_info_free ((CamelStoreSummary *) s, si);
218
220
                f = full;
219
221
        } else if (ns) {
220
 
                full = g_strdup_printf("%s%s", ns->full_name, f);
 
222
                full = g_strdup_printf ("%s%s", ns->full_name, f);
221
223
                g_free (f);
222
224
                f = full;
223
225
        }
236
238
        gchar *full_name;
237
239
        CamelIMAPXStoreNamespace *ns;
238
240
 
239
 
        d("adding full name '%s' '%c'\n", full, dir_sep);
 
241
        d ("adding full name '%s' '%c'\n", full, dir_sep);
240
242
 
241
243
        len = strlen (full);
242
244
        full_name = alloca (len + 1);
247
249
        info = camel_imapx_store_summary_full_name (s, full_name);
248
250
        if (info) {
249
251
                camel_store_summary_info_free ((CamelStoreSummary *) s, (CamelStoreInfo *) info);
250
 
                d("  already there\n");
 
252
                d ("  already there\n");
251
253
                return info;
252
254
        }
253
255
 
254
256
        ns = camel_imapx_store_summary_namespace_find_full (s, full_name);
255
257
        if (ns) {
256
 
                d("(found namespace for '%s' ns '%s') ", full_name, ns->path);
 
258
                d ("(found namespace for '%s' ns '%s') ", full_name, ns->path);
257
259
                len = strlen (ns->full_name);
258
260
                if (len >= strlen (full_name)) {
259
261
                        pathu8 = g_strdup (ns->path);
269
271
                                pathu8 = prefix;
270
272
                        }
271
273
                }
272
 
                d(" (pathu8 = '%s')", pathu8);
 
274
                d (" (pathu8 = '%s')", pathu8);
273
275
        } else {
274
 
                d("(Cannot find namespace for '%s')\n", full_name);
 
276
                d ("(Cannot find namespace for '%s')\n", full_name);
275
277
                pathu8 = camel_imapx_store_summary_full_to_path (s, full_name, dir_sep);
276
278
        }
277
279
 
278
280
        info = (CamelIMAPXStoreInfo *) camel_store_summary_add_from_path ((CamelStoreSummary *) s, pathu8);
279
281
        if (info) {
280
 
                d("  '%s' -> '%s'\n", pathu8, full_name);
 
282
                d ("  '%s' -> '%s'\n", pathu8, full_name);
281
283
                camel_store_info_set_string ((CamelStoreSummary *) s, (CamelStoreInfo *) info, CAMEL_IMAPX_STORE_INFO_FULL_NAME, full_name);
282
284
 
283
 
                if (!g_ascii_strcasecmp(full_name, "inbox"))
 
285
                if (!g_ascii_strcasecmp (full_name, "inbox"))
284
286
                        info->info.flags |= CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_TYPE_INBOX;
285
287
        } else {
286
 
                d("  failed\n");
 
288
                d ("  failed\n");
287
289
        }
288
290
 
289
291
        g_free (pathu8);
304
306
        if (ns)
305
307
                name = camel_imapx_store_summary_path_to_full (s, path, ns->sep);
306
308
 
307
 
        d("looking up path %s -> %s\n", path, name?name:"not found");
 
309
        d ("looking up path %s -> %s\n", path, name ? name:"not found");
308
310
 
309
311
        return name;
310
312
}
341
343
 
342
344
void camel_imapx_store_summary_namespace_set (CamelIMAPXStoreSummary *s, CamelIMAPXStoreNamespace *ns)
343
345
{
344
 
        d("Setting namesapce to '%s' '%c' -> '%s'\n", ns->full_name, ns->sep, ns->path);
 
346
        d ("Setting namesapce to '%s' '%c' -> '%s'\n", ns->full_name, ns->sep, ns->path);
345
347
 
346
348
        /* CHEN not needed  */
347
349
        camel_store_summary_touch ((CamelStoreSummary *) s);
383
385
        while (ns) {
384
386
                if (ns->full_name)
385
387
                        len = strlen (ns->full_name);
386
 
                d("find_full: comparing namespace '%s' to name '%s'\n", ns->full_name, full);
 
388
                d ("find_full: comparing namespace '%s' to name '%s'\n", ns->full_name, full);
387
389
                if (len == 0
388
390
                    || (strncmp (ns->full_name, full, len) == 0
389
391
                        && (full[len] == ns->sep || full[len] == 0)))
523
525
        is->version = version;
524
526
 
525
527
        if (version < CAMEL_IMAPX_STORE_SUMMARY_VERSION_0) {
526
 
                g_warning("Store summary header version too low");
 
528
                g_warning ("Store summary header version too low");
527
529
                return -1;
528
530
        }
529
531
 
575
577
                        mi = NULL;
576
578
                } else {
577
579
                        /* NB: this is done again for compatability */
578
 
                        if (g_ascii_strcasecmp(mi->full_name, "inbox") == 0)
 
580
                        if (g_ascii_strcasecmp (mi->full_name, "inbox") == 0)
579
581
                                mi->info.flags |= CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_TYPE_INBOX;
580
582
                }
581
583
        }
649
651
 
650
652
        switch (type) {
651
653
        case CAMEL_IMAPX_STORE_INFO_FULL_NAME:
652
 
                d("Set full name %s -> %s\n", isi->full_name, str);
 
654
                d ("Set full name %s -> %s\n", isi->full_name, str);
653
655
                camel_store_summary_lock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
654
656
                g_free (isi->full_name);
655
657
                isi->full_name = g_strdup (str);