pidgin: 1cb1b4ee: Only build SSL plugins if the correspond...

resiak at pidgin.im resiak at pidgin.im
Sat Oct 25 10:41:01 EDT 2008


-----------------------------------------------------------------
Revision: 1cb1b4ee3379b50280fbc97f2c889a43cd7c8c41
Ancestor: 271416527fc1a61b43119cd7f07e34abb90aead9
Author: resiak at pidgin.im
Date: 2008-10-25T14:33:54
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1cb1b4ee3379b50280fbc97f2c889a43cd7c8c41

Modified files:
        libpurple/plugins/ssl/Makefile.am
        libpurple/plugins/ssl/ssl-gnutls.c
        libpurple/plugins/ssl/ssl-nss.c

ChangeLog: 

Only build SSL plugins if the corresponding library is present.

Previously, stub versions of the plugins were built which refused to load if
the corresponding library was missing, which seems ... unconventional to me.

-------------- next part --------------
============================================================
--- libpurple/plugins/ssl/Makefile.am	a30ff6771787dcd1be55fbfdff83f7d5f05e739a
+++ libpurple/plugins/ssl/Makefile.am	4dc470b3e95ae11960e40bfda08d0f4567fc9c1f
@@ -9,10 +9,31 @@ if PLUGINS
 
 if PLUGINS
 
+# I'm sorry to report that Automake Conditionals don't support
+#   if USE_GNUTLS && USE_NSS
+# but only support testing a single variable. Hence:
+
+if USE_GNUTLS
+if USE_NSS
 plugin_LTLIBRARIES = \
 	ssl.la           \
 	ssl-gnutls.la    \
 	ssl-nss.la
+else
+plugin_LTLIBRARIES = \
+	ssl.la           \
+	ssl-gnutls.la
+endif
+else
+if USE_NSS
+plugin_LTLIBRARIES = \
+	ssl.la           \
+	ssl-nss.la
+else
+plugin_LTLIBRARIES = \
+	ssl.la
+endif
+endif
 
 ssl_la_SOURCES        = ssl.c
 ssl_gnutls_la_SOURCES = ssl-gnutls.c
============================================================
--- libpurple/plugins/ssl/ssl-gnutls.c	ad74b6e213dde98eb5052f85890f7b82931758d4
+++ libpurple/plugins/ssl/ssl-gnutls.c	37ec4c66c78f459d80e7cd1c154b05411de315c4
@@ -29,8 +29,6 @@
 
 #define SSL_GNUTLS_PLUGIN_ID "ssl-gnutls"
 
-#ifdef HAVE_GNUTLS
-
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
@@ -943,12 +941,9 @@ static PurpleSslOps ssl_ops =
 	NULL
 };
 
-#endif /* HAVE_GNUTLS */
-
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-#ifdef HAVE_GNUTLS
 	if(!purple_ssl_get_ops()) {
 		purple_ssl_set_ops(&ssl_ops);
 	}
@@ -960,21 +955,16 @@ plugin_load(PurplePlugin *plugin)
 	purple_certificate_register_scheme( &x509_gnutls );
 
 	return TRUE;
-#else
-	return FALSE;
-#endif
 }
 
 static gboolean
 plugin_unload(PurplePlugin *plugin)
 {
-#ifdef HAVE_GNUTLS
 	if(purple_ssl_get_ops() == &ssl_ops) {
 		purple_ssl_set_ops(NULL);
 	}
 
 	purple_certificate_unregister_scheme( &x509_gnutls );
-#endif
 
 	return TRUE;
 }
============================================================
--- libpurple/plugins/ssl/ssl-nss.c	d92a6fbada55afa6ca08d592ecb4c7b99858bc49
+++ libpurple/plugins/ssl/ssl-nss.c	39e19a3039e0ccb427bf19f29d4b25f1a86331d6
@@ -29,8 +29,6 @@
 
 #define SSL_NSS_PLUGIN_ID "ssl-nss"
 
-#ifdef HAVE_NSS
-
 #undef HAVE_LONG_LONG /* Make Mozilla less angry. If angry, Mozilla SMASH! */
 
 #include <nspr.h>
@@ -891,13 +889,10 @@ static PurpleSslOps ssl_ops =
 	NULL
 };
 
-#endif /* HAVE_NSS */
 
-
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-#ifdef HAVE_NSS
 	if (!purple_ssl_get_ops()) {
 		purple_ssl_set_ops(&ssl_ops);
 	}
@@ -909,22 +904,17 @@ plugin_load(PurplePlugin *plugin)
 	purple_certificate_register_scheme(&x509_nss);
 
 	return TRUE;
-#else
-	return FALSE;
-#endif
 }
 
 static gboolean
 plugin_unload(PurplePlugin *plugin)
 {
-#ifdef HAVE_NSS
 	if (purple_ssl_get_ops() == &ssl_ops) {
 		purple_ssl_set_ops(NULL);
 	}
 
 	/* Unregister our X.509 functions */
 	purple_certificate_unregister_scheme(&x509_nss);
-#endif
 
 	return TRUE;
 }


More information about the Commits mailing list