aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog28
-rw-r--r--mail/Makefile.am2
-rw-r--r--mail/em-composer-utils.c14
-rw-r--r--mail/em-menu.c15
-rw-r--r--mail/em-popup.c14
-rw-r--r--mail/em-utils.c6
-rw-r--r--mail/em-vfs-stream.c323
-rw-r--r--mail/em-vfs-stream.h60
-rw-r--r--mail/importers/evolution-outlook-importer.c2
-rw-r--r--mail/importers/mail-importer.c16
-rw-r--r--mail/mail-component.c22
-rw-r--r--mail/mail-ops.c13
-rw-r--r--mail/mail-send-recv.c2
-rw-r--r--mail/mail-vfolder.c18
-rw-r--r--mail/message-list.c92
15 files changed, 545 insertions, 82 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2061234d1a..dbff54f9d6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,7 @@
+2004-11-12 Not Zed <NotZed@Ximian.com>
+
+ ** Merge in notzed-messageinfo-branch.
+
2004-11-11 Radek Doulik <rodo@ximian.com>
* em-format-hook.c (emfh_enable): l = g_list_next (l); in inner
@@ -56,6 +60,30 @@
* em-account-editor.c: Change the labels back to the same as they
were in 2.0
+2004-11-12 Not Zed <NotZed@Ximian.com>
+
+ * mail-send-recv.c (auto_account_finalised): fix the callback
+ signature.
+
+2004-11-11 Not Zed <NotZed@Ximian.com>
+
+ * mail-component.c (mc_add_store):
+ (mc_add_store_done): Let the counters know about the junk/trash
+ folders that have already been opened.
+
+ * em-vfs-stream.[ch]: Added stream class to read/write gnome-vfs
+ data from camel. NFI if this will work, depends on how
+ thread-safe gnome-vfs is.
+
+2004-11-08 Not Zed <NotZed@Ximian.com>
+
+ * mail-vfolder.c (uri_is_spethal): fix the special check for local
+ folders.
+
+2004-10-30 Not Zed <NotZed@Ximian.com>
+
+ * */*.c, *.c: camel api changes.
+
2004-10-28 Not Zed <NotZed@Ximian.com>
* mail-folder-cache.c (real_flush_updates):
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 834ad77d4c..e8c684011c 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -144,6 +144,8 @@ libevolution_mail_la_SOURCES = \
em-vfolder-editor.h \
em-vfolder-rule.c \
em-vfolder-rule.h \
+ em-vfs-stream.c \
+ em-vfs-stream.h \
mail-account-editor.c \
mail-account-editor.h \
mail-account-gui.c \
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 12156559ef..691354af97 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -415,8 +415,8 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
if (mail_folder) {
/* mail the message */
- info = camel_message_info_new ();
- info->flags = CAMEL_MESSAGE_SEEN;
+ info = camel_message_info_new(NULL);
+ camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
send = g_malloc (sizeof (*send));
send->emcs = user_data;
@@ -439,8 +439,8 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
mail_tool_destroy_xevolution (xev);
/* mail the message */
- info = camel_message_info_new ();
- info->flags = CAMEL_MESSAGE_SEEN;
+ info = camel_message_info_new(NULL);
+ camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
post_ptr = post_folders;
while (post_ptr) {
@@ -530,7 +530,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
g_object_unref (sdi->composer);
if (sdi->emcs)
emcs_unref (sdi->emcs);
- g_free (info);
+ camel_message_info_free(info);
g_free (sdi);
}
@@ -578,8 +578,8 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user
msg = e_msg_composer_get_message_draft (composer);
- info = g_new0 (CamelMessageInfo, 1);
- info->flags = CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN;
+ info = camel_message_info_new(NULL);
+ camel_message_info_set_flags(info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0);
sdi = g_malloc (sizeof (struct _save_draft_info));
sdi->composer = composer;
diff --git a/mail/em-menu.c b/mail/em-menu.c
index 62a4a3ee8e..bf2eb19fe6 100644
--- a/mail/em-menu.c
+++ b/mail/em-menu.c
@@ -187,34 +187,37 @@ em_menu_target_new_select(EMMenu *emp, struct _CamelFolder *folder, const char *
for (i = 0; i < uids->len; i++) {
CamelMessageInfo *info = camel_folder_get_message_info(folder, uids->pdata[i]);
+ guint32 flags;
if (info == NULL)
continue;
- if (info->flags & CAMEL_MESSAGE_SEEN)
+ flags = camel_message_info_flags(info);
+
+ if (flags & CAMEL_MESSAGE_SEEN)
mask &= ~EM_MENU_SELECT_MARK_UNREAD;
else
mask &= ~EM_MENU_SELECT_MARK_READ;
- if (info->flags & CAMEL_MESSAGE_DELETED)
+ if (flags & CAMEL_MESSAGE_DELETED)
mask &= ~EM_MENU_SELECT_UNDELETE;
else
mask &= ~EM_MENU_SELECT_DELETE;
- if (info->flags & CAMEL_MESSAGE_FLAGGED)
+ if (flags & CAMEL_MESSAGE_FLAGGED)
mask &= ~EM_MENU_SELECT_MARK_UNIMPORTANT;
else
mask &= ~EM_MENU_SELECT_MARK_IMPORTANT;
- if (info->flags & CAMEL_MESSAGE_JUNK)
+ if (flags & CAMEL_MESSAGE_JUNK)
mask &= ~EM_MENU_SELECT_MARK_NOJUNK;
else
mask &= ~EM_MENU_SELECT_MARK_JUNK;
- tmp = camel_tag_get (&info->user_tags, "follow-up");
+ tmp = camel_message_info_user_tag(info, "follow-up");
if (tmp && *tmp) {
mask &= ~EM_MENU_SELECT_FLAG_CLEAR;
- tmp = camel_tag_get(&info->user_tags, "completed-on");
+ tmp = camel_message_info_user_tag(info, "completed-on");
if (tmp == NULL || *tmp == 0)
mask &= ~EM_MENU_SELECT_FLAG_COMPLETED;
} else
diff --git a/mail/em-popup.c b/mail/em-popup.c
index 5d7017aa75..7ecc258417 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -206,34 +206,36 @@ em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char
for (i = 0; i < uids->len; i++) {
CamelMessageInfo *info = camel_folder_get_message_info(folder, uids->pdata[i]);
+ guint32 flags;
if (info == NULL)
continue;
- if (info->flags & CAMEL_MESSAGE_SEEN)
+ flags = camel_message_info_flags(info);
+ if (flags & CAMEL_MESSAGE_SEEN)
mask &= ~EM_POPUP_SELECT_MARK_UNREAD;
else
mask &= ~EM_POPUP_SELECT_MARK_READ;
- if (info->flags & CAMEL_MESSAGE_DELETED)
+ if (flags & CAMEL_MESSAGE_DELETED)
mask &= ~EM_POPUP_SELECT_UNDELETE;
else
mask &= ~EM_POPUP_SELECT_DELETE;
- if (info->flags & CAMEL_MESSAGE_FLAGGED)
+ if (flags & CAMEL_MESSAGE_FLAGGED)
mask &= ~EM_POPUP_SELECT_MARK_UNIMPORTANT;
else
mask &= ~EM_POPUP_SELECT_MARK_IMPORTANT;
- if (info->flags & CAMEL_MESSAGE_JUNK)
+ if (flags & CAMEL_MESSAGE_JUNK)
mask &= ~EM_POPUP_SELECT_MARK_NOJUNK;
else
mask &= ~EM_POPUP_SELECT_MARK_JUNK;
- tmp = camel_tag_get (&info->user_tags, "follow-up");
+ tmp = camel_message_info_user_tag(info, "follow-up");
if (tmp && *tmp) {
mask &= ~EM_POPUP_SELECT_FLAG_CLEAR;
- tmp = camel_tag_get(&info->user_tags, "completed-on");
+ tmp = camel_message_info_user_tag(info, "completed-on");
if (tmp == NULL || *tmp == 0)
mask &= ~EM_POPUP_SELECT_FLAG_COMPLETED;
} else
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 2adf723f67..b5041ff8bd 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -696,8 +696,10 @@ em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *u
info = camel_folder_get_message_info (folder, uids->pdata[0]);
if (info) {
- if (info->user_tags)
- message_tag_editor_set_tag_list (MESSAGE_TAG_EDITOR (editor), info->user_tags);
+ const CamelTag *tags = camel_message_info_user_tags(info);
+
+ if (tags)
+ message_tag_editor_set_tag_list (MESSAGE_TAG_EDITOR (editor), tags);
camel_folder_free_message_info (folder, info);
}
}
diff --git a/mail/em-vfs-stream.c b/mail/em-vfs-stream.c
new file mode 100644
index 0000000000..af23862988
--- /dev/null
+++ b/mail/em-vfs-stream.c
@@ -0,0 +1,323 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *
+ * Copyright 2004 Ximian, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * A GnomeVFS to CamelStream mapper.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <libgnomevfs/gnome-vfs.h>
+
+#include "em-vfs-stream.h"
+
+#define LOG_STREAM
+
+#define d(x)
+
+#define EMVS_CLASS(x) ((EMVFSStreamClass *)(((CamelObject *)(x))->klass))
+
+static CamelStreamClass *parent_class = NULL;
+
+static void
+em_vfs_stream_init (CamelObject *object)
+{
+ /*EMVFSStream *emvfs = (EMVFSStream *)object;*/
+}
+
+static void
+em_vfs_stream_finalize (CamelObject *object)
+{
+ EMVFSStream *emvfs = (EMVFSStream *)object;
+
+ if (emvfs->handle)
+ gnome_vfs_close(emvfs->handle);
+}
+
+static void
+emvfs_set_errno(GnomeVFSResult res)
+{
+ switch(res) {
+ case GNOME_VFS_OK:
+ g_warning("em-vfs-stream: calling set_errno with no error");
+ break;
+ case GNOME_VFS_ERROR_NOT_FOUND:
+ case GNOME_VFS_ERROR_HOST_NOT_FOUND:
+ case GNOME_VFS_ERROR_INVALID_HOST_NAME:
+ case GNOME_VFS_ERROR_HOST_HAS_NO_ADDRESS:
+ case GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE:
+ errno = ENOENT;
+ break;
+ case GNOME_VFS_ERROR_GENERIC:
+ case GNOME_VFS_ERROR_INTERNAL:
+ case GNOME_VFS_ERROR_IO:
+ case GNOME_VFS_ERROR_EOF: /* will be caught by read before here anyway */
+ case GNOME_VFS_ERROR_SERVICE_OBSOLETE:
+ case GNOME_VFS_ERROR_PROTOCOL_ERROR:
+ default:
+ errno = EIO;
+ break;
+ case GNOME_VFS_ERROR_BAD_PARAMETERS:
+ case GNOME_VFS_ERROR_NOT_SUPPORTED:
+ case GNOME_VFS_ERROR_INVALID_URI:
+ case GNOME_VFS_ERROR_NOT_OPEN:
+ case GNOME_VFS_ERROR_INVALID_OPEN_MODE:
+ case GNOME_VFS_ERROR_NOT_SAME_FILE_SYSTEM:
+ errno = EINVAL;
+ break;
+ case GNOME_VFS_ERROR_CORRUPTED_DATA: /* not sure about these */
+ case GNOME_VFS_ERROR_WRONG_FORMAT:
+ case GNOME_VFS_ERROR_BAD_FILE:
+ errno = EBADF;
+ break;
+ case GNOME_VFS_ERROR_TOO_BIG:
+ errno = E2BIG;
+ break;
+ case GNOME_VFS_ERROR_NO_SPACE:
+ errno = ENOSPC;
+ break;
+ case GNOME_VFS_ERROR_READ_ONLY:
+ case GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM:
+ errno = EROFS;
+ break;
+ case GNOME_VFS_ERROR_TOO_MANY_OPEN_FILES:
+ errno = EMFILE;
+ break;
+ case GNOME_VFS_ERROR_NOT_A_DIRECTORY:
+ errno = ENOTDIR;
+ break;
+ case GNOME_VFS_ERROR_IN_PROGRESS:
+ errno = EINPROGRESS;
+ break;
+ case GNOME_VFS_ERROR_INTERRUPTED:
+ errno = EINTR;
+ break;
+ case GNOME_VFS_ERROR_FILE_EXISTS:
+ errno = EEXIST;
+ case GNOME_VFS_ERROR_LOOP:
+ errno = ELOOP;
+ break;
+ case GNOME_VFS_ERROR_ACCESS_DENIED:
+ case GNOME_VFS_ERROR_NOT_PERMITTED:
+ case GNOME_VFS_ERROR_LOGIN_FAILED:
+ errno = EPERM;
+ break;
+ case GNOME_VFS_ERROR_IS_DIRECTORY:
+ case GNOME_VFS_ERROR_DIRECTORY_NOT_EMPTY: /* ?? */
+ errno = EISDIR;
+ break;
+ case GNOME_VFS_ERROR_NO_MEMORY:
+ errno = ENOMEM;
+ break;
+ case GNOME_VFS_ERROR_CANCELLED:
+ errno = EINTR;
+ break;
+ case GNOME_VFS_ERROR_DIRECTORY_BUSY:
+ errno = EBUSY;
+ break;
+ case GNOME_VFS_ERROR_TOO_MANY_LINKS:
+ errno = EMLINK;
+ break;
+ case GNOME_VFS_ERROR_NAME_TOO_LONG:
+ errno = ENAMETOOLONG;
+ break;
+ }
+}
+
+static ssize_t
+emvfs_read(CamelStream *stream, char *buffer, size_t n)
+{
+ EMVFSStream *emvfs = EM_VFS_STREAM (stream);
+ GnomeVFSFileSize count;
+ GnomeVFSResult res;
+
+ if (emvfs->handle == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* TODO: handle camel cancellation? */
+
+ res = gnome_vfs_read(emvfs->handle, buffer, n, &count);
+ if (res == GNOME_VFS_OK)
+ return (ssize_t)count;
+ else if (res == GNOME_VFS_ERROR_EOF) {
+ stream->eos = TRUE;
+ return 0;
+ }
+
+ emvfs_set_errno(res);
+
+ return -1;
+}
+
+static ssize_t
+emvfs_write(CamelStream *stream, const char *buffer, size_t n)
+{
+ EMVFSStream *emvfs = EM_VFS_STREAM (stream);
+ GnomeVFSFileSize count;
+ GnomeVFSResult res;
+
+ if (emvfs->handle == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ res = gnome_vfs_write(emvfs->handle, buffer, n, &count);
+ if (res == GNOME_VFS_OK)
+ return (ssize_t)count;
+
+ emvfs_set_errno(res);
+
+ return -1;
+}
+
+static int
+emvfs_close(CamelStream *stream)
+{
+ EMVFSStream *emvfs = EM_VFS_STREAM (stream);
+ GnomeVFSResult res;
+
+ if (emvfs->handle == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ res = gnome_vfs_close(emvfs->handle);
+ emvfs->handle = NULL;
+ if (res == GNOME_VFS_OK)
+ return 0;
+
+ emvfs_set_errno(res);
+
+ return -1;
+}
+
+static off_t
+emvfs_seek(CamelSeekableStream *stream, off_t offset, CamelStreamSeekPolicy policy)
+{
+ EMVFSStream *emvfs = EM_VFS_STREAM (stream);
+ GnomeVFSSeekPosition vpolicy;
+ GnomeVFSFileSize pos;
+ GnomeVFSResult res;
+
+ if (emvfs->handle == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ switch (policy) {
+ case CAMEL_STREAM_SET:
+ default:
+ vpolicy = GNOME_VFS_SEEK_START;
+ break;
+ case CAMEL_STREAM_CUR:
+ vpolicy = GNOME_VFS_SEEK_CURRENT;
+ break;
+ case CAMEL_STREAM_END:
+ vpolicy = GNOME_VFS_SEEK_END;
+ break;
+ }
+
+ if ( (res = gnome_vfs_seek(emvfs->handle, vpolicy, offset)) == GNOME_VFS_OK
+ && (res = gnome_vfs_tell(emvfs->handle, &pos)) == GNOME_VFS_OK)
+ return pos;
+
+ emvfs_set_errno(res);
+
+ return -1;
+}
+
+static off_t
+emvfs_tell(CamelSeekableStream *stream)
+{
+ EMVFSStream *emvfs = EM_VFS_STREAM (stream);
+ GnomeVFSFileSize pos;
+ GnomeVFSResult res;
+
+ if (emvfs->handle == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if ((res = gnome_vfs_tell(emvfs->handle, &pos)) == GNOME_VFS_OK)
+ return pos;
+
+ emvfs_set_errno(res);
+
+ return -1;
+}
+
+static void
+em_vfs_stream_class_init (EMVFSStreamClass *klass)
+{
+ ((CamelStreamClass *)klass)->read = emvfs_read;
+ ((CamelStreamClass *)klass)->write = emvfs_write;
+ ((CamelStreamClass *)klass)->close = emvfs_close;
+
+ ((CamelSeekableStreamClass *)klass)->seek = emvfs_seek;
+ ((CamelSeekableStreamClass *)klass)->tell = emvfs_tell;
+ /* set_bounds? */
+}
+
+CamelType
+em_vfs_stream_get_type (void)
+{
+ static CamelType type = CAMEL_INVALID_TYPE;
+
+ if (type == CAMEL_INVALID_TYPE) {
+ parent_class = (CamelStreamClass *)camel_seekable_stream_get_type();
+ type = camel_type_register ((CamelType)parent_class,
+ "EMVFSStream",
+ sizeof (EMVFSStream),
+ sizeof (EMVFSStreamClass),
+ (CamelObjectClassInitFunc) em_vfs_stream_class_init,
+ NULL,
+ (CamelObjectInitFunc) em_vfs_stream_init,
+ (CamelObjectFinalizeFunc) em_vfs_stream_finalize);
+ }
+
+ return type;
+}
+
+/**
+ * emvfs_stream_new:
+ * @handle:
+ *
+ * Create a new camel stream from a GnomeVFS handle. The camel stream
+ * will own the handle from now on.
+ *
+ * Return value: A CamelStream that will talk to @handle. This function cannot fail.
+ **/
+EMVFSStream *
+emvfs_stream_new(GnomeVFSHandle *handle)
+{
+ EMVFSStream *emvfs;
+
+ emvfs = (EMVFSStream *)camel_object_new(em_vfs_stream_get_type());
+ emvfs->handle = handle;
+
+ return emvfs;
+}
diff --git a/mail/em-vfs-stream.h b/mail/em-vfs-stream.h
new file mode 100644
index 0000000000..110b5459be
--- /dev/null
+++ b/mail/em-vfs-stream.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *
+ * Copyright 2004 Ximian, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+#ifndef EM_VFS_STREAM_H
+#define EM_VFS_STREAM_H
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define EM_VFS_STREAM_TYPE (em_vfs_stream_get_type ())
+#define EM_VFS_STREAM(obj) (CAMEL_CHECK_CAST((obj), EM_VFS_STREAM_TYPE, EMVFSStream))
+#define EM_VFS_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_VFS_STREAM_TYPE, EMVFSStreamClass))
+#define EM_IS_VFS_STREAM(o) (CAMEL_CHECK_TYPE((o), EM_VFS_STREAM_TYPE))
+
+#include <glib.h>
+#include <camel/camel-seekable-stream.h>
+#include <libgnomevfs/gnome-vfs.h>
+
+typedef struct _EMVFSStream EMVFSStream;
+typedef struct _EMVFSStreamClass EMVFSStreamClass;
+
+struct _EMVFSStream {
+ CamelSeekableStream parent_stream;
+
+ GnomeVFSHandle *handle;
+};
+
+struct _EMVFSStreamClass {
+ CamelSeekableStreamClass parent_class;
+};
+
+CamelType em_vfs_stream_get_type (void);
+EMVFSStream *emvfs_stream_new(GnomeVFSHandle *handle);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* EM_VFS_STREAM_H */
diff --git a/mail/importers/evolution-outlook-importer.c b/mail/importers/evolution-outlook-importer.c
index 4b78cd3b81..ca04678260 100644
--- a/mail/importers/evolution-outlook-importer.c
+++ b/mail/importers/evolution-outlook-importer.c
@@ -388,7 +388,7 @@ import_outlook_import(struct _mail_msg *mm)
goto fail2;
}
- info = camel_message_info_new();
+ info = camel_message_info_new(NULL);
/* any headers to read? */
camel_folder_append_message(folder, msg, info, NULL, &mm->ex);
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index b9e022ac29..7cc6482c84 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -93,8 +93,8 @@ mail_importer_add_line (MailImporter *importer,
return;
camel_stream_reset (CAMEL_STREAM (importer->mstream));
- info = g_new0 (CamelMessageInfo, 1);
- info->flags = CAMEL_MESSAGE_SEEN;
+ info = camel_message_info_new(NULL);
+ camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
msg = camel_mime_message_new ();
camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg),
@@ -108,7 +108,7 @@ mail_importer_add_line (MailImporter *importer,
camel_object_unref (msg);
camel_exception_free (ex);
- g_free (info);
+ camel_message_info_free(info);
}
struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *factory, const char *iid, void *data)
@@ -230,6 +230,7 @@ import_mbox_import(struct _mail_msg *mm)
CamelMimeMessage *msg;
const char *tmp;
int pc;
+ guint32 flags = 0;
if (st.st_size > 0)
pc = (int)(100.0 * ((double)camel_mime_parser_tell(mp) / (double)st.st_size));
@@ -242,18 +243,19 @@ import_mbox_import(struct _mail_msg *mm)
break;
}
- info = camel_message_info_new();
+ info = camel_message_info_new(NULL);
tmp = camel_medium_get_header((CamelMedium *)msg, "X-Mozilla-Status");
if (tmp)
- info->flags |= decode_mozilla_status(tmp);
+ flags |= decode_mozilla_status(tmp);
tmp = camel_medium_get_header((CamelMedium *)msg, "Status");
if (tmp)
- info->flags |= decode_status(tmp);
+ flags |= decode_status(tmp);
tmp = camel_medium_get_header((CamelMedium *)msg, "X-Status");
if (tmp)
- info->flags |= decode_status(tmp);
+ flags |= decode_status(tmp);
+ camel_message_info_set_flags(info, flags, ~0);
camel_folder_append_message(folder, msg, info, NULL, &mm->ex);
camel_message_info_free(info);
camel_object_unref(msg);
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 54f544762b..fe52f409df 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -100,6 +100,10 @@ struct _store_info {
/* we keep a reference to these so they remain around for the session */
CamelFolder *vtrash;
CamelFolder *vjunk;
+
+ /* for setup only */
+ void (*done)(CamelStore *store, CamelFolderInfo *info, void *data);
+ void *done_data;
};
struct _MailComponentPrivate {
@@ -174,6 +178,21 @@ store_info_free(struct _store_info *si)
g_free(si);
}
+static void
+mc_add_store_done(CamelStore *store, CamelFolderInfo *info, void *data)
+{
+ struct _store_info *si = data;
+
+ if (si->done)
+ si->done(store, info, si);
+
+ /* let the counters know about the already opened junk/trash folders */
+ if (si->vtrash)
+ mail_note_folder(si->vtrash);
+ if (si->vjunk)
+ mail_note_folder(si->vjunk);
+}
+
/* Utility functions. */
static void
mc_add_store(MailComponent *component, CamelStore *store, const char *name, void (*done)(CamelStore *store, CamelFolderInfo *info, void *data))
@@ -183,9 +202,10 @@ mc_add_store(MailComponent *component, CamelStore *store, const char *name, void
MAIL_COMPONENT_DEFAULT(component);
si = store_info_new(store, name);
+ si->done = done;
g_hash_table_insert(component->priv->store_hash, store, si);
em_folder_tree_model_add_store(component->priv->model, store, si->name);
- mail_note_store(store, NULL, done, component);
+ mail_note_store(store, NULL, mc_add_store_done, si);
}
static void
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index c4cb73e908..1d7c7b710d 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -527,8 +527,8 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
}
/* post-process */
- info = camel_message_info_new ();
- info->flags = CAMEL_MESSAGE_SEEN;
+ info = camel_message_info_new(NULL);
+ camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0);
if (sent_folder_uri) {
folder = mail_tool_uri_to_folder (sent_folder_uri, 0, ex);
@@ -658,10 +658,11 @@ send_queue_send(struct _mail_msg *mm)
CamelMessageInfo *info;
info = camel_folder_get_message_info (m->queue, uids->pdata[i]);
- if (info && info->flags & CAMEL_MESSAGE_DELETED)
- continue;
-
- send_uids->pdata[j++] = uids->pdata[i];
+ if (info) {
+ if ((camel_message_info_flags(info) & CAMEL_MESSAGE_DELETED) == 0)
+ send_uids->pdata[j++] = uids->pdata[i];
+ camel_folder_free_message_info(m->queue, info);
+ }
}
send_uids->len = j;
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index bb3af5aa48..4a3e182927 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -798,7 +798,7 @@ auto_account_removed(EAccountList *eal, EAccount *ea, void *dummy)
}
static void
-auto_account_finalised(EAccount *ea, struct _auto_data *info)
+auto_account_finalised(struct _auto_data *info)
{
if (info->timeout_id)
g_source_remove(info->timeout_id);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 07a2a85128..e600a34635 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -393,11 +393,19 @@ uri_is_spethal(CamelStore *store, const char *uri)
return TRUE;
/* don't use strcasecmp here */
- res = url->path
- && (((store->flags & CAMEL_STORE_VTRASH)
- && strcmp(url->path, "/" CAMEL_VTRASH_NAME) == 0)
- || ((store->flags & CAMEL_STORE_VJUNK)
- && strcmp(url->path, "/" CAMEL_VJUNK_NAME) == 0));
+ if (url->fragment) {
+ res = (((store->flags & CAMEL_STORE_VTRASH)
+ && strcmp(url->fragment, CAMEL_VTRASH_NAME) == 0)
+ || ((store->flags & CAMEL_STORE_VJUNK)
+ && strcmp(url->fragment, CAMEL_VJUNK_NAME) == 0));
+ } else {
+ res = url->path
+ && (((store->flags & CAMEL_STORE_VTRASH)
+ && strcmp(url->path, "/" CAMEL_VTRASH_NAME) == 0)
+ || ((store->flags & CAMEL_STORE_VJUNK)
+ && strcmp(url->path, "/" CAMEL_VJUNK_NAME) == 0));
+ }
+
camel_url_free(url);
return res;
diff --git a/mail/message-list.c b/mail/message-list.c
index 86bdd4c47a..590e58f0ad 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -487,7 +487,7 @@ ml_search_forward(MessageList *ml, int start, int end, guint32 flags, guint32 ma
path = e_tree_table_adapter_node_at_row(etta, row);
if (path
&& (info = get_message_info(ml, path))
- && (info->flags & mask) == flags)
+ && (camel_message_info_flags(info) & mask) == flags)
return path;
}
@@ -506,7 +506,7 @@ ml_search_backward(MessageList *ml, int start, int end, guint32 flags, guint32 m
path = e_tree_table_adapter_node_at_row(etta, row);
if (path
&& (info = get_message_info(ml, path))
- && (info->flags & mask) == flags)
+ && (camel_message_info_flags(info) & mask) == flags)
return path;
}
@@ -1077,7 +1077,7 @@ subtree_unread(MessageList *ml, ETreePath node)
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
- if (!(info->flags & CAMEL_MESSAGE_SEEN))
+ if (!(camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN))
return TRUE;
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
@@ -1099,7 +1099,7 @@ subtree_size(MessageList *ml, ETreePath node)
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
- size += info->size;
+ size += camel_message_info_size(info);
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
size += subtree_size(ml, child);
@@ -1120,9 +1120,9 @@ subtree_earliest(MessageList *ml, ETreePath node, int sent)
g_assert(info);
if (sent)
- date = info->date_sent;
+ date = camel_message_info_date_sent(info);
else
- date = info->date_received;
+ date = camel_message_info_date_received(info);
if (earliest == 0 || date < earliest)
earliest = date;
@@ -1145,6 +1145,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
MessageList *message_list = model_data;
CamelMessageInfo *msg_info;
const char *str;
+ guint32 flags;
if (e_tree_model_node_is_root (etm, path))
return NULL;
@@ -1155,20 +1156,21 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
switch (col){
case COL_MESSAGE_STATUS:
- if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
+ flags = camel_message_info_flags(msg_info);
+ if (flags & CAMEL_MESSAGE_ANSWERED)
return GINT_TO_POINTER (2);
- else if (msg_info->flags & CAMEL_MESSAGE_SEEN)
+ else if (flags & CAMEL_MESSAGE_SEEN)
return GINT_TO_POINTER (1);
else
return GINT_TO_POINTER (0);
break;
case COL_FLAGGED:
- return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_FLAGGED) != 0);
+ return GINT_TO_POINTER ((camel_message_info_flags(msg_info) & CAMEL_MESSAGE_FLAGGED) != 0);
case COL_SCORE: {
const char *tag;
int score = 0;
- tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "score");
+ tag = camel_message_info_user_tag(msg_info, "score");
if (tag)
score = atoi (tag);
@@ -1179,8 +1181,8 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
/* FIXME: this all should be methods off of message-tag-followup class,
FIXME: the tag names should be namespaced :( */
- tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- cmp = camel_tag_get ((CamelTag **) &msg_info->user_tags, "completed-on");
+ tag = camel_message_info_user_tag(msg_info, "follow-up");
+ cmp = camel_message_info_user_tag(msg_info, "completed-on");
if (tag && tag[0]) {
if (cmp && cmp[0])
return GINT_TO_POINTER(2);
@@ -1193,7 +1195,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
const char *tag;
time_t due_by;
- tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "due-by");
+ tag = camel_message_info_user_tag(msg_info, "due-by");
if (tag && *tag) {
due_by = camel_header_decode_date (tag, NULL);
return GINT_TO_POINTER (due_by);
@@ -1202,10 +1204,10 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
}
}
case COL_FOLLOWUP_FLAG:
- str = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
+ str = camel_message_info_user_tag(msg_info, "follow-up");
return (void *)(str ? str : "");
case COL_ATTACHMENT:
- return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
+ return GINT_TO_POINTER ((camel_message_info_flags(msg_info) & CAMEL_MESSAGE_ATTACHMENTS) != 0);
case COL_FROM:
str = camel_message_info_from (msg_info);
return (void *)(str ? str : "");
@@ -1217,38 +1219,41 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
case COL_SUBJECT_NORM:
return (void *) get_normalised_string (message_list, msg_info, col);
case COL_SENT:
- return GINT_TO_POINTER (msg_info->date_sent);
+ return GINT_TO_POINTER (camel_message_info_date_sent(msg_info));
case COL_RECEIVED:
- return GINT_TO_POINTER (msg_info->date_received);
+ return GINT_TO_POINTER (camel_message_info_date_received(msg_info));
case COL_TO:
str = camel_message_info_to (msg_info);
return (void *)(str ? str : "");
case COL_TO_NORM:
return (void *) get_normalised_string (message_list, msg_info, col);
case COL_SIZE:
- return GINT_TO_POINTER (msg_info->size);
+ return GINT_TO_POINTER (camel_message_info_size(msg_info));
case COL_DELETED:
- return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0);
+ return GINT_TO_POINTER ((camel_message_info_flags(msg_info) & CAMEL_MESSAGE_DELETED) != 0);
case COL_UNREAD: {
ETreePath child;
-
+ flags = camel_message_info_flags(msg_info);
+
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)
- && (msg_info->flags & CAMEL_MESSAGE_SEEN)) {
+ && (flags & CAMEL_MESSAGE_SEEN)) {
return GINT_TO_POINTER (subtree_unread (message_list, child));
}
- return GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN));
+ return GINT_TO_POINTER (!(flags & CAMEL_MESSAGE_SEEN));
}
case COL_COLOUR: {
const char *colour, *due_by, *completed, *label;
/* Priority: colour tag; label tag; important flag; due-by tag */
-
- colour = camel_tag_get ((CamelTag **) &msg_info->user_tags, "colour");
- due_by = camel_tag_get ((CamelTag **) &msg_info->user_tags, "due-by");
- completed = camel_tag_get ((CamelTag **) &msg_info->user_tags, "completed-on");
- label = camel_tag_get ((CamelTag **) &msg_info->user_tags, "label");
+
+ /* This is astonisngly poorly written code */
+
+ colour = camel_message_info_user_tag(msg_info, "colour");
+ due_by = camel_message_info_user_tag(msg_info, "due-by");
+ completed = camel_message_info_user_tag(msg_info, "completed-on");
+ label = camel_message_info_user_tag(msg_info, "label");
if (colour == NULL) {
find_colour:
if (label != NULL) {
@@ -1258,7 +1263,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
label = NULL;
goto find_colour;
}
- } else if (msg_info->flags & CAMEL_MESSAGE_FLAGGED) {
+ } else if (camel_message_info_flags(msg_info) & CAMEL_MESSAGE_FLAGGED) {
/* FIXME: extract from the important.xpm somehow. */
colour = "#A7453E";
} else if ((due_by && *due_by) && !(completed && *completed)) {
@@ -2148,7 +2153,7 @@ find_next_undeleted (MessageList *ml)
check |= CAMEL_MESSAGE_DELETED;
info = get_message_info (ml, node);
- if (info && (info->flags & check) == 0) {
+ if (info && (camel_message_info_flags(info) & check) == 0) {
return NULL;
}
@@ -2165,7 +2170,7 @@ find_next_undeleted (MessageList *ml)
node = e_tree_node_at_row (et, vrow);
info = get_message_info (ml, node);
- if (info && (info->flags & check) == 0) {
+ if (info && (camel_message_info_flags(info) & check) == 0) {
return g_strdup (camel_message_info_uid (info));
}
vrow ++;
@@ -2668,17 +2673,21 @@ mail_folder_hide_by_flag (CamelFolder *folder, MessageList *ml, CamelFolderChang
for (i = 0; i < oldchanges->uid_changed->len; i++) {
ETreePath node = g_hash_table_lookup (ml->uid_nodemap, oldchanges->uid_changed->pdata[i]);
-
+ guint32 flags;
+
info = camel_folder_get_message_info (folder, oldchanges->uid_changed->pdata[i]);
- if (node != NULL && info != NULL && (info->flags & flag) != 0)
+ if (info)
+ flags = camel_message_info_flags(info);
+
+ if (node != NULL && info != NULL && (flags & flag) != 0)
camel_folder_change_info_remove_uid (newchanges, oldchanges->uid_changed->pdata[i]);
- else if (node == NULL && info != NULL && (info->flags & flag) == 0)
+ else if (node == NULL && info != NULL && (flags & flag) == 0)
camel_folder_change_info_add_uid (newchanges, oldchanges->uid_changed->pdata[i]);
else
camel_folder_change_info_change_uid (newchanges, oldchanges->uid_changed->pdata[i]);
camel_folder_free_message_info (folder, info);
}
-
+
if (newchanges->uid_added->len > 0 || newchanges->uid_removed->len > 0) {
for (i = 0; i < oldchanges->uid_added->len; i++)
camel_folder_change_info_add_uid (newchanges, oldchanges->uid_added->pdata[i]);
@@ -2937,7 +2946,8 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess
{
CamelMessageInfo *info;
int flag;
-
+ guint32 flags;
+
if (col == COL_MESSAGE_STATUS)
flag = CAMEL_MESSAGE_SEEN;
else if (col == COL_FLAGGED)
@@ -2947,19 +2957,21 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess
if (!(info = get_message_info (list, path)))
return FALSE;
-
+
+ flags = camel_message_info_flags(info);
+
/* If a message was marked as deleted and the user flags it as
important, marks it as needing a reply, marks it as unread,
then undelete the message. */
- if (info->flags & CAMEL_MESSAGE_DELETED) {
- if (col == COL_FLAGGED && !(info->flags & CAMEL_MESSAGE_FLAGGED))
+ if (flags & CAMEL_MESSAGE_DELETED) {
+ if (col == COL_FLAGGED && !(flags & CAMEL_MESSAGE_FLAGGED))
flag |= CAMEL_MESSAGE_DELETED;
- if (col == COL_MESSAGE_STATUS && (info->flags & CAMEL_MESSAGE_SEEN))
+ if (col == COL_MESSAGE_STATUS && (flags & CAMEL_MESSAGE_SEEN))
flag |= CAMEL_MESSAGE_DELETED;
}
- camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~info->flags);
+ camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~flags);
if (flag == CAMEL_MESSAGE_SEEN && list->seen_id) {
g_source_remove (list->seen_id);