aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-12 08:00:11 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-12 08:00:11 +0800
commite0fcbaf71a371f95a19d0ea29e8797f26f234326 (patch)
tree5ec091e635a8014f57121bc3d1b1018f65d17653
parent1bdc8787b94b821c5a2cb6be6799a2367e71b4b9 (diff)
downloadgsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.tar
gsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.tar.gz
gsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.tar.bz2
gsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.tar.lz
gsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.tar.xz
gsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.tar.zst
gsoc2013-evolution-e0fcbaf71a371f95a19d0ea29e8797f26f234326.zip
Now takes a flags argument to specify the flags to be set on the message
2000-07-11 Jeffrey Stedfast <fejj@helixcode.com> * camel-folder.c (camel_folder_append_message): Now takes a flags argument to specify the flags to be set on the message since we might not necessarily want the flags to be wiped clean. (move_message_to): (copy_message_to): Updated to send a flags argument to append_message (); currently sends the original message's flags. * providers/mbox/camel-mbox-folder.c (mbox_append_message): * providers/imap/camel-imap-folder.c (imap_append_message): Updated. svn path=/trunk/; revision=4099
-rw-r--r--camel/ChangeLog13
-rw-r--r--camel/camel-folder.c15
-rw-r--r--camel/camel-folder.h6
-rw-r--r--camel/providers/imap/camel-imap-folder.c22
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c6
5 files changed, 46 insertions, 16 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e5e9bc5f3c..5d3dec98b9 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,18 @@
2000-07-11 Jeffrey Stedfast <fejj@helixcode.com>
+ * camel-folder.c (camel_folder_append_message): Now takes a
+ flags argument to specify the flags to be set on the message
+ since we might not necessarily want the flags to be wiped clean.
+ (move_message_to):
+ (copy_message_to): Updated to send a flags argument to
+ append_message (); currently sends the original message's flags.
+
+ * providers/mbox/camel-mbox-folder.c (mbox_append_message):
+ * providers/imap/camel-imap-folder.c (imap_append_message):
+ Updated.
+
+2000-07-11 Jeffrey Stedfast <fejj@helixcode.com>
+
* providers/imap/camel-imap-folder.c (imap_search_by_expression):
This shouldn't return NULL, it should return g_ptr_array_new ()
so the mailer gets what it expects.
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 454db69773..c76e7faf15 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -96,7 +96,7 @@ static void expunge (CamelFolder *folder,
static void append_message (CamelFolder *folder, CamelMimeMessage *message,
- CamelException *ex);
+ guint32 flags, CamelException *ex);
static GPtrArray *get_uids (CamelFolder *folder,
@@ -621,7 +621,7 @@ camel_folder_get_unread_message_count (CamelFolder *folder, CamelException *ex)
static void
append_message (CamelFolder *folder, CamelMimeMessage *message,
- CamelException *ex)
+ guint32 flags, CamelException *ex)
{
g_warning ("CamelFolder::append_message not implemented for `%s'",
gtk_type_name (GTK_OBJECT_TYPE (folder)));
@@ -640,11 +640,12 @@ append_message (CamelFolder *folder, CamelMimeMessage *message,
void
camel_folder_append_message (CamelFolder *folder,
CamelMimeMessage *message,
+ guint32 flags,
CamelException *ex)
{
g_return_if_fail (CAMEL_IS_FOLDER (folder));
- CF_CLASS (folder)->append_message (folder, message, ex);
+ CF_CLASS (folder)->append_message (folder, message, flags, ex);
}
@@ -1080,13 +1081,15 @@ copy_message_to (CamelFolder *source, const char *uid, CamelFolder *dest,
CamelException *ex)
{
CamelMimeMessage *msg;
+ CamelMessageInfo *info;
/* Default implementation. */
msg = camel_folder_get_message (source, uid, ex);
if (!msg)
return;
- camel_folder_append_message (dest, msg, ex);
+ info = camel_folder_get_message_info (source, uid);
+ camel_folder_append_message (dest, msg, info ? info->flags : 0, ex);
gtk_object_unref (GTK_OBJECT (msg));
if (camel_exception_is_set (ex))
return;
@@ -1124,13 +1127,15 @@ move_message_to (CamelFolder *source, const char *uid, CamelFolder *dest,
CamelException *ex)
{
CamelMimeMessage *msg;
+ CamelMessageInfo *info;
/* Default implementation. */
msg = camel_folder_get_message (source, uid, ex);
if (!msg)
return;
- camel_folder_append_message (dest, msg, ex);
+ info = camel_folder_get_message_info (source, uid);
+ camel_folder_append_message (dest, msg, info ? info->flags : 0, ex);
gtk_object_unref (GTK_OBJECT (msg));
if (camel_exception_is_set (ex))
return;
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 1d749be294..121a0277cb 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -110,7 +110,8 @@ typedef struct {
CamelException *ex);
void (*append_message) (CamelFolder *folder,
- CamelMimeMessage *message,
+ CamelMimeMessage *message,
+ guint32 flags,
CamelException *ex);
guint32 (*get_permanent_flags) (CamelFolder *folder,
@@ -247,7 +248,8 @@ void camel_folder_set_message_user_flag (CamelFolder *folder,
/* message manipulation */
void camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message,
+ CamelMimeMessage *message,
+ guint32 flags,
CamelException *ex);
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index e2929eb83c..5dd7926503 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -64,7 +64,7 @@ static void imap_init (CamelFolder *folder, CamelStore *parent_store,
static void imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
static gint imap_get_message_count (CamelFolder *folder, CamelException *ex);
static gint imap_get_unread_message_count (CamelFolder *folder, CamelException *ex);
-static void imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
+static void imap_append_message (CamelFolder *folder, CamelMimeMessage *message, guint32 flags, CamelException *ex);
static void imap_copy_message_to (CamelFolder *source, const char *uid, CamelFolder *destination, CamelException *ex);
static void imap_move_message_to (CamelFolder *source, const char *uid, CamelFolder *destination, CamelException *ex);
static GPtrArray *imap_get_uids (CamelFolder *folder, CamelException *ex);
@@ -476,12 +476,12 @@ imap_get_unread_message_count (CamelFolder *folder, CamelException *ex)
}
static void
-imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
+imap_append_message (CamelFolder *folder, CamelMimeMessage *message, guint32 flags, CamelException *ex)
{
CamelStore *store = CAMEL_STORE (folder->parent_store);
CamelURL *url = CAMEL_SERVICE (store)->url;
CamelStreamMem *mem;
- gchar *result, *folder_path;
+ gchar *result, *folder_path, *flagstr = NULL;
gint status;
g_return_if_fail (folder != NULL);
@@ -506,11 +506,21 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
else
folder_path = g_strdup (folder->full_name);
+ /* create flag string param */
+ if (flags) {
+ flagstr = g_strconcat (" (", flags & CAMEL_MESSAGE_SEEN ? "\\Seen " : "",
+ flags & CAMEL_MESSAGE_DRAFT ? "\\Draft " : "",
+ flags & CAMEL_MESSAGE_DELETED ? "\\Answered " : "",
+ NULL);
+ if (flagstr)
+ *(flagstr + strlen (flagstr) - 1) = ')';
+ }
+
/* FIXME: len isn't really correct I don't think, we need to filter and possibly other things */
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store),
- folder, &result,
- "APPEND %s (\\Seen) {%d}\r\n%s",
- folder_path, mem->buffer->len - 1, mem->buffer->data);
+ folder, &result, "APPEND %s%s {%d}\r\n%s",
+ folder_path, flagstr ? flagstr : "",
+ mem->buffer->len - 1, mem->buffer->data);
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index e8c3f7c795..e35237c808 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -65,7 +65,7 @@ static void mbox_init (CamelFolder *folder, CamelStore *parent_store,
static void mbox_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
static gint mbox_get_message_count (CamelFolder *folder, CamelException *ex);
static gint mbox_get_unread_message_count (CamelFolder *folder, CamelException *ex);
-static void mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
+static void mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, guint32 flags, CamelException *ex);
static GPtrArray *mbox_get_uids (CamelFolder *folder, CamelException *ex);
static GPtrArray *mbox_get_subfolder_names (CamelFolder *folder, CamelException *ex);
static GPtrArray *mbox_get_summary (CamelFolder *folder, CamelException *ex);
@@ -299,7 +299,7 @@ mbox_get_unread_message_count (CamelFolder *folder, CamelException *ex)
/* FIXME: this may need some tweaking for performance? */
static void
-mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
+mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, guint32 flags, CamelException *ex)
{
CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
CamelStream *output_stream = NULL, *filter_stream = NULL;
@@ -332,7 +332,7 @@ mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
/* assign a new x-evolution header/uid */
camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution");
uid = camel_folder_summary_next_uid (CAMEL_FOLDER_SUMMARY (mbox_folder->summary));
- xev = g_strdup_printf ("%08x-0000", uid);
+ xev = g_strdup_printf ("%08x-%08x", uid, flags);
camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution", xev);
g_print ("%s -- %s\n", __FUNCTION__, xev);
g_free (xev);