aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-07-24 13:23:53 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-07-24 13:23:53 +0800
commit8c88d15dd503cab462365de378604fb83fd8a295 (patch)
tree72335052a2f9aa2c92362abc9d2fea5584c8608b /mail
parent975b2f33f985cb9f57c8fc19b481de6a147cb49e (diff)
downloadgsoc2013-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')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/component-factory.c4
-rw-r--r--mail/mail-vfolder.c53
3 files changed, 56 insertions, 13 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6fd070c5bb..c3ec3dbb33 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -11,6 +11,18 @@
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.
+
* mail-display.c (drag_data_delete_cb): use uri_list before we set
"uri-list" to NULL, which will automagically free it for us, so
dont free it either. Found with vagrind.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index ad9d424356..0dc164d0fb 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -716,6 +716,9 @@ owner_set_cb (EvolutionShellComponent *shell_component,
storages_hash = g_hash_table_new (NULL, NULL);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
+
+ for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++)
+ *standard_folders[i].uri = g_strdup_printf ("file://%s/local/%s", evolution_dir, standard_folders[i].name);
vfolder_load_storage(corba_shell);
@@ -726,7 +729,6 @@ owner_set_cb (EvolutionShellComponent *shell_component,
mail_importer_init (shell_client);
for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++) {
- *standard_folders[i].uri = g_strdup_printf ("file://%s/local/%s", evolution_dir, standard_folders[i].name);
mail_msg_wait (mail_get_folder (*standard_folders[i].uri, CAMEL_STORE_FOLDER_CREATE,
got_folder, standard_folders[i].folder, mail_thread_new));
}
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"))))