diff options
author | Not Zed <NotZed@Ximian.com> | 2002-07-24 13:23:53 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-07-24 13:23:53 +0800 |
commit | 8c88d15dd503cab462365de378604fb83fd8a295 (patch) | |
tree | 72335052a2f9aa2c92362abc9d2fea5584c8608b /mail/mail-vfolder.c | |
parent | 975b2f33f985cb9f57c8fc19b481de6a147cb49e (diff) | |
download | gsoc2013-evolution-8c88d15dd503cab462365de378604fb83fd8a295.tar.gz gsoc2013-evolution-8c88d15dd503cab462365de378604fb83fd8a295.tar.zst gsoc2013-evolution-8c88d15dd503cab462365de378604fb83fd8a295.zip |
Initialise the standard uri's before doing anything else.
2002-07-24 Not Zed <NotZed@Ximian.com>
* component-factory.c (owner_set_cb): Initialise the standard
uri's before doing anything else.
* mail-vfolder.c (uri_is_ignore): Return true if the uri is any
sent, drafts or outbox folder uri.
(mail_vfolder_add_uri): Dont automagically add any
sent/outbox/drafts folder with "local" or "remote" etc rules, only
add sent folders if explictly listed as folder rules. Maintain
the remote/local folders list accordingly.
(vfolder_adduri_do): dont check against sent_folder, drafts_folder
or outbox_folder, this is checked by above code. For #14863.
svn path=/trunk/; revision=17564
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r-- | mail/mail-vfolder.c | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 18691529fd..2b2e05ae89 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -208,7 +208,6 @@ vfolder_adduri_do(struct _mail_msg *mm) struct _adduri_msg *m = (struct _adduri_msg *)mm; GList *l; CamelFolder *folder = NULL; - extern CamelFolder *drafts_folder, *outbox_folder, *sent_folder; d(printf("%s uri to vfolder: %s\n", m->remove?"Removing":"Adding", m->uri)); @@ -222,15 +221,13 @@ vfolder_adduri_do(struct _mail_msg *mm) folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex); if (folder != NULL) { - if (folder != drafts_folder && folder != outbox_folder && folder != sent_folder) { - l = m->folders; - while (l) { - if (m->remove) - camel_vee_folder_remove_folder((CamelVeeFolder *)l->data, folder); - else - camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder); - l = l->next; - } + l = m->folders; + while (l) { + if (m->remove) + camel_vee_folder_remove_folder((CamelVeeFolder *)l->data, folder); + else + camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder); + l = l->next; } camel_object_unref((CamelObject *)folder); } @@ -292,6 +289,32 @@ my_list_find(GList *l, const char *uri, GCompareFunc cmp) return l; } +static int +uri_is_ignore(const char *uri, GCompareFunc uri_cmp) +{ + int found = FALSE; + const GSList *l; + MailConfigAccount *ac; + extern char *default_outbox_folder_uri, *default_sent_folder_uri, *default_drafts_folder_uri; + + d(printf("checking '%s' against:\n %s\n %s\n %s\n", uri, default_outbox_folder_uri, default_sent_folder_uri, default_drafts_folder_uri)); + + found = (default_outbox_folder_uri && uri_cmp(default_outbox_folder_uri, uri)) + || (default_sent_folder_uri && uri_cmp(default_sent_folder_uri, uri)) + || (default_drafts_folder_uri && uri_cmp(default_drafts_folder_uri, uri)); + + l = mail_config_get_accounts(); + while (!found && l) { + ac = l->data; + d(printf("checkint sent_folder_uri '%s' == '%s'\n", ac->sent_folder_uri?ac->sent_folder_uri:"empty", uri)); + found = (ac->sent_folder_uri && uri_cmp(ac->sent_folder_uri, uri)) + || (ac->drafts_folder_uri && uri_cmp(ac->drafts_folder_uri, uri)); + l = l->next; + } + + return found; +} + /* called when a new uri becomes (un)available */ void mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) @@ -302,12 +325,15 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) GList *folders = NULL, *link; int remote = (((CamelService *)store)->provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0; GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; + int is_ignore; if (CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7) || context == NULL) return; g_assert(pthread_self() == mail_gui_thread); + is_ignore = uri_is_ignore(uri, uri_cmp); + LOCK(); d(printf("%s uri to check: %s\n", remove?"Removing":"Adding", uri)); @@ -325,7 +351,8 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) source_folders_local = g_list_remove_link(source_folders_local, link); } } - } else { + } else if (!is_ignore) { + /* we ignore drafts/sent/outbox here */ if (remote) { if (my_list_find(source_folders_remote, (void *)uri, uri_cmp) == NULL) source_folders_remote = g_list_prepend(source_folders_remote, g_strdup(uri)); @@ -343,8 +370,10 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) d(printf("invalid rule (%p): rule->name is set to NULL\n", rule)); continue; } - + + /* dont auto-add any sent/drafts folders etc, they must be explictly listed as a source */ if (rule->source + && !is_ignore && ((!strcmp(rule->source, "local") && !remote) || (!strcmp(rule->source, "remote_active") && remote) || (!strcmp(rule->source, "local_remote_active")))) |