aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/local')
-rw-r--r--camel/providers/local/camel-local-summary.c85
-rw-r--r--camel/providers/local/camel-local-summary.h14
-rw-r--r--camel/providers/local/camel-maildir-folder.c4
-rw-r--r--camel/providers/local/camel-maildir-store.c2
-rw-r--r--camel/providers/local/camel-maildir-summary.c83
-rw-r--r--camel/providers/local/camel-maildir-summary.h18
-rw-r--r--camel/providers/local/camel-mbox-folder.c80
-rw-r--r--camel/providers/local/camel-mbox-store.c2
-rw-r--r--camel/providers/local/camel-mbox-summary.c179
-rw-r--r--camel/providers/local/camel-mbox-summary.h4
-rw-r--r--camel/providers/local/camel-mh-folder.c4
-rw-r--r--camel/providers/local/camel-mh-store.c2
-rw-r--r--camel/providers/local/camel-mh-summary.c28
-rw-r--r--camel/providers/local/camel-mh-summary.h2
-rw-r--r--camel/providers/local/camel-spool-folder.c2
-rw-r--r--camel/providers/local/camel-spool-summary.c10
-rw-r--r--camel/providers/local/camel-spool-summary.h2
17 files changed, 250 insertions, 271 deletions
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index e515dd54c6..0a4f96b552 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -46,10 +46,10 @@
static int summary_header_load (CamelFolderSummary *, FILE *);
static int summary_header_save (CamelFolderSummary *, FILE *);
-static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _camel_header_raw *);
+static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, struct _camel_header_raw *);
-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_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *mi);
+static char *local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
static int local_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
static int local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
@@ -89,7 +89,7 @@ camel_local_summary_class_init(CamelLocalSummaryClass *klass)
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_header = message_info_new_from_header;
klass->load = local_summary_load;
klass->check = local_summary_check;
@@ -106,7 +106,7 @@ camel_local_summary_init(CamelLocalSummary *obj)
struct _CamelFolderSummary *s = (CamelFolderSummary *)obj;
/* subclasses need to set the right instance data sizes */
- s->message_info_size = sizeof(CamelMessageInfo);
+ s->message_info_size = sizeof(CamelLocalMessageInfo);
s->content_info_size = sizeof(CamelMessageContentInfo);
/* and a unique file version */
@@ -166,13 +166,13 @@ void camel_local_summary_check_force(CamelLocalSummary *cls)
}
char *
-camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *info)
+camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *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)
+camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *info)
{
return ((CamelLocalSummaryClass *)(CAMEL_OBJECT_GET_CLASS(cls)))->decode_x_evolution(cls, xev, info);
}
@@ -273,7 +273,7 @@ camel_local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changei
for (i=0;i<camel_folder_summary_count(s);i++) {
CamelMessageInfo *info = camel_folder_summary_index(s, i);
do_stat_mi(cls, &stats, info);
- camel_folder_summary_info_free(s, info);
+ camel_message_info_free(info);
}
printf("\nMemory used by summary:\n\n");
@@ -418,43 +418,42 @@ local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeIn
static CamelMessageInfo *
local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
{
- CamelMessageInfo *mi;
+ CamelLocalMessageInfo *mi;
char *xev;
d(printf("Adding message to summary\n"));
- mi = camel_folder_summary_add_from_message((CamelFolderSummary *)cls, msg);
+ mi = (CamelLocalMessageInfo *)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;
+ const CamelTag *tag = camel_message_info_user_tags(info);
+ const CamelFlag *flag = camel_message_info_user_flags(info);
while (flag) {
- camel_flag_set(&mi->user_flags, flag->name, TRUE);
+ camel_message_info_set_user_flag((CamelMessageInfo *)mi, flag->name, TRUE);
flag = flag->next;
}
while (tag) {
- camel_tag_set(&mi->user_tags, tag->name, tag->value);
+ camel_message_info_set_user_tag((CamelMessageInfo *)mi, tag->name, tag->value);
tag = tag->next;
}
- mi->flags = mi->flags | (info->flags & 0xffff);
- if (info->size)
- mi->size = info->size;
+ mi->info.flags |= (camel_message_info_flags(info) & 0xffff);
+ mi->info.size = camel_message_info_size(info);
}
/* we need to calculate the size ourselves */
- if (mi->size == 0) {
+ if (mi->info.size == 0) {
CamelStreamNull *sn = (CamelStreamNull *)camel_stream_null_new();
camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)sn);
- mi->size = sn->written;
+ mi->info.size = sn->written;
camel_object_unref((CamelObject *)sn);
}
- mi->flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED);
+ mi->info.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);
@@ -464,17 +463,17 @@ local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMess
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unable to add message to summary: unknown reason"));
}
- return mi;
+ return (CamelMessageInfo *)mi;
}
static char *
-local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
+local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *mi)
{
GString *out = g_string_new("");
struct _camel_header_param *params = NULL;
GString *val = g_string_new("");
- CamelFlag *flag = mi->user_flags;
- CamelTag *tag = mi->user_tags;
+ CamelFlag *flag = mi->info.user_flags;
+ CamelTag *tag = mi->info.user_tags;
char *ret;
const char *p, *uidstr;
guint32 uid;
@@ -485,9 +484,9 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo
while (*p && isdigit(*p))
p++;
if (*p == 0 && sscanf (uidstr, "%u", &uid) == 1) {
- g_string_printf (out, "%08x-%04x", uid, mi->flags & 0xffff);
+ g_string_printf (out, "%08x-%04x", uid, mi->info.flags & 0xffff);
} else {
- g_string_printf (out, "%s-%04x", uidstr, mi->flags & 0xffff);
+ g_string_printf (out, "%s-%04x", uidstr, mi->info.flags & 0xffff);
}
if (flag || tag) {
@@ -525,23 +524,22 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo
}
static int
-local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
+local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *mi)
{
struct _camel_header_param *params, *scan;
guint32 uid, flags;
char *header;
int i;
+ char uidstr[20];
+
+ uidstr[0] = 0;
/* check for uid/flags */
header = camel_header_token_decode(xev);
if (header && strlen(header) == strlen("00000000-0000")
&& sscanf(header, "%08x-%04x", &uid, &flags) == 2) {
- char uidstr[20];
- if (mi) {
+ if (mi)
sprintf(uidstr, "%u", uid);
- camel_message_info_set_uid(mi, g_strdup(uidstr));
- mi->flags = flags;
- }
} else {
g_free(header);
return -1;
@@ -560,9 +558,8 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelM
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);
- }
+ for (i=0;flagv[i];i++)
+ camel_message_info_set_user_flag((CamelMessageInfo *)mi, flagv[i], TRUE);
g_strfreev(flagv);
} else if (!strcasecmp(scan->name, "tags")) {
char **tagv = g_strsplit(scan->value, ",", 10000);
@@ -572,7 +569,7 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelM
val = strchr(tagv[i], '=');
if (val) {
*val++ = 0;
- camel_tag_set(&mi->user_tags, tagv[i], val);
+ camel_message_info_set_user_tag((CamelMessageInfo *)mi, tagv[i], val);
val[-1]='=';
}
}
@@ -582,6 +579,10 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelM
}
camel_header_param_list_free(params);
}
+
+ mi->info.uid = g_strdup(uidstr);
+ mi->info.flags = flags;
+
return 0;
}
@@ -615,12 +616,12 @@ summary_header_save(CamelFolderSummary *s, FILE *out)
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
+message_info_new_from_header(CamelFolderSummary *s, struct _camel_header_raw *h)
{
- CamelMessageInfo *mi;
+ CamelLocalMessageInfo *mi;
CamelLocalSummary *cls = (CamelLocalSummary *)s;
- mi = ((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_new(s, h);
+ mi = (CamelLocalMessageInfo *)((CamelFolderSummaryClass *)camel_local_summary_parent)->message_info_new_from_header(s, h);
if (mi) {
const char *xev;
int doindex = FALSE;
@@ -628,8 +629,8 @@ message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
xev = camel_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;
- camel_message_info_set_uid(mi, camel_folder_summary_next_uid_string(s));
+ mi->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
+ mi->info.uid = camel_folder_summary_next_uid_string(s);
/* shortcut, no need to look it up in the index library */
doindex = TRUE;
@@ -647,5 +648,5 @@ message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
}
}
- return mi;
+ return (CamelMessageInfo *)mi;
}
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
index 99a520f243..cc7dc3eb2d 100644
--- a/camel/providers/local/camel-local-summary.h
+++ b/camel/providers/local/camel-local-summary.h
@@ -40,6 +40,12 @@ enum {
CAMEL_MESSAGE_FOLDER_NOTSEEN = 1<<19, /* have we seen this in processing this loop? */
};
+typedef struct _CamelLocalMessageInfo CamelLocalMessageInfo;
+
+struct _CamelLocalMessageInfo {
+ CamelMessageInfoBase info;
+};
+
struct _CamelLocalSummary {
CamelFolderSummary parent;
@@ -60,8 +66,8 @@ struct _CamelLocalSummaryClass {
int (*sync)(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
CamelMessageInfo *(*add)(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
- char *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelMessageInfo *info);
- int (*decode_x_evolution)(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info);
+ char *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
+ int (*decode_x_evolution)(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *info);
};
CamelType camel_local_summary_get_type (void);
@@ -80,8 +86,8 @@ CamelMessageInfo *camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessa
void camel_local_summary_check_force(CamelLocalSummary *cls);
/* generate an X-Evolution header line */
-char *camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *info);
-int camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info);
+char *camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
+int camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *info);
/* utility functions - write headers to a file with optional X-Evolution header and/or status header */
int camel_local_summary_write_headers(int fd, struct _camel_header_raw *header, const char *xevline, const char *status, const char *xstatus);
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index 669e636527..b74f6e5ace 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -153,7 +153,7 @@ camel_maildir_folder_new(CamelStore *parent_store, const char *full_name, guint3
static CamelLocalSummary *maildir_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index)
{
- return (CamelLocalSummary *)camel_maildir_summary_new(path, folder, index);
+ return (CamelLocalSummary *)camel_maildir_summary_new((CamelFolder *)lf, path, folder, index);
}
static void
@@ -251,7 +251,7 @@ static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar *
/* what do we do if the message flags (and :info data) changes? filename mismatch - need to recheck I guess */
name = g_strdup_printf("%s/cur/%s", lf->folder_path, camel_maildir_info_filename(mdi));
- camel_folder_summary_info_free(folder->summary, info);
+ camel_message_info_free(info);
if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 9c4097a3cb..eac22d23c6 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -283,7 +283,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
root = camel_local_store_get_toplevel_dir((CamelLocalStore *)store);
path = g_strdup_printf("%s/%s.ev-summary", root, fi->full_name);
folderpath = g_strdup_printf("%s/%s", root, fi->full_name);
- s = (CamelFolderSummary *)camel_maildir_summary_new(path, folderpath, NULL);
+ s = (CamelFolderSummary *)camel_maildir_summary_new(NULL, path, folderpath, NULL);
if (camel_folder_summary_header_load(s) != -1) {
fi->unread = s->unread_count;
fi->total = s->saved_count;
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 8b15c2b991..07183d2cb4 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -49,7 +49,7 @@
#define CAMEL_MAILDIR_SUMMARY_VERSION (0x2000)
static CamelMessageInfo *message_info_load(CamelFolderSummary *s, FILE *in);
-static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _camel_header_raw *);
+static CamelMessageInfo *message_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
static void message_info_free(CamelFolderSummary *, CamelMessageInfo *mi);
static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
@@ -58,8 +58,8 @@ static int maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelF
static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
static char *maildir_summary_next_uid_string(CamelFolderSummary *s);
-static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi);
-static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi);
+static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *mi);
+static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
static void camel_maildir_summary_class_init (CamelMaildirSummaryClass *class);
static void camel_maildir_summary_init (CamelMaildirSummary *gspaper);
@@ -104,7 +104,7 @@ camel_maildir_summary_class_init (CamelMaildirSummaryClass *class)
/* override methods */
sklass->message_info_load = message_info_load;
- sklass->message_info_new = message_info_new;
+ sklass->message_info_new_from_header = message_info_new_from_header;
sklass->message_info_free = message_info_free;
sklass->next_uid_string = maildir_summary_next_uid_string;
@@ -151,15 +151,20 @@ camel_maildir_summary_finalise(CamelObject *obj)
/**
* camel_maildir_summary_new:
+ * @folder: parent folder.
+ * @filename: Path to root of this maildir directory (containing new/tmp/cur directories).
+ * @index: Index if one is reqiured.
*
* Create a new CamelMaildirSummary object.
*
* Return value: A new #CamelMaildirSummary object.
**/
-CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, CamelIndex *index)
+CamelMaildirSummary *camel_maildir_summary_new(struct _CamelFolder *folder, const char *filename, const char *maildirdir, CamelIndex *index)
{
CamelMaildirSummary *o = (CamelMaildirSummary *)camel_object_new(camel_maildir_summary_get_type ());
+ ((CamelFolderSummary *)o)->folder = folder;
+
camel_local_summary_construct((CamelLocalSummary *)o, filename, maildirdir, index);
return o;
}
@@ -178,17 +183,17 @@ static struct {
};
/* convert the uid + flags into a unique:info maildir format */
-char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info)
+char *camel_maildir_summary_info_to_name(const CamelMaildirMessageInfo *info)
{
const char *uid;
char *p, *buf;
int i;
-
+
uid = camel_message_info_uid (info);
buf = g_alloca (strlen (uid) + strlen (":2,") + (sizeof (flagbits) / sizeof (flagbits[0])) + 1);
p = buf + sprintf (buf, "%s:2,", uid);
for (i = 0; i < sizeof (flagbits) / sizeof (flagbits[0]); i++) {
- if (info->flags & flagbits[i].flagbit)
+ if (info->info.info.flags & flagbits[i].flagbit)
*p++ = flagbits[i].flag;
}
*p = 0;
@@ -197,7 +202,7 @@ char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info)
}
/* returns 0 if the info matches (or there was none), otherwise we changed it */
-int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name)
+int camel_maildir_summary_name_to_info(CamelMaildirMessageInfo *info, const char *name)
{
char *p, c;
guint32 set = 0; /* what we set */
@@ -210,7 +215,7 @@ int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name)
while ((c = *p++)) {
/* we could assume that the flags are in order, but its just as easy not to require */
for (i=0;i<sizeof(flagbits)/sizeof(flagbits[0]);i++) {
- if (flagbits[i].flag == c && (info->flags & flagbits[i].flagbit) == 0) {
+ if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 0) {
set |= flagbits[i].flagbit;
}
/*all |= flagbits[i].flagbit;*/
@@ -219,10 +224,10 @@ int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name)
/* changed? */
/*if ((info->flags & all) != set) {*/
- if ((info->flags & set) != set) {
+ if ((info->info.info.flags & set) != set) {
/* ok, they did change, only add the new flags ('merge flags'?) */
/*info->flags &= all; if we wanted to set only the new flags, which we probably dont */
- info->flags |= set;
+ info->info.info.flags |= set;
return 1;
}
}
@@ -231,12 +236,12 @@ int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name)
}
/* for maildir, x-evolution isn't used, so dont try and get anything out of it */
-static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
+static int maildir_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *mi)
{
return -1;
}
-static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
+static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessageInfo *mi)
{
return NULL;
}
@@ -246,9 +251,9 @@ static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const Ca
*/
static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
{
- CamelMessageInfo *mi;
+ CamelMaildirMessageInfo *mi;
- mi = ((CamelLocalSummaryClass *) parent_class)->add(cls, msg, info, changes, ex);
+ mi = (CamelMaildirMessageInfo *)((CamelLocalSummaryClass *) parent_class)->add(cls, msg, info, changes, ex);
if (mi) {
if (info) {
camel_maildir_info_set_filename(mi, camel_maildir_summary_info_to_name(mi));
@@ -256,35 +261,35 @@ static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMe
}
}
- return mi;
+ return (CamelMessageInfo *)mi;
}
-static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _camel_header_raw *h)
+static CamelMessageInfo *message_info_new_from_header(CamelFolderSummary * s, struct _camel_header_raw *h)
{
CamelMessageInfo *mi, *info;
CamelMaildirSummary *mds = (CamelMaildirSummary *)s;
CamelMaildirMessageInfo *mdi;
const char *uid;
- mi = ((CamelFolderSummaryClass *) parent_class)->message_info_new(s, h);
+ mi = ((CamelFolderSummaryClass *) parent_class)->message_info_new_from_header(s, h);
/* assign the uid and new filename */
if (mi) {
mdi = (CamelMaildirMessageInfo *)mi;
uid = camel_message_info_uid(mi);
if (uid==NULL || uid[0] == 0)
- camel_message_info_set_uid(mi, camel_folder_summary_next_uid_string(s));
+ mdi->info.info.uid = camel_folder_summary_next_uid_string(s);
/* handle 'duplicates' */
info = camel_folder_summary_uid(s, uid);
if (info) {
d(printf("already seen uid '%s', just summarising instead\n", uid));
- camel_folder_summary_info_free(s, mi);
+ camel_message_info_free(mi);
mdi = (CamelMaildirMessageInfo *)(mi = info);
}
/* with maildir we know the real received date, from the filename */
- mi->date_received = strtoul(camel_message_info_uid(mi), NULL, 10);
+ mdi->info.info.date_received = strtoul(camel_message_info_uid(mi), NULL, 10);
if (mds->priv->current_file) {
#if 0
@@ -293,7 +298,7 @@ static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _camel_
#endif
/* if setting from a file, grab the flags from it */
camel_maildir_info_set_filename(mi, g_strdup(mds->priv->current_file));
- camel_maildir_summary_name_to_info(mi, mds->priv->current_file);
+ camel_maildir_summary_name_to_info(mdi, mds->priv->current_file);
#if 0
/* Actually, I dont think all this effort is worth it at all ... */
@@ -313,7 +318,7 @@ static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _camel_
#endif
} else {
/* if creating a file, set its name from the flags we have */
- camel_maildir_info_set_filename(mdi, camel_maildir_summary_info_to_name(mi));
+ camel_maildir_info_set_filename(mdi, camel_maildir_summary_info_to_name(mdi));
d(printf("Setting filename to %s\n", camel_maildir_info_filename(mi)));
}
}
@@ -393,7 +398,7 @@ message_info_load(CamelFolderSummary *s, FILE *in)
&& (name = g_hash_table_lookup(mds->priv->load_map, camel_message_info_uid(mi)))) {
d(printf("Setting filename of %s to %s\n", camel_message_info_uid(mi), name));
camel_maildir_info_set_filename(mi, g_strdup(name));
- camel_maildir_summary_name_to_info(mi, name);
+ camel_maildir_summary_name_to_info((CamelMaildirMessageInfo *)mi, name);
}
}
@@ -502,19 +507,19 @@ remove_summary(char *key, CamelMessageInfo *info, struct _remove_data *rd)
if (rd->changes)
camel_folder_change_info_remove_uid(rd->changes, key);
camel_folder_summary_remove((CamelFolderSummary *)rd->cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)rd->cls, info);
+ camel_message_info_free(info);
}
static int
sort_receive_cmp(const void *ap, const void *bp)
{
- const CamelMessageInfo
- *a = *((CamelMessageInfo **)ap),
- *b = *((CamelMessageInfo **)bp);
+ const CamelMaildirMessageInfo
+ *a = *((CamelMaildirMessageInfo **)ap),
+ *b = *((CamelMaildirMessageInfo **)bp);
- if (a->date_received < b->date_received)
+ if (a->info.info.date_received < b->info.info.date_received)
return -1;
- else if (a->date_received > b->date_received)
+ else if (a->info.info.date_received > b->info.info.date_received)
return 1;
return 0;
@@ -594,7 +599,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
info = g_hash_table_lookup(left, uid);
if (info) {
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
g_hash_table_remove(left, uid);
}
@@ -634,7 +639,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
# endif
#endif
}
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
}
g_free(uid);
}
@@ -669,7 +674,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
/* already in summary? shouldn't happen, but just incase ... */
if ((info = camel_folder_summary_uid((CamelFolderSummary *)cls, name))) {
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
newname = destname = camel_folder_summary_next_uid_string(s);
} else {
newname = NULL;
@@ -741,7 +746,7 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange
info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
mdi = (CamelMaildirMessageInfo *)info;
- if (info && (info->flags & CAMEL_MESSAGE_DELETED) && expunge) {
+ if (mdi && (mdi->info.info.flags & CAMEL_MESSAGE_DELETED) && expunge) {
name = g_strdup_printf("%s/cur/%s", cls->folder_path, camel_maildir_info_filename(mdi));
d(printf("deleting %s\n", name));
if (unlink(name) == 0 || errno==ENOENT) {
@@ -754,8 +759,8 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange
camel_folder_summary_remove((CamelFolderSummary *)cls, info);
}
g_free(name);
- } else if (info && (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
- char *newname = camel_maildir_summary_info_to_name(info);
+ } else if (mdi && (mdi->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
+ char *newname = camel_maildir_summary_info_to_name(mdi);
char *dest;
/* do we care about additional metainfo stored inside the message? */
@@ -798,9 +803,9 @@ maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChange
}
/* strip FOLDER_MESSAGE_FLAGED, etc */
- info->flags &= 0xffff;
+ mdi->info.info.flags &= 0xffff;
}
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
}
camel_operation_end(NULL);
diff --git a/camel/providers/local/camel-maildir-summary.h b/camel/providers/local/camel-maildir-summary.h
index 0cae785c6c..4ecaf368f5 100644
--- a/camel/providers/local/camel-maildir-summary.h
+++ b/camel/providers/local/camel-maildir-summary.h
@@ -37,19 +37,15 @@ typedef struct _CamelMaildirMessageContentInfo {
CamelMessageContentInfo info;
} CamelMaildirMessageContentInfo;
-#if defined (DOEPOOLV) || defined (DOESTRV)
enum {
CAMEL_MAILDIR_INFO_FILENAME = CAMEL_MESSAGE_INFO_LAST,
CAMEL_MAILDIR_INFO_LAST,
};
-#endif
typedef struct _CamelMaildirMessageInfo {
- CamelMessageInfo info;
+ CamelLocalMessageInfo info;
-#if !defined (DOEPOOLV) && !defined (DOESTRV)
char *filename; /* maildir has this annoying status shit on the end of the filename, use this to get the real message id */
-#endif
} CamelMaildirMessageInfo;
struct _CamelMaildirSummary {
@@ -66,19 +62,15 @@ struct _CamelMaildirSummaryClass {
};
CamelType camel_maildir_summary_get_type (void);
-CamelMaildirSummary *camel_maildir_summary_new (const char *filename, const char *maildirdir, CamelIndex *index);
+CamelMaildirSummary *camel_maildir_summary_new (struct _CamelFolder *folder, const char *filename, const char *maildirdir, CamelIndex *index);
/* convert some info->flags to/from the messageinfo */
-char *camel_maildir_summary_info_to_name(const CamelMessageInfo *info);
-int camel_maildir_summary_name_to_info(CamelMessageInfo *info, const char *name);
+char *camel_maildir_summary_info_to_name(const CamelMaildirMessageInfo *info);
+int camel_maildir_summary_name_to_info(CamelMaildirMessageInfo *info, const char *name);
-#if defined (DOEPOOLV) || defined (DOESTRV)
-#define camel_maildir_info_filename(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MAILDIR_INFO_FILENAME)
-#define camel_maildir_info_set_filename(x, s) camel_message_info_set_string((CamelMessageInfo *)(x), CAMEL_MAILDIR_INFO_FILENAME, s)
-#else
+/* TODO: could proably use get_string stuff */
#define camel_maildir_info_filename(x) (((CamelMaildirMessageInfo *)x)->filename)
#define camel_maildir_info_set_filename(x, s) (g_free(((CamelMaildirMessageInfo *)x)->filename),((CamelMaildirMessageInfo *)x)->filename = s)
-#endif
#endif /* ! _CAMEL_MAILDIR_SUMMARY_H */
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index b4926b9b04..d213b444fc 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -56,13 +56,6 @@ static CamelLocalFolderClass *parent_class = NULL;
static int mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
static void mbox_unlock(CamelLocalFolder *lf);
-#ifdef STATUS_PINE
-static gboolean mbox_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set);
-#endif
-
-static void mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value);
-static void mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
-
static void mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, char **appended_uid, CamelException *ex);
static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex);
static CamelLocalSummary *mbox_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index);
@@ -83,12 +76,6 @@ camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
camel_folder_class->append_message = mbox_append_message;
camel_folder_class->get_message = mbox_get_message;
-#ifdef STATUS_PINE
- camel_folder_class->set_message_flags = mbox_set_message_flags;
-#endif
- camel_folder_class->set_message_user_flag = mbox_set_message_user_flag;
- camel_folder_class->set_message_user_tag = mbox_set_message_user_tag;
-
lclass->get_full_path = camel_mbox_folder_get_full_path;
lclass->get_meta_path = camel_mbox_folder_get_meta_path;
lclass->create_summary = mbox_create_summary;
@@ -207,7 +194,7 @@ camel_mbox_folder_get_meta_path (CamelLocalFolder *lf, const char *toplevel_dir,
static CamelLocalSummary *mbox_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index)
{
- return (CamelLocalSummary *)camel_mbox_summary_new(path, folder, index);
+ return (CamelLocalSummary *)camel_mbox_summary_new((CamelFolder *)lf, path, folder, index);
}
static int mbox_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
@@ -421,7 +408,7 @@ retry:
g_assert(info->frompos != -1);
frompos = info->frompos;
- camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)info);
+ camel_message_info_free((CamelMessageInfo *)info);
/* we use an fd instead of a normal stream here - the reason is subtle, camel_mime_part will cache
the whole message in memory if the stream is non-seekable (which it is when built from a parser
@@ -493,66 +480,3 @@ fail:
return message;
}
-
-#ifdef STATUS_PINE
-static gboolean
-mbox_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set)
-{
- /* Basically, if anything could change the Status line, presume it does */
- if (((CamelMboxSummary *)folder->summary)->xstatus
- && (flags & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_DELETED))) {
- flags |= CAMEL_MESSAGE_FOLDER_XEVCHANGE|CAMEL_MESSAGE_FOLDER_FLAGGED;
- set |= CAMEL_MESSAGE_FOLDER_XEVCHANGE|CAMEL_MESSAGE_FOLDER_FLAGGED;
- }
-
- return ((CamelFolderClass *)parent_class)->set_message_flags(folder, uid, flags, set);
-}
-#endif
-
-static void
-mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value)
-{
- CamelMessageInfo *info;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- if (info == NULL)
- return;
-
- if (camel_flag_set(&info->user_flags, name, value)) {
- CamelFolderChangeInfo *changes = camel_folder_change_info_new();
-
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE;
- camel_folder_summary_touch(folder->summary);
-
- camel_folder_change_info_change_uid(changes, uid);
- camel_object_trigger_event(folder, "folder_changed", changes);
- camel_folder_change_info_free(changes);
- }
- camel_folder_summary_info_free(folder->summary, info);
-}
-
-static void
-mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value)
-{
- CamelMessageInfo *info;
-
- g_return_if_fail(folder->summary != NULL);
-
- info = camel_folder_summary_uid(folder->summary, uid);
- if (info == NULL)
- return;
-
- if (camel_tag_set(&info->user_tags, name, value)) {
- CamelFolderChangeInfo *changes = camel_folder_change_info_new();
-
- info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE;
- camel_folder_summary_touch(folder->summary);
-
- camel_folder_change_info_change_uid(changes, uid);
- camel_object_trigger_event (folder, "folder_changed", changes);
- camel_folder_change_info_free(changes);
- }
- camel_folder_summary_info_free(folder->summary, info);
-}
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
index f98c87a8ea..a9e581cdd7 100644
--- a/camel/providers/local/camel-mbox-store.c
+++ b/camel/providers/local/camel-mbox-store.c
@@ -618,7 +618,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
path = camel_mbox_folder_get_meta_path(NULL, root, fi->full_name, ".ev-summary");
folderpath = camel_mbox_folder_get_full_path(NULL, root, fi->full_name);
- mbs = (CamelMboxSummary *)camel_mbox_summary_new(path, folderpath, NULL);
+ mbs = (CamelMboxSummary *)camel_mbox_summary_new(NULL, path, folderpath, NULL);
if (camel_folder_summary_header_load((CamelFolderSummary *)mbs) != -1) {
fi->unread = ((CamelFolderSummary *)mbs)->unread_count;
fi->total = ((CamelFolderSummary *)mbs)->saved_count;
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 60dcf34c1c..9dcee0a9c8 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -51,13 +51,13 @@
static int summary_header_load (CamelFolderSummary *, FILE *);
static int summary_header_save (CamelFolderSummary *, FILE *);
-static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _camel_header_raw *);
-static CamelMessageInfo * message_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
+static CamelMessageInfo * message_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
+static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
static CamelMessageInfo * message_info_load (CamelFolderSummary *, FILE *);
static int message_info_save (CamelFolderSummary *, FILE *, CamelMessageInfo *);
/*static void message_info_free (CamelFolderSummary *, CamelMessageInfo *);*/
-static char *mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelMessageInfo *mi);
+static char *mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
static int mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
static int mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
@@ -100,6 +100,44 @@ camel_mbox_summary_get_type(void)
return type;
}
+static gboolean
+mbox_info_set_user_flag(CamelMessageInfo *mi, const char *name, gboolean value)
+{
+ int res;
+
+ res = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->info_set_user_flag(mi, name, value);
+ if (res)
+ ((CamelLocalMessageInfo *)mi)->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE;
+
+ return res;
+}
+
+static gboolean
+mbox_info_set_user_tag(CamelMessageInfo *mi, const char *name, const char *value)
+{
+ int res;
+
+ res = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->info_set_user_tag(mi, name, value);
+ if (res)
+ ((CamelLocalMessageInfo *)mi)->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE;
+
+ return res;
+}
+
+#ifdef STATUS_PINE
+static gboolean
+mbox_info_set_flags(CamelMessageInfo *mi, guint32 flags, guint32 set)
+{
+ /* Basically, if anything could change the Status line, presume it does */
+ if (((CamelMboxSummary *)mi->summary)->xstatus
+ && (flags & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_DELETED))) {
+ flags |= CAMEL_MESSAGE_FOLDER_XEVCHANGE|CAMEL_MESSAGE_FOLDER_FLAGGED;
+ set |= CAMEL_MESSAGE_FOLDER_XEVCHANGE|CAMEL_MESSAGE_FOLDER_FLAGGED;
+ }
+
+ return ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->info_set_flags(mi, flags, set);
+}
+#endif
static void
camel_mbox_summary_class_init(CamelMboxSummaryClass *klass)
@@ -112,11 +150,17 @@ camel_mbox_summary_class_init(CamelMboxSummaryClass *klass)
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_header = message_info_new_from_header;
sklass->message_info_new_from_parser = message_info_new_from_parser;
sklass->message_info_load = message_info_load;
sklass->message_info_save = message_info_save;
/*sklass->message_info_free = message_info_free;*/
+
+ sklass->info_set_user_flag = mbox_info_set_user_flag;
+ sklass->info_set_user_tag = mbox_info_set_user_tag;
+#ifdef STATUS_PINE
+ sklass->info_set_flags = mbox_info_set_flags;
+#endif
lklass->encode_x_evolution = mbox_summary_encode_x_evolution;
lklass->check = mbox_summary_check;
@@ -156,10 +200,12 @@ camel_mbox_summary_finalise(CamelObject *obj)
* Return value: A new CamelMboxSummary widget.
**/
CamelMboxSummary *
-camel_mbox_summary_new(const char *filename, const char *mbox_name, CamelIndex *index)
+camel_mbox_summary_new(struct _CamelFolder *folder, const char *filename, const char *mbox_name, CamelIndex *index)
{
CamelMboxSummary *new = (CamelMboxSummary *)camel_object_new(camel_mbox_summary_get_type());
+ ((CamelFolderSummary *)new)->folder = folder;
+
camel_local_summary_construct((CamelLocalSummary *)new, filename, mbox_name, index);
return new;
}
@@ -170,19 +216,20 @@ void camel_mbox_summary_xstatus(CamelMboxSummary *mbs, int state)
}
static char *
-mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelMessageInfo *mi)
+mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi)
{
const char *p, *uidstr;
guint32 uid;
-
- p = uidstr = camel_message_info_uid (mi);
- while (*p && isdigit (*p))
+
+ /* This is busted, it is supposed to encode ALL DATA */
+ p = uidstr = camel_message_info_uid(mi);
+ while (*p && isdigit(*p))
p++;
- if (*p == 0 && sscanf (uidstr, "%u", &uid) == 1) {
- return g_strdup_printf ("%08x-%04x", uid, mi->flags & 0xffff);
+ if (*p == 0 && sscanf(uidstr, "%u", &uid) == 1) {
+ return g_strdup_printf("%08x-%04x", uid, mi->info.flags & 0xffff);
} else {
- return g_strdup_printf ("%s-%04x", uidstr, mi->flags & 0xffff);
+ return g_strdup_printf("%s-%04x", uidstr, mi->info.flags & 0xffff);
}
}
@@ -220,16 +267,15 @@ summary_header_save(CamelFolderSummary *s, FILE *out)
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
+message_info_new_from_header(CamelFolderSummary *s, struct _camel_header_raw *h)
{
- CamelMessageInfo *mi;
+ CamelMboxMessageInfo *mi;
CamelMboxSummary *mbs = (CamelMboxSummary *)s;
- mi = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new(s, h);
+ mi = (CamelMboxMessageInfo *)((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_new_from_header(s, h);
if (mi) {
- CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
const char *xev, *uid;
- CamelMessageInfo *info = NULL;
+ CamelMboxMessageInfo *info = NULL;
int add = 0; /* bitmask of things to add, 1 assign uid, 2, just add as new, 4 = recent */
#ifdef STATUS_PINE
const char *status = NULL, *xstatus = NULL;
@@ -248,19 +294,19 @@ message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
/* if we have an xev header, use it, else assign a new one */
xev = camel_header_raw_find(&h, "X-Evolution", NULL);
if (xev != NULL
- && camel_local_summary_decode_x_evolution((CamelLocalSummary *)s, xev, mi) == 0) {
+ && camel_local_summary_decode_x_evolution((CamelLocalSummary *)s, xev, &mi->info) == 0) {
uid = camel_message_info_uid(mi);
d(printf("found valid x-evolution: %s\n", uid));
- info = camel_folder_summary_uid(s, uid);
+ info = (CamelMboxMessageInfo *)camel_folder_summary_uid(s, uid);
if (info) {
- if ((info->flags & CAMEL_MESSAGE_FOLDER_NOTSEEN)) {
- info->flags &= ~CAMEL_MESSAGE_FOLDER_NOTSEEN;
- camel_folder_summary_info_free(s, mi);
- mbi = (CamelMboxMessageInfo *)(mi = info);
+ if ((info->info.info.flags & CAMEL_MESSAGE_FOLDER_NOTSEEN)) {
+ info->info.info.flags &= ~CAMEL_MESSAGE_FOLDER_NOTSEEN;
+ camel_message_info_free(mi);
+ mi = info;
} else {
add = 7;
d(printf("seen '%s' before, adding anew\n", uid));
- camel_folder_summary_info_free(s, info);
+ camel_message_info_free(info);
}
} else {
add = 2;
@@ -272,8 +318,8 @@ message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
}
if (add&1) {
- mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
- camel_message_info_set_uid(mi, camel_folder_summary_next_uid_string(s));
+ mi->info.info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
+ mi->info.info.uid = camel_folder_summary_next_uid_string(s);
} else {
camel_folder_summary_set_uid(s, strtoul(camel_message_info_uid(mi), NULL, 10));
}
@@ -281,9 +327,9 @@ message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
if (mbs->xstatus && add&2) {
/* use the status as the flags when we read it the first time */
if (status)
- mi->flags = (mi->flags & ~(STATUS_STATUS)) | (flags & STATUS_STATUS);
+ mi->info.info.flags = (mi->info.info.flags & ~(STATUS_STATUS)) | (flags & STATUS_STATUS);
if (xstatus)
- mi->flags = (mi->flags & ~(STATUS_XSTATUS)) | (flags & STATUS_XSTATUS);
+ mi->info.info.flags = (mi->info.info.flags & ~(STATUS_XSTATUS)) | (flags & STATUS_XSTATUS);
}
#endif
if (mbs->changes) {
@@ -293,10 +339,10 @@ message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
camel_folder_change_info_recent_uid(mbs->changes, camel_message_info_uid(mi));
}
- mbi->frompos = -1;
+ mi->frompos = -1;
}
- return mi;
+ return (CamelMessageInfo *)mi;
}
static CamelMessageInfo *
@@ -331,7 +377,7 @@ message_info_load(CamelFolderSummary *s, FILE *in)
return mi;
error:
- camel_folder_summary_info_free(s, mi);
+ camel_message_info_free(mi);
return NULL;
}
@@ -357,7 +403,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
CamelFolderSummary *s = (CamelFolderSummary *)cls;
CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
CamelMimeParser *mp;
- CamelMessageInfo *mi;
+ CamelMboxMessageInfo *mi;
int fd;
int ok = 0;
struct stat st;
@@ -404,12 +450,12 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
from the old end, so everything must be treated as new */
count = camel_folder_summary_count(s);
for (i=0;i<count;i++) {
- mi = camel_folder_summary_index(s, i);
+ mi = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
if (offset == 0)
- mi->flags |= CAMEL_MESSAGE_FOLDER_NOTSEEN;
+ mi->info.info.flags |= CAMEL_MESSAGE_FOLDER_NOTSEEN;
else
- mi->flags &= ~CAMEL_MESSAGE_FOLDER_NOTSEEN;
- camel_folder_summary_info_free(s, mi);
+ mi->info.info.flags &= ~CAMEL_MESSAGE_FOLDER_NOTSEEN;
+ camel_message_info_free(mi);
}
mbs->changes = changeinfo;
@@ -434,17 +480,17 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
count = camel_folder_summary_count(s);
for (i=0;i<count;i++) {
- mi = camel_folder_summary_index(s, i);
+ mi = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
/* must've dissapeared from the file? */
- if (mi->flags & CAMEL_MESSAGE_FOLDER_NOTSEEN) {
+ if (mi->info.info.flags & CAMEL_MESSAGE_FOLDER_NOTSEEN) {
d(printf("uid '%s' vanished, removing", camel_message_info_uid(mi)));
if (changeinfo)
camel_folder_change_info_remove_uid(changeinfo, camel_message_info_uid(mi));
- camel_folder_summary_remove(s, mi);
+ camel_folder_summary_remove(s, (CamelMessageInfo *)mi);
count--;
i--;
}
- camel_folder_summary_info_free(s, mi);
+ camel_message_info_free(mi);
}
mbs->changes = NULL;
@@ -495,7 +541,7 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
if (info) {
camel_folder_change_info_remove_uid(changes, camel_message_info_uid(info));
- camel_folder_summary_info_free(s, info);
+ camel_message_info_free(info);
}
}
camel_folder_summary_clear(s);
@@ -661,8 +707,8 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
d(printf("Checking message %s %08x\n", camel_message_info_uid(info), info->info.flags));
- if ((info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ if ((info->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) == 0) {
+ camel_message_info_free((CamelMessageInfo *)info);
info = NULL;
continue;
}
@@ -696,7 +742,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
g_warning("We're supposed to have a valid x-ev header, but we dont");
goto error;
}
- xevnew = camel_local_summary_encode_x_evolution(cls, (CamelMessageInfo *)info);
+ xevnew = camel_local_summary_encode_x_evolution(cls, &info->info);
/* SIGH: encode_param_list is about the only function which folds headers by itself.
This should be fixed somehow differently (either parser doesn't fold headers,
or param_list doesn't, or something */
@@ -725,8 +771,8 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
camel_mime_parser_drop_step(mp);
camel_mime_parser_drop_step(mp);
- info->info.flags &= 0xffff;
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ info->info.info.flags &= 0xffff;
+ camel_message_info_free((CamelMessageInfo *)info);
}
d(printf("Closing folders\n"));
@@ -751,7 +797,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
if (mp)
camel_object_unref((CamelObject *)mp);
if (info)
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ camel_message_info_free((CamelMessageInfo *)info);
camel_operation_end(NULL);
@@ -778,14 +824,15 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
/* check what work we have to do, if any */
for (i=0;quick && i<count; i++) {
- CamelMessageInfo *info = camel_folder_summary_index(s, i);
+ CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
+
g_assert(info);
- if ((expunge && (info->flags & CAMEL_MESSAGE_DELETED)) ||
- (info->flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_XEVCHANGE)))
+ if ((expunge && (info->info.info.flags & CAMEL_MESSAGE_DELETED)) ||
+ (info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_XEVCHANGE)))
quick = FALSE;
else
- work |= (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
- camel_folder_summary_info_free(s, info);
+ work |= (info->info.info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED) != 0;
+ camel_message_info_free(info);
}
/* yuck i hate this logic, but its to simplify the 'all ok, update summary' and failover cases */
@@ -888,7 +935,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
}
lastdel = FALSE;
- if ((flags&1) && info->info.flags & CAMEL_MESSAGE_DELETED) {
+ if ((flags&1) && info->info.info.flags & CAMEL_MESSAGE_DELETED) {
const char *uid = camel_message_info_uid(info);
d(printf("Deleting %s\n", uid));
@@ -899,7 +946,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
/* remove it from the change list */
camel_folder_change_info_remove_uid(changeinfo, uid);
camel_folder_summary_remove(s, (CamelMessageInfo *)info);
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ camel_message_info_free((CamelMessageInfo *)info);
count--;
i--;
info = NULL;
@@ -915,7 +962,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
write(fdout, fromline, strlen(fromline));
}
- if (info && info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
+ if (info && info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
d(printf("Updating header for %s flags = %08x\n", camel_message_info_uid(info), info->info.flags));
if (camel_mime_parser_step(mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_FROM_END) {
@@ -923,11 +970,11 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
goto error;
}
- xevnew = camel_local_summary_encode_x_evolution((CamelLocalSummary *)cls, (CamelMessageInfo *)info);
+ xevnew = camel_local_summary_encode_x_evolution((CamelLocalSummary *)cls, &info->info);
#ifdef STATUS_PINE
if (mbs->xstatus) {
- encode_status(((CamelMessageInfo *)info)->flags & STATUS_STATUS, statnew);
- encode_status(((CamelMessageInfo *)info)->flags & STATUS_XSTATUS, xstatnew);
+ encode_status(info->info.info.flags & STATUS_STATUS, statnew);
+ encode_status(info->info.info.flags & STATUS_XSTATUS, xstatnew);
len = camel_local_summary_write_headers(fdout, camel_mime_parser_headers_raw(mp), xevnew, statnew, xstatnew);
} else {
#endif
@@ -942,7 +989,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
g_strerror (errno));
goto error;
}
- info->info.flags &= 0xffff;
+ info->info.info.flags &= 0xffff;
g_free(xevnew);
xevnew = NULL;
camel_mime_parser_drop_step(mp);
@@ -972,7 +1019,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
d(printf("we are now at %d, from = %d\n", (int)camel_mime_parser_tell(mp),
(int)camel_mime_parser_tell_start_from(mp)));
camel_mime_parser_unstep(mp);
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ camel_message_info_free((CamelMessageInfo *)info);
info = NULL;
}
}
@@ -992,7 +1039,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
if (mp)
camel_object_unref((CamelObject *)mp);
if (info)
- camel_folder_summary_info_free(s, (CamelMessageInfo *)info);
+ camel_message_info_free((CamelMessageInfo *)info);
return -1;
}
@@ -1001,20 +1048,20 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
static CamelMessageInfo *
mbox_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *ci, CamelException *ex)
{
- CamelMessageInfo *mi;
+ CamelMboxMessageInfo *mi;
- mi = ((CamelLocalSummaryClass *)camel_mbox_summary_parent)->add(cls, msg, info, ci, ex);
+ mi = (CamelMboxMessageInfo *)((CamelLocalSummaryClass *)camel_mbox_summary_parent)->add(cls, msg, info, ci, ex);
if (mi && ((CamelMboxSummary *)cls)->xstatus) {
char status[8];
/* we snoop and add status/x-status headers to suit */
- encode_status(mi->flags & STATUS_STATUS, status);
+ encode_status(mi->info.info.flags & STATUS_STATUS, status);
camel_medium_set_header((CamelMedium *)msg, "Status", status);
- encode_status(mi->flags & STATUS_XSTATUS, status);
+ encode_status(mi->info.info.flags & STATUS_XSTATUS, status);
camel_medium_set_header((CamelMedium *)msg, "X-Status", status);
}
- return mi;
+ return (CamelMessageInfo *)mi;
}
static struct {
diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h
index 34402ad264..9089fe7c8e 100644
--- a/camel/providers/local/camel-mbox-summary.h
+++ b/camel/providers/local/camel-mbox-summary.h
@@ -38,7 +38,7 @@ typedef struct _CamelMboxMessageContentInfo {
} CamelMboxMessageContentInfo;
typedef struct _CamelMboxMessageInfo {
- CamelMessageInfo info;
+ CamelLocalMessageInfo info;
off_t frompos;
} CamelMboxMessageInfo;
@@ -64,7 +64,7 @@ struct _CamelMboxSummaryClass {
};
CamelType camel_mbox_summary_get_type (void);
-CamelMboxSummary *camel_mbox_summary_new (const char *filename, const char *mbox_name, CamelIndex *index);
+CamelMboxSummary *camel_mbox_summary_new (struct _CamelFolder *, const char *filename, const char *mbox_name, CamelIndex *index);
/* do we honour/use xstatus headers, etc */
void camel_mbox_summary_xstatus(CamelMboxSummary *mbs, int state);
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index fd054933c5..1b054a4547 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -117,7 +117,7 @@ camel_mh_folder_new(CamelStore *parent_store, const char *full_name, guint32 fla
static CamelLocalSummary *mh_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index)
{
- return (CamelLocalSummary *)camel_mh_summary_new(path, folder, index);
+ return (CamelLocalSummary *)camel_mh_summary_new((CamelFolder *)lf, path, folder, index);
}
static void
@@ -205,7 +205,7 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
}
/* we only need it to check the message exists */
- camel_folder_summary_info_free(folder->summary, info);
+ camel_message_info_free(info);
name = g_strdup_printf("%s/%s", lf->folder_path, uid);
if ((message_stream = camel_stream_fs_new_with_name(name, O_RDONLY, 0)) == NULL) {
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
index cc2f3ce9c9..03b6db92bd 100644
--- a/camel/providers/local/camel-mh-store.c
+++ b/camel/providers/local/camel-mh-store.c
@@ -324,7 +324,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
root = camel_local_store_get_toplevel_dir((CamelLocalStore *)store);
path = g_strdup_printf("%s/%s.ev-summary", root, fi->full_name);
folderpath = g_strdup_printf("%s/%s", root, fi->full_name);
- s = (CamelFolderSummary *)camel_mh_summary_new(path, folderpath, NULL);
+ s = (CamelFolderSummary *)camel_mh_summary_new(NULL, path, folderpath, NULL);
if (camel_folder_summary_header_load(s) != -1) {
fi->unread = s->unread_count;
fi->total = s->saved_count;
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index d51bf7a108..fe0201e4f2 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -123,10 +123,12 @@ camel_mh_summary_finalise(CamelObject *obj)
*
* Return value: A new #CamelMhSummary object.
**/
-CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, CamelIndex *index)
+CamelMhSummary *camel_mh_summary_new(struct _CamelFolder *folder, const char *filename, const char *mhdir, CamelIndex *index)
{
CamelMhSummary *o = (CamelMhSummary *)camel_object_new(camel_mh_summary_get_type ());
+ ((CamelFolderSummary *)o)->folder = folder;
+
camel_local_summary_construct((CamelLocalSummary *)o, filename, mhdir, index);
return o;
}
@@ -204,7 +206,7 @@ remove_summary(char *key, CamelMessageInfo *info, CamelLocalSummary *cls)
if (cls->index)
camel_index_delete_name(cls->index, camel_message_info_uid(info));
camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
}
static int
@@ -272,7 +274,7 @@ mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, Came
if (info != NULL) {
g_hash_table_remove(left, camel_message_info_uid(info));
camel_folder_summary_remove((CamelFolderSummary *)cls, info);
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
}
camel_mh_summary_add(cls, d->d_name, forceindex);
} else {
@@ -280,10 +282,10 @@ mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, Came
CamelMessageInfo *old = g_hash_table_lookup(left, uid);
if (old) {
- camel_folder_summary_info_free((CamelFolderSummary *)cls, old);
+ camel_message_info_free(old);
g_hash_table_remove(left, uid);
}
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
}
}
}
@@ -300,7 +302,7 @@ mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, Came
}
static int
-mh_summary_sync_message(CamelLocalSummary *cls, CamelMessageInfo *info, CamelException *ex)
+mh_summary_sync_message(CamelLocalSummary *cls, CamelLocalMessageInfo *info, CamelException *ex)
{
CamelMimeParser *mp;
const char *xev, *buffer;
@@ -378,7 +380,7 @@ static int
mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changes, CamelException *ex)
{
int count, i;
- CamelMessageInfo *info;
+ CamelLocalMessageInfo *info;
char *name;
const char *uid;
@@ -391,9 +393,9 @@ mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo
count = camel_folder_summary_count((CamelFolderSummary *)cls);
for (i=count-1;i>=0;i--) {
- info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
+ info = (CamelLocalMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)cls, i);
g_assert(info);
- if (expunge && (info->flags & CAMEL_MESSAGE_DELETED)) {
+ if (expunge && (info->info.flags & CAMEL_MESSAGE_DELETED)) {
uid = camel_message_info_uid(info);
name = g_strdup_printf("%s/%s", cls->folder_path, uid);
d(printf("deleting %s\n", name));
@@ -404,17 +406,17 @@ mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo
camel_index_delete_name(cls->index, (char *)uid);
camel_folder_change_info_remove_uid(changes, uid);
- camel_folder_summary_remove((CamelFolderSummary *)cls, info);
+ camel_folder_summary_remove((CamelFolderSummary *)cls, (CamelMessageInfo *)info);
}
g_free(name);
- } else if (info->flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED)) {
+ } else if (info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED)) {
if (mh_summary_sync_message(cls, info, ex) != -1) {
- info->flags &= 0xffff;
+ info->info.flags &= 0xffff;
} else {
g_warning("Problem occured when trying to expunge, ignored");
}
}
- camel_folder_summary_info_free((CamelFolderSummary *)cls, info);
+ camel_message_info_free(info);
}
return ((CamelLocalSummaryClass *)parent_class)->sync(cls, expunge, changes, ex);
diff --git a/camel/providers/local/camel-mh-summary.h b/camel/providers/local/camel-mh-summary.h
index 4ee30df63b..d2fdcd1e4a 100644
--- a/camel/providers/local/camel-mh-summary.h
+++ b/camel/providers/local/camel-mh-summary.h
@@ -47,7 +47,7 @@ struct _CamelMhSummaryClass {
};
CamelType camel_mh_summary_get_type (void);
-CamelMhSummary *camel_mh_summary_new (const char *filename, const char *mhdir, CamelIndex *index);
+CamelMhSummary *camel_mh_summary_new(struct _CamelFolder *, const char *filename, const char *mhdir, CamelIndex *index);
#endif /* ! _CAMEL_MH_SUMMARY_H */
diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c
index b9cb643189..c4c7da91b6 100644
--- a/camel/providers/local/camel-spool-folder.c
+++ b/camel/providers/local/camel-spool-folder.c
@@ -160,7 +160,7 @@ spool_get_meta_path(CamelLocalFolder *lf, const char *toplevel_dir, const char *
static CamelLocalSummary *
spool_create_summary(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index)
{
- return (CamelLocalSummary *)camel_spool_summary_new(folder);
+ return (CamelLocalSummary *)camel_spool_summary_new((CamelFolder *)lf, folder);
}
static int
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index 3e4fb533ab..c8e074ae99 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -106,10 +106,12 @@ camel_spool_summary_finalise(CamelObject *obj)
}
CamelSpoolSummary *
-camel_spool_summary_new(const char *mbox_name)
+camel_spool_summary_new(struct _CamelFolder *folder, const char *mbox_name)
{
CamelSpoolSummary *new = (CamelSpoolSummary *)camel_object_new(camel_spool_summary_get_type());
+ ((CamelFolderSummary *)new)->folder = folder;
+
camel_local_summary_construct((CamelLocalSummary *)new, NULL, mbox_name, NULL);
return new;
}
@@ -318,10 +320,10 @@ spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, C
work = FALSE;
count = camel_folder_summary_count(s);
for (i=0;!work && i<count; i++) {
- CamelMessageInfo *info = camel_folder_summary_index(s, i);
+ CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
g_assert(info);
- work = (info->flags & (CAMEL_MESSAGE_FOLDER_NOXEV)) != 0;
- camel_folder_summary_info_free(s, info);
+ work = (info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV)) != 0;
+ camel_message_info_free((CamelMessageInfo *)info);
}
/* if we do, then write out the headers using sync_full, etc */
diff --git a/camel/providers/local/camel-spool-summary.h b/camel/providers/local/camel-spool-summary.h
index b72aeda527..2849c8cc20 100644
--- a/camel/providers/local/camel-spool-summary.h
+++ b/camel/providers/local/camel-spool-summary.h
@@ -47,7 +47,7 @@ CamelType camel_spool_summary_get_type (void);
void camel_spool_summary_construct (CamelSpoolSummary *new, const char *filename, const char *spool_name, CamelIndex *index);
/* create the summary, in-memory only */
-CamelSpoolSummary *camel_spool_summary_new(const char *filename);
+CamelSpoolSummary *camel_spool_summary_new(struct _CamelFolder *, const char *filename);
/* load/check the summary */
int camel_spool_summary_load(CamelSpoolSummary *cls, int forceindex, CamelException *ex);