mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
restore config-param if configure() fails
This commit is contained in:
@@ -501,15 +501,9 @@ char* dc_get_oauth2_url (dc_context_t* context, const char*
|
|||||||
* To interrupt a configuration prematurely, use dc_stop_ongoing_process();
|
* To interrupt a configuration prematurely, use dc_stop_ongoing_process();
|
||||||
* this is not needed if #DC_EVENT_CONFIGURE_PROGRESS reports success.
|
* this is not needed if #DC_EVENT_CONFIGURE_PROGRESS reports success.
|
||||||
*
|
*
|
||||||
* On a successfull configuration,
|
* If #DC_EVENT_CONFIGURE_PROGRESS reports failure,
|
||||||
* the core makes a copy of the parameters mentioned above:
|
* the core continues to use the last working configuration
|
||||||
* the original parameters as are never modified by the core.
|
* and parameters as `addr`, `mail_pw` etc. are set to that.
|
||||||
*
|
|
||||||
* UI-implementors should keep this in mind -
|
|
||||||
* eg. if the UI wants to prefill a configure-edit-dialog with these parameters,
|
|
||||||
* the UI should reset them if the user cancels the dialog
|
|
||||||
* after a configure-attempts has failed.
|
|
||||||
* Otherwise the parameters may not reflect the current configuation.
|
|
||||||
*
|
*
|
||||||
* @memberof dc_context_t
|
* @memberof dc_context_t
|
||||||
* @param context The context object as created by dc_context_new().
|
* @param context The context object as created by dc_context_new().
|
||||||
|
|||||||
@@ -421,6 +421,16 @@ pub fn dc_job_do_DC_JOB_CONFIGURE_IMAP(context: &Context) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// remember the entered parameters on success
|
||||||
|
// and restore to last-entered on failure.
|
||||||
|
// this way, the parameters visible to the ui are always in-sync with the current configuration.
|
||||||
|
if success {
|
||||||
|
LoginParam::from_database(context, "").save_to_database(context, "configured_raw_");
|
||||||
|
} else {
|
||||||
|
LoginParam::from_database(context, "configured_raw_").save_to_database(context, "");
|
||||||
|
}
|
||||||
|
|
||||||
context.free_ongoing();
|
context.free_ongoing();
|
||||||
progress!(context, if success { 1000 } else { 0 });
|
progress!(context, if success { 1000 } else { 0 });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user