home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / libpurple / request.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  43.5 KB  |  1,478 lines

  1. /**
  2.  * @file request.h Request API
  3.  * @ingroup core
  4.  *
  5.  * purple
  6.  *
  7.  * Purple is the legal property of its developers, whose names are too numerous
  8.  * to list here.  Please refer to the COPYRIGHT file distributed with this
  9.  * source distribution.
  10.  *
  11.  * This program is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  24.  */
  25. #ifndef _PURPLE_REQUEST_H_
  26. #define _PURPLE_REQUEST_H_
  27.  
  28. #include <stdlib.h>
  29. #include <glib-object.h>
  30. #include <glib.h>
  31.  
  32. #include "account.h"
  33.  
  34. #define PURPLE_DEFAULT_ACTION_NONE    -1
  35.  
  36. /**
  37.  * Request types.
  38.  */
  39. typedef enum
  40. {
  41.     PURPLE_REQUEST_INPUT = 0,  /**< Text input request.        */
  42.     PURPLE_REQUEST_CHOICE,     /**< Multiple-choice request.   */
  43.     PURPLE_REQUEST_ACTION,     /**< Action request.            */
  44.     PURPLE_REQUEST_FIELDS,     /**< Multiple fields request.   */
  45.     PURPLE_REQUEST_FILE,       /**< File open or save request. */
  46.     PURPLE_REQUEST_FOLDER      /**< Folder selection request.  */
  47.  
  48. } PurpleRequestType;
  49.  
  50. /**
  51.  * A type of field.
  52.  */
  53. typedef enum
  54. {
  55.     PURPLE_REQUEST_FIELD_NONE,
  56.     PURPLE_REQUEST_FIELD_STRING,
  57.     PURPLE_REQUEST_FIELD_INTEGER,
  58.     PURPLE_REQUEST_FIELD_BOOLEAN,
  59.     PURPLE_REQUEST_FIELD_CHOICE,
  60.     PURPLE_REQUEST_FIELD_LIST,
  61.     PURPLE_REQUEST_FIELD_LABEL,
  62.     PURPLE_REQUEST_FIELD_IMAGE,
  63.     PURPLE_REQUEST_FIELD_ACCOUNT
  64.  
  65. } PurpleRequestFieldType;
  66.  
  67. /**
  68.  * Multiple fields request data.
  69.  */
  70. typedef struct
  71. {
  72.     GList *groups;
  73.  
  74.     GHashTable *fields;
  75.  
  76.     GList *required_fields;
  77.  
  78.     void *ui_data;
  79.  
  80. } PurpleRequestFields;
  81.  
  82. /**
  83.  * A group of fields with a title.
  84.  */
  85. typedef struct
  86. {
  87.     PurpleRequestFields *fields_list;
  88.  
  89.     char *title;
  90.  
  91.     GList *fields;
  92.  
  93. } PurpleRequestFieldGroup;
  94.  
  95. /**
  96.  * A request field.
  97.  */
  98. typedef struct
  99. {
  100.     PurpleRequestFieldType type;
  101.     PurpleRequestFieldGroup *group;
  102.  
  103.     char *id;
  104.     char *label;
  105.     char *type_hint;
  106.  
  107.     gboolean visible;
  108.     gboolean required;
  109.  
  110.     union
  111.     {
  112.         struct
  113.         {
  114.             gboolean multiline;
  115.             gboolean masked;
  116.             gboolean editable;
  117.             char *default_value;
  118.             char *value;
  119.  
  120.         } string;
  121.  
  122.         struct
  123.         {
  124.             int default_value;
  125.             int value;
  126.  
  127.         } integer;
  128.  
  129.         struct
  130.         {
  131.             gboolean default_value;
  132.             gboolean value;
  133.  
  134.         } boolean;
  135.  
  136.         struct
  137.         {
  138.             int default_value;
  139.             int value;
  140.  
  141.             GList *labels;
  142.  
  143.         } choice;
  144.  
  145.         struct
  146.         {
  147.             GList *items;
  148.             GHashTable *item_data;
  149.             GList *selected;
  150.             GHashTable *selected_table;
  151.  
  152.             gboolean multiple_selection;
  153.  
  154.         } list;
  155.  
  156.         struct
  157.         {
  158.             PurpleAccount *default_account;
  159.             PurpleAccount *account;
  160.             gboolean show_all;
  161.  
  162.             PurpleFilterAccountFunc filter_func;
  163.  
  164.         } account;
  165.  
  166.         struct
  167.         {
  168.             unsigned int scale_x;
  169.             unsigned int scale_y;
  170.             const char *buffer;
  171.             gsize size;
  172.         } image;
  173.  
  174.     } u;
  175.  
  176.     void *ui_data;
  177.  
  178. } PurpleRequestField;
  179.  
  180. /**
  181.  * Request UI operations.
  182.  */
  183. typedef struct
  184. {
  185.     void *(*request_input)(const char *title, const char *primary,
  186.                            const char *secondary, const char *default_value,
  187.                            gboolean multiline, gboolean masked, gchar *hint,
  188.                            const char *ok_text, GCallback ok_cb,
  189.                            const char *cancel_text, GCallback cancel_cb,
  190.                            PurpleAccount *account, const char *who, PurpleConversation *conv,
  191.                            void *user_data);
  192.     void *(*request_choice)(const char *title, const char *primary,
  193.                             const char *secondary, unsigned int default_value,
  194.                             const char *ok_text, GCallback ok_cb,
  195.                             const char *cancel_text, GCallback cancel_cb,
  196.                             PurpleAccount *account, const char *who, PurpleConversation *conv,
  197.                             void *user_data, va_list choices);
  198.     void *(*request_action)(const char *title, const char *primary,
  199.                             const char *secondary, unsigned int default_action,
  200.                             PurpleAccount *account, const char *who, PurpleConversation *conv,
  201.                             void *user_data, size_t action_count,
  202.                             va_list actions);
  203.     void *(*request_fields)(const char *title, const char *primary,
  204.                             const char *secondary, PurpleRequestFields *fields,
  205.                             const char *ok_text, GCallback ok_cb,
  206.                             const char *cancel_text, GCallback cancel_cb,
  207.                             PurpleAccount *account, const char *who, PurpleConversation *conv,
  208.                             void *user_data);
  209.     void *(*request_file)(const char *title, const char *filename,
  210.                           gboolean savedialog, GCallback ok_cb, GCallback cancel_cb,
  211.                           PurpleAccount *account, const char *who, PurpleConversation *conv,
  212.                           void *user_data);
  213.     void (*close_request)(PurpleRequestType type, void *ui_handle);
  214.     void *(*request_folder)(const char *title, const char *dirname,
  215.                             GCallback ok_cb, GCallback cancel_cb,
  216.                             PurpleAccount *account, const char *who, PurpleConversation *conv,
  217.                             void *user_data);
  218.  
  219.     void (*_purple_reserved1)(void);
  220.     void (*_purple_reserved2)(void);
  221.     void (*_purple_reserved3)(void);
  222.     void (*_purple_reserved4)(void);
  223. } PurpleRequestUiOps;
  224.  
  225. typedef void (*PurpleRequestInputCb)(void *, const char *);
  226. typedef void (*PurpleRequestActionCb)(void *, int);
  227. typedef void (*PurpleRequestChoiceCb)(void *, int);
  228. typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields);
  229. typedef void (*PurpleRequestFileCb)(void *, const char *filename);
  230.  
  231. #ifdef __cplusplus
  232. extern "C" {
  233. #endif
  234.  
  235. /**************************************************************************/
  236. /** @name Field List API                                                  */
  237. /**************************************************************************/
  238. /*@{*/
  239.  
  240. /**
  241.  * Creates a list of fields to pass to purple_request_fields().
  242.  *
  243.  * @return A PurpleRequestFields structure.
  244.  */
  245. PurpleRequestFields *purple_request_fields_new(void);
  246.  
  247. /**
  248.  * Destroys a list of fields.
  249.  *
  250.  * @param fields The list of fields to destroy.
  251.  */
  252. void purple_request_fields_destroy(PurpleRequestFields *fields);
  253.  
  254. /**
  255.  * Adds a group of fields to the list.
  256.  *
  257.  * @param fields The fields list.
  258.  * @param group  The group to add.
  259.  */
  260. void purple_request_fields_add_group(PurpleRequestFields *fields,
  261.                                    PurpleRequestFieldGroup *group);
  262.  
  263. /**
  264.  * Returns a list of all groups in a field list.
  265.  *
  266.  * @param fields The fields list.
  267.  *
  268.  * @return A list of groups.
  269.  */
  270. GList *purple_request_fields_get_groups(const PurpleRequestFields *fields);
  271.  
  272. /**
  273.  * Returns whether or not the field with the specified ID exists.
  274.  *
  275.  * @param fields The fields list.
  276.  * @param id     The ID of the field.
  277.  *
  278.  * @return TRUE if the field exists, or FALSE.
  279.  */
  280. gboolean purple_request_fields_exists(const PurpleRequestFields *fields,
  281.                                     const char *id);
  282.  
  283. /**
  284.  * Returns a list of all required fields.
  285.  *
  286.  * @param fields The fields list.
  287.  *
  288.  * @return The list of required fields.
  289.  */
  290. const GList *purple_request_fields_get_required(const PurpleRequestFields *fields);
  291.  
  292. /**
  293.  * Returns whether or not a field with the specified ID is required.
  294.  *
  295.  * @param fields The fields list.
  296.  * @param id     The field ID.
  297.  *
  298.  * @return TRUE if the specified field is required, or FALSE.
  299.  */
  300. gboolean purple_request_fields_is_field_required(const PurpleRequestFields *fields,
  301.                                                const char *id);
  302.  
  303. /**
  304.  * Returns whether or not all required fields have values.
  305.  *
  306.  * @param fields The fields list.
  307.  *
  308.  * @return TRUE if all required fields have values, or FALSE.
  309.  */
  310. gboolean purple_request_fields_all_required_filled(
  311.     const PurpleRequestFields *fields);
  312.  
  313. /**
  314.  * Return the field with the specified ID.
  315.  *
  316.  * @param fields The fields list.
  317.  * @param id     The ID of the field.
  318.  *
  319.  * @return The field, if found.
  320.  */
  321. PurpleRequestField *purple_request_fields_get_field(
  322.         const PurpleRequestFields *fields, const char *id);
  323.  
  324. /**
  325.  * Returns the string value of a field with the specified ID.
  326.  *
  327.  * @param fields The fields list.
  328.  * @param id     The ID of the field.
  329.  *
  330.  * @return The string value, if found, or @c NULL otherwise.
  331.  */
  332. const char *purple_request_fields_get_string(const PurpleRequestFields *fields,
  333.                                            const char *id);
  334.  
  335. /**
  336.  * Returns the integer value of a field with the specified ID.
  337.  *
  338.  * @param fields The fields list.
  339.  * @param id     The ID of the field.
  340.  *
  341.  * @return The integer value, if found, or 0 otherwise.
  342.  */
  343. int purple_request_fields_get_integer(const PurpleRequestFields *fields,
  344.                                     const char *id);
  345.  
  346. /**
  347.  * Returns the boolean value of a field with the specified ID.
  348.  *
  349.  * @param fields The fields list.
  350.  * @param id     The ID of the field.
  351.  *
  352.  * @return The boolean value, if found, or @c FALSE otherwise.
  353.  */
  354. gboolean purple_request_fields_get_bool(const PurpleRequestFields *fields,
  355.                                       const char *id);
  356.  
  357. /**
  358.  * Returns the choice index of a field with the specified ID.
  359.  *
  360.  * @param fields The fields list.
  361.  * @param id     The ID of the field.
  362.  *
  363.  * @return The choice index, if found, or -1 otherwise.
  364.  */
  365. int purple_request_fields_get_choice(const PurpleRequestFields *fields,
  366.                                    const char *id);
  367.  
  368. /**
  369.  * Returns the account of a field with the specified ID.
  370.  *
  371.  * @param fields The fields list.
  372.  * @param id     The ID of the field.
  373.  *
  374.  * @return The account value, if found, or NULL otherwise.
  375.  */
  376. PurpleAccount *purple_request_fields_get_account(const PurpleRequestFields *fields,
  377.                                              const char *id);
  378.  
  379. /*@}*/
  380.  
  381. /**************************************************************************/
  382. /** @name Fields Group API                                                */
  383. /**************************************************************************/
  384. /*@{*/
  385.  
  386. /**
  387.  * Creates a fields group with an optional title.
  388.  *
  389.  * @param title The optional title to give the group.
  390.  *
  391.  * @return A new fields group
  392.  */
  393. PurpleRequestFieldGroup *purple_request_field_group_new(const char *title);
  394.  
  395. /**
  396.  * Destroys a fields group.
  397.  *
  398.  * @param group The group to destroy.
  399.  */
  400. void purple_request_field_group_destroy(PurpleRequestFieldGroup *group);
  401.  
  402. /**
  403.  * Adds a field to the group.
  404.  *
  405.  * @param group The group to add the field to.
  406.  * @param field The field to add to the group.
  407.  */
  408. void purple_request_field_group_add_field(PurpleRequestFieldGroup *group,
  409.                                         PurpleRequestField *field);
  410.  
  411. /**
  412.  * Returns the title of a fields group.
  413.  *
  414.  * @param group The group.
  415.  *
  416.  * @return The title, if set.
  417.  */
  418. const char *purple_request_field_group_get_title(
  419.         const PurpleRequestFieldGroup *group);
  420.  
  421. /**
  422.  * Returns a list of all fields in a group.
  423.  *
  424.  * @param group The group.
  425.  *
  426.  * @return The list of fields in the group.
  427.  */
  428. GList *purple_request_field_group_get_fields(
  429.         const PurpleRequestFieldGroup *group);
  430.  
  431. /*@}*/
  432.  
  433. /**************************************************************************/
  434. /** @name Field API                                                       */
  435. /**************************************************************************/
  436. /*@{*/
  437.  
  438. /**
  439.  * Creates a field of the specified type.
  440.  *
  441.  * @param id   The field ID.
  442.  * @param text The text label of the field.
  443.  * @param type The type of field.
  444.  *
  445.  * @return The new field.
  446.  */
  447. PurpleRequestField *purple_request_field_new(const char *id, const char *text,
  448.                                          PurpleRequestFieldType type);
  449.  
  450. /**
  451.  * Destroys a field.
  452.  *
  453.  * @param field The field to destroy.
  454.  */
  455. void purple_request_field_destroy(PurpleRequestField *field);
  456.  
  457. /**
  458.  * Sets the label text of a field.
  459.  *
  460.  * @param field The field.
  461.  * @param label The text label.
  462.  */
  463. void purple_request_field_set_label(PurpleRequestField *field, const char *label);
  464.  
  465. /**
  466.  * Sets whether or not a field is visible.
  467.  *
  468.  * @param field   The field.
  469.  * @param visible TRUE if visible, or FALSE if not.
  470.  */
  471. void purple_request_field_set_visible(PurpleRequestField *field, gboolean visible);
  472.  
  473. /**
  474.  * Sets the type hint for the field.
  475.  *
  476.  * This is optionally used by the UIs to provide such features as
  477.  * auto-completion for type hints like "account" and "screenname".
  478.  *
  479.  * @param field     The field.
  480.  * @param type_hint The type hint.
  481.  */
  482. void purple_request_field_set_type_hint(PurpleRequestField *field,
  483.                                       const char *type_hint);
  484.  
  485. /**
  486.  * Sets whether or not a field is required.
  487.  *
  488.  * @param field    The field.
  489.  * @param required TRUE if required, or FALSE.
  490.  */
  491. void purple_request_field_set_required(PurpleRequestField *field,
  492.                                      gboolean required);
  493.  
  494. /**
  495.  * Returns the type of a field.
  496.  *
  497.  * @param field The field.
  498.  *
  499.  * @return The field's type.
  500.  */
  501. PurpleRequestFieldType purple_request_field_get_type(const PurpleRequestField *field);
  502.  
  503. /**
  504.  * Returns the ID of a field.
  505.  *
  506.  * @param field The field.
  507.  *
  508.  * @return The ID
  509.  */
  510. const char *purple_request_field_get_id(const PurpleRequestField *field);
  511.  
  512. /**
  513.  * Returns the label text of a field.
  514.  *
  515.  * @param field The field.
  516.  *
  517.  * @return The label text.
  518.  */
  519. const char *purple_request_field_get_label(const PurpleRequestField *field);
  520.  
  521. /**
  522.  * Returns whether or not a field is visible.
  523.  *
  524.  * @param field The field.
  525.  *
  526.  * @return TRUE if the field is visible. FALSE otherwise.
  527.  */
  528. gboolean purple_request_field_is_visible(const PurpleRequestField *field);
  529.  
  530. /**
  531.  * Returns the field's type hint.
  532.  *
  533.  * @param field The field.
  534.  *
  535.  * @return The field's type hint.
  536.  */
  537. const char *purple_request_field_get_type_hint(const PurpleRequestField *field);
  538.  
  539. /**
  540.  * Returns whether or not a field is required.
  541.  *
  542.  * @param field The field.
  543.  *
  544.  * @return TRUE if the field is required, or FALSE.
  545.  */
  546. gboolean purple_request_field_is_required(const PurpleRequestField *field);
  547.  
  548. /*@}*/
  549.  
  550. /**************************************************************************/
  551. /** @name String Field API                                                */
  552. /**************************************************************************/
  553. /*@{*/
  554.  
  555. /**
  556.  * Creates a string request field.
  557.  *
  558.  * @param id            The field ID.
  559.  * @param text          The text label of the field.
  560.  * @param default_value The optional default value.
  561.  * @param multiline     Whether or not this should be a multiline string.
  562.  *
  563.  * @return The new field.
  564.  */
  565. PurpleRequestField *purple_request_field_string_new(const char *id,
  566.                                                 const char *text,
  567.                                                 const char *default_value,
  568.                                                 gboolean multiline);
  569.  
  570. /**
  571.  * Sets the default value in a string field.
  572.  *
  573.  * @param field         The field.
  574.  * @param default_value The default value.
  575.  */
  576. void purple_request_field_string_set_default_value(PurpleRequestField *field,
  577.                                                  const char *default_value);
  578.  
  579. /**
  580.  * Sets the value in a string field.
  581.  *
  582.  * @param field The field.
  583.  * @param value The value.
  584.  */
  585. void purple_request_field_string_set_value(PurpleRequestField *field,
  586.                                          const char *value);
  587.  
  588. /**
  589.  * Sets whether or not a string field is masked
  590.  * (commonly used for password fields).
  591.  *
  592.  * @param field  The field.
  593.  * @param masked The masked value.
  594.  */
  595. void purple_request_field_string_set_masked(PurpleRequestField *field,
  596.                                           gboolean masked);
  597.  
  598. /**
  599.  * Sets whether or not a string field is editable.
  600.  *
  601.  * @param field    The field.
  602.  * @param editable The editable value.
  603.  */
  604. void purple_request_field_string_set_editable(PurpleRequestField *field,
  605.                                             gboolean editable);
  606.  
  607. /**
  608.  * Returns the default value in a string field.
  609.  *
  610.  * @param field The field.
  611.  *
  612.  * @return The default value.
  613.  */
  614. const char *purple_request_field_string_get_default_value(
  615.         const PurpleRequestField *field);
  616.  
  617. /**
  618.  * Returns the user-entered value in a string field.
  619.  *
  620.  * @param field The field.
  621.  *
  622.  * @return The value.
  623.  */
  624. const char *purple_request_field_string_get_value(const PurpleRequestField *field);
  625.  
  626. /**
  627.  * Returns whether or not a string field is multi-line.
  628.  *
  629.  * @param field The field.
  630.  *
  631.  * @return @c TRUE if the field is mulit-line, or @c FALSE otherwise.
  632.  */
  633. gboolean purple_request_field_string_is_multiline(const PurpleRequestField *field);
  634.  
  635. /**
  636.  * Returns whether or not a string field is masked.
  637.  *
  638.  * @param field The field.
  639.  *
  640.  * @return @c TRUE if the field is masked, or @c FALSE otherwise.
  641.  */
  642. gboolean purple_request_field_string_is_masked(const PurpleRequestField *field);
  643.  
  644. /**
  645.  * Returns whether or not a string field is editable.
  646.  *
  647.  * @param field The field.
  648.  *
  649.  * @return @c TRUE if the field is editable, or @c FALSE otherwise.
  650.  */
  651. gboolean purple_request_field_string_is_editable(const PurpleRequestField *field);
  652.  
  653. /*@}*/
  654.  
  655. /**************************************************************************/
  656. /** @name Integer Field API                                               */
  657. /**************************************************************************/
  658. /*@{*/
  659.  
  660. /**
  661.  * Creates an integer field.
  662.  *
  663.  * @param id            The field ID.
  664.  * @param text          The text label of the field.
  665.  * @param default_value The default value.
  666.  *
  667.  * @return The new field.
  668.  */
  669. PurpleRequestField *purple_request_field_int_new(const char *id,
  670.                                              const char *text,
  671.                                              int default_value);
  672.  
  673. /**
  674.  * Sets the default value in an integer field.
  675.  *
  676.  * @param field         The field.
  677.  * @param default_value The default value.
  678.  */
  679. void purple_request_field_int_set_default_value(PurpleRequestField *field,
  680.                                               int default_value);
  681.  
  682. /**
  683.  * Sets the value in an integer field.
  684.  *
  685.  * @param field The field.
  686.  * @param value The value.
  687.  */
  688. void purple_request_field_int_set_value(PurpleRequestField *field, int value);
  689.  
  690. /**
  691.  * Returns the default value in an integer field.
  692.  *
  693.  * @param field The field.
  694.  *
  695.  * @return The default value.
  696.  */
  697. int purple_request_field_int_get_default_value(const PurpleRequestField *field);
  698.  
  699. /**
  700.  * Returns the user-entered value in an integer field.
  701.  *
  702.  * @param field The field.
  703.  *
  704.  * @return The value.
  705.  */
  706. int purple_request_field_int_get_value(const PurpleRequestField *field);
  707.  
  708. /*@}*/
  709.  
  710. /**************************************************************************/
  711. /** @name Boolean Field API                                               */
  712. /**************************************************************************/
  713. /*@{*/
  714.  
  715. /**
  716.  * Creates a boolean field.
  717.  *
  718.  * This is often represented as a checkbox.
  719.  *
  720.  * @param id            The field ID.
  721.  * @param text          The text label of the field.
  722.  * @param default_value The default value.
  723.  *
  724.  * @return The new field.
  725.  */
  726. PurpleRequestField *purple_request_field_bool_new(const char *id,
  727.                                               const char *text,
  728.                                               gboolean default_value);
  729.  
  730. /**
  731.  * Sets the default value in an boolean field.
  732.  *
  733.  * @param field         The field.
  734.  * @param default_value The default value.
  735.  */
  736. void purple_request_field_bool_set_default_value(PurpleRequestField *field,
  737.                                                gboolean default_value);
  738.  
  739. /**
  740.  * Sets the value in an boolean field.
  741.  *
  742.  * @param field The field.
  743.  * @param value The value.
  744.  */
  745. void purple_request_field_bool_set_value(PurpleRequestField *field,
  746.                                        gboolean value);
  747.  
  748. /**
  749.  * Returns the default value in an boolean field.
  750.  *
  751.  * @param field The field.
  752.  *
  753.  * @return The default value.
  754.  */
  755. gboolean purple_request_field_bool_get_default_value(
  756.         const PurpleRequestField *field);
  757.  
  758. /**
  759.  * Returns the user-entered value in an boolean field.
  760.  *
  761.  * @param field The field.
  762.  *
  763.  * @return The value.
  764.  */
  765. gboolean purple_request_field_bool_get_value(const PurpleRequestField *field);
  766.  
  767. /*@}*/
  768.  
  769. /**************************************************************************/
  770. /** @name Choice Field API                                                */
  771. /**************************************************************************/
  772. /*@{*/
  773.  
  774. /**
  775.  * Creates a multiple choice field.
  776.  *
  777.  * This is often represented as a group of radio buttons.
  778.  *
  779.  * @param id            The field ID.
  780.  * @param text          The optional label of the field.
  781.  * @param default_value The default choice.
  782.  *
  783.  * @return The new field.
  784.  */
  785. PurpleRequestField *purple_request_field_choice_new(const char *id,
  786.                                                 const char *text,
  787.                                                 int default_value);
  788.  
  789. /**
  790.  * Adds a choice to a multiple choice field.
  791.  *
  792.  * @param field The choice field.
  793.  * @param label The choice label.
  794.  */
  795. void purple_request_field_choice_add(PurpleRequestField *field,
  796.                                    const char *label);
  797.  
  798. /**
  799.  * Sets the default value in an choice field.
  800.  *
  801.  * @param field         The field.
  802.  * @param default_value The default value.
  803.  */
  804. void purple_request_field_choice_set_default_value(PurpleRequestField *field,
  805.                                                  int default_value);
  806.  
  807. /**
  808.  * Sets the value in an choice field.
  809.  *
  810.  * @param field The field.
  811.  * @param value The value.
  812.  */
  813. void purple_request_field_choice_set_value(PurpleRequestField *field, int value);
  814.  
  815. /**
  816.  * Returns the default value in an choice field.
  817.  *
  818.  * @param field The field.
  819.  *
  820.  * @return The default value.
  821.  */
  822. int purple_request_field_choice_get_default_value(const PurpleRequestField *field);
  823.  
  824. /**
  825.  * Returns the user-entered value in an choice field.
  826.  *
  827.  * @param field The field.
  828.  *
  829.  * @return The value.
  830.  */
  831. int purple_request_field_choice_get_value(const PurpleRequestField *field);
  832.  
  833. /**
  834.  * Returns a list of labels in a choice field.
  835.  *
  836.  * @param field The field.
  837.  *
  838.  * @return The list of labels.
  839.  */
  840. GList *purple_request_field_choice_get_labels(const PurpleRequestField *field);
  841.  
  842. /*@}*/
  843.  
  844. /**************************************************************************/
  845. /** @name List Field API                                                  */
  846. /**************************************************************************/
  847. /*@{*/
  848.  
  849. /**
  850.  * Creates a multiple list item field.
  851.  *
  852.  * @param id   The field ID.
  853.  * @param text The optional label of the field.
  854.  *
  855.  * @return The new field.
  856.  */
  857. PurpleRequestField *purple_request_field_list_new(const char *id, const char *text);
  858.  
  859. /**
  860.  * Sets whether or not a list field allows multiple selection.
  861.  *
  862.  * @param field        The list field.
  863.  * @param multi_select TRUE if multiple selection is enabled,
  864.  *                     or FALSE otherwise.
  865.  */
  866. void purple_request_field_list_set_multi_select(PurpleRequestField *field,
  867.                                               gboolean multi_select);
  868.  
  869. /**
  870.  * Returns whether or not a list field allows multiple selection.
  871.  *
  872.  * @param field The list field.
  873.  *
  874.  * @return TRUE if multiple selection is enabled, or FALSE otherwise.
  875.  */
  876. gboolean purple_request_field_list_get_multi_select(
  877.     const PurpleRequestField *field);
  878.  
  879. /**
  880.  * Returns the data for a particular item.
  881.  *
  882.  * @param field The list field.
  883.  * @param text  The item text.
  884.  *
  885.  * @return The data associated with the item.
  886.  */
  887. void *purple_request_field_list_get_data(const PurpleRequestField *field,
  888.                                        const char *text);
  889.  
  890. /**
  891.  * Adds an item to a list field.
  892.  *
  893.  * @param field The list field.
  894.  * @param item  The list item.
  895.  * @param data  The associated data.
  896.  */
  897. void purple_request_field_list_add(PurpleRequestField *field,
  898.                                  const char *item, void *data);
  899.  
  900. /**
  901.  * Adds a selected item to the list field.
  902.  *
  903.  * @param field The field.
  904.  * @param item  The item to add.
  905.  */
  906. void purple_request_field_list_add_selected(PurpleRequestField *field,
  907.                                           const char *item);
  908.  
  909. /**
  910.  * Clears the list of selected items in a list field.
  911.  *
  912.  * @param field The field.
  913.  */
  914. void purple_request_field_list_clear_selected(PurpleRequestField *field);
  915.  
  916. /**
  917.  * Sets a list of selected items in a list field.
  918.  *
  919.  * @param field The field.
  920.  * @param items The list of selected items.
  921.  */
  922. void purple_request_field_list_set_selected(PurpleRequestField *field,
  923.                                           const GList *items);
  924.  
  925. /**
  926.  * Returns whether or not a particular item is selected in a list field.
  927.  *
  928.  * @param field The field.
  929.  * @param item  The item.
  930.  *
  931.  * @return TRUE if the item is selected. FALSE otherwise.
  932.  */
  933. gboolean purple_request_field_list_is_selected(const PurpleRequestField *field,
  934.                                              const char *item);
  935.  
  936. /**
  937.  * Returns a list of selected items in a list field.
  938.  *
  939.  * To retrieve the data for each item, use
  940.  * purple_request_field_list_get_data().
  941.  *
  942.  * @param field The field.
  943.  *
  944.  * @return The list of selected items.
  945.  */
  946. const GList *purple_request_field_list_get_selected(
  947.     const PurpleRequestField *field);
  948.  
  949. /**
  950.  * Returns a list of items in a list field.
  951.  *
  952.  * @param field The field.
  953.  *
  954.  * @return The list of items.
  955.  */
  956. const GList *purple_request_field_list_get_items(const PurpleRequestField *field);
  957.  
  958. /*@}*/
  959.  
  960. /**************************************************************************/
  961. /** @name Label Field API                                                 */
  962. /**************************************************************************/
  963. /*@{*/
  964.  
  965. /**
  966.  * Creates a label field.
  967.  *
  968.  * @param id   The field ID.
  969.  * @param text The label of the field.
  970.  *
  971.  * @return The new field.
  972.  */
  973. PurpleRequestField *purple_request_field_label_new(const char *id,
  974.                                                const char *text);
  975.  
  976. /*@}*/
  977.  
  978. /**************************************************************************/
  979. /** @name Image Field API                                                 */
  980. /**************************************************************************/
  981. /*@{*/
  982.  
  983. /**
  984.  * Creates an image field.
  985.  *
  986.  * @param id   The field ID.
  987.  * @param text The label of the field.
  988.  * @param buf  The image data.
  989.  * @param size The size of the data in @a buffer.
  990.  *
  991.  * @return The new field.
  992.  */
  993. PurpleRequestField *purple_request_field_image_new(const char *id, const char *text,
  994.                                                const char *buf, gsize size);
  995.  
  996. /**
  997.  * Sets the scale factors of an image field.
  998.  *
  999.  * @param field The image field.
  1000.  * @param x     The x scale factor.
  1001.  * @param y     The y scale factor.
  1002.  */
  1003. void purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y);
  1004.  
  1005. /**
  1006.  * Returns pointer to the image.
  1007.  *
  1008.  * @param field The image field.
  1009.  *
  1010.  * @return Pointer to the image.
  1011.  */
  1012. const char *purple_request_field_image_get_buffer(PurpleRequestField *field);
  1013.  
  1014. /**
  1015.  * Returns size (in bytes) of the image.
  1016.  *
  1017.  * @param field The image field.
  1018.  *
  1019.  * @return Size of the image.
  1020.  */
  1021. gsize purple_request_field_image_get_size(PurpleRequestField *field);
  1022.  
  1023. /**
  1024.  * Returns X scale coefficient of the image.
  1025.  *
  1026.  * @param field The image field.
  1027.  *
  1028.  * @return X scale coefficient of the image.
  1029.  */
  1030. unsigned int purple_request_field_image_get_scale_x(PurpleRequestField *field);
  1031.  
  1032. /**
  1033.  * Returns Y scale coefficient of the image.
  1034.  *
  1035.  * @param field The image field.
  1036.  *
  1037.  * @return Y scale coefficient of the image.
  1038.  */
  1039. unsigned int purple_request_field_image_get_scale_y(PurpleRequestField *field);
  1040.  
  1041. /*@}*/
  1042.  
  1043. /**************************************************************************/
  1044. /** @name Account Field API                                               */
  1045. /**************************************************************************/
  1046. /*@{*/
  1047.  
  1048. /**
  1049.  * Creates an account field.
  1050.  *
  1051.  * By default, this field will not show offline accounts.
  1052.  *
  1053.  * @param id      The field ID.
  1054.  * @param text    The text label of the field.
  1055.  * @param account The optional default account.
  1056.  *
  1057.  * @return The new field.
  1058.  */
  1059. PurpleRequestField *purple_request_field_account_new(const char *id,
  1060.                                                  const char *text,
  1061.                                                  PurpleAccount *account);
  1062.  
  1063. /**
  1064.  * Sets the default account on an account field.
  1065.  *
  1066.  * @param field         The account field.
  1067.  * @param default_value The default account.
  1068.  */
  1069. void purple_request_field_account_set_default_value(PurpleRequestField *field,
  1070.                                                   PurpleAccount *default_value);
  1071.  
  1072. /**
  1073.  * Sets the account in an account field.
  1074.  *
  1075.  * @param field The account field.
  1076.  * @param value The account.
  1077.  */
  1078. void purple_request_field_account_set_value(PurpleRequestField *field,
  1079.                                           PurpleAccount *value);
  1080.  
  1081. /**
  1082.  * Sets whether or not to show all accounts in an account field.
  1083.  *
  1084.  * If TRUE, all accounts, online or offline, will be shown. If FALSE,
  1085.  * only online accounts will be shown.
  1086.  *
  1087.  * @param field    The account field.
  1088.  * @param show_all Whether or not to show all accounts.
  1089.  */
  1090. void purple_request_field_account_set_show_all(PurpleRequestField *field,
  1091.                                              gboolean show_all);
  1092.  
  1093. /**
  1094.  * Sets the account filter function in an account field.
  1095.  *
  1096.  * This function will determine which accounts get displayed and which
  1097.  * don't.
  1098.  *
  1099.  * @param field       The account field.
  1100.  * @param filter_func The account filter function.
  1101.  */
  1102. void purple_request_field_account_set_filter(PurpleRequestField *field,
  1103.                                            PurpleFilterAccountFunc filter_func);
  1104.  
  1105. /**
  1106.  * Returns the default account in an account field.
  1107.  *
  1108.  * @param field The field.
  1109.  *
  1110.  * @return The default account.
  1111.  */
  1112. PurpleAccount *purple_request_field_account_get_default_value(
  1113.         const PurpleRequestField *field);
  1114.  
  1115. /**
  1116.  * Returns the user-entered account in an account field.
  1117.  *
  1118.  * @param field The field.
  1119.  *
  1120.  * @return The user-entered account.
  1121.  */
  1122. PurpleAccount *purple_request_field_account_get_value(
  1123.         const PurpleRequestField *field);
  1124.  
  1125. /**
  1126.  * Returns whether or not to show all accounts in an account field.
  1127.  *
  1128.  * If TRUE, all accounts, online or offline, will be shown. If FALSE,
  1129.  * only online accounts will be shown.
  1130.  *
  1131.  * @param field    The account field.
  1132.  * @return Whether or not to show all accounts.
  1133.  */
  1134. gboolean purple_request_field_account_get_show_all(
  1135.         const PurpleRequestField *field);
  1136.  
  1137. /**
  1138.  * Returns the account filter function in an account field.
  1139.  *
  1140.  * This function will determine which accounts get displayed and which
  1141.  * don't.
  1142.  *
  1143.  * @param field       The account field.
  1144.  *
  1145.  * @return The account filter function.
  1146.  */
  1147. PurpleFilterAccountFunc purple_request_field_account_get_filter(
  1148.         const PurpleRequestField *field);
  1149.  
  1150. /*@}*/
  1151.  
  1152. /**************************************************************************/
  1153. /** @name Request API                                                     */
  1154. /**************************************************************************/
  1155. /*@{*/
  1156.  
  1157. /**
  1158.  * Prompts the user for text input.
  1159.  *
  1160.  * @param handle        The plugin or connection handle.  For some
  1161.  *                      things this is EXTREMELY important.  The
  1162.  *                      handle is used to programmatically close
  1163.  *                      the request dialog when it is no longer
  1164.  *                      needed.  For PRPLs this is often a pointer
  1165.  *                      to the PurpleConnection instance.  For plugins
  1166.  *                      this should be a similar, unique memory
  1167.  *                      location.  This value is important because
  1168.  *                      it allows a request to be closed, say, when
  1169.  *                      you sign offline.  If the request is NOT
  1170.  *                      closed it is VERY likely to cause a crash
  1171.  *                      whenever the callback handler functions are
  1172.  *                      triggered.
  1173.  * @param title         The title of the message.
  1174.  * @param primary       The main point of the message.
  1175.  * @param secondary     The secondary information.
  1176.  * @param default_value The default value.
  1177.  * @param multiline     TRUE if the inputted text can span multiple lines.
  1178.  * @param masked        TRUE if the inputted text should be masked in some way.
  1179.  * @param hint          Optionally suggest how the input box should appear.
  1180.  *                      Use "html," for example, to allow the user to enter
  1181.  *                      HTML.
  1182.  * @param ok_text       The text for the @c OK button.
  1183.  * @param ok_cb         The callback for the @c OK button.
  1184.  * @param cancel_text   The text for the @c Cancel button.
  1185.  * @param cancel_cb     The callback for the @c Cancel button.
  1186.  * @param account        The PurpleAccount associated with this request, or NULL if none is
  1187.  * @param who            The username of the buddy assocaited with this request, or NULL if none is
  1188.  * @param conv            The PurpleConversation associated with this request, or NULL if none is
  1189.  * @param user_data     The data to pass to the callback.
  1190.  *
  1191.  * @return A UI-specific handle.
  1192.  */
  1193. void *purple_request_input(void *handle, const char *title,
  1194.                          const char *primary, const char *secondary,
  1195.                          const char *default_value,
  1196.                          gboolean multiline, gboolean masked, gchar *hint,
  1197.                          const char *ok_text, GCallback ok_cb,
  1198.                          const char *cancel_text, GCallback cancel_cb,
  1199.                          PurpleAccount *account, const char *who, PurpleConversation *conv,
  1200.                          void *user_data);
  1201.  
  1202. /**
  1203.  * Prompts the user for multiple-choice input.
  1204.  *
  1205.  * @param handle        The plugin or connection handle.  For some
  1206.  *                      things this is EXTREMELY important.  See
  1207.  *                      the comments on purple_request_input.
  1208.  * @param title         The title of the message.
  1209.  * @param primary       The main point of the message.
  1210.  * @param secondary     The secondary information.
  1211.  * @param default_value The default value.
  1212.  * @param ok_text       The text for the @c OK button.
  1213.  * @param ok_cb         The callback for the @c OK button.
  1214.  * @param cancel_text   The text for the @c Cancel button.
  1215.  * @param cancel_cb     The callback for the @c Cancel button.
  1216.  * @param account        The PurpleAccount associated with this request, or NULL if none is
  1217.  * @param who            The username of the buddy assocaited with this request, or NULL if none is
  1218.  * @param conv            The PurpleConversation associated with this request, or NULL if none is 
  1219.  * @param user_data     The data to pass to the callback.
  1220.  * @param ...           The choices.  This argument list should be
  1221.  *                      terminated with a NULL parameter.
  1222.  *
  1223.  * @return A UI-specific handle.
  1224.  */
  1225. void *purple_request_choice(void *handle, const char *title,
  1226.                           const char *primary, const char *secondary,
  1227.                           unsigned int default_value,
  1228.                           const char *ok_text, GCallback ok_cb,
  1229.                           const char *cancel_text, GCallback cancel_cb,
  1230.                           PurpleAccount *account, const char *who, PurpleConversation *conv,
  1231.                           void *user_data, ...);
  1232.  
  1233. /**
  1234.  * Prompts the user for multiple-choice input.
  1235.  *
  1236.  * @param handle        The plugin or connection handle.  For some
  1237.  *                      things this is EXTREMELY important.  See
  1238.  *                      the comments on purple_request_input.
  1239.  * @param title         The title of the message.
  1240.  * @param primary       The main point of the message.
  1241.  * @param secondary     The secondary information.
  1242.  * @param default_value The default value.
  1243.  * @param ok_text       The text for the @c OK button.
  1244.  * @param ok_cb         The callback for the @c OK button.
  1245.  * @param cancel_text   The text for the @c Cancel button.
  1246.  * @param cancel_cb     The callback for the @c Cancel button.
  1247.  * @param account        The PurpleAccount associated with this request, or NULL if none is
  1248.  * @param who            The username of the buddy assocaited with this request, or NULL if none is
  1249.  * @param conv            The PurpleConversation associated with this request, or NULL if none is 
  1250.  * @param user_data     The data to pass to the callback.
  1251.  * @param choices       The choices.  This argument list should be
  1252.  *                      terminated with a @c NULL parameter.
  1253.  *
  1254.  * @return A UI-specific handle.
  1255.  */
  1256. void *purple_request_choice_varg(void *handle, const char *title,
  1257.                                const char *primary, const char *secondary,
  1258.                                unsigned int default_value,
  1259.                                const char *ok_text, GCallback ok_cb,
  1260.                                const char *cancel_text, GCallback cancel_cb,
  1261.                                PurpleAccount *account, const char *who, PurpleConversation *conv,
  1262.                                void *user_data, va_list choices);
  1263.  
  1264. /**
  1265.  * Prompts the user for an action.
  1266.  *
  1267.  * This is often represented as a dialog with a button for each action.
  1268.  *
  1269.  * @param handle         The plugin or connection handle.  For some
  1270.  *                       things this is EXTREMELY important.  See
  1271.  *                       the comments on purple_request_input.
  1272.  * @param title          The title of the message.
  1273.  * @param primary        The main point of the message.
  1274.  * @param secondary      The secondary information.
  1275.  * @param default_action The default value.
  1276.  * @param account         The PurpleAccount associated with this request, or NULL if none is
  1277.  * @param who             The username of the buddy assocaited with this request, or NULL if none is
  1278.  * @param conv             The PurpleConversation associated with this request, or NULL if none is 
  1279.  * @param user_data      The data to pass to the callback.
  1280.  * @param action_count   The number of actions.
  1281.  * @param ...            A list of actions.  These are pairs of
  1282.  *                       arguments.  The first of each pair is the
  1283.  *                       string that appears on the button.  It should
  1284.  *                       have an underscore before the letter you want
  1285.  *                       to use as the accelerator key for the button.
  1286.  *                       The second of each pair is the callback
  1287.  *                       function to use when the button is clicked.
  1288.  *
  1289.  * @return A UI-specific handle.
  1290.  */
  1291. void *purple_request_action(void *handle, const char *title,
  1292.                           const char *primary, const char *secondary,
  1293.                           unsigned int default_action,
  1294.                           PurpleAccount *account, const char *who, PurpleConversation *conv,
  1295.                           void *user_data, size_t action_count, ...);
  1296.  
  1297. /**
  1298.  * Prompts the user for an action.
  1299.  *
  1300.  * This is often represented as a dialog with a button for each action.
  1301.  *
  1302.  * @param handle         The plugin or connection handle.  For some
  1303.  *                       things this is EXTREMELY important.  See
  1304.  *                       the comments on purple_request_input.
  1305.  * @param title          The title of the message.
  1306.  * @param primary        The main point of the message.
  1307.  * @param secondary      The secondary information.
  1308.  * @param default_action The default value.
  1309.  * @param account         The PurpleAccount associated with this request, or NULL if none is
  1310.  * @param who             The username of the buddy assocaited with this request, or NULL if none is
  1311.  * @param conv             The PurpleConversation associated with this request, or NULL if none is 
  1312.  * @param user_data      The data to pass to the callback.
  1313.  * @param action_count   The number of actions.
  1314.  * @param actions        A list of actions and callbacks.
  1315.  *
  1316.  * @return A UI-specific handle.
  1317.  */
  1318. void *purple_request_action_varg(void *handle, const char *title,
  1319.                                const char *primary, const char *secondary,
  1320.                                unsigned int default_action,
  1321.                                PurpleAccount *account, const char *who, PurpleConversation *conv,
  1322.                                void *user_data, size_t action_count,
  1323.                                va_list actions);
  1324.  
  1325. /**
  1326.  * Displays groups of fields for the user to fill in.
  1327.  *
  1328.  * @param handle      The plugin or connection handle.  For some
  1329.  *                    things this is EXTREMELY important.  See
  1330.  *                    the comments on purple_request_input.
  1331.  * @param title       The title of the message.
  1332.  * @param primary     The main point of the message.
  1333.  * @param secondary   The secondary information.
  1334.  * @param fields      The list of fields.
  1335.  * @param ok_text     The text for the @c OK button.
  1336.  * @param ok_cb       The callback for the @c OK button.
  1337.  * @param cancel_text The text for the @c Cancel button.
  1338.  * @param cancel_cb   The callback for the @c Cancel button.
  1339.  * @param account      The PurpleAccount associated with this request, or NULL if none is
  1340.  * @param who          The username of the buddy associated with this request, or NULL if none is
  1341.  * @param conv          The PurpleConversation associated with this request, or NULL if none is 
  1342.  * @param user_data   The data to pass to the callback.
  1343.  *
  1344.  * @return A UI-specific handle.
  1345.  */
  1346. void *purple_request_fields(void *handle, const char *title,
  1347.                           const char *primary, const char *secondary,
  1348.                           PurpleRequestFields *fields,
  1349.                           const char *ok_text, GCallback ok_cb,
  1350.                           const char *cancel_text, GCallback cancel_cb,
  1351.                           PurpleAccount *account, const char *who, PurpleConversation *conv,
  1352.                           void *user_data);
  1353.  
  1354. /**
  1355.  * Closes a request.
  1356.  *
  1357.  * @param type     The request type.
  1358.  * @param uihandle The request UI handle.
  1359.  */
  1360. void purple_request_close(PurpleRequestType type, void *uihandle);
  1361.  
  1362. /**
  1363.  * Closes all requests registered with the specified handle.
  1364.  *
  1365.  * @param handle The handle.
  1366.  */
  1367. void purple_request_close_with_handle(void *handle);
  1368.  
  1369. /**
  1370.  * A wrapper for purple_request_action() that uses @c Yes and @c No buttons.
  1371.  */
  1372. #define purple_request_yes_no(handle, title, primary, secondary, \
  1373.                             default_action, account, who, conv, \
  1374.                             user_data, yes_cb, no_cb) \
  1375.     purple_request_action((handle), (title), (primary), (secondary), \
  1376.                         (default_action), account, who, conv, (user_data), 2, \
  1377.                         _("_Yes"), (yes_cb), _("_No"), (no_cb))
  1378.  
  1379. /**
  1380.  * A wrapper for purple_request_action() that uses @c OK and @c Cancel buttons.
  1381.  */
  1382. #define purple_request_ok_cancel(handle, title, primary, secondary, \
  1383.                             default_action, account, who, conv, \
  1384.                             user_data, ok_cb, cancel_cb) \
  1385.     purple_request_action((handle), (title), (primary), (secondary), \
  1386.                         (default_action), account, who, conv, (user_data), 2, \
  1387.                         _("_OK"), (ok_cb), _("_Cancel"), (cancel_cb))
  1388.  
  1389. /**
  1390.  * A wrapper for purple_request_action() that uses Accept and Cancel buttons.
  1391.  */
  1392. #define purple_request_accept_cancel(handle, title, primary, secondary, \
  1393.                                    default_action, account, who, conv, \
  1394.                                    user_data, accept_cb, cancel_cb) \
  1395.     purple_request_action((handle), (title), (primary), (secondary), \
  1396.                         (default_action), account, who, conv, (user_data), 2, \
  1397.                         _("_Accept"), (accept_cb), _("_Cancel"), (cancel_cb))
  1398.  
  1399. /**
  1400.  * Displays a file selector request dialog.  Returns the selected filename to
  1401.  * the callback.  Can be used for either opening a file or saving a file.
  1402.  *
  1403.  * @param handle      The plugin or connection handle.  For some
  1404.  *                    things this is EXTREMELY important.  See
  1405.  *                    the comments on purple_request_input.
  1406.  * @param title       The title for the dialog (may be @c NULL)
  1407.  * @param filename    The default filename (may be @c NULL)
  1408.  * @param savedialog  True if this dialog is being used to save a file.
  1409.  *                    False if it is being used to open a file.
  1410.  * @param ok_cb       The callback for the @c OK button.
  1411.  * @param cancel_cb   The callback for the @c Cancel button.
  1412.  * @param account      The PurpleAccount associated with this request, or NULL if none is
  1413.  * @param who          The username of the buddy assocaited with this request, or NULL if none is
  1414.  * @param conv          The PurpleConversation associated with this request, or NULL if none is 
  1415.  * @param user_data   The data to pass to the callback.
  1416.  *
  1417.  * @return A UI-specific handle.
  1418.  */
  1419. void *purple_request_file(void *handle, const char *title, const char *filename,
  1420.                         gboolean savedialog,
  1421.                         GCallback ok_cb, GCallback cancel_cb,
  1422.                         PurpleAccount *account, const char *who, PurpleConversation *conv,
  1423.                         void *user_data);
  1424.  
  1425. /**
  1426.  * Displays a folder select dialog. Returns the selected filename to
  1427.  * the callback.
  1428.  *
  1429.  * @param handle      The plugin or connection handle.  For some
  1430.  *                    things this is EXTREMELY important.  See
  1431.  *                    the comments on purple_request_input.
  1432.  * @param title       The title for the dialog (may be @c NULL)
  1433.  * @param dirname     The default directory name (may be @c NULL)
  1434.  * @param ok_cb       The callback for the @c OK button.
  1435.  * @param cancel_cb   The callback for the @c Cancel button.
  1436.  * @param account      The PurpleAccount associated with this request, or NULL if none is
  1437.  * @param who          The username of the buddy assocaited with this request, or NULL if none is
  1438.  * @param conv          The PurpleConversation associated with this request, or NULL if none is 
  1439.  * @param user_data   The data to pass to the callback.
  1440.  *
  1441.  * @return A UI-specific handle.
  1442.  */
  1443. void *purple_request_folder(void *handle, const char *title, const char *dirname,
  1444.                         GCallback ok_cb, GCallback cancel_cb,
  1445.                         PurpleAccount *account, const char *who, PurpleConversation *conv,
  1446.                         void *user_data);
  1447.  
  1448. /*@}*/
  1449.  
  1450. /**************************************************************************/
  1451. /** @name UI Registration Functions                                       */
  1452. /**************************************************************************/
  1453. /*@{*/
  1454.  
  1455. /**
  1456.  * Sets the UI operations structure to be used when displaying a
  1457.  * request.
  1458.  *
  1459.  * @param ops The UI operations structure.
  1460.  */
  1461. void purple_request_set_ui_ops(PurpleRequestUiOps *ops);
  1462.  
  1463. /**
  1464.  * Returns the UI operations structure to be used when displaying a
  1465.  * request.
  1466.  *
  1467.  * @return The UI operations structure.
  1468.  */
  1469. PurpleRequestUiOps *purple_request_get_ui_ops(void);
  1470.  
  1471. /*@}*/
  1472.  
  1473. #ifdef __cplusplus
  1474. }
  1475. #endif
  1476.  
  1477. #endif /* _PURPLE_REQUEST_H_ */
  1478.