diff options
author | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-01 07:44:14 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-01 07:44:14 +0800 |
commit | a6186f01e677cf687274f0affd18079a16c65633 (patch) | |
tree | 25677e060b3904d97f4da8fa7c3474928a514a28 /camel/providers | |
parent | 3fb1708c2cae2011fd44f1a1fcb953f0e859cc7e (diff) | |
download | gsoc2013-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/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 41 |
1 files changed, 41 insertions, 0 deletions
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) { |