Commit 5c7999c6 authored by Michael Gratton's avatar Michael Gratton 🤞

Merge branch 'wip/301-auth-errors' into 'master'

Fix SMTP auth errors when using IMAP credentials

See merge request !168
parents fcf07ad4 cd8ed405
Pipeline #66489 passed with stages
in 14 minutes and 34 seconds
...@@ -466,41 +466,49 @@ public class Geary.AccountInformation : BaseObject { ...@@ -466,41 +466,49 @@ public class Geary.AccountInformation : BaseObject {
} }
/** /**
* Loads this account's outgoing service credentials, if needed. * Loads the authentication token for the outgoing service.
* *
* Credentials are loaded from the mediator, thus it may yield for * Credentials are loaded from the mediator, thus it may yield for
* some time. * some time.
* *
* Returns true if the credentials were successfully loaded, or * Returns true if the credential's token was successfully loaded
* false if the credentials could not be loaded and the service's * or are not needed (that is, if the credentials are null), or
* false if the token could not be loaded and the service's
* credentials are invalid. * credentials are invalid.
*/ */
public async bool load_outgoing_credentials(GLib.Cancellable? cancellable) public async bool load_outgoing_credentials(GLib.Cancellable? cancellable)
throws GLib.Error { throws GLib.Error {
Credentials? creds = this.outgoing.credentials; Credentials? creds = get_outgoing_credentials();
bool loaded = false; bool loaded = true;
if (creds != null) { if (creds != null) {
loaded = yield this.mediator.load_token( if (this.outgoing.credentials_requirement == USE_INCOMING) {
this, this.outgoing, cancellable loaded = yield this.mediator.load_token(
); this, this.incoming, cancellable
);
} else {
loaded = yield this.mediator.load_token(
this, this.outgoing, cancellable
);
}
} }
return loaded; return loaded;
} }
/** /**
* Loads this account's incoming service credentials, if needed. * Loads the authentication token for the incoming service.
* *
* Credentials are loaded from the mediator, thus it may yield for * Credentials are loaded from the mediator, thus it may yield for
* some time. * some time.
* *
* Returns true if the credentials were successfully loaded, or * Returns true if the credential's token was successfully loaded
* false if the credentials could not be loaded and the service's * or are not needed (that is, if the credentials are null), or
* false if the token could not be loaded and the service's
* credentials are invalid. * credentials are invalid.
*/ */
public async bool load_incoming_credentials(GLib.Cancellable? cancellable) public async bool load_incoming_credentials(GLib.Cancellable? cancellable)
throws GLib.Error { throws GLib.Error {
Credentials? creds = this.incoming.credentials; Credentials? creds = this.incoming.credentials;
bool loaded = false; bool loaded = true;
if (creds != null) { if (creds != null) {
loaded = yield this.mediator.load_token( loaded = yield this.mediator.load_token(
this, this.incoming, cancellable this, this.incoming, cancellable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment