aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-07-09 11:10:13 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-07-09 11:10:13 +0800
commit0885119ef7c4bf7123d822e001c99c15e0fffcae (patch)
tree00f15d5721b5a78b2004ef3e4e0a425be6e96771
parent58af720ebbfba0f47daae448ffcf52d5cd5cff20 (diff)
downloadgsoc2013-evolution-0885119ef7c4bf7123d822e001c99c15e0fffcae.tar.gz
gsoc2013-evolution-0885119ef7c4bf7123d822e001c99c15e0fffcae.tar.zst
gsoc2013-evolution-0885119ef7c4bf7123d822e001c99c15e0fffcae.zip
** Fix for bug #307410
svn path=/trunk/; revision=33776
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/em-utils.c25
-rw-r--r--mail/em-utils.h3
-rw-r--r--mail/mail-component.c1
-rw-r--r--mail/mail-session.c72
5 files changed, 79 insertions, 33 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1ddcad3737..14ea420c04 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+2007-06-22 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #307410
+
+ * em-utils.[ch]: (em_utils_clear_get_password_canceled_accounts_flag):
+ Added new function to clear previously set flag to default value.
+ * mail-session.c: (get_password): Storing and using new flag within
+ account's service structure.
+ * mail-component.c: (impl_sendAndReceive):
+ Always clear flag to default when user clicks UI component.
+
2007-07-09 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #271864 from Hiroyuki Ikezoe
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 7fba93cd35..78e5cbca06 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -2107,3 +2107,28 @@ em_utils_snoop_type(CamelMimePart *part)
/* We used to load parts to check their type, we dont anymore,
see bug #11778 for some discussion */
}
+
+void
+em_utils_clear_get_password_canceled_accounts_flag (void)
+{
+ EAccountList *accounts;
+
+ accounts = mail_config_get_accounts ();
+ if (accounts) {
+ EIterator *iter;
+
+ for (iter = e_list_get_iterator ((EList *) accounts);
+ e_iterator_is_valid (iter);
+ e_iterator_next (iter)) {
+ EAccount *account = (EAccount *) e_iterator_get (iter);
+
+ if (account && account->source)
+ account->source->get_password_canceled = FALSE;
+
+ if (account && account->transport)
+ account->transport->get_password_canceled = FALSE;
+ }
+
+ g_object_unref (iter);
+ }
+}
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 565011a4d0..440a83fa2a 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -108,6 +108,9 @@ struct _CamelMimePart *em_utils_contact_photo (struct _CamelInternetAddress *add
const char *em_utils_snoop_type(struct _CamelMimePart *part);
+/* clears flag 'get_password_canceled' at every known accounts, so if needed, get_password will show dialog */
+void em_utils_clear_get_password_canceled_accounts_flag (void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 6282187190..65f2a5a56b 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -1013,6 +1013,7 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme
static void
impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev)
{
+ em_utils_clear_get_password_canceled_accounts_flag ();
mail_send_receive ();
}
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 0a7b0d7f06..c4014ed329 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -182,9 +182,7 @@ get_password (CamelSession *session, CamelService *service, const char *domain,
ret = e_passwords_get_password(domain, key);
if (ret == NULL || (flags & CAMEL_SESSION_PASSWORD_REPROMPT)) {
- guint32 eflags;
gboolean remember;
- char *title;
if (url) {
if ((account = mail_config_get_account_by_source_url(url)))
@@ -195,45 +193,53 @@ get_password (CamelSession *session, CamelService *service, const char *domain,
remember = config_service?config_service->save_passwd:FALSE;
- if (flags & CAMEL_SESSION_PASSPHRASE) {
- if (account)
- title = g_strdup_printf (_("Enter Passphrase for %s"), account->name);
+ if (!config_service || (config_service && !config_service->get_password_canceled)) {
+ guint32 eflags;
+ char *title;
+
+ if (flags & CAMEL_SESSION_PASSPHRASE) {
+ if (account)
+ title = g_strdup_printf (_("Enter Passphrase for %s"), account->name);
+ else
+ title = g_strdup (_("Enter Passphrase"));
+ } else {
+ if (account)
+ title = g_strdup_printf (_("Enter Password for %s"), account->name);
+ else
+ title = g_strdup (_("Enter Password"));
+ }
+ if ((flags & CAMEL_SESSION_PASSWORD_STATIC) != 0)
+ eflags = E_PASSWORDS_REMEMBER_NEVER;
+ else if (config_service == NULL)
+ eflags = E_PASSWORDS_REMEMBER_SESSION;
else
- title = g_strdup (_("Enter Passphrase"));
- } else {
- if (account)
- title = g_strdup_printf (_("Enter Password for %s"), account->name);
- else
- title = g_strdup (_("Enter Password"));
- }
- if ((flags & CAMEL_SESSION_PASSWORD_STATIC) != 0)
- eflags = E_PASSWORDS_REMEMBER_NEVER;
- else if (config_service == NULL)
- eflags = E_PASSWORDS_REMEMBER_SESSION;
- else
- eflags = E_PASSWORDS_REMEMBER_FOREVER;
+ eflags = E_PASSWORDS_REMEMBER_FOREVER;
- if (flags & CAMEL_SESSION_PASSWORD_REPROMPT)
- eflags |= E_PASSWORDS_REPROMPT;
+ if (flags & CAMEL_SESSION_PASSWORD_REPROMPT)
+ eflags |= E_PASSWORDS_REPROMPT;
- if (flags & CAMEL_SESSION_PASSWORD_SECRET)
- eflags |= E_PASSWORDS_SECRET;
+ if (flags & CAMEL_SESSION_PASSWORD_SECRET)
+ eflags |= E_PASSWORDS_SECRET;
- if (flags & CAMEL_SESSION_PASSPHRASE)
- eflags |= E_PASSWORDS_PASSPHRASE;
+ if (flags & CAMEL_SESSION_PASSPHRASE)
+ eflags |= E_PASSWORDS_PASSPHRASE;
- /* HACK: breaks abstraction ...
- e_account_writable doesn't use the eaccount, it also uses the same writable key for
- source and transport */
- if (!e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD))
- eflags |= E_PASSWORDS_DISABLE_REMEMBER;
+ /* HACK: breaks abstraction ...
+ e_account_writable doesn't use the eaccount, it also uses the same writable key for
+ source and transport */
+ if (!e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD))
+ eflags |= E_PASSWORDS_DISABLE_REMEMBER;
- ret = e_passwords_ask_password(title, domain, key, prompt, eflags, &remember, NULL);
+ ret = e_passwords_ask_password(title, domain, key, prompt, eflags, &remember, NULL);
- g_free(title);
+ g_free(title);
- if (ret && config_service)
- mail_config_service_set_save_passwd(config_service, remember);
+ if (ret && config_service)
+ mail_config_service_set_save_passwd(config_service, remember);
+
+ if (config_service)
+ config_service->get_password_canceled = ret == NULL;
+ }
}
g_free(key);