## EUserPrompterServerExtension

EUserPrompterServerExtension — Extension for a server-side user prompter

## Synopsis

    struct              EUserPrompterServerExtension;
    struct              EUserPrompterServerExtensionClass;
    gboolean            e_user_prompter_server_extension_prompt
                                                            (EUserPrompterServerExtension *extension,
                                                             gint prompt_id,
                                                             const gchar *dialog_name,
                                                             const ENamedParameters *parameters);
    void                e_user_prompter_server_extension_response
                                                            (EUserPrompterServerExtension *extension,
                                                             gint prompt_id,
                                                             gint response,
                                                             const ENamedParameters *values);

## Description

The EUserPrompterServerExtension is a base struct for extension of EUserPrompterServer, to provide customized or specialized dialog prompts.

A descendant defines two virtual functions, the EUserPrompterServerExtensionClass::register_dialogs which is used as a convenient function, where the descendant registers all the dialogs it provides on the server with `e_user_prompter_server_register()`.

The next function is EUserPrompterServerExtensionClass::prompt, which is used to initiate user prompt. The implementor should not block main thread with this function, because this is treated fully asynchronously. User's response is passed to the server with `e_user_prompter_server_extension_response()` call.

## Details

### struct EUserPrompterServerExtension

    struct EUserPrompterServerExtension {
    	EExtension parent;
    	EUserPrompterServerExtensionPrivate *priv;
    };

Contains only private data that should be read and manipulated using the functions below.

Since 3.8

### struct EUserPrompterServerExtensionClass

    struct EUserPrompterServerExtensionClass {
    	EExtensionClass parent_class;

    	/* virtual methods */
    	void		(*register_dialogs)
    					(EExtension *extension,
    					 struct _EUserPrompterServer *server);
    	gboolean (*prompt) (EUserPrompterServerExtension *extension,
    					 gint prompt_id,
    					 const gchar *dialog_name,
    					 const ENamedParameters *parameters);
    };

### e_user_prompter_server_extension_prompt ()

    gboolean            e_user_prompter_server_extension_prompt
                                                            (EUserPrompterServerExtension *extension,
                                                             gint prompt_id,
                                                             const gchar *dialog_name,
                                                             const ENamedParameters *parameters);

Instructs extension to show dialog `dialog_name`. If it cannot be found, or any error, then return `FALSE`. The caller can pass optional `parameters`, if `extension` uses any. Meaning of `parameters` is known only to the caller and to the dialog implementor, it's not interpretted nor checked for correctness in any way in EUserPrompterServer. The only limitation of `parameters` is that the array elements are strings.

The `prompt_id` is used as an identificator of the prompt itself, and is used in `e_user_prompter_server_extension_response()` call, which finishes the prompt.

Note: The function call should not block main loop, it should just show dialog and return.

`extension` : | an EUserPrompterServerExtension
`prompt_id` : | Prompt identificator, which is used in call to `e_user_prompter_server_extension_response()`
`dialog_name` : | Name of a dialog to run
`parameters` : | Optional extension parameters for the dialog, as passed by a caller. [allow-none]
Returns : | Whether dialog was found and shown.

Since 3.8

### e_user_prompter_server_extension_response ()

    void                e_user_prompter_server_extension_response
                                                            (EUserPrompterServerExtension *extension,
                                                             gint prompt_id,
                                                             gint response,
                                                             const ENamedParameters *values);

A conveniente wrapper function around `e_user_prompter_server_response()`, which ends previous call of `e_user_prompter_server_extension_prompt()`. The `response` and `values` is known only to the caller and to the dialog implementor, it's not interpretted nor checked for correctness in any way in EUserPrompterServer. The only limitation of `values` is that the array elements are strings.

`extension` : | an EUserPrompterServerExtension
`prompt_id` : | Prompt identificator
`response` : | Response of the prompt
`values` : | Additional response values, if extension defines any. [allow-none]

Since 3.8