changeset 19507:7086c311867a

merge of 'db94e3dde2f5edb422e7d7c1ec30474e2000997c' and 'f655557cb302f81ab02279d4c79a097d8028c5b7'
author William Ehlhardt <williamehlhardt@gmail.com>
date Tue, 28 Aug 2007 03:34:06 +0000
parents c3405700c2fe (current diff) f9b3ab516f22 (diff)
children f0c3497e2ea6
files libpurple/sslconn.c
diffstat 15 files changed, 106 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/.mtn-ignore	Tue Aug 28 03:31:38 2007 +0000
+++ b/.mtn-ignore	Tue Aug 28 03:34:06 2007 +0000
@@ -33,7 +33,7 @@
 pidgin-.*.tar.gz
 pidgin-.*.tar.bz2
 pidgin/pidgin$
-pidgin/pixmaps/emotes/default/22/theme
+pidgin/pixmaps/emotes/default/24/theme
 pidgin/pixmaps/emotes/none/theme
 pidgin/plugins/musicmessaging/music-messaging-bindings.c
 pidgin/plugins/perl/common/Makefile.PL$
--- a/Makefile.mingw	Tue Aug 28 03:31:38 2007 +0000
+++ b/Makefile.mingw	Tue Aug 28 03:34:06 2007 +0000
@@ -51,6 +51,7 @@
 	silc.dll \
 	silcclient.dll \
 	softokn3.dll \
+	smime3.dll \
 	ssl3.dll
 
 #build an expression for `find` to use to ignore the above files
--- a/libpurple/Makefile.mingw	Tue Aug 28 03:31:38 2007 +0000
+++ b/libpurple/Makefile.mingw	Tue Aug 28 03:34:06 2007 +0000
@@ -33,6 +33,7 @@
 			accountopt.c \
 			blist.c \
 			buddyicon.c \
+			certificate.c \
 			cipher.c \
 			cmds.c \
 			connection.c \
--- a/libpurple/certificate.c	Tue Aug 28 03:31:38 2007 +0000
+++ b/libpurple/certificate.c	Tue Aug 28 03:34:06 2007 +0000
@@ -28,9 +28,9 @@
 
 #include <glib.h>
 
+#include "internal.h"
 #include "certificate.h"
 #include "debug.h"
-#include "internal.h"
 #include "request.h"
 #include "signals.h"
 #include "util.h"
@@ -670,8 +670,13 @@
 
 	/* Attempt to point at the appropriate system path */
 	if (NULL == x509_ca_syspath) {
+#ifdef _WIN32
+		x509_ca_syspath = g_build_filename(DATADIR,
+						   "ca-certs", NULL);
+#else
 		x509_ca_syspath = g_build_filename(DATADIR,
 						   "purple", "ca-certs", NULL);
+#endif
 	}
 
 	/* Populate the certificates pool from the system path */
@@ -1771,7 +1776,7 @@
 	gchar *cn;
 	time_t activation, expiration;
 	/* Length of these buffers is dictated by 'man ctime_r' */
-	gchar activ_str[26], expir_str[26];
+	gchar *activ_str, *expir_str;
 	gchar *secondary;
 
 	/* Pull out the SHA1 checksum */
@@ -1788,27 +1793,29 @@
 	/* TODO: Check the times against localtime */
 	/* TODO: errorcheck? */
 	g_assert(purple_certificate_get_times(crt, &activation, &expiration));
-	ctime_r(&activation, activ_str);
-	ctime_r(&expiration, expir_str);
-	
+	activ_str = g_strdup(ctime(&activation));
+	expir_str = g_strdup(ctime(&expiration));
+
 	/* Make messages */
 	secondary = g_strdup_printf(_("Common name: %s\n\n"
 				      "Fingerprint (SHA1): %s\n\n"
 				      "Activation date: %s\n"
 				      "Expiration date: %s\n"),
 				    cn, sha_asc, activ_str, expir_str);
-	
+
 	/* Make a semi-pretty display */
 	purple_notify_info(
 		NULL,         /* TODO: Find what the handle ought to be */
 		_("Certificate Information"),
 		"",
 		secondary);
-		
+
 	/* Cleanup */
 	g_free(cn);
 	g_free(secondary);
 	g_free(sha_asc);
