aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@src.gnome.org>2000-07-01 07:44:14 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-01 07:44:14 +0800
commita6186f01e677cf687274f0affd18079a16c65633 (patch)
tree25677e060b3904d97f4da8fa7c3474928a514a28 /camel
parent3fb1708c2cae2011fd44f1a1fcb953f0e859cc7e (diff)
downloadgsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.tar
gsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.tar.gz
gsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.tar.bz2
gsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.tar.lz
gsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.tar.xz
gsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.tar.zst
gsoc2013-evolution-a6186f01e677cf687274f0affd18079a16c65633.zip
providers/imap/camel-imap-folder.c: added move_message_to()
svn path=/trunk/; revision=3839
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/providers/imap/camel-imap-folder.c41
2 files changed, 44 insertions, 0 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b5a372a293..1c6e1dae8d 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,8 @@
2000-06-30 Jeffrey Stedfast <fejj@helixcode.com>
+ * providers/imap/camel-imap-folder.c (imap_move_message_to):
+ Implemented.
+
* camel-mime-utils.c (header_decode_date): Wrote some code to try
and un-mangle broken date formats and then parse that new string
instead.
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 602d0bc8b0..c90e0cbb3d 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -510,6 +510,47 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
g_free (folder_path);
}
+static void
+imap_move_message_to (CamelFolder *source, const char *uid, CamelFolder *destination, CamelException *ex)
+{
+ CamelStore *store = CAMEL_STORE (source->parent_store);
+ CamelURL *url = CAMEL_SERVICE (store)->url;
+ CamelMessageInfo *info;
+ char *result, *folder_path;
+ int status;
+
+ if (url && url->path && *(url->path + 1) && strcmp (destination->full_name, "INBOX"))
+ folder_path = g_strdup_printf ("%s/%s", url->path + 1, destination->full_name);
+ else
+ folder_path = g_strdup (destination->full_name);
+
+ status = camel_imap_command (CAMEL_IMAP_STORE (store), NULL, &result,
+ "COPY %s %s", uid, folder_path);
+
+ if (status != CAMEL_IMAP_OK) {
+ CamelService *service = CAMEL_SERVICE (store);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ "Could not COPY message %s to %s on IMAP server %s: %s.",
+ uid, folder_path, service->url->host,
+ status == CAMEL_IMAP_ERR ? result :
+ "Unknown error");
+ g_free (result);
+ g_free (folder_path);
+ return;
+ }
+
+ if (!(info = (CamelMessageInfo *)imap_summary_get_by_uid (source, uid))) {
+ CamelService *service = CAMEL_SERVICE (store);
+
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ "Could not set flags for message %s on IMAP server %s: %s",
+ uid, service->url->host, "Unknown error");
+ return;
+ }
+
+ info->flags |= CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED;
+}
+
static GPtrArray *
imap_get_uids (CamelFolder *folder, CamelException *ex)
{