changeset 19049:8cbc110456ac

- Add purple_certificate_pool_delete
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 27 Jul 2007 07:31:47 +0000
parents fd0b4b2f6cf0
children c563b8f84aa0
files libpurple/certificate.c libpurple/certificate.h
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Fri Jul 27 07:27:34 2007 +0000
+++ b/libpurple/certificate.c	Fri Jul 27 07:31:47 2007 +0000
@@ -345,6 +345,24 @@
 	return ret;
 }	
 
+gboolean
+purple_certificate_pool_delete(PurpleCertificatePool *pool, const gchar *id)
+{
+	gboolean ret = FALSE;
+	
+	g_return_val_if_fail(pool, FALSE);
+	g_return_val_if_fail(id, FALSE);
+	g_return_val_if_fail(pool->delete_cert, FALSE);
+
+	ret = (pool->delete_cert)(id);
+
+	/* Signal that the certificate was deleted */
+	purple_signal_emit(pool, "certificate-deleted",
+			   pool, id);
+
+	return ret;
+}
+
 GList *
 purple_certificate_pool_get_idlist(PurpleCertificatePool *pool)
 {
@@ -614,6 +632,7 @@
 	x509_tls_peers_cert_in_pool,  /* Certificate exists? */
 	x509_tls_peers_get_cert,      /* Cert retriever */
 	x509_tls_peers_put_cert,      /* Cert writer */
+	x509_tls_peers_delete_cert,   /* Cert remover */
 	x509_tls_peers_get_idlist     /* idlist retriever */
 };
 
--- a/libpurple/certificate.h	Fri Jul 27 07:27:34 2007 +0000
+++ b/libpurple/certificate.h	Fri Jul 27 07:31:47 2007 +0000
@@ -118,6 +118,8 @@
 	 *  @return TRUE if the operation succeeded, otherwise FALSE
 	 */
 	gboolean (* put_cert)(const gchar *id, PurpleCertificate *crt);
+	/** Delete a certificate from the pool */
+	gboolean (* delete_cert)(const gchar *id);
 
 	/** Returns a list of IDs stored in the pool */
 	GList * (* get_idlist)(void);
@@ -538,6 +540,16 @@
 purple_certificate_pool_store(PurpleCertificatePool *pool, const gchar *id, PurpleCertificate *crt);
 
 /**
+ * Remove a certificate from a pool
+ *
+ * @param pool   Pool to remove from
+ * @param id     ID to remove
+ * @return TRUE if the operation succeeded, otherwise FALSE
+ */
+gboolean
+purple_certificate_pool_delete(PurpleCertificatePool *pool, const gchar *id);
+
+/**
  * Get the list of IDs currently in the pool.
  *
  * @param pool   Pool to enumerate