diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-06-21 06:07:48 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-06-21 06:07:48 +0800 |
commit | de2f05a152535e1b16f095906851c2aad9d1e32d (patch) | |
tree | 72573c897997ed066f8ba6ad2fbc4c43861552f3 /camel/providers/imap | |
parent | 051c089b48326a515cd832747ba6d383cbf05b90 (diff) | |
download | gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.tar gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.tar.gz gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.tar.bz2 gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.tar.lz gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.tar.xz gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.tar.zst gsoc2013-evolution-de2f05a152535e1b16f095906851c2aad9d1e32d.zip |
Implemented. (imap_sync): Added code to set flags on messages that have
2000-06-20 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c (imap_set_message_flags):
Implemented.
(imap_sync): Added code to set flags on messages that have had
their flags changed (however I #if'd it out until we are more
confidant in the IMAP code :)
svn path=/trunk/; revision=3652
Diffstat (limited to 'camel/providers/imap')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index fd005f82ba..0323ecb7ff 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -135,7 +135,7 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class) camel_folder_class->get_permanent_flags = imap_get_permanent_flags; camel_folder_class->get_message_flags = imap_get_message_flags; - /*camel_folder_class->set_message_flags = imap_set_message_flags;*/ + camel_folder_class->set_message_flags = imap_set_message_flags; /*camel_folder_class->get_message_user_flags = imap_get_message_user_flags;*/ /*camel_folder_class->set_message_user_flags = imap_set_message_user_flags;*/ @@ -312,6 +312,55 @@ static void imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) { /* TODO: actually code this method */ + CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); + gint i, max; + +#if 0 + /* uhhh...this is kinda unsafe so we'll leave it blocked out */ + if (imap_folder->summary) { + max = imap_folder->summary->len; + for (i = 0; i < max; i++) { + CamelMessageInfo *info; + + info = (CamelMessageInfo *) g_ptr_array_index (imap_folder->summary, i); + if (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED) { + char *flags; + + flags = g_strconcat (info->flags & CAMEL_MESSAGE_SEEN ? "\\Seen " : "", + info->flags & CAMEL_MESSAGE_DRAFT ? "\\Draft " : "", + info->flags & CAMEL_MESSAGE_DELETED ? "\\Deleted " : "", + info->flags & CAMEL_MESSAGE_DELETED ? "\\Answered " : "", + NULL); + if (*flags) { + gchar *result; + gint s; + + *(flags + strlen (flags) - 1) = '\0'; + s = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), + folder, &result, + "UID STORE %s FLAGS.SILENT (%s)", + info->uid, flags); + + if (s != CAMEL_IMAP_OK) { + CamelService *service = CAMEL_SERVICE (folder->parent_store); + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, + "Could not set flags on message %s on IMAP " + "server %s: %s.", info->uid, + service->url->host, + status == CAMEL_IMAP_ERR ? result : + "Unknown error"); + g_free (result); + return; + } + + g_free(result); + } + g_free (flags); + } + } + } +#endif + if (expunge) imap_expunge (folder, ex); } @@ -520,7 +569,6 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept static GPtrArray * imap_get_uids (CamelFolder *folder, CamelException *ex) { - CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); CamelMessageInfo *info; GPtrArray *array, *infolist; gint i, count; @@ -1090,7 +1138,18 @@ imap_get_message_flags (CamelFolder *folder, const char *uid, CamelException *ex static void imap_set_message_flags (CamelFolder *folder, const char *uid, guint32 flags, guint32 set, CamelException *ex) { - return; + CamelMessageInfo *info; + + if (!(info = (CamelMessageInfo *)imap_summary_get_by_uid (folder, uid))) { + CamelService *service = CAMEL_SERVICE (folder->parent_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 = (info->flags & ~flags) | (set & flags) | CAMEL_MESSAGE_FOLDER_FLAGGED; } static gboolean |