# HG changeset patch # User Elliott Sales de Andrade # Date 1330231030 0 # Node ID ca8b2ec198d91f7ff26d0242c5aa6f616dee5557 # Parent 03dcb0185c822af8c93885827a4f101772e41616 Add a function for prompting about a certificate. This is basically a small wrapper around the request field API. diff -r 03dcb0185c82 -r ca8b2ec198d9 ChangeLog.API --- a/ChangeLog.API Sun Feb 26 03:54:26 2012 +0000 +++ b/ChangeLog.API Sun Feb 26 04:37:10 2012 +0000 @@ -34,6 +34,7 @@ * purple_menu_action_set_data * purple_menu_action_set_callback * purple_menu_action_set_children + * purple_request_certificate * purple_request_field_certificate_new * purple_request_field_certificate_get_value * purple_request_field_get_tooltip diff -r 03dcb0185c82 -r ca8b2ec198d9 libpurple/request.c --- a/libpurple/request.c Sun Feb 26 03:54:26 2012 +0000 +++ b/libpurple/request.c Sun Feb 26 04:37:10 2012 +0000 @@ -1666,6 +1666,29 @@ return NULL; } +void * +purple_request_certificate(void *handle, const char *title, + const char *primary, const char *secondary, + PurpleCertificate *cert, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + void *user_data) +{ + PurpleRequestFields *fields; + PurpleRequestFieldGroup *group; + PurpleRequestField *field; + + fields = purple_request_fields_new(); + group = purple_request_field_group_new(NULL); + purple_request_fields_add_group(fields, group); + field = purple_request_field_certificate_new("certificate", "Certificate", cert); + purple_request_field_group_add_field(group, field); + + return purple_request_fields(handle, title, primary, secondary, fields, + ok_text, ok_cb, cancel_text, cancel_cb, + NULL, NULL, NULL, user_data); +} + static void purple_request_close_info(PurpleRequestInfo *info) { diff -r 03dcb0185c82 -r ca8b2ec198d9 libpurple/request.h --- a/libpurple/request.h Sun Feb 26 03:54:26 2012 +0000 +++ b/libpurple/request.h Sun Feb 26 04:37:10 2012 +0000 @@ -1531,6 +1531,37 @@ PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data); +/** + * Prompts the user for action over a certificate. + * + * This is often represented as a dialog with a button for each action. + * + * @param handle The plugin or connection handle. For some things this + * is extremely important. See the comments on + * purple_request_input(). + * @param title The title of the message, or @c NULL if it should have + * no title. + * @param primary The main point of the message, or @c NULL if you're + * feeling enigmatic. + * @param secondary Secondary information, or @c NULL if there is none. + * @param cert The #PurpleCertificate associated with this request. + * @param ok_text The text for the @c OK button, which may not be @c NULL. + * @param ok_cb The callback for the @c OK button, which may not be + * @c NULL. + * @param cancel_text The text for the @c Cancel button, which may not be + * @c NULL. + * @param cancel_cb The callback for the @c Cancel button, which may be + * @c NULL. + * @param user_data The data to pass to the callback. + * + * @return A UI-specific handle. + */ +void *purple_request_certificate(void *handle, const char *title, + const char *primary, const char *secondary, PurpleCertificate *cert, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + void *user_data); + /*@}*/ /**************************************************************************/