[evolution-patches] patch for bug 315987 (http://bugzilla.gnome.org/show_bug.cgi?id=315987)



Hi,
The attached patch fixes the bug 315987, primarily caused by the usage
of disabled accounts while sending mails. This patch also fixes the
issue with saving a message as draft on a server folder (of a disabled
account).

Cheers,
partha
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3725
diff -u -p -r1.3725 ChangeLog
--- ChangeLog	18 Nov 2005 09:25:25 -0000	1.3725
+++ ChangeLog	22 Nov 2005 08:32:27 -0000
@@ -1,3 +1,16 @@
+2005-11-22  Parthasarathi Susarla <sparthasarathi novell com>
+	
+	** See bug #315987
+	* em-composer-utils.c:
+	(em_utils_composer_send_cb): Send only if account is enabled
+	(em_utils_composer_save_draft_cb): Save message to server
+	folder only if the account is enabled, else save it locally
+	(generate_account_hash): Add default account into the account hash
+	only if the account none of the account is enabled.
+	(guess_account): use only enabled account
+
+	* mail.error.xml: Add error message for send-no-account-enabled
+
 2005-11-11  Boby Wang <boby wang sun com>
 
 	** See bug 321214.
Index: em-composer-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.c,v
retrieving revision 1.45
diff -u -p -r1.45 em-composer-utils.c
--- em-composer-utils.c	22 Oct 2005 08:18:50 -0000	1.45
+++ em-composer-utils.c	22 Nov 2005 08:32:36 -0000
@@ -381,6 +381,13 @@ em_utils_composer_send_cb (EMsgComposer 
 	CamelMessageInfo *info;
 	struct _send_data *send;
 	CamelFolder *mail_folder;
+	EAccount *account;
+
+	account = e_msg_composer_get_preferred_account (composer);
+	if (!account->enabled) {
+		e_error_run(NULL, "mail:send-no-account-enabled", NULL);
+		return;
+	}
 
 	if (!(message = composer_get_message (composer, FALSE)))
 		return;
@@ -519,7 +526,7 @@ em_utils_composer_save_draft_cb (EMsgCom
 		id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_thread_new);
 		mail_msg_wait (id);
 		
-		if (!folder) {
+		if (!folder || !account->enabled) {
 			if (e_error_run((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) {
 				g_object_unref(composer);
 				camel_object_unref(msg);
@@ -1270,11 +1277,7 @@ generate_account_hash (void)
 	accounts = mail_config_get_accounts ();
 	account_hash = g_hash_table_new (camel_strcase_hash, camel_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);
-	}
+	def = mail_config_get_default_account ();
 	
 	iter = e_list_get_iterator ((EList *) accounts);
 	while (e_iterator_is_valid (iter)) {
@@ -1303,6 +1306,10 @@ generate_account_hash (void)
 	}
 	
 	g_object_unref (iter);
+
+	/* The default account has to be there if none of the enabled accounts are present */
+	if (g_hash_table_size (account_hash) == 0 && def && def->id->address)
+		g_hash_table_insert (account_hash, (char *) def->id->address, (void *) def);
 	
 	return account_hash;
 }
@@ -1460,7 +1467,7 @@ guess_account (CamelMimeMessage *message
 		if (to) {
 			for (i = 0; camel_internet_address_get(to, i, NULL, &tmp); i++) {
 				account = g_hash_table_lookup(account_hash, tmp);
-				if (account)
+				if (account && account->enabled)
 					break;
 			}
 		}
Index: mail-send-recv.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-send-recv.c,v
retrieving revision 1.101
diff -u -p -r1.101 mail-send-recv.c
--- mail-send-recv.c	16 Aug 2005 03:39:19 -0000	1.101
+++ mail-send-recv.c	22 Nov 2005 08:32:40 -0000
@@ -1064,7 +1064,7 @@ mail_send (void)
 	send_info_t type;
 	
 	transport = mail_config_get_default_transport ();
-	if (!transport || !transport->url)
+	if (!transport || !transport->url) 
 		return;
 	
 	data = setup_send_data ();
Index: mail.error.xml
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail.error.xml,v
retrieving revision 1.6
diff -u -p -r1.6 mail.error.xml
--- mail.error.xml	18 Oct 2005 07:12:15 -0000	1.6
+++ mail.error.xml	22 Nov 2005 08:32:40 -0000
@@ -378,6 +378,11 @@ You can choose to ignore this folder, ov
   	<_primary>Blank Signature</_primary>
 	<_secondary>Please provide an unique name to identify this signature.</_secondary>
   </error>
+  
+  <error id="send-no-account-enabled" type="warning">
+  <_primary>This message cannot be sent because the account you chose to send with is not enabled</_primary>
+  <_secondary xml:space="preserve">Please enable the account or send using another account.</_secondary>
+ </error>
 
 </error-list>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]