1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
/*
* Copyright (C) 2000 Helix Code Inc.
*
* Authors: Michael Zucchi <notzed@helixcode.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include "camel-local-summary.h"
#include <camel/camel-mime-message.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#define io(x)
#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
#define CAMEL_LOCAL_SUMMARY_VERSION (0x100)
struct _CamelLocalSummaryPrivate {
};
#define _PRIVATE(o) (((CamelLocalSummary *)(o))->priv)
#if 0
static int summary_header_load (CamelFolderSummary *, FILE *);
static int summary_header_save (CamelFolderSummary *, FILE *);
#endif
static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _header_raw *);
static CamelMessageInfo * message_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
static CamelMessageInfo * message_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg);
#if 0
static CamelMessageInfo * message_info_load (CamelFolderSummary *, FILE *);
static int message_info_save (CamelFolderSummary *, FILE *, CamelMessageInfo *);
#endif
/*static void message_info_free (CamelFolderSummary *, CamelMessageInfo *);*/
static int local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi);
static char *local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi);
static int local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
static int local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
static CamelMessageInfo *local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
static void camel_local_summary_class_init (CamelLocalSummaryClass *klass);
static void camel_local_summary_init (CamelLocalSummary *obj);
static void camel_local_summary_finalise (CamelObject *obj);
static CamelFolderSummaryClass *camel_local_summary_parent;
CamelType
camel_local_summary_get_type(void)
{
static CamelType type = CAMEL_INVALID_TYPE;
if (type == CAMEL_INVALID_TYPE) {
type = camel_type_register(camel_folder_summary_get_type(), "CamelLocalSummary",
sizeof (CamelLocalSummary),
sizeof (CamelLocalSummaryClass),
(CamelObjectClassInitFunc) camel_local_summary_class_init,
NULL,
(CamelObjectInitFunc) camel_local_summary_init,
(CamelObjectFinalizeFunc) camel_local_summary_finalise);
}
return type;
}
static void
camel_local_summary_class_init(CamelLocalSummaryClass *klass)
{
CamelFolderSummaryClass *sklass = (CamelFolderSummaryClass *) klass;
camel_local_summary_parent = CAMEL_FOLDER_SUMMARY_CLASS(camel_type_get_global_classfuncs(camel_folder_summary_get_type()));
/*sklass->summary_header_load = summary_header_load;
sklass->summary_header_save = summary_header_save;*/
sklass->message_info_new = message_info_new;
sklass->message_info_new_from_parser = message_info_new_from_parser;
sklass->message_info_new_from_message = message_info_new_from_message;
/*sklass->message_info_load = message_info_load;
sklass->message_info_save = message_info_save;*/
/*sklass->message_info_free = message_info_free;*/
klass->check = local_summary_check;
klass->sync = local_summary_sync;
klass->add = local_summary_add;
klass->encode_x_evolution = local_summary_encode_x_evolution;
klass->decode_x_evolution = local_summary_decode_x_evolution;
}
static void
camel_local_summary_init(CamelLocalSummary *obj)
{
struct _CamelLocalSummaryPrivate *p;
struct _CamelFolderSummary *s = (CamelFolderSummary *)obj;
p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
/* subclasses need to set the right instance data sizes */
s->message_info_size = sizeof(CamelMessageInfo);
s->content_info_size = sizeof(CamelMessageContentInfo);
/* and a unique file version */
s->version += CAMEL_LOCAL_SUMMARY_VERSION;
}
static void
camel_local_summary_finalise(CamelObject *obj)
{
CamelLocalSummary *mbs = CAMEL_LOCAL_SUMMARY(obj);
g_free(mbs->folder_path);
}
void
camel_local_summary_construct(CamelLocalSummary *new, const char *filename, const char *local_name, ibex *index)
{
camel_folder_summary_set_build_content(CAMEL_FOLDER_SUMMARY(new), TRUE);
camel_folder_summary_set_filename(CAMEL_FOLDER_SUMMARY(new), filename);
new->folder_path = g_strdup(local_name);
new->index = index;
}
/* load/check the summary */
int
camel_local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex)
{
if (forceindex || camel_folder_summary_load((CamelFolderSummary *)cls) == -1) {
camel_folder_summary_clear((CamelFolderSummary *)cls);
}
return camel_local_summary_check(cls, NULL, ex);
}
char *
camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *info)
{
return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->encode_x_evolution(cls, info);
}
int
camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info)
{
return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->decode_x_evolution(cls, xev, info);
}
/*#define DOSTATS*/
#ifdef DOSTATS
struct _stat_info {
int mitotal;
int micount;
int citotal;
int cicount;
int msgid;
int msgcount;
};
static void
do_stat_ci(CamelLocalSummary *cls, struct _stat_info *info, CamelMessageContentInfo *ci)
{
info->cicount++;
info->citotal += ((CamelFolderSummary *)cls)->content_info_size /*+ 4 memchunks are 1/4 byte overhead per mi */;
if (ci->id)
info->citotal += strlen(ci->id) + 4;
if (ci->description)
info->citotal += strlen(ci->description) + 4;
if (ci->encoding)
info->citotal += strlen(ci->encoding) + 4;
if (ci->type) {
struct _header_content_type *ct = ci->type;
struct _header_param *param;
info->citotal += sizeof(*ct) + 4;
if (ct->type)
info->citotal += strlen(ct->type) + 4;
if (ct->subtype)
info->citotal += strlen(ct->subtype) + 4;
param = ct->params;
while (param) {
info->citotal += sizeof(*param) + 4;
if (param->name)
info->citotal += strlen(param->name)+4;
if (param->value)
info->citotal += strlen(param->value)+4;
param = param->next;
}
}
ci = ci->childs;
while (ci) {
do_stat_ci(cls, info, ci);
ci = ci->next;
}
}
static void
do_stat_mi(CamelLocalSummary *cls, struct _stat_info *info, CamelMessageInfo *mi)
{
info->micount++;
info->mitotal += ((CamelFolderSummary *)cls)->content_info_size /*+ 4*/;
if (mi->subject)
info->mitotal += strlen(mi->subject) + 4;
if (mi->to)
info->mitotal += strlen(mi->to) + 4;
if (mi->from)
info->mitotal += strlen(mi->from) + 4;
if (mi->cc)
info->mitotal += strlen(mi->cc) + 4;
if (mi->uid)
info->mitotal += strlen(mi->uid) + 4;
if (mi->references) {
info->mitotal += (mi->references->size-1) * sizeof(CamelSummaryMessageID) + sizeof(CamelSummaryReferences) + 4;
info->msgid += (mi->references->size) * sizeof(CamelSummaryMessageID);
info->msgcount += mi->references->size;
}
/* dont have any user flags yet */
if (mi->content) {
do_stat_ci(cls, info, mi->content);
}
}
#endif
int
camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
{
int ret;
ret = ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->check(cls, changeinfo, ex);
#ifdef DOSTATS
if (ret != -1) {
int i;
CamelFolderSummary *s = (CamelFolderSummary *)cls;
struct _stat_info stats = { 0 };
for (i=0;i<camel_folder_summary_count(s);i++) {
CamelMessageInfo *info = camel_folder_summary_index(s, i);
do_stat_mi(cls, &stats, info);
}
printf("\nMemory used by summary:\n\n");
printf("Total of %d messages\n", camel_folder_summary_count(s));
printf("Total: %d bytes (ave %f)\n", stats.citotal + stats.mitotal,
(double)(stats.citotal+stats.mitotal)/(double)camel_folder_summary_count(s));
printf("Message Info: %d (ave %f)\n", stats.mitotal, (double)stats.mitotal/(double)stats.micount);
printf("Content Info; %d (ave %f) count %d\n", stats.citotal, (double)stats.citotal/(double)stats.cicount, stats.cicount);
printf("message id's: %d (ave %f) count %d\n", stats.msgid, (double)stats.msgid/(double)stats.msgcount, stats.msgcount);
}
#endif
return ret;
}
int
camel_local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
{
return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->sync(cls, expunge, changeinfo, ex);
}
CamelMessageInfo *
camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
{
return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->add(cls, msg, info, ci, ex);
}
/**
* camel_local_summary_write_headers:
* @fd:
* @header:
* @xevline:
*
* Write a bunch of headers to the file @fd. IF xevline is non NULL, then
* an X-Evolution header line is created at the end of all of the headers.
* The headers written are termianted with a blank line.
*
* Return value: -1 on error, otherwise the number of bytes written.
**/
int
camel_local_summary_write_headers(int fd, struct _header_raw *header, char *xevline)
{
int outlen = 0, len;
int newfd;
FILE *out;
/* dum de dum, maybe the whole sync function should just use stdio for output */
newfd = dup(fd);
if (newfd == -1)
return -1;
out = fdopen(newfd, "w");
if (out == NULL) {
close(newfd);
errno = EINVAL;
return -1;
}
while (header) {
if (strcasecmp(header->name, "X-Evolution")) {
len = fprintf(out, "%s:%s\n", header->name, header->value);
if (len == -1) {
fclose(out);
return -1;
}
outlen += len;
}
header = header->next;
}
if (xevline) {
len = fprintf(out, "X-Evolution: %s\n\n", xevline);
if (len == -1) {
fclose(out);
return -1;
}
outlen += len;
}
if (fclose(out) == -1)
return -1;
return outlen;
}
#if 0
static int
summary_header_load(CamelFolderSummary *s, FILE *in)
{
CamelLocalSummary *mbs = CAMEL_LOCAL_SUMMARY(s);
if (((CamelFolderSummaryClass *)camel_local_summary_parent)->summary_header_load(s, in) == -1)
return -1;
return camel_folder_summary_decode_uint32(in, &mbs->folder_size);
}
static int
summary_header_save(CamelFolderSummary *s, FILE *out)
{
CamelLocalSummary *mbs = CAMEL_LOCAL_SUMMARY(s);
if (((CamelFolderSummaryClass *)camel_local_summary_parent)->summary_header_save(s, out) == -1)
return -1;
return camel_folder_summary_encode_uint32(out, mbs->folder_size);
}
static int
header_evolution_decode(const char *in, guint32 *uid, guint32 *flags)
{
char *header;
if (in && (header = header_token_decode(in))) {
if (strlen (header) == strlen ("00000000-0000")
&& sscanf (header, "%08x-%04x", uid, flags) == 2) {
g_free(header);
return *uid;
}
g_free(header);
}
return -1;
}
static char *
header_evolution_encode(guint32 uid, guint32 flags)
{
return g_strdup_printf("%08x-%04x", uid, flags & 0xffff);
}
#endif
static int
local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
{
/* FIXME: sync index here */
return 0;
}
static int
local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
{
return 0;
}
static CamelMessageInfo *
local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
{
CamelMessageInfo *mi;
char *xev;
d(printf("Adding message to summary\n"));
mi = camel_folder_summary_add_from_message((CamelFolderSummary *)cls, msg);
if (mi) {
d(printf("Added, uid = %s\n", mi->uid));
if (info) {
CamelTag *tag = info->user_tags;
CamelFlag *flag = info->user_flags;
while (flag) {
camel_flag_set(&mi->user_flags, flag->name, TRUE);
flag = flag->next;
}
while (tag) {
camel_tag_set(&mi->user_tags, tag->name, tag->value);
tag = tag->next;
}
mi->flags = mi->flags | (info->flags & 0xffff);
}
mi->flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED);
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, mi->uid);
} else {
d(printf("Failed!\n"));
camel_exception_set(ex, 1, "Unable to add message to summary: unknown reason");
}
return mi;
}
static char *
local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
{
GString *out = g_string_new("");
struct _header_param *params = NULL;
GString *val = g_string_new("");
CamelFlag *flag = mi->user_flags;
CamelTag *tag = mi->user_tags;
char *ret, *p;
guint32 uid;
/* FIXME: work out what to do with uid's that aren't stored here? */
/* FIXME: perhaps make that a mbox folder only issue?? */
p = mi->uid;
while (*p && isdigit(*p))
p++;
if (*p == 0 && sscanf(mi->uid, "%u", &uid) == 1) {
g_string_sprintf(out, "%08x-%04x", uid, mi->flags & 0xffff);
} else {
g_string_sprintf(out, "%s-%04x", mi->uid, mi->flags & 0xffff);
}
if (flag || tag) {
g_string_append(out, "; ");
val = g_string_new("");
if (flag) {
while (flag) {
g_string_append(val, flag->name);
if (flag->next)
g_string_append_c(out, ',');
flag = flag->next;
}
header_set_param(¶ms, "flags", val->str);
g_string_truncate(val, 0);
}
if (tag) {
while (tag) {
g_string_append(val, tag->name);
g_string_append_c(val, '=');
g_string_append(val, tag->value);
if (tag->next)
g_string_append_c(out, ',');
tag = tag->next;
}
header_set_param(¶ms, "tags", val->str);
}
g_string_free(val, TRUE);
header_param_list_format_append(out, params);
header_param_list_free(params);
}
ret = out->str;
g_string_free(out, FALSE);
return ret;
}
static int
local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
{
struct _header_param *params, *scan;
guint32 uid, flags;
char *header;
int i;
/* check for uid/flags */
header = header_token_decode(xev);
if (header && strlen(header) == strlen("00000000-0000")
&& sscanf(header, "%08x-%04x", &uid, &flags) == 2) {
char uidstr[20];
if (mi) {
sprintf(uidstr, "%u", uid);
g_free(mi->uid);
mi->uid = g_strdup(uidstr);
mi->flags = flags;
}
} else {
g_free(header);
return -1;
}
g_free(header);
if (mi == NULL)
return 0;
/* check for additional data */
header = strchr(xev, ';');
if (header) {
params = header_param_list_decode(header+1);
scan = params;
while (scan) {
if (!strcasecmp(scan->name, "flags")) {
char **flagv = g_strsplit(scan->value, ",", 1000);
for (i=0;flagv[i];i++) {
camel_flag_set(&mi->user_flags, flagv[i], TRUE);
}
g_strfreev(flagv);
} else if (!strcasecmp(scan->name, "tags")) {
char **tagv = g_strsplit(scan->value, ",", 10000);
char *val;
for (i=0;tagv[i];i++) {
val = strchr(tagv[i], '=');
if (val) {
*val++ = 0;
camel_tag_set(&mi->user_tags, tagv[i], val);
val[-1]='=';
}
}
g_strfreev(tagv);
}
scan = scan->next;
}
header_param_list_free(params);
}
return 0;
}
static CamelMessageInfo *
message_info_new(CamelFolderSummary *s, struct _header_raw *h)
{
CamelMessageInfo *mi;
CamelLocalSummary *cls = (CamelLocalSummary *)s;
mi = ((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_new(s, h);
if (mi) {
const char *xev;
int doindex = FALSE;
xev = header_raw_find(&h, "X-Evolution", NULL);
if (xev==NULL || camel_local_summary_decode_x_evolution(cls, xev, mi) == -1) {
/* to indicate it has no xev header */
mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
mi->uid = camel_folder_summary_next_uid_string(s);
/* shortcut, no need to look it up in the index library */
doindex = TRUE;
}
if (cls->index
&& (doindex
|| cls->index_force
|| !ibex_contains_name(cls->index, mi->uid))) {
d(printf("Am indexing message %s\n", mi->uid));
camel_folder_summary_set_index(s, cls->index);
} else {
d(printf("Not indexing message %s\n", mi->uid));
camel_folder_summary_set_index(s, NULL);
}
}
return mi;
}
static CamelMessageInfo * message_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg)
{
CamelMessageInfo *mi;
/*CamelLocalSummary *cls = (CamelLocalSummary *)s;*/
mi = ((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_new_from_message(s, msg);
#if 0
if (mi) {
if (mi->uid == NULL) {
d(printf("no uid assigned yet, assigning one\n"));
mi->uid = camel_folder_summary_next_uid_string(s);
mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
}
if (cls->index
&& (cls->index_force
|| !ibex_contains_name(cls->index, mi->uid))) {
d(printf("Am indexing message %s\n", mi->uid));
camel_folder_summary_set_index(s, cls->index);
} else {
d(printf("Not indexing message %s\n", mi->uid));
camel_folder_summary_set_index(s, NULL);
}
}
#endif
return mi;
}
static CamelMessageInfo *
message_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser *mp)
{
CamelMessageInfo *mi;
/*CamelLocalSummary *mbs = CAMEL_LOCAL_SUMMARY(s);*/
mi = ((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_new_from_parser(s, mp);
if (mi) {
#if 0
/* do we want to index this message as we add it, as well? */
if (mbs->index
&& (mbs->index_force
|| !ibex_contains_name(mbs->index, mi->uid))) {
d(printf("Am indexing message %s\n", mi->uid));
camel_folder_summary_set_index(s, mbs->index);
} else {
d(printf("Not indexing message %s\n", mi->uid));
camel_folder_summary_set_index(s, NULL);
}
#endif
}
return mi;
}
#if 0
static CamelMessageInfo *
message_info_load(CamelFolderSummary *s, FILE *in)
{
CamelMessageInfo *mi;
io(printf("loading local message info\n"));
mi = ((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_load(s, in);
if (mi) {
guint32 position;
CamelLocalMessageInfo *mbi = (CamelLocalMessageInfo *)mi;
camel_folder_summary_decode_uint32(in, &position);
mbi->frompos = position;
}
return mi;
}
static int
message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
{
CamelLocalMessageInfo *mbi = (CamelLocalMessageInfo *)mi;
io(printf("saving local message info\n"));
((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_save(s, out, mi);
return camel_folder_summary_encode_uint32(out, mbi->frompos);
}
#endif
|