Commit 325070b5 authored by Michael Gratton's avatar Michael Gratton 🤞

Merge branch 'wip/avoid-unusable-goa-accounts' into 'master'

Don't use GOA accounts with no valid IMAP/SMTP host names

See merge request !134
parents c0c0856d ad2636e0
Pipeline #62147 passed with stages
in 9 minutes and 27 seconds
...@@ -610,7 +610,7 @@ public class Accounts.Manager : GLib.Object { ...@@ -610,7 +610,7 @@ public class Accounts.Manager : GLib.Object {
throw new ConfigError.MANAGEMENT(err.message); throw new ConfigError.MANAGEMENT(err.message);
} }
if (goa_handle.get_mail() == null) { if (!is_valid_goa_account(goa_handle)) {
// If we get here, the GOA account's mail service used // If we get here, the GOA account's mail service used
// to exist (we just loaded Geary's config for it) but // to exist (we just loaded Geary's config for it) but
// no longer does. This indicates the mail service has // no longer does. This indicates the mail service has
...@@ -783,12 +783,21 @@ public class Accounts.Manager : GLib.Object { ...@@ -783,12 +783,21 @@ public class Accounts.Manager : GLib.Object {
: id; : id;
} }
private async void create_goa_account(Goa.Object account, private bool is_valid_goa_account(Goa.Object handle) {
GLib.Cancellable? cancellable) {
// Goa.Account.mail_disabled doesn't seem to reflect if we get // Goa.Account.mail_disabled doesn't seem to reflect if we get
// get a valid mail object here, so just rely on that instead. // get a valid mail object here, so just rely on that instead.
Goa.Mail? mail = account.get_mail(); Goa.Mail? mail = handle.get_mail();
if (mail != null) { return (
mail != null &&
!Geary.String.is_empty(mail.imap_host) &&
!Geary.String.is_empty(mail.smtp_host)
);
}
private async void create_goa_account(Goa.Object account,
GLib.Cancellable? cancellable) {
if (is_valid_goa_account(account)) {
Goa.Mail? mail = account.get_mail();
string? name = mail.name; string? name = mail.name;
if (Geary.String.is_empty_or_whitespace(name)) { if (Geary.String.is_empty_or_whitespace(name)) {
name = get_account_name(); name = get_account_name();
......
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