aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-12-04 01:42:44 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-12-04 01:42:44 +0800
commit0fe83413d09ea683050aa1fc8f8b46b72aaafd72 (patch)
tree0d0cde6a148f5aa15607ccf4d9ab1f7fba632216 /mail
parent9ce8e76a13e95e40c8c1493c7e863a4552e05090 (diff)
downloadgsoc2013-evolution-0fe83413d09ea683050aa1fc8f8b46b72aaafd72.tar.gz
gsoc2013-evolution-0fe83413d09ea683050aa1fc8f8b46b72aaafd72.tar.zst
gsoc2013-evolution-0fe83413d09ea683050aa1fc8f8b46b72aaafd72.zip
Use the same logic as mail_generate_reply(). Fixes bug #34882
2002-12-03 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (guess_me_from_accounts): Use the same logic as mail_generate_reply(). Fixes bug #34882 Fixes bug #34315 * component-factory.c (message_rfc822_dnd): Return TRUE if we successfully handled all messages in the mbox stream, or FALSE otherwise. (destination_folder_handle_drop): For TEXT_URI_LIST, use the retval from message_rfc822_dnd() rather than relying on an exception, because one will not always necessarily be set. For MESSAGE_RFC822, also use the retval from message_rfc822_dnd(). svn path=/trunk/; revision=18995
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/component-factory.c34
-rw-r--r--mail/mail-callbacks.c30
3 files changed, 63 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index dbb82a84f6..ddd57b115f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2002-12-03 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (guess_me_from_accounts): Use the same logic as
+ mail_generate_reply(). Fixes bug #34882
+
+ Fixes bug #34315
+
+ * component-factory.c (message_rfc822_dnd): Return TRUE if we
+ successfully handled all messages in the mbox stream, or FALSE
+ otherwise.
+ (destination_folder_handle_drop): For TEXT_URI_LIST, use the
+ retval from message_rfc822_dnd() rather than relying on an
+ exception, because one will not always necessarily be set. For
+ MESSAGE_RFC822, also use the retval from message_rfc822_dnd().
+
2002-12-03 Not Zed <NotZed@Ximian.com>
* folder-browser.c (folder_browser_finalise/destroy): frobbed
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 4a522d1daa..03aaa2c5b6 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -508,10 +508,11 @@ destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *f
return TRUE;
}
-static void
+static gboolean
message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex)
{
CamelMimeParser *mp;
+ gboolean handled = FALSE;
mp = camel_mime_parser_new ();
camel_mime_parser_scan_from (mp, TRUE);
@@ -521,25 +522,32 @@ message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex)
CamelMessageInfo *info;
CamelMimeMessage *msg;
+ handled = TRUE;
+
msg = camel_mime_message_new ();
if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) {
- camel_object_unref (CAMEL_OBJECT (msg));
+ camel_object_unref (msg);
+ handled = FALSE;
break;
}
/* append the message to the folder... */
info = g_new0 (CamelMessageInfo, 1);
camel_folder_append_message (dest, msg, info, NULL, ex);
- camel_object_unref (CAMEL_OBJECT (msg));
+ camel_object_unref (msg);
- if (camel_exception_is_set (ex))
+ if (camel_exception_is_set (ex)) {
+ handled = FALSE;
break;
+ }
/* skip over the FROM_END state */
camel_mime_parser_step (mp, 0, 0);
}
- camel_object_unref (CAMEL_OBJECT (mp));
+ camel_object_unref (mp);
+
+ return handled;
}
static CORBA_boolean
@@ -621,11 +629,9 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
}
stream = camel_stream_fs_new_with_fd (fd);
- message_rfc822_dnd (folder, stream, &ex);
- camel_object_unref (CAMEL_OBJECT (stream));
- camel_object_unref (CAMEL_OBJECT (folder));
-
- retval = !camel_exception_is_set (&ex);
+ retval = message_rfc822_dnd (folder, stream, &ex);
+ camel_object_unref (stream);
+ camel_object_unref (folder);
if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE && retval)
unlink (url);
@@ -647,9 +653,9 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
camel_stream_write (stream, data->bytes._buffer, data->bytes._length);
camel_stream_reset (stream);
- message_rfc822_dnd (folder, stream, &ex);
- camel_object_unref (CAMEL_OBJECT (stream));
- camel_object_unref (CAMEL_OBJECT (folder));
+ retval = message_rfc822_dnd (folder, stream, &ex);
+ camel_object_unref (stream);
+ camel_object_unref (folder);
break;
case ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE:
folder = mail_tools_x_evolution_message_parse (data->bytes._buffer,
@@ -663,7 +669,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE,
physical_uri, 0, NULL, NULL);
- camel_object_unref (CAMEL_OBJECT (folder));
+ camel_object_unref (folder);
break;
default:
break;
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index fb46cb05a5..4d655f6950 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -869,15 +869,41 @@ guess_me (const CamelInternetAddress *to, const CamelInternetAddress *cc, GHashT
static const MailConfigAccount *
guess_me_from_accounts (const CamelInternetAddress *to, const CamelInternetAddress *cc, const GSList *accounts)
{
- const MailConfigAccount *account;
+ const MailConfigAccount *account, *def;
GHashTable *account_hash;
const GSList *l;
account_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
+
+ /* add the default account to the hash first */
+ if ((def = mail_config_get_default_account ())) {
+ if (def->id->address)
+ g_hash_table_insert (account_hash, (char *) def->id->address, (void *) def);
+ }
+
l = accounts;
while (l) {
account = l->data;
- g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account);
+
+ if (account->id->address) {
+ const MailConfigAccount *acnt;
+
+ /* Accounts with identical email addresses that are enabled
+ * take precedence over the accounts that aren't. If all
+ * accounts with matching email addresses are disabled, then
+ * the first one in the list takes precedence. The default
+ * account always takes precedence no matter what.
+ */
+ acnt = g_hash_table_lookup (account_hash, account->id->address);
+ if (acnt && acnt != def && !acnt->source->enabled && account->source->enabled) {
+ g_hash_table_remove (account_hash, acnt->id->address);
+ acnt = NULL;
+ }
+
+ if (!acnt)
+ g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account);
+ }
+
l = l->next;
}