diff options
-rw-r--r-- | camel/ChangeLog | 20 | ||||
-rw-r--r-- | camel/camel-folder-summary.c | 16 | ||||
-rw-r--r-- | camel/camel-folder-summary.h | 1 | ||||
-rw-r--r-- | camel/camel-store.c | 15 |
4 files changed, 46 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 40f649d5e0..bd72907da1 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,23 @@ +2004-05-14 Not Zed <NotZed@Ximian.com> + + * camel-store.c (camel_store_create_folder): don't allow creation + of Trash or Junk folders. + (camel_store_rename_folder): similar for rename. #57250. + +2004-05-13 Not Zed <NotZed@Ximian.com> + + * camel-folder-summary.c (summary_build_content_info): set secure + flag if we have a known security type. + (flag_names[]): Added secure bit. + (summary_build_content_info_message): set secure flag as + appropriate. + (summary_build_content_info_message): dont set attachments for + simple types (non text), only base it on multipart/* stuff. + (summary_build_content_info): same. + + * camel-folder-summary.h: added SECURE flag. Indicates signed or + encrypted content. + 2004-05-12 Jeffrey Stedfast <fejj@novell.com> * providers/imap/camel-imap-folder.c (camel_imap_folder_selected): diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 83c7022c33..ccbe13b22d 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -2056,9 +2056,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam || camel_content_type_is(ct, "application", "pkcs7-signature") #endif ) - /* TODO: set secured bit */; - else if (!camel_content_type_is(ct, "text", "*")) - msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; + msginfo->flags |= CAMEL_MESSAGE_SECURE; if (p->index && camel_content_type_is(ct, "text", "*")) { char *encoding; @@ -2143,6 +2141,9 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam ct = camel_mime_parser_content_type(mp); if (camel_content_type_is(ct, "multipart", "mixed")) msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; + if (camel_content_type_is(ct, "multipart", "signed") + || camel_content_type_is(ct, "multipart", "encrypted")) + msginfo->flags |= CAMEL_MESSAGE_SECURE; while (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_MULTIPART_END) { camel_mime_parser_unstep(mp); @@ -2203,15 +2204,17 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi if (camel_content_type_is(ct, "multipart", "*")) { if (camel_content_type_is(ct, "multipart", "mixed")) msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; + if (camel_content_type_is(ct, "multipart", "signed") + || camel_content_type_is(ct, "multipart", "encrypted")) + msginfo->flags |= CAMEL_MESSAGE_SECURE; } else if (camel_content_type_is(ct, "application", "pgp-signature") #ifdef ENABLE_SMIME || camel_content_type_is(ct, "application", "x-pkcs7-signature") || camel_content_type_is(ct, "application", "pkcs7-signature") #endif ) { - /* TODO: signed bit */; - } else if (!camel_content_type_is(ct, "text", "*")) - msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; + msginfo->flags |= CAMEL_MESSAGE_SECURE; + } /* using the object types is more accurate than using the mime/types */ if (CAMEL_IS_MULTIPART(containee)) { @@ -2557,6 +2560,7 @@ struct flag_names_t { { "seen", CAMEL_MESSAGE_SEEN }, { "attachments", CAMEL_MESSAGE_ATTACHMENTS }, { "junk", CAMEL_MESSAGE_JUNK }, + { "secure", CAMEL_MESSAGE_SECURE }, { NULL, 0 } }; diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index 00506dec35..cf0100b5af 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -68,6 +68,7 @@ enum _CamelMessageFlags { CAMEL_MESSAGE_ATTACHMENTS = 1<<5, CAMEL_MESSAGE_ANSWERED_ALL = 1<<6, CAMEL_MESSAGE_JUNK = 1<<7, + CAMEL_MESSAGE_SECURE = 1<<8, /* following flags are for the folder, and are not really permanent flags */ CAMEL_MESSAGE_FOLDER_FLAGGED = 1<<16, /* for use by the folder implementation */ diff --git a/camel/camel-store.c b/camel/camel-store.c index d9deb41d98..3b6b60afff 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -316,6 +316,14 @@ camel_store_create_folder (CamelStore *store, const char *parent_name, { CamelFolderInfo *fi; + if ((parent_name == NULL || parent_name[0] == 0) + && (((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0) + || ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0))) { + camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_INVALID, + _("Cannot create folder: %s: folder exists"), folder_name); + return NULL; + } + CAMEL_STORE_LOCK(store, folder_lock); fi = CS_CLASS (store)->create_folder (store, parent_name, folder_name, ex); CAMEL_STORE_UNLOCK(store, folder_lock); @@ -423,6 +431,13 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char if (strcmp(old_namein, new_name) == 0) return; + if (((store->flags & CAMEL_STORE_VTRASH) && strcmp(old_namein, CAMEL_VTRASH_NAME) == 0) + || ((store->flags & CAMEL_STORE_VJUNK) && strcmp(old_namein, CAMEL_VJUNK_NAME) == 0)) { + camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, + _("Cannot rename folder: %s: Invalid operation"), old_namein); + return; + } + /* need to save this, since old_namein might be folder->full_name, which could go away */ old_name = g_strdup(old_namein); oldlen = strlen(old_name); |