aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
{