diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-07-25 04:12:47 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-07-25 04:12:47 +0800 |
commit | 49bad5e10fbf9a6f084d53ff1076df4f10aff049 (patch) | |
tree | 1b7d7ce712ac52086b96abcaa8d428cc038bd303 /mail/mail-callbacks.c | |
parent | 1ec137b9d68f02523919059d9bc4c22dea581c07 (diff) | |
download | gsoc2013-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
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r-- | mail/mail-callbacks.c | 32 |
1 files changed, 17 insertions, 15 deletions
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); |