changeset 32553:c3eaa2a6aa42

Add PurpleCertificate request field API.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 26 Feb 2012 03:38:28 +0000
parents 298080cecdc5
children 03dcb0185c82
files ChangeLog.API libpurple/request.c libpurple/request.h
diffstat 3 files changed, 64 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun Feb 26 03:01:41 2012 +0000
+++ b/ChangeLog.API	Sun Feb 26 03:38:28 2012 +0000
@@ -34,6 +34,8 @@
 		* purple_menu_action_set_data
 		* purple_menu_action_set_callback
 		* purple_menu_action_set_children
+		* purple_request_field_certificate_new
+		* purple_request_field_certificate_get_value
 		* purple_request_field_get_tooltip
 		* purple_request_field_group_get_fields_list
 		* purple_request_field_set_tooltip
--- a/libpurple/request.c	Sun Feb 26 03:01:41 2012 +0000
+++ b/libpurple/request.c	Sun Feb 26 03:38:28 2012 +0000
@@ -119,6 +119,11 @@
 			gsize size;
 		} image;
 
+		struct
+		{
+			PurpleCertificate *cert;
+		} certificate;
+
 	} u;
 
 	void *ui_data;
@@ -1329,6 +1334,31 @@
 	return field->u.account.filter_func;
 }
 
+PurpleRequestField *
+purple_request_field_certificate_new(const char *id, const char *text, PurpleCertificate *cert)
+{
+	PurpleRequestField *field;
+
+	g_return_val_if_fail(id   != NULL, NULL);
+	g_return_val_if_fail(text != NULL, NULL);
+	g_return_val_if_fail(cert != NULL, NULL);
+
+	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_CERTIFICATE);
+
+	field->u.certificate.cert = cert;
+
+	return field;
+}
+
+PurpleCertificate *
+purple_request_field_certificate_get_value(const PurpleRequestField *field)
+{
+	g_return_val_if_fail(field != NULL, NULL);
+	g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CERTIFICATE, NULL);
+
+	return field->u.certificate.cert;
+}
+
 /* -- */
 
 void *
--- a/libpurple/request.h	Sun Feb 26 03:01:41 2012 +0000
+++ b/libpurple/request.h	Sun Feb 26 03:38:28 2012 +0000
@@ -76,7 +76,8 @@
 	PURPLE_REQUEST_FIELD_LIST,
 	PURPLE_REQUEST_FIELD_LABEL,
 	PURPLE_REQUEST_FIELD_IMAGE,
-	PURPLE_REQUEST_FIELD_ACCOUNT
+	PURPLE_REQUEST_FIELD_ACCOUNT,
+	PURPLE_REQUEST_FIELD_CERTIFICATE
 
 } PurpleRequestFieldType;
 
@@ -1170,6 +1171,36 @@
 /*@}*/
 
 /**************************************************************************/
+/** @name Certificate Field API                                           */
+/**************************************************************************/
+/*@{*/
+
+/**
+ * Creates a certificate field.
+ *
+ * @param id   The field ID.
+ * @param text The label of the field.
+ * @param cert The certificate of the field.
+ *
+ * @return The new field.
+ */
+PurpleRequestField *purple_request_field_certificate_new(const char *id,
+														 const char *text,
+														 PurpleCertificate *cert);
+
+/**
+ * Returns the certificate in a certificate field.
+ *
+ * @param field The field.
+ *
+ * @return The certificate.
+ */
+PurpleCertificate *purple_request_field_certificate_get_value(
+		const PurpleRequestField *field);
+
+/*@}*/
+
+/**************************************************************************/
 /** @name Request API                                                     */
 /**************************************************************************/
 /*@{*/