[geary/wip/714104-refine-account-dialog: 67/69] Require IMAP creds when validating a SMTP service
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/714104-refine-account-dialog: 67/69] Require IMAP creds when validating a SMTP service
- Date: Fri, 30 Nov 2018 12:53:58 +0000 (UTC)
commit 4691dc4e252a36dc6ecff2654e6625b50d3df805
Author: Michael Gratton <mike vee net>
Date: Fri Nov 30 23:39:42 2018 +1100
Require IMAP creds when validating a SMTP service
We can't rely on getting the IMAP creds from the account, since we may
be validating updated services and the IMAP creds may be different then
those on the account.
src/client/accounts/accounts-editor-add-pane.vala | 5 ++++-
src/engine/api/geary-engine.vala | 15 ++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/client/accounts/accounts-editor-add-pane.vala
b/src/client/accounts/accounts-editor-add-pane.vala
index a9d3222a..ca762df4 100644
--- a/src/client/accounts/accounts-editor-add-pane.vala
+++ b/src/client/accounts/accounts-editor-add-pane.vala
@@ -205,7 +205,10 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane {
debug("Validating SMTP...");
try {
yield this.engine.validate_smtp(
- account, account.smtp, cancellable
+ account,
+ account.smtp,
+ account.imap.credentials,
+ cancellable
);
smtp_valid = true;
} catch (Geary.SmtpError.AUTHENTICATION_FAILED err) {
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index 751cd641..4768d7c0 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -297,6 +297,7 @@ public class Geary.Engine : BaseObject {
*/
public async void validate_smtp(AccountInformation account,
ServiceInformation service,
+ Credentials? imap_credentials,
GLib.Cancellable? cancellable = null)
throws GLib.Error {
check_opened();
@@ -307,12 +308,20 @@ public class Geary.Engine : BaseObject {
(security, cx) => account.untrusted_host(service, security, cx)
);
+ Credentials? credentials = null;
+ switch (service.smtp_credentials_source) {
+ case IMAP:
+ credentials = imap_credentials;
+ break;
+ case CUSTOM:
+ credentials = service.credentials;
+ break;
+ }
+
Geary.Smtp.ClientSession client = new Geary.Smtp.ClientSession(endpoint);
GLib.Error? login_err = null;
try {
- yield client.login_async(
- account.get_smtp_credentials(), cancellable
- );
+ yield client.login_async(credentials, cancellable);
} catch (GLib.Error err) {
login_err = err;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]