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

« back to all changes in this revision

Viewing changes to camel/providers/imapx/camel-imapx-summary.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-09-01 18:51:26 UTC
  • mfrom: (1.1.81 upstream) (1.2.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100901185126-o2s9mvyrx6h3rb30
Tags: 2.30.3-1ubuntu1
* Merge from debian unstable. Remaining changes:
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one
  + debian/rules:
    - don't build documentation it's shipped with the tarball
* use dh_autoreconf now, as in debian (it's in main now)
  - remove debian/patches/90_autoreconf.patch
  - change debian/rules to include it
  - build-dep in debian/control
* disable large file support, like in debian, which causes crashes
  (LP: #584536)
* debian/patches/91_revert_formatted_adress.patch: removed, upstream
* debian/patches/01_build_with_deprecated_symbols.patch:
  - remove -DGDK_DISABLE_DEPRECATED to build it

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "camel-imapx-summary.h"
41
41
//#include "camel-imap-utils.h"
42
42
 
43
 
#define CAMEL_IMAPX_SUMMARY_VERSION (3)
 
43
#define CAMEL_IMAPX_SUMMARY_VERSION (4)
44
44
 
45
 
#define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
46
 
#define EXTRACT_DIGIT(val) if (*part) part++; val=strtoul (part, &part, 10);
 
45
#define EXTRACT_FIRST_DIGIT(val) val=strtoull (part, &part, 10);
 
46
#define EXTRACT_DIGIT(val) if (*part) part++; val=strtoull (part, &part, 10);
47
47
 
48
48
static gint summary_header_load (CamelFolderSummary *, FILE *);
49
49
static gint summary_header_save (CamelFolderSummary *, FILE *);
239
239
                EXTRACT_DIGIT (ims->validity)
240
240
        }
241
241
 
 
242
        if (ims->version >= 4) {
 
243
                if (part)
 
244
                        EXTRACT_DIGIT (ims->uidnext);
 
245
                if (part)
 
246
                        EXTRACT_DIGIT (ims->modseq);
 
247
        }
 
248
 
242
249
        if (ims->version > CAMEL_IMAPX_SUMMARY_VERSION) {
243
 
                g_warning("Unkown summary version\n");
 
250
                g_warning("Unknown summary version\n");
244
251
                errno = EINVAL;
245
252
                return -1;
246
253
        }
252
259
summary_header_load (CamelFolderSummary *s, FILE *in)
253
260
{
254
261
        CamelIMAPXSummary *ims = CAMEL_IMAPX_SUMMARY (s);
 
262
        guint32 validity;
 
263
        gint ret;
255
264
 
256
265
        if (camel_imapx_summary_parent->summary_header_load (s, in) == -1)
257
266
                return -1;
258
267
 
259
268
        /* Legacy version */
260
 
        if (s->version == 0x30c)
261
 
                return camel_file_util_decode_uint32(in, &ims->validity);
 
269
        if (s->version == 0x30c) {
 
270
                ret = camel_file_util_decode_uint32(in, &validity);
 
271
                if (!ret)
 
272
                        ims->validity = validity;
 
273
                return ret;
 
274
        }
262
275
 
263
276
        /* Version 1 */
264
277
        if (camel_file_util_decode_fixed_int32(in, (gint32 *) &ims->version) == -1)
272
285
                        return -1;
273
286
        }
274
287
 
275
 
        if (camel_file_util_decode_fixed_int32(in, (gint32 *) &ims->validity) == -1)
 
288
        if (camel_file_util_decode_fixed_int32(in, (gint32 *) &validity) == -1)
276
289
                return -1;
 
290
        ims->validity = validity;
277
291
 
278
 
        if (ims->version > CAMEL_IMAPX_SUMMARY_VERSION) {
279
 
                g_warning("Unkown summary version\n");
 
292
        /* This is only used for migration; will never be asked to load newer
 
293
           versions of the store format */
 
294
        if (ims->version > 3) {
 
295
                g_warning("Unknown summary version\n");
280
296
                errno = EINVAL;
281
297
                return -1;
282
298
        }
293
309
        fir = camel_imapx_summary_parent->summary_header_to_db (s, ex);
294
310
        if (!fir)
295
311
                return NULL;
296
 
        fir->bdata = g_strdup_printf ("%d %u", CAMEL_IMAPX_SUMMARY_VERSION, ims->validity);
297
 
 
 
312
        fir->bdata = g_strdup_printf ("%d %llu %u %llu", CAMEL_IMAPX_SUMMARY_VERSION,
 
313
                                      (unsigned long long)ims->validity, ims->uidnext,
 
314
                                      (unsigned long long)ims->modseq);
298
315
        return fir;
299
316
}
300
317
 
301
318
static gint
302
319
summary_header_save (CamelFolderSummary *s, FILE *out)
303
320
{
304
 
        CamelIMAPXSummary *ims = CAMEL_IMAPX_SUMMARY(s);
305
 
 
306
 
        if (camel_imapx_summary_parent->summary_header_save (s, out) == -1)
307
 
                return -1;
308
 
 
309
 
        camel_file_util_encode_fixed_int32(out, CAMEL_IMAPX_SUMMARY_VERSION);
310
 
 
311
 
        return camel_file_util_encode_fixed_int32(out, ims->validity);
 
321
        g_warning("imapx %s called; should never happen!\n", __func__);
 
322
        return -1;
312
323
}
313
324
 
314
325
static CamelMessageInfo *