@@ -126,17 +126,9 @@ public class Mail.Backend.Session : Camel.Session {
126126 /* We need a password, preferrably one cached in
127127 * the keyring or else by interactive user prompt. */
128128
129- try {
130- var credentials_provider = new E .SourceCredentialsProvider (registry);
131- E . NamedParameters out_credentials;
132- credentials_provider. lookup_sync (source, cancellable, out out_credentials);
133- bool out_authenticated;
134- try_credentials_sync (credentials_provider, source, out_credentials, out out_authenticated, cancellable, service, mechanism);
135- return out_authenticated;
136- } catch (Error e) {
137- critical (e. message);
138- return false ;
139- }
129+ var credentials_prompter = new E .CredentialsPrompter (registry);
130+ credentials_prompter. set_auto_prompt (true );
131+ return credentials_prompter. loop_prompt_sync (source, E . CredentialsPrompterPromptFlags . ALLOW_SOURCE_SAVE , (prompter, source, credentials, out out_authenticated, cancellable) = > try_credentials_sync (prompter, source, credentials, out out_authenticated, cancellable, service, mechanism));
140132 } else {
141133 return (result == Camel . AuthenticationResult . ACCEPTED );
142134 }
@@ -182,7 +174,7 @@ public class Mail.Backend.Session : Camel.Session {
182174 return success;
183175 }
184176
185- public bool try_credentials_sync (E .SourceCredentialsProvider provider , E .Source source , E .NamedParameters credentials , out bool out_authenticated , GLib .Cancellable ? cancellable , Camel .Service service , string ? mechanism ) throws GLib .Error {
177+ public bool try_credentials_sync (E .CredentialsPrompter prompter , E .Source source , E .NamedParameters credentials , out bool out_authenticated , GLib .Cancellable ? cancellable , Camel .Service service , string ? mechanism ) throws GLib .Error {
186178 string credential_name = null ;
187179
188180 if (source. has_extension (E . SOURCE_EXTENSION_AUTHENTICATION )) {
@@ -202,7 +194,7 @@ public class Mail.Backend.Session : Camel.Session {
202194 out_authenticated = (result == Camel . AuthenticationResult . ACCEPTED );
203195
204196 if (out_authenticated) {
205- var credentials_source = provider . ref_credentials_source (source);
197+ var credentials_source = prompter . get_provider () . ref_credentials_source (source);
206198
207199 if (credentials_source != null ) {
208200 credentials_source. invoke_authenticate_sync (credentials);
0 commit comments