Extending test-client-custom-summary to try e_book_client_get_contacts_uids()
[platform/upstream/evolution-data-server.git] / camel / camel.c
index ce26323..49f2d60 100644 (file)
 
 #include <signal.h>
 
-#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
 #include <prthread.h>
 #include "nss.h"      /* Don't use <> here or it will include the system nss.h instead */
 #include <ssl.h>
 #include <errno.h>
-#endif /* CAMEL_HAVE_NSS */
 
 #include <glib/gi18n-lib.h>
 
@@ -43,7 +41,6 @@
 #include "camel-provider.h"
 #include "camel-win32.h"
 
-#ifdef CAMEL_HAVE_NSS
 /* To protect NSS initialization and shutdown. This prevents
  * concurrent calls to shutdown () and init () by different threads */
 PRLock *nss_initlock = NULL;
@@ -53,7 +50,6 @@ PRLock *nss_initlock = NULL;
  * library before. This boolean ensures that we only perform a cleanup
  * if and only if Camel is the one that previously initialized NSS */
 volatile gboolean nss_initialized = FALSE;
-#endif
 
 static gint initialised = FALSE;
 
@@ -69,13 +65,13 @@ nss_has_system_db (void)
        FILE *f;
        gchar buf[80];
 
-       f = fopen(NSS_SYSTEM_DB "/pkcs11.txt", "r");
+       f = fopen (NSS_SYSTEM_DB "/pkcs11.txt", "r");
        if (!f)
                return FALSE;
 
        /* Check whether the system NSS db is actually enabled */
        while (fgets (buf, 80, f) && !found) {
-               if (!strcmp(buf, "library=libnsssysinit.so\n"))
+               if (!strcmp (buf, "library=libnsssysinit.so\n"))
                        found = TRUE;
        }
        fclose (f);
@@ -98,7 +94,6 @@ camel_init (const gchar *configdir,
 
        camel_debug_init ();
 
-#ifdef CAMEL_HAVE_NSS
        if (nss_init) {
                gchar *nss_configdir = NULL;
                gchar *nss_sql_configdir = NULL;
@@ -132,15 +127,19 @@ camel_init (const gchar *configdir,
                         * to prevent camel from bailing out on first run. */
 #ifdef G_OS_WIN32
                        g_mkdir_with_parents (configdir, 0700);
-                       nss_sql_configdir = g_strconcat ("sql:", nss_configdir, NULL);
+                       nss_sql_configdir = g_strconcat (
+                               "sql:", nss_configdir, NULL);
 #else
-                       gchar *user_nss_dir = g_build_filename ( g_get_home_dir (),
-                                                                ".pki/nssdb", NULL );
+                       gchar *user_nss_dir = g_build_filename (
+                               g_get_home_dir (), ".pki/nssdb", NULL );
                        if (g_mkdir_with_parents (user_nss_dir, 0700))
-                               g_warning("Failed to create SQL database directory %s: %s\n",
-                                         user_nss_dir, strerror (errno));
+                               g_warning (
+                                       "Failed to create SQL "
+                                       "database directory %s: %s\n",
+                                       user_nss_dir, strerror (errno));
 
-                       nss_sql_configdir = g_strconcat ("sql:", user_nss_dir, NULL);
+                       nss_sql_configdir = g_strconcat (
+                               "sql:", user_nss_dir, NULL);
                        g_free (user_nss_dir);
 #endif
                }
@@ -160,8 +159,9 @@ camel_init (const gchar *configdir,
                        0);                     /* flags */
 
                if (status == SECFailure) {
-                       g_warning ("Failed to initialize NSS SQL database in %s: NSS error %d",
-                                  nss_sql_configdir, PORT_GetError ());
+                       g_warning (
+                               "Failed to initialize NSS SQL database in %s: NSS error %d",
+                               nss_sql_configdir, PORT_GetError ());
                        /* Fall back to opening the old DBM database */
                }
 #endif
@@ -201,7 +201,6 @@ skip_nss_init:
                g_free (nss_configdir);
                g_free (nss_sql_configdir);
        }
-#endif /* CAMEL_HAVE_NSS */
 
        path = g_strdup_printf ("%s/camel-cert.db", configdir);
        certdb = camel_certdb_new ();
@@ -242,14 +241,12 @@ camel_shutdown (void)
 
        /* These next calls must come last. */
 
-#if defined (CAMEL_HAVE_NSS)
        if (nss_initlock != NULL) {
                PR_Lock (nss_initlock);
                if (nss_initialized)
                        NSS_Shutdown ();
                PR_Unlock (nss_initlock);
        }
-#endif /* CAMEL_HAVE_NSS */
 
        initialised = FALSE;
 }