diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/mail-config.c | 23 | ||||
-rw-r--r-- | mail/mail-config.h | 1 | ||||
-rw-r--r-- | mail/mail-mt.c | 30 |
4 files changed, 60 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4125e1f1a0..776c96a0a1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2001-07-26 Peter Williams <peterw@ximian.com> + + * mail-mt.c (do_get_pass): Figure out whether we're getting the password + for the source or the transport, and get the toggle button accordingly. + (pass_got): Same. + + * mail-config.c (mail_config_get_account_by_transport_url): New function. + Cut + paste + search + replace of _by_source_url. + + * mail-config.h: Prototype here. + 2001-07-26 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (message_list_drag_data_get): If we don't have diff --git a/mail/mail-config.c b/mail/mail-config.c index 48e735814f..e88c9a5a1f 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -1326,6 +1326,29 @@ mail_config_get_account_by_source_url (const char *source_url) return NULL; } +const MailConfigAccount * +mail_config_get_account_by_transport_url (const char *transport_url) +{ + const MailConfigAccount *account; + GSList *l; + + g_return_val_if_fail (transport_url != NULL, NULL); + + l = config->accounts; + while (l) { + account = l->data; + if (account + && account->transport + && account->transport->url + && e_url_equal (account->transport->url, transport_url)) + return account; + + l = l->next; + } + + return NULL; +} + const GSList * mail_config_get_accounts (void) { diff --git a/mail/mail-config.h b/mail/mail-config.h index d73e5004c5..a997802c6d 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -168,6 +168,7 @@ const MailConfigAccount *mail_config_get_default_account (void); gint mail_config_get_default_account_num (void); const MailConfigAccount *mail_config_get_account_by_name (const char *account_name); const MailConfigAccount *mail_config_get_account_by_source_url (const char *url); +const MailConfigAccount *mail_config_get_account_by_transport_url (const char *url); const GSList *mail_config_get_accounts (void); void mail_config_add_account (MailConfigAccount *account); const GSList *mail_config_remove_account (MailConfigAccount *account); diff --git a/mail/mail-mt.c b/mail/mail-mt.c index a4d7f91d9a..369af19548 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -409,12 +409,21 @@ pass_got (char *string, void *data) if (string) { const MailConfigAccount *mca; - + gboolean remember; + m->result = g_strdup (string); + remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->tb)); mca = mail_config_get_account_by_source_url (m->service_url); - mail_config_service_set_save_passwd (mca->source, - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->tb))); + if (mca) + mail_config_service_set_save_passwd (mca->source, remember); + else { + mca = mail_config_get_account_by_transport_url (m->service_url); + if (mca) + mail_config_service_set_save_passwd (mca->transport, remember); + else + printf ("Cannot figure out which account owns URL \"%s\" (could before?)\n", m->service_url); + } } } @@ -432,11 +441,22 @@ do_get_pass(struct _mail_msg *mm) 0, pass_got, m, NULL); /* Remember the password? */ - mca = mail_config_get_account_by_source_url (m->service_url); tb = gtk_check_button_new_with_label (_("Remember this password")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tb), mca->source->save_passwd); gtk_widget_show (tb); + mca = mail_config_get_account_by_source_url (m->service_url); + if (mca) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tb), mca->source->save_passwd); + else { + mca = mail_config_get_account_by_transport_url (m->service_url); + if (mca) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tb), mca->transport->save_passwd); + else { + printf ("Cannot figure out which account owns URL \"%s\"\n", m->service_url); + gtk_widget_hide (tb); + } + } + /* do some dirty stuff to put the checkbutton after the entry */ entry = NULL; children = gtk_container_children (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox)); |