2 * Copyright (C) 2000 Ximian Inc.
4 * Authors: Michael Zucchi <notzed@ximian.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef _CAMEL_LOCAL_SUMMARY_H
22 #define _CAMEL_LOCAL_SUMMARY_H
24 #include <camel/camel-folder-summary.h>
25 #include <camel/camel-folder.h>
26 #include <camel/camel-exception.h>
27 #include <camel/camel-index.h>
29 #define CAMEL_LOCAL_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_local_summary_get_type (), CamelLocalSummary)
30 #define CAMEL_LOCAL_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_local_summary_get_type (), CamelLocalSummaryClass)
31 #define CAMEL_IS_LOCAL_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_local_summary_get_type ())
35 typedef struct _CamelLocalSummary CamelLocalSummary;
36 typedef struct _CamelLocalSummaryClass CamelLocalSummaryClass;
38 /* extra summary flags */
40 CAMEL_MESSAGE_FOLDER_NOXEV = 1<<17,
41 CAMEL_MESSAGE_FOLDER_XEVCHANGE = 1<<18,
42 CAMEL_MESSAGE_FOLDER_NOTSEEN = 1<<19, /* have we seen this in processing this loop? */
45 typedef struct _CamelLocalMessageInfo CamelLocalMessageInfo;
47 struct _CamelLocalMessageInfo {
48 CamelMessageInfoBase info;
51 struct _CamelLocalSummary {
52 CamelFolderSummary parent;
54 guint32 version; /* file version being loaded */
56 char *folder_path; /* name of matching folder */
59 unsigned int index_force:1; /* do we force index during creation? */
60 unsigned int check_force:1; /* does a check force a full check? */
63 struct _CamelLocalSummaryClass {
64 CamelFolderSummaryClass parent_class;
66 int (*load)(CamelLocalSummary *cls, int forceindex, CamelException *ex);
67 int (*check)(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
68 int (*sync)(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
69 CamelMessageInfo *(*add)(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
71 char *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
72 int (*decode_x_evolution)(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *info);
75 CamelType camel_local_summary_get_type (void);
76 void camel_local_summary_construct (CamelLocalSummary *new, const char *filename, const char *local_name, CamelIndex *index);
78 /* load/check the summary */
79 int camel_local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
80 /* check for new/removed messages */
81 int camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *, CamelException *ex);
82 /* perform a folder sync or expunge, if needed */
83 int camel_local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *, CamelException *ex);
84 /* add a new message to the summary */
85 CamelMessageInfo *camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
87 /* force the next check to be a full check/rebuild */
88 void camel_local_summary_check_force(CamelLocalSummary *cls);
90 /* generate an X-Evolution header line */
91 char *camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
92 int camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *info);
94 /* utility functions - write headers to a file with optional X-Evolution header and/or status header */
95 int camel_local_summary_write_headers(int fd, struct _camel_header_raw *header, const char *xevline, const char *status, const char *xstatus);
99 #endif /* ! _CAMEL_LOCAL_SUMMARY_H */