+	g_free(activ_str);
+	g_free(expir_str);
 	g_byte_array_free(sha_bin, TRUE);
 }
 
--- a/libpurple/plugins/ssl/Makefile.mingw	Tue Aug 28 03:31:38 2007 +0000
+++ b/libpurple/plugins/ssl/Makefile.mingw	Tue Aug 28 03:34:06 2007 +0000
@@ -18,6 +18,7 @@
 			$(NSS_TOP)/lib/nss3.dll \
 			$(NSS_TOP)/lib/nssckbi.dll \
 			$(NSS_TOP)/lib/softokn3.dll \
+			$(NSS_TOP)/lib/smime3.dll \
 			$(NSS_TOP)/lib/ssl3.dll \
 			$(NSPR_TOP)/lib/nspr4.dll \
 			$(NSPR_TOP)/lib/plc4.dll \
@@ -59,7 +60,8 @@
 			-lpurple \
 			-lnss3 \
 			-lnspr4 \
-			-lssl3
+			-lssl3 \
+			-lsmime3
 
 include $(PIDGIN_COMMON_RULES)
 
--- a/libpurple/sslconn.c	Tue Aug 28 03:31:38 2007 +0000
+++ b/libpurple/sslconn.c	Tue Aug 28 03:34:06 2007 +0000
@@ -297,9 +297,8 @@
 	/* Although purple_ssl_is_supported will do the initialization on
 	   command, SSL plugins tend to register CertificateSchemes as well
 	   as providing SSL ops. */
-	if ( !ssl_init() ) {
-		purple_debug_error("sslconn",
-				   "SSL subsystem failed to init!\n");
+	if (!ssl_init()) {
+		purple_debug_error("sslconn", "Unable to initialize SSL.\n");
 	}
 }
 
--- a/pidgin/Makefile.mingw	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/Makefile.mingw	Tue Aug 28 03:34:06 2007 +0000
@@ -56,10 +56,11 @@
 PIDGIN_C_SRC =	\
 			gtkaccount.c \
 			gtkblist.c \
+			gtkcertmgr.c \
+			gtkcellrendererexpander.c \
+			gtkcellrendererprogress.c \
 			gtkconn.c \
 			gtkconv.c \
-			gtkcellrendererexpander.c \
-			gtkcellrendererprogress.c \
 			gtkdebug.c \
 			gtkdialogs.c \
 			gtkdnd-hints.c \
--- a/pidgin/gtkaccount.c	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/gtkaccount.c	Tue Aug 28 03:34:06 2007 +0000
@@ -136,9 +136,6 @@
 	GtkWidget *proxy_user_entry;
 	GtkWidget *proxy_pass_entry;
 
-	/* Are we registering? */
-	gboolean   registering;
-
 } AccountPrefsDialog;
 
 typedef struct
@@ -1147,7 +1144,7 @@
 	account_win_destroy_cb(NULL, NULL, dialog);
 }
 
