26#ifndef _PURPLE_REQUEST_H_
27#define _PURPLE_REQUEST_H_
30#include <glib-object.h>
38#define PURPLE_DEFAULT_ACTION_NONE -1
60 PURPLE_REQUEST_FIELD_NONE,
61 PURPLE_REQUEST_FIELD_STRING,
62 PURPLE_REQUEST_FIELD_INTEGER,
63 PURPLE_REQUEST_FIELD_BOOLEAN,
64 PURPLE_REQUEST_FIELD_CHOICE,
65 PURPLE_REQUEST_FIELD_LIST,
66 PURPLE_REQUEST_FIELD_LABEL,
67 PURPLE_REQUEST_FIELD_IMAGE,
68 PURPLE_REQUEST_FIELD_ACCOUNT
81 GList *required_fields;
100#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_)
137 gboolean default_value;
155 GHashTable *item_data;
157 GHashTable *selected_table;
159 gboolean multiple_selection;
169 PurpleFilterAccountFunc filter_func;
175 unsigned int scale_x;
176 unsigned int scale_y;
194 void *(*request_input)(
const char *title,
const char *primary,
195 const char *secondary,
const char *default_value,
196 gboolean multiline, gboolean masked, gchar *hint,
197 const char *ok_text, GCallback ok_cb,
198 const char *cancel_text, GCallback cancel_cb,
203 void *(*request_choice)(
const char *title,
const char *primary,
204 const char *secondary,
int default_value,
205 const char *ok_text, GCallback ok_cb,
206 const char *cancel_text, GCallback cancel_cb,
212 void *(*request_action)(
const char *title,
const char *primary,
213 const char *secondary,
int default_action,
216 size_t action_count, va_list actions);
219 void *(*request_fields)(
const char *title,
const char *primary,
221 const char *ok_text, GCallback ok_cb,
222 const char *cancel_text, GCallback cancel_cb,
227 void *(*request_file)(
const char *title,
const char *filename,
228 gboolean savedialog, GCallback ok_cb,
236 void *(*request_folder)(
const char *title,
const char *dirname,
237 GCallback ok_cb, GCallback cancel_cb,
242 void *(*request_action_with_icon)(
const char *title,
const char *primary,
243 const char *secondary,
int default_action,
246 gconstpointer icon_data, gsize icon_size,
248 size_t action_count, va_list actions);
250 void *(*request_screenshare_media)(
const char *title,
const char *primary,
252 GCallback cb,
void *user_data);
254 void (*_purple_reserved1)(void);
255 void (*_purple_reserved2)(void);
258typedef void (*PurpleRequestInputCb)(
void *,
const char *);
265typedef void (*PurpleRequestChoiceCb)(
void *, int);
267typedef void (*PurpleRequestFileCb)(
void *,
const char *filename);
268typedef void (*PurpleRequestScreenshareCb)(
void *, GObject *info);
522 const char *type_hint);
641 const char *default_value,
651 const char *default_value);
802 gboolean default_value);
811 gboolean default_value);
941 gboolean multi_select);
974 const char *item,
void *data);
985 const char *item,
const char* icon_path,
void* data);
1093 const char *buf, gsize size);
1202 PurpleFilterAccountFunc filter_func);
1303 const char *secondary,
const char *default_value, gboolean multiline,
1304 gboolean masked, gchar *hint,
1305 const char *ok_text, GCallback ok_cb,
1306 const char *cancel_text, GCallback cancel_cb,
1344 const char *secondary,
int default_value,
1345 const char *ok_text, GCallback ok_cb,
1346 const char *cancel_text, GCallback cancel_cb,
1348 void *user_data, ...) G_GNUC_NULL_TERMINATED;
1354 const
char *primary, const
char *secondary,
int default_value,
1355 const
char *ok_text, GCallback ok_cb,
1356 const
char *cancel_text, GCallback cancel_cb,
1358 void *user_data, va_list choices);
1396 const
char *secondary,
int default_action,
PurpleAccount *account,
1398 size_t action_count, ...);
1404 const
char *primary, const
char *secondary,
int default_action,
1406 void *user_data,
size_t action_count, va_list actions);
1414 const
char *primary, const
char *secondary,
int default_action,
1416 gconstpointer icon_data, gsize icon_size,
void *user_data,
1417 size_t action_count, ...);
1425 const
char *primary, const
char *secondary,
int default_action,
1427 gconstpointer icon_data, gsize icon_size,
1428 void *user_data,
size_t action_count, va_list actions);
1462 const
char *ok_text, GCallback ok_cb,
1463 const
char *cancel_text, GCallback cancel_cb,
1488#define purple_request_yes_no(handle, title, primary, secondary, \
1489 default_action, account, who, conv, \
1490 user_data, yes_cb, no_cb) \
1491 purple_request_action((handle), (title), (primary), (secondary), \
1492 (default_action), account, who, conv, (user_data), 2, \
1493 _("_Yes"), (yes_cb), _("_No"), (no_cb))
1498#define purple_request_ok_cancel(handle, title, primary, secondary, \
1499 default_action, account, who, conv, \
1500 user_data, ok_cb, cancel_cb) \
1501 purple_request_action((handle), (title), (primary), (secondary), \
1502 (default_action), account, who, conv, (user_data), 2, \
1503 _("_OK"), (ok_cb), _("_Cancel"), (cancel_cb))
1508#define purple_request_accept_cancel(handle, title, primary, secondary, \
1509 default_action, account, who, conv, \
1510 user_data, accept_cb, cancel_cb) \
1511 purple_request_action((handle), (title), (primary), (secondary), \
1512 (default_action), account, who, conv, (user_data), 2, \
1513 _("_Accept"), (accept_cb), _("_Cancel"), (cancel_cb))
1519#define purple_request_accept_cancel_with_icon(handle, title, primary, secondary, \
1520 default_action, account, who, conv, \
1521 icon_data, icon_size, \
1522 user_data, accept_cb, cancel_cb) \
1523 purple_request_action_with_icon((handle), (title), (primary), (secondary), \
1524 (default_action), account, who, conv, icon_data, icon_size, \
1526 _("_Accept"), (accept_cb), _("_Cancel"), (cancel_cb))
1553 gboolean savedialog, GCallback ok_cb, GCallback cancel_cb,
1580 GCallback ok_cb, GCallback cancel_cb,
1604 const char *primary,
const char *secondary,
void purple_request_field_group_add_field(PurpleRequestFieldGroup *group, PurpleRequestField *field)
Adds a field to the group.
void purple_request_field_string_set_editable(PurpleRequestField *field, gboolean editable)
Sets whether or not a string field is editable.
void purple_request_field_string_set_default_value(PurpleRequestField *field, const char *default_value)
Sets the default value in a string field.
void purple_request_close(PurpleRequestType type, void *uihandle)
Closes a request.
const char * purple_request_field_get_type_hint(const PurpleRequestField *field)
Returns the field's type hint.
void * purple_request_choice(void *handle, const char *title, const char *primary, const char *secondary, int default_value, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data,...) G_GNUC_NULL_TERMINATED
Prompts the user for multiple-choice input.
gboolean purple_request_fields_get_bool(const PurpleRequestFields *fields, const char *id)
Returns the boolean value of a field with the specified ID.
void purple_request_field_set_type_hint(PurpleRequestField *field, const char *type_hint)
Sets the type hint for the field.
PurpleRequestFieldType purple_request_field_get_type(const PurpleRequestField *field)
Returns the type of a field.
const char * purple_request_field_get_id(const PurpleRequestField *field)
Returns the ID of a field.
void purple_request_field_account_set_filter(PurpleRequestField *field, PurpleFilterAccountFunc filter_func)
Sets the account filter function in an account field.
PurpleRequestField * purple_request_field_int_new(const char *id, const char *text, int default_value)
Creates an integer field.
void * purple_request_field_list_get_data(const PurpleRequestField *field, const char *text)
Returns the data for a particular item.
gboolean purple_request_field_string_is_multiline(const PurpleRequestField *field)
Returns whether or not a string field is multi-line.
void * purple_request_choice_varg(void *handle, const char *title, const char *primary, const char *secondary, int default_value, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data, va_list choices)
va_list version of purple_request_choice(); see its documentation.
gboolean purple_request_field_is_required(const PurpleRequestField *field)
Returns whether or not a field is required.
int purple_request_field_choice_get_default_value(const PurpleRequestField *field)
Returns the default value in an choice field.
void purple_request_close_with_handle(void *handle)
Closes all requests registered with the specified handle.
gboolean purple_request_field_string_is_masked(const PurpleRequestField *field)
Returns whether or not a string field is masked.
PurpleRequestType
Request types.
@ PURPLE_REQUEST_SCREENSHARE
Screenshare media request.
@ PURPLE_REQUEST_INPUT
Text input request.
@ PURPLE_REQUEST_FIELDS
Multiple fields request.
@ PURPLE_REQUEST_CHOICE
Multiple-choice request.
@ PURPLE_REQUEST_FILE
File open or save request.
@ PURPLE_REQUEST_ACTION
Action request.
@ PURPLE_REQUEST_FOLDER
Folder selection request.
void purple_request_field_int_set_value(PurpleRequestField *field, int value)
Sets the value in an integer field.
PurpleRequestFields * purple_request_fields_new(void)
Creates a list of fields to pass to purple_request_fields().
gboolean purple_request_field_bool_get_value(const PurpleRequestField *field)
Returns the user-entered value in an boolean field.
gsize purple_request_field_image_get_size(PurpleRequestField *field)
Returns size (in bytes) of the image.
void * purple_request_folder(void *handle, const char *title, const char *dirname, GCallback ok_cb, GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data)
Displays a folder select dialog.
int purple_request_field_int_get_default_value(const PurpleRequestField *field)
Returns the default value in an integer field.
void * purple_request_action(void *handle, const char *title, const char *primary, const char *secondary, int default_action, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data, size_t action_count,...)
Prompts the user for an action.
PurpleRequestField * purple_request_field_label_new(const char *id, const char *text)
Creates a label field.
void purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y)
Sets the scale factors of an image field.
gpointer purple_request_field_get_ui_data(const PurpleRequestField *field)
Returns the ui_data for a field.
void purple_request_field_account_set_value(PurpleRequestField *field, PurpleAccount *value)
Sets the account in an account field.
unsigned int purple_request_field_image_get_scale_x(PurpleRequestField *field)
Returns X scale coefficient of the image.
const char * purple_request_field_string_get_default_value(const PurpleRequestField *field)
Returns the default value in a string field.
int purple_request_field_int_get_value(const PurpleRequestField *field)
Returns the user-entered value in an integer field.
void * purple_request_action_with_icon(void *handle, const char *title, const char *primary, const char *secondary, int default_action, PurpleAccount *account, const char *who, PurpleConversation *conv, gconstpointer icon_data, gsize icon_size, void *user_data, size_t action_count,...)
Version of purple_request_action() supplying an image for the UI to optionally display as an icon in ...
PurpleRequestField * purple_request_field_account_new(const char *id, const char *text, PurpleAccount *account)
Creates an account field.
void * purple_request_fields(void *handle, const char *title, const char *primary, const char *secondary, PurpleRequestFields *fields, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data)
Displays groups of fields for the user to fill in.
PurpleRequestField * purple_request_field_bool_new(const char *id, const char *text, gboolean default_value)
Creates a boolean field.
void * purple_request_action_varg(void *handle, const char *title, const char *primary, const char *secondary, int default_action, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data, size_t action_count, va_list actions)
va_list version of purple_request_action(); see its documentation.
const char * purple_request_field_get_label(const PurpleRequestField *field)
Returns the label text of a field.
gboolean purple_request_field_is_visible(const PurpleRequestField *field)
Returns whether or not a field is visible.
void purple_request_field_choice_set_value(PurpleRequestField *field, int value)
Sets the value in an choice field.
void purple_request_field_bool_set_default_value(PurpleRequestField *field, gboolean default_value)
Sets the default value in an boolean field.
GList * purple_request_field_list_get_selected(const PurpleRequestField *field)
Returns a list of selected items in a list field.
int purple_request_field_choice_get_value(const PurpleRequestField *field)
Returns the user-entered value in an choice field.
void purple_request_field_list_add_selected(PurpleRequestField *field, const char *item)
Adds a selected item to the list field.
PurpleRequestField * purple_request_field_new(const char *id, const char *text, PurpleRequestFieldType type)
Creates a field of the specified type.
PurpleRequestFieldGroup * purple_request_field_get_group(const PurpleRequestField *field)
Returns the group for the field.
void purple_request_field_choice_add(PurpleRequestField *field, const char *label)
Adds a choice to a multiple choice field.
void purple_request_field_string_set_masked(PurpleRequestField *field, gboolean masked)
Sets whether or not a string field is masked (commonly used for password fields).
int purple_request_fields_get_choice(const PurpleRequestFields *fields, const char *id)
Returns the choice index of a field with the specified ID.
GList * purple_request_field_list_get_items(const PurpleRequestField *field)
Returns a list of items in a list field.
gboolean purple_request_field_string_is_editable(const PurpleRequestField *field)
Returns whether or not a string field is editable.
void * purple_request_action_with_icon_varg(void *handle, const char *title, const char *primary, const char *secondary, int default_action, PurpleAccount *account, const char *who, PurpleConversation *conv, gconstpointer icon_data, gsize icon_size, void *user_data, size_t action_count, va_list actions)
va_list version of purple_request_action_with_icon(); see its documentation.
void purple_request_field_string_set_value(PurpleRequestField *field, const char *value)
Sets the value in a string field.
void purple_request_field_list_add_icon(PurpleRequestField *field, const char *item, const char *icon_path, void *data)
Adds an item to a list field.
void purple_request_field_destroy(PurpleRequestField *field)
Destroys a field.
void * purple_request_file(void *handle, const char *title, const char *filename, gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data)
Displays a file selector request dialog.
GList * purple_request_fields_get_groups(const PurpleRequestFields *fields)
Returns a list of all groups in a field list.
PurpleAccount * purple_request_fields_get_account(const PurpleRequestFields *fields, const char *id)
Returns the account of a field with the specified ID.
void purple_request_field_bool_set_value(PurpleRequestField *field, gboolean value)
Sets the value in an boolean field.
void purple_request_field_set_label(PurpleRequestField *field, const char *label)
Sets the label text of a field.
PurpleRequestField * purple_request_fields_get_field(const PurpleRequestFields *fields, const char *id)
Return the field with the specified ID.
void purple_request_field_set_required(PurpleRequestField *field, gboolean required)
Sets whether or not a field is required.
const char * purple_request_field_group_get_title(const PurpleRequestFieldGroup *group)
Returns the title of a fields group.
gboolean purple_request_field_bool_get_default_value(const PurpleRequestField *field)
Returns the default value in an boolean field.
gboolean purple_request_field_list_is_selected(const PurpleRequestField *field, const char *item)
Returns whether or not a particular item is selected in a list field.
const char * purple_request_field_string_get_value(const PurpleRequestField *field)
Returns the user-entered value in a string field.
PurpleAccount * purple_request_field_account_get_value(const PurpleRequestField *field)
Returns the user-entered account in an account field.
void purple_request_field_list_add(PurpleRequestField *field, const char *item, void *data)
Adds an item to a list field.
void purple_request_fields_destroy(PurpleRequestFields *fields)
Destroys a list of fields.
PurpleRequestField * purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size)
Creates an image field.
void purple_request_field_int_set_default_value(PurpleRequestField *field, int default_value)
Sets the default value in an integer field.
void purple_request_field_account_set_default_value(PurpleRequestField *field, PurpleAccount *default_value)
Sets the default account on an account field.
const char * purple_request_field_image_get_buffer(PurpleRequestField *field)
Returns pointer to the image.
void purple_request_field_set_ui_data(PurpleRequestField *field, gpointer ui_data)
Sets the ui_data for a field.
void purple_request_field_list_clear_selected(PurpleRequestField *field)
Clears the list of selected items in a list field.
GList * purple_request_field_list_get_icons(const PurpleRequestField *field)
Returns a list of icons in a list field.
void purple_request_fields_add_group(PurpleRequestFields *fields, PurpleRequestFieldGroup *group)
Adds a group of fields to the list.
PurpleFilterAccountFunc purple_request_field_account_get_filter(const PurpleRequestField *field)
Returns the account filter function in an account field.
PurpleRequestField * purple_request_field_list_new(const char *id, const char *text)
Creates a multiple list item field.
PurpleRequestUiOps * purple_request_get_ui_ops(void)
Returns the UI operations structure to be used when displaying a request.
gboolean purple_request_fields_is_field_required(const PurpleRequestFields *fields, const char *id)
Returns whether or not a field with the specified ID is required.
PurpleRequestField * purple_request_field_string_new(const char *id, const char *text, const char *default_value, gboolean multiline)
Creates a string request field.
gboolean purple_request_fields_exists(const PurpleRequestFields *fields, const char *id)
Returns whether or not the field with the specified ID exists.
const char * purple_request_fields_get_string(const PurpleRequestFields *fields, const char *id)
Returns the string value of a field with the specified ID.
void * purple_request_screenshare_media(void *handle, const char *title, const char *primary, const char *secondary, PurpleAccount *account, GCallback cb, void *user_data)
Displays a dialog allowing the user to select a window/monitor etc.
int purple_request_fields_get_integer(const PurpleRequestFields *fields, const char *id)
Returns the integer value of a field with the specified ID.
void purple_request_field_group_destroy(PurpleRequestFieldGroup *group)
Destroys a fields group.
void purple_request_field_set_visible(PurpleRequestField *field, gboolean visible)
Sets whether or not a field is visible.
gboolean purple_request_field_account_get_show_all(const PurpleRequestField *field)
Returns whether or not to show all accounts in an account field.
PurpleRequestField * purple_request_field_choice_new(const char *id, const char *text, int default_value)
Creates a multiple choice field.
void * purple_request_input(void *handle, const char *title, const char *primary, const char *secondary, const char *default_value, gboolean multiline, gboolean masked, gchar *hint, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data)
Prompts the user for text input.
gboolean purple_request_fields_all_required_filled(const PurpleRequestFields *fields)
Returns whether or not all required fields have values.
void purple_request_field_account_set_show_all(PurpleRequestField *field, gboolean show_all)
Sets whether or not to show all accounts in an account field.
GList * purple_request_fields_get_required(const PurpleRequestFields *fields)
Returns a list of all required fields.
unsigned int purple_request_field_image_get_scale_y(PurpleRequestField *field)
Returns Y scale coefficient of the image.
GList * purple_request_field_choice_get_labels(const PurpleRequestField *field)
Returns a list of labels in a choice field.
void purple_request_field_list_set_selected(PurpleRequestField *field, GList *items)
Sets a list of selected items in a list field.
void purple_request_field_list_set_multi_select(PurpleRequestField *field, gboolean multi_select)
Sets whether or not a list field allows multiple selection.
void purple_request_field_choice_set_default_value(PurpleRequestField *field, int default_value)
Sets the default value in an choice field.
void(* PurpleRequestActionCb)(void *, int)
The type of callbacks passed to purple_request_action().
PurpleRequestFieldType
A type of field.
gboolean purple_request_field_list_get_multi_select(const PurpleRequestField *field)
Returns whether or not a list field allows multiple selection.
PurpleAccount * purple_request_field_account_get_default_value(const PurpleRequestField *field)
Returns the default account in an account field.
void purple_request_set_ui_ops(PurpleRequestUiOps *ops)
Sets the UI operations structure to be used when displaying a request.
PurpleRequestFieldGroup * purple_request_field_group_new(const char *title)
Creates a fields group with an optional title.
GList * purple_request_field_group_get_fields(const PurpleRequestFieldGroup *group)
Returns a list of all fields in a group.
A group of fields with a title.
Multiple fields request data.
Structure representing an account.
A core representation of a conversation between two or more people.