diff libpurple/certificate.c @ 19024:264f00bc8f22

- Change certificate_uninit to unregister all Pools, Schemes, and Verifiers
author William Ehlhardt <williamehlhardt@gmail.com>
date Sat, 14 Jul 2007 04:49:30 +0000
parents eb86ff3ba21a
children b3acaf46d9ad
line wrap: on
line diff
--- a/libpurple/certificate.c	Sat Jul 14 02:54:48 2007 +0000
+++ b/libpurple/certificate.c	Sat Jul 14 04:49:30 2007 +0000
@@ -712,12 +712,31 @@
 void
 purple_certificate_uninit(void)
 {
-	/* Unregister the builtins */
-	purple_certificate_unregister_verifier(&x509_singleuse);
-	purple_certificate_unregister_pool(&x509_tls_peers);
-	purple_certificate_unregister_verifier(&x509_tls_cached);
-	
-	/* TODO: Unregistering everything would be good... */
+	GList *full_list, *l;
+
+	/* Unregister all Schemes */
+	full_list = g_list_copy(cert_schemes); /* Make a working copy */
+	for (l = full_list; l; l = l->next) {
+		purple_certificate_unregister_scheme(
+			(PurpleCertificateScheme *) l->data );
+	}
+	g_list_free(full_list);
+
+	/* Unregister all Verifiers */
+	full_list = g_list_copy(cert_verifiers); /* Make a working copy */
+	for (l = full_list; l; l = l->next) {
+		purple_certificate_unregister_verifier(
+			(PurpleCertificateVerifier *) l->data );
+	}
+	g_list_free(full_list);
+
+	/* Unregister all Pools */
+	full_list = g_list_copy(cert_pools); /* Make a working copy */
+	for (l = full_list; l; l = l->next) {
+		purple_certificate_unregister_pool(
+			(PurpleCertificatePool *) l->data );
+	}
+	g_list_free(full_list);
 }
 
 gpointer