-static PurpleAccount*
+static void
 ok_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
 {
 	PurpleProxyInfo *proxy_info = NULL;
@@ -1155,22 +1152,58 @@
 	const char *value;
 	char *username;
 	char *tmp;
-	gboolean new = FALSE, icon_change = FALSE;
+	gboolean new_acct = FALSE, icon_change = FALSE;
 	PurpleAccount *account;
 	PurplePluginProtocolInfo *prpl_info;
 
+	/* Build the username string. */
+	username = g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry)));
+
+	if (dialog->prpl_info != NULL)
+	{
+		for (l = dialog->prpl_info->user_splits,
+			 l2 = dialog->user_split_entries;
+			 l != NULL && l2 != NULL;
+			 l = l->next, l2 = l2->next)
+		{
+			PurpleAccountUserSplit *split = l->data;
+			GtkEntry *entry = l2->data;
+			char sep[2] = " ";
+
+			value = gtk_entry_get_text(entry);
+
+			*sep = purple_account_user_split_get_separator(split);
+
+			tmp = g_strconcat(username, sep,
+					(*value ? value :
+					 purple_account_user_split_get_default_value(split)),
+					NULL);
+
+			g_free(username);
+			username = tmp;
+		}
+	}
+
 	if (dialog->account == NULL)
 	{
-		const char *screenname;
+		if (purple_accounts_find(username, dialog->protocol_id) != NULL) {
+			purple_debug_warning("gtkaccount", "Trying to add a duplicate %s account (%s).\n",
+				dialog->protocol_id, username);
+
+			purple_notify_error(NULL, NULL, _("Unable to save new account"),
+				_("An account already exists with the specified criteria."));
+
+			g_free(username);
+			return;
+		}
 
 		if (purple_accounts_get_all() == NULL) {
 			/* We're adding our first account.  Be polite and show the buddy list */
 			purple_blist_set_visible(TRUE);
 		}
 
-		screenname = gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry));
-		account = purple_account_new(screenname, dialog->protocol_id);
-		new = TRUE;
+		account = purple_account_new(username, dialog->protocol_id);
+		new_acct = TRUE;
 	}
 	else
 	{
@@ -1194,7 +1227,7 @@
 	{
 		const char *filename;
 
-		if (new || purple_account_get_bool(account, "use-global-buddyicon", TRUE) ==
+		if (new_acct || purple_account_get_bool(account, "use-global-buddyicon", TRUE) ==
 			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->icon_check)))
 		{
 			icon_change = TRUE;
@@ -1247,40 +1280,11 @@
 	 * the account editor (but has not checked the 'save' box), then we
 	 * don't want to prompt them.
 	 */
-	if ((purple_account_get_remember_password(account) || new) && (*value != '\0'))
+	if ((purple_account_get_remember_password(account) || new_acct) && (*value != '\0'))
 		purple_account_set_password(account, value);
 	else
 		purple_account_set_password(account, NULL);
 
-	/* Build the username string. */
-	username =
-		g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry)));
-
-	if (dialog->prpl_info != NULL)
-	{
-		for (l = dialog->prpl_info->user_splits,
-			 l2 = dialog->user_split_entries;
-			 l != NULL && l2 != NULL;
-			 l = l->next, l2 = l2->next)
-		{
-			PurpleAccountUserSplit *split = l->data;
-			GtkEntry *entry = l2->data;
-			char sep[2] = " ";
-
-			value = gtk_entry_get_text(entry);
-
-			*sep = purple_account_user_split_get_separator(split);
-
-			tmp = g_strconcat(username, sep,
-					(*value ? value :
-					 purple_account_user_split_get_default_value(split)),
-					NULL);
-
-			g_free(username);
-			username = tmp;
-		}
-	}
-
 	purple_account_set_username(account, username);
 	g_free(username);
 
@@ -1389,7 +1393,7 @@
 	}
 
 	/* If this is a new account, add it to our list */
-	if (new)
+	if (new_acct)
 		purple_accounts_add(account);
 	else
 		purple_signal_emit(pidgin_account_get_handle(), "account-modified", account);
