aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-25 04:12:47 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-25 04:12:47 +0800
commit49bad5e10fbf9a6f084d53ff1076df4f10aff049 (patch)
tree1b7d7ce712ac52086b96abcaa8d428cc038bd303
parent1ec137b9d68f02523919059d9bc4c22dea581c07 (diff)
downloadgsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.tar
gsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.tar.gz
gsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.tar.bz2
gsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.tar.lz
gsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.tar.xz
gsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.tar.zst
gsoc2013-evolution-49bad5e10fbf9a6f084d53ff1076df4f10aff049.zip
Do a case-insensitive comparison. (mail_generate_reply): Only resort to
2001-07-24 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (guess_me): Do a case-insensitive comparison. (mail_generate_reply): Only resort to the source account's identity if we can't find out which identity to use based on the recipients of the message first. * mail-config.c (mail_config_get_default_account): Make sure to return the 0th account if we don't have a default. We don't want to return NULL. * mail-callbacks.c (empty_trash): Use mail_tool_get_trash for the remote store trash folders. * mail-tools.c (mail_tool_get_trash): New convenience function. svn path=/trunk/; revision=11353
-rw-r--r--mail/ChangeLog19
-rw-r--r--mail/component-factory.c10
-rw-r--r--mail/mail-callbacks.c32
-rw-r--r--mail/mail-config.c21
-rw-r--r--mail/mail-local.c34
-rw-r--r--mail/mail-tools.c16
-rw-r--r--mail/mail-tools.h3
7 files changed, 86 insertions, 49 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e4cf98263a..40a70a862c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,19 @@
+2001-07-24 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (guess_me): Do a case-insensitive comparison.
+ (mail_generate_reply): Only resort to the source account's
+ identity if we can't find out which identity to use based on the
+ recipients of the message first.
+
+ * mail-config.c (mail_config_get_default_account): Make sure to
+ return the 0th account if we don't have a default. We don't want
+ to return NULL.
+
+ * mail-callbacks.c (empty_trash): Use mail_tool_get_trash for the
+ remote store trash folders.
+
+ * mail-tools.c (mail_tool_get_trash): New convenience function.
+
2001-07-24 Jason Leach <jleach@ximian.com>
* mail-config.c (config_read): get_boolean_with_default for the
@@ -8,7 +24,8 @@
* mail-folder-cache.c (make_folder_name): Don't display "(0 unsent)" if
the outbox is empty.
- * mail-local.c (init_trash): Set up the local trash in the folder cache.
+ * mail-local.c (init_trash): Set up the local trash in the folder
+ cache.
* mail-folder-cache.c (update_idle): Make the error reporting a little
but more descriptive.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 37e004a2d7..d7fb1ee8f9 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -137,7 +137,7 @@ create_view (EvolutionShellComponent *shell_component,
} else if (g_strcasecmp (folder_type, "mailstorage") == 0) {
CamelService *store;
EvolutionStorage *storage;
-
+
store = camel_session_get_service (session, physical_uri,
CAMEL_PROVIDER_STORE, NULL);
if (!store)
@@ -147,20 +147,20 @@ create_view (EvolutionShellComponent *shell_component,
camel_object_unref (CAMEL_OBJECT (store));
return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
}
-
+
if (!gtk_object_get_data (GTK_OBJECT (storage), "connected"))
mail_scan_subfolders (CAMEL_STORE(store), storage);
camel_object_unref (CAMEL_OBJECT (store));
-
+
control = folder_browser_factory_new_control ("", corba_shell);
} else if (g_strcasecmp (folder_type, "vtrash") == 0) {
control = folder_browser_factory_new_control ("vtrash:file:/", corba_shell);
} else
return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
-
+
if (!control)
return EVOLUTION_SHELL_COMPONENT_NOTFOUND;
-
+
*control_return = control;
return EVOLUTION_SHELL_COMPONENT_OK;
}
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 7f61351f6f..6b3a9faa8f 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -587,7 +587,7 @@ guess_me (const CamelInternetAddress *to, const CamelInternetAddress *cc, const
while (l) {
const MailConfigAccount *acnt = l->data;
- if (!strcmp (acnt->id->address, addr)) {
+ if (!g_strcasecmp (acnt->id->address, addr)) {
notme = FALSE;
return acnt;
}
@@ -604,7 +604,7 @@ guess_me (const CamelInternetAddress *to, const CamelInternetAddress *cc, const
while (l) {
const MailConfigAccount *acnt = l->data;
- if (!strcmp (acnt->id->address, addr)) {
+ if (!g_strcasecmp (acnt->id->address, addr)) {
notme = FALSE;
return acnt;
}
@@ -641,9 +641,6 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
time_t date;
int offset;
- source = camel_mime_message_get_source (message);
- me = mail_config_get_account_by_source_url (source);
-
composer = e_msg_composer_new_with_sig_file ();
if (!composer)
return NULL;
@@ -664,6 +661,9 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
/* Set the recipients */
accounts = mail_config_get_accounts ();
+ to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
+ cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
+
if (mode == REPLY_LIST) {
CamelMessageInfo *info;
const char *mlist;
@@ -697,6 +697,8 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
/* We only want to reply to the list address - if it even exists */
to = address && i != max ? g_list_append (to, g_strdup (address)) : to;
}
+
+ me = guess_me (to_addrs, cc_addrs, accounts);
} else {
GHashTable *rcpt_hash;
@@ -713,19 +715,23 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
}
}
- to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
- cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
-
if (mode == REPLY_ALL) {
cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, &me, NULL);
cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me, reply_addr);
- } else if (me == NULL) {
+ } else {
me = guess_me (to_addrs, cc_addrs, accounts);
}
g_hash_table_destroy (rcpt_hash);
}
+ if (me == NULL) {
+ /* as a last resort, set the replying account (aka me)
+ to the account this was fetched from */
+ source = camel_mime_message_get_source (message);
+ me = mail_config_get_account_by_source_url (source);
+ }
+
/* Set the subject of the new message. */
subject = (char *)camel_mime_message_get_subject (message);
if (!subject)
@@ -1996,11 +2002,7 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path)
/* make sure this store is a remote store */
if (provider->flags & CAMEL_PROVIDER_IS_STORAGE &&
provider->flags & CAMEL_PROVIDER_IS_REMOTE) {
- char *url;
-
- url = g_strdup_printf ("vtrash:%s", account->source->url);
- vtrash = mail_tool_uri_to_folder (url, NULL);
- g_free (url);
+ vtrash = mail_tool_get_trash (account->source->url, NULL);
if (vtrash)
mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL);
@@ -2011,7 +2013,7 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path)
}
/* Now empty the local trash folder */
- vtrash = mail_tool_uri_to_folder ("vtrash:file:/", ex);
+ vtrash = mail_tool_get_trash ("file:/", ex);
if (vtrash)
mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index ada42089ec..080b8e46e0 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1266,21 +1266,21 @@ mail_config_set_default_charset (const char *charset)
const MailConfigAccount *
mail_config_get_default_account (void)
{
- const MailConfigAccount *account;
- GSList *l;
MailConfigAccount *retval;
if (!config->accounts)
return NULL;
-
+
retval = g_slist_nth_data (config->accounts,
config->default_account);
-
+
/* Looks like we have no default, so make the first account
the default */
- if (retval == NULL)
+ if (retval == NULL) {
mail_config_set_default_account_num (0);
-
+ retval = config->accounts->data;
+ }
+
return retval;
}
@@ -1367,13 +1367,12 @@ mail_config_set_default_account_num (gint new_default)
void
mail_config_set_default_account (const MailConfigAccount *account)
{
- GSList *node = config->accounts;
- gint position = 0;
-
+ int position;
+
position = g_slist_index (config->accounts, (void*)account);
-
+
config->default_account = position;
-
+
return;
}
diff --git a/mail/mail-local.c b/mail/mail-local.c
index 2238a4ecd2..1999033964 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -502,7 +502,7 @@ register_folder_registered(struct _mail_msg *mm)
if (local_folder->folder) {
gchar *name;
-
+
g_hash_table_insert (local_folder->local_store->folders, local_folder->uri + 8,
local_folder);
/* Remove the circular ref once the local store knows aboutthe folder */
@@ -510,20 +510,20 @@ register_folder_registered(struct _mail_msg *mm)
/* add the folder to the vfolder lists FIXME: merge stuff above with this */
vfolder_register_source(local_folder->folder);
-
+
mail_folder_cache_set_update_lstorage (local_folder->uri,
local_folder->local_store->corba_local_storage,
local_folder->path);
-
+
name = strrchr (local_folder->path, '/');
if (name) /* should always be true... */ {
name += 1; /* skip the slash */
mail_folder_cache_note_name (local_folder->uri, name);
}
-
+
/* Do this after specifying the name so it isn't 'mbox' */
mail_folder_cache_note_folder (local_folder->uri, local_folder->folder);
-
+
m->local_folder = NULL;
}
}
@@ -532,7 +532,7 @@ static void
register_folder_free(struct _mail_msg *mm)
{
struct _register_msg *m = (struct _register_msg *)mm;
-
+
if (m->local_folder)
free_local_folder(m->local_folder);
}
@@ -554,24 +554,24 @@ local_storage_new_folder_cb (EvolutionStorageListener *storage_listener,
MailLocalFolder *local_folder;
struct _register_msg *m;
int id;
-
+
if (strcmp (folder->type, "mail") != 0 ||
strncmp (folder->physical_uri, "file://", 7) != 0 ||
strncmp (folder->physical_uri + 7, local_store->local_path,
local_store->local_pathlen) != 0)
return;
-
+
local_folder = g_new0 (MailLocalFolder, 1);
local_folder->name = g_strdup (strrchr (path, '/') + 1);
local_folder->path = g_strdup (path);
local_folder->uri = g_strdup (folder->physical_uri);
local_folder->local_store = local_store;
camel_object_ref((CamelObject *)local_store);
-
+
m = mail_msg_new(&register_folder_op, NULL, sizeof(*m));
-
+
m->local_folder = local_folder;
-
+
/* run synchronous, the shell expects it (I think) */
id = m->msg.seq;
e_thread_put(mail_thread_queued, (EMsg *)m);
@@ -587,13 +587,13 @@ local_storage_removed_folder_cb (EvolutionStorageListener *storage_listener,
MailLocalFolder *local_folder;
char *physical_path;
char *tmpname;
-
+
physical_path = e_path_to_physical (local_store->local_path, path);
-
+
if (strncmp (physical_path, local_store->local_path,
local_store->local_pathlen) != 0)
return;
-
+
tmpname = strchr (physical_path, '/');
if (tmpname) {
while (*tmpname == '/')
@@ -604,13 +604,13 @@ local_storage_removed_folder_cb (EvolutionStorageListener *storage_listener,
}
else
local_folder = NULL;
-
+
if (local_folder) {
g_hash_table_remove (local_store->folders, tmpname);
-
+
free_local_folder (local_folder);
}
-
+
g_free (physical_path);
}
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index cd31fa067f..47f949ac10 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -133,6 +133,22 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex)
return folder;
}
+CamelFolder *
+mail_tool_get_trash (const gchar *url, CamelException *ex)
+{
+ CamelStore *store;
+ CamelFolder *trash;
+
+ store = camel_session_get_store (session, url, ex);
+ if (!store)
+ return NULL;
+
+ trash = camel_store_get_trash (store, ex);
+ camel_object_unref (CAMEL_OBJECT (store));
+
+ return trash;
+}
+
/* why is this function so stupidly complex when allthe work is done elsehwere? */
char *
mail_tool_do_movemail (const gchar *source_url, CamelException *ex)
diff --git a/mail/mail-tools.h b/mail/mail-tools.h
index 4e29edbefe..57802e0be9 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -45,6 +45,9 @@ CamelFolder *mail_tool_get_local_inbox (CamelException *ex);
/* Get the "inbox" for a url (uses global session) */
CamelFolder *mail_tool_get_inbox (const gchar *url, CamelException *ex);
+/* Get the "trash" for a url (uses global session) */
+CamelFolder *mail_tool_get_trash (const gchar *url, CamelException *ex);
+
/* Does a camel_movemail into the local movemail folder
* and returns the path to the new movemail folder that was created. which shoudl be freed later */
char *