aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParthasarathi Susarla <sparthasarathi@novell.com>2005-11-23 14:46:51 +0800
committerParthasarathi Susarla <saps@src.gnome.org>2005-11-23 14:46:51 +0800
commit3c74da6893887b68caa185f6d2eb2a280a0e445e (patch)
tree75f2cd68d5a2723bebcf3ec4e792ce5e9982d5ad
parent02c366550efba502867f625adb288bd42171e189 (diff)
downloadgsoc2013-evolution-3c74da6893887b68caa185f6d2eb2a280a0e445e.tar.gz
gsoc2013-evolution-3c74da6893887b68caa185f6d2eb2a280a0e445e.tar.zst
gsoc2013-evolution-3c74da6893887b68caa185f6d2eb2a280a0e445e.zip
** See bug #315987 Send only if account is enabled
2005-11-23 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 svn path=/trunk/; revision=30646
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/em-composer-utils.c21
-rw-r--r--mail/mail-send-recv.c2
-rw-r--r--mail/mail.error.xml5
4 files changed, 33 insertions, 8 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 839ec6af0e..8d534329e4 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+2005-11-23 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.
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 66f4ca90a0..b0eac88d5e 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -381,6 +381,13 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
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 (EMsgComposer *composer, int quit, gpointer user
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, CamelFolder *folder)
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;
}
}
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index ad8f79b669..efd0a2f884 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -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 ();
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 2b23652f03..6c3aae2cde 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -378,6 +378,11 @@ You can choose to ignore this folder, overwrite or append its contents, or quit.
<_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>