@@ -1397,7 +1401,7 @@
 	/* If this is a new account, then sign on! */
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->register_button))) {
 		purple_account_register(account);
-	} else if (new) {
+	} else if (new_acct) {
 		const PurpleSavedStatus *saved_status;
 
 		saved_status = purple_savedstatus_get_current();
@@ -1410,7 +1414,6 @@
 	/* We no longer need the data from the dialog window */
 	account_win_destroy_cb(NULL, NULL, dialog);
 
-	return account;
 }
 
 static const GtkTargetEntry dnd_targets[] = {
--- a/pidgin/gtkcertmgr.c	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/gtkcertmgr.c	Tue Aug 28 03:34:06 2007 +0000
@@ -29,6 +29,7 @@
 #include "core.h"
 #include "internal.h"
 #include "pidgin.h"
+#include "pidginstock.h"
 
 #include "certificate.h"
 #include "debug.h"
@@ -506,7 +507,7 @@
 
 	/* Info button */
 	tpm_dat->infobutton = infobutton =
-		gtk_button_new_from_stock(GTK_STOCK_INFO);
+		gtk_button_new_from_stock(PIDGIN_STOCK_INFO);
 	gtk_box_pack_start(GTK_BOX(bbox), infobutton, FALSE, FALSE, 0);
 	gtk_widget_show(infobutton);
 	g_signal_connect(G_OBJECT(infobutton), "clicked",
--- a/pidgin/pidginstock.c	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/pidginstock.c	Tue Aug 28 03:34:06 2007 +0000
@@ -74,6 +74,11 @@
 	{ PIDGIN_STOCK_SIGN_OFF,        NULL,      GTK_STOCK_CLOSE            },
 	{ PIDGIN_STOCK_TYPED,           "pidgin",  "typed.png"                },
 	{ PIDGIN_STOCK_UPLOAD,          NULL,      GTK_STOCK_GO_UP            },
+#if GTK_CHECK_VERSION(2,8,0)
+	{ PIDGIN_STOCK_INFO,            NULL,      GTK_STOCK_INFO             },
+#else
+	{ PIDGIN_STOCK_INFO,            "buttons", "info.png"                 },
+#endif
 };
 
 static const GtkStockItem stock_items[] =
--- a/pidgin/pidginstock.h	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/pidginstock.h	Tue Aug 28 03:34:06 2007 +0000
@@ -45,6 +45,7 @@
 #define PIDGIN_STOCK_FILE_CANCELED   "pidgin-file-canceled"
 #define PIDGIN_STOCK_FILE_DONE       "pidgin-file-done"
 #define PIDGIN_STOCK_IGNORE          "pidgin-ignore"
+#define PIDGIN_STOCK_INFO            "pidgin-info"
 #define PIDGIN_STOCK_INVITE          "pidgin-invite"
 #define PIDGIN_STOCK_MODIFY          "pidgin-modify"
 #define PIDGIN_STOCK_OPEN_MAIL       "pidgin-stock-open-mail"
--- a/pidgin/pixmaps/Makefile.am	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/pixmaps/Makefile.am	Tue Aug 28 03:34:06 2007 +0000
@@ -2,6 +2,7 @@
 
 EXTRA_DIST = \
 		edit.png			\
+		info.png			\
 		logo.png			\
 		pause.png			\
 		arrow-down.xpm		\
@@ -12,7 +13,7 @@
 		pidgin.ico
 
 pidginbuttonpixdir = $(datadir)/pixmaps/pidgin/buttons
-pidginbuttonpix_DATA = edit.png pause.png 
+pidginbuttonpix_DATA = edit.png pause.png info.png
 
 pidgindistpixdir = $(datadir)/pixmaps/pidgin
 pidgindistpix_DATA = logo.png arrow-down.xpm arrow-left.xpm arrow-right.xpm arrow-up.xpm
Binary file pidgin/pixmaps/info.png has changed
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Tue Aug 28 03:31:38 2007 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Tue Aug 28 03:34:06 2007 +0000
@@ -692,6 +692,9 @@
     DeleteRegValue HKLM "${STARTUP_RUN_KEY}" "Pidgin"
     ; Remove Language preference info (TODO: check if NSIS removes this)
 
+    Delete "$INSTDIR\ca-certs\Equifax_Secure_CA.pem"
+    Delete "$INSTDIR\ca-certs\Verisign_RSA_Secure_Server_CA.pem"
+    RMDir "$INSTDIR\ca-certs"
     RMDir /r "$INSTDIR\locale"
     RMDir /r "$INSTDIR\pixmaps"
     RMDir /r "$INSTDIR\perlmod"
@@ -763,6 +766,7 @@
     Delete "$INSTDIR\plds4.dll"
     Delete "$INSTDIR\silc.dll"
     Delete "$INSTDIR\silcclient.dll"
+    Delete "$INSTDIR\smime3.dll"
     Delete "$INSTDIR\softokn3.dll"
     Delete "$INSTDIR\ssl3.dll"
     Delete "$INSTDIR\${PIDGIN_UNINST_EXE}"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/ca-certs/Makefile.mingw	Tue Aug 28 03:34:06 2007 +0000
@@ -0,0 +1,21 @@
+#
+# Makefile.mingw
+#
+# Description: Makefile for win32 (mingw) version of Pidgin ca-certs
+#
+
+PIDGIN_TREE_TOP := ../..
+include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
+
+datadir := $(PIDGIN_INSTALL_DIR)
+include ./Makefile.am
+cacertsdir := $(PIDGIN_INSTALL_DIR)/ca-certs
+
+.PHONY: install
+
+install:
+	if test '$(cacerts_DATA)'; then \
+	  mkdir -p $(cacertsdir); \
+	  cp $(cacerts_DATA) $(cacertsdir); \
+	fi;
+