text stringlengths 0 357 |
|---|
* the function **uses autoconfigure/autodiscover** |
* to get the full configuration from well-known URLs. |
* |
* - If _more_ options as `mail_server`, `mail_port`, `send_server`, |
* `send_port`, `send_user` or `server_flags` are specified, |
* **autoconfigure/autodiscover is skipped**. |
* |
* While dc_configure() returns immediately, |
* the started configuration-job may take a while. |
* |
* During configuration, #DC_EVENT_CONFIGURE_PROGRESS events are emmited; |
* they indicate a successful configuration as well as errors |
* and may be used to create a progress bar. |
* |
* Additional calls to dc_configure() while a config-job is running are ignored. |
* To interrupt a configuration prematurely, use dc_stop_ongoing_process(); |
* this is not needed if #DC_EVENT_CONFIGURE_PROGRESS reports success. |
* |
* On a successfull configuration, |
* the core makes a copy of the parameters mentioned above: |
* the original parameters as are never modified by the core. |
* |
* 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 |
* @param context The context object as created by dc_context_new(). |
* @return None. |
* |
* There is no need to call dc_configure() on every program start, |
* the configuration result is saved in the database |
* and you can use the connection directly: |
* |
* ~~~ |
* if (!dc_is_configured(context)) { |
* dc_configure(context); |
* // wait for progress events |
* } |
* ~~~ |
*/ |
void dc_configure(dc_context_t* context) |
{ |
if (dc_has_ongoing(context)) { |
dc_log_warning(context, 0, "There is already another ongoing process running."); |
return; |
} |
dc_job_kill_action(context, DC_JOB_CONFIGURE_IMAP); |
dc_job_add(context, DC_JOB_CONFIGURE_IMAP, 0, NULL, 0); // results in a call to dc_configure_job() |
} |
/** |
* Check if the context is already configured. |
* |
* Typically, for unconfigured accounts, the user is prompted |
* to enter some settings and dc_configure() is called in a thread then. |
* |
* @memberof dc_context_t |
* @param context The context object as created by dc_context_new(). |
* @return 1=context is configured and can be used; |
* 0=context is not configured and a configuration by dc_configure() is required. |
*/ |
int dc_is_configured(const dc_context_t* context) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
return 0; |
} |
return dc_sqlite3_get_config_int(context->sql, "configured", 0)? 1 : 0; |
} |
/* |
* Check if there is an ongoing process. |
*/ |
int dc_has_ongoing(dc_context_t* context) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
return 0; |
} |
return (context->ongoing_running || context->shall_stop_ongoing==0)? 1 : 0; |
} |
/* |
* Request an ongoing process to start. |
* Returns 0=process started, 1=not started, there is running another process |
*/ |
int dc_alloc_ongoing(dc_context_t* context) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
return 0; |
} |
if (dc_has_ongoing(context)) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.