changeset 24297:b0f0f830f15f

merge of '1cb1b4ee3379b50280fbc97f2c889a43cd7c8c41' and '83046a7036aafc5be7f10950286bb2112398789d'
author Richard Laager <rlaager@wiktel.com>
date Sat, 25 Oct 2008 18:09:05 +0000
parents e39cafdbe089 (diff) aa31602fdc37 (current diff)
children a4fe2bf0da94
files
diffstat 11 files changed, 129 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Tue Oct 21 05:26:38 2008 +0000
+++ b/configure.ac	Sat Oct 25 18:09:05 2008 +0000
@@ -74,7 +74,7 @@
 
 AC_CANONICAL_SYSTEM
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE([dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 -Wno-portability dist-bzip2])
 
 PURPLE_MAJOR_VERSION=purple_major_version
 PURPLE_MINOR_VERSION=purple_minor_version
--- a/finch/gntblist.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/finch/gntblist.c	Sat Oct 25 18:09:05 2008 +0000
@@ -1288,6 +1288,17 @@
 }
 
 static void
+toggle_show_offline(GntMenuItem *item, gpointer buddy)
+{
+	purple_blist_node_set_bool(buddy, "show_offline",
+			!purple_blist_node_get_bool(buddy, "show_offline"));
+	if (!ggblist->manager->can_add_node(buddy))
+		node_remove(purple_get_blist(), buddy);
+	else
+		node_update(purple_get_blist(), buddy);
+}
+
+static void
 create_buddy_menu(GntMenu *menu, PurpleBuddy *buddy)
 {
 	PurpleAccount *account;
@@ -1322,10 +1333,10 @@
 	gnt_menuitem_set_callback(item, toggle_block_buddy, buddy);
 	gnt_menu_add_item(menu, item);
 
-#if 0
-	add_custom_action(tree, _("View Log"),
-			PURPLE_CALLBACK(finch_blist_view_log_cb)), buddy);
-#endif
+	item = gnt_menuitem_check_new(_("Show when offline"));
+	gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"));
+	gnt_menuitem_set_callback(item, toggle_show_offline, buddy);
+	gnt_menu_add_item(menu, item);
 
 	/* Protocol actions */
 	append_proto_menu(menu,
--- a/libpurple/circbuffer.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/libpurple/circbuffer.c	Sat Oct 25 18:09:05 2008 +0000
@@ -109,13 +109,12 @@
 	else
 		len_stored = len;
 
-	memcpy(buf->inptr, src, len_stored);
+	if (len_stored > 0)
+		memcpy(buf->inptr, src, len_stored);
 
 	if (len_stored < len) {
 		memcpy(buf->buffer, (char*)src + len_stored, len - len_stored);
 		buf->inptr = buf->buffer + (len - len_stored);
-	} else if ((buf->buffer - buf->inptr) == len_stored) {
-		buf->inptr = buf->buffer;
 	} else {
 		buf->inptr += len_stored;
 	}
--- a/libpurple/plugins/ssl/Makefile.am	Tue Oct 21 05:26:38 2008 +0000
+++ b/libpurple/plugins/ssl/Makefile.am	Sat Oct 25 18:09:05 2008 +0000
@@ -9,10 +9,31 @@
 
 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
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Sat Oct 25 18:09:05 2008 +0000
@@ -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 @@
 	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 @@
 	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;
 }
--- a/libpurple/plugins/ssl/ssl-nss.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Sat Oct 25 18:09:05 2008 +0000
@@ -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 @@
 	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 @@
 	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;
 }
--- a/libpurple/proxy.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/libpurple/proxy.c	Sat Oct 25 18:09:05 2008 +0000
@@ -2152,6 +2152,8 @@
 			break;
 
 		default:
+			purple_debug_error("proxy", "Invalid Proxy type (%d) specified.\n",
+							   purple_proxy_info_get_type(connect_data->gpi));
 			purple_proxy_connect_data_destroy(connect_data);
 			return NULL;
 	}
@@ -2160,6 +2162,7 @@
 			connectport, connection_host_resolved, connect_data);
 	if (connect_data->query_data == NULL)
 	{
+		purple_debug_error("proxy", "dns query failed unexpectedly.\n");
 		purple_proxy_connect_data_destroy(connect_data);
 		return NULL;
 	}
--- a/libpurple/util.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/libpurple/util.c	Sat Oct 25 18:09:05 2008 +0000
@@ -3979,6 +3979,13 @@
 					     callback, user_data);
 }
 
+static gboolean
+url_fetch_connect_failed(gpointer data)
+{
+	url_fetch_connect_cb(data, -1, "");
+	return FALSE;
+}
+
 PurpleUtilFetchUrlData *
 purple_util_fetch_url_request_len(const char *url, gboolean full,
 		const char *user_agent, gboolean http11,
@@ -4016,9 +4023,8 @@
 
 	if (gfud->connect_data == NULL)
 	{
-		purple_util_fetch_url_error(gfud, _("Unable to connect to %s"),
-				gfud->website.address);
-		return NULL;
+		/* Trigger the connect_cb asynchronously. */
+		purple_timeout_add(10, url_fetch_connect_failed, gfud);
 	}
 
 	return gfud;
--- a/pidgin/gtkimhtml.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/pidgin/gtkimhtml.c	Sat Oct 25 18:09:05 2008 +0000
@@ -348,9 +348,7 @@
 			g_string_free (t->values, TRUE);
 			g_free (t->children);
 		}
-		if (t && t->image) {
-			t->image->imhtml = NULL;
-		}
+		
 		g_free (t);
 	}
 }
@@ -2522,6 +2520,78 @@
 	}
 }
 
+/* CSS colors are either rgb (x,y,z) or #hex
+ * we need to convert to hex if it is RGB */
+static gchar*
+parse_css_color(gchar *in_color)
+{
+	char *tmp = in_color;
+
+	if (*tmp == 'r' && *(++tmp) == 'g' && *(++tmp) == 'b' && *(++tmp)) {
+		int rgbval[] = {0, 0, 0};
+		int count = 0;
+		const char *v_start;
+
+		while (*tmp && g_ascii_isspace(*tmp))
+			tmp++;
+		if (*tmp != '(') {
+			/* We don't support rgba() */
+			purple_debug_warning("gtkimhtml", "Invalid rgb CSS color in '%s'!\n", in_color);
+			return in_color;
+		}
+		tmp++;
+
+		while (count < 3) {
+			/* Skip any leading spaces */
+			while (*tmp && g_ascii_isspace(*tmp))
+				tmp++;
+
+			/* Find the subsequent contiguous digits */
+			v_start = tmp;
+			if (*v_start == '-')
+				tmp++;
+			while (*tmp && g_ascii_isdigit(*tmp))
+				tmp++;
+
+			if (tmp != v_start) {
+				char prev = *tmp;
+				*tmp = '\0';
+				rgbval[count] = atoi(v_start);
+				*tmp = prev;
+
+				/* deal with % */
+				while (*tmp && g_ascii_isspace(*tmp))
+					tmp++;
+				if (*tmp == '%') {
+					rgbval[count] = (rgbval[count] / 100.0) * 255;
+					tmp++;
+				}
+			} else {
+				purple_debug_warning("gtkimhtml", "Invalid rgb CSS color in '%s'!\n", in_color);
+				return in_color;
+			}
+
+			if (rgbval[count] > 255) {
+				rgbval[count] = 255;
+			} else if (rgbval[count] < 0) {
+				rgbval[count] = 0;
+			}
+
+			while (*tmp && g_ascii_isspace(*tmp))
+				tmp++;
+			if (*tmp == ',')
+				tmp++;
+
+			count++;
+		}
+		
+		g_free(in_color);
+		return g_strdup_printf("#%02X%02X%02X", rgbval[0], rgbval[1], rgbval[2]);
+	}
+
+	return in_color;
+}
+
 void gtk_imhtml_insert_html_at_iter(GtkIMHtml        *imhtml,
                                     const gchar      *text,
                                     GtkIMHtmlOptions  options,
@@ -2982,7 +3052,7 @@
 							oldfont = fonts->data;
 
 						if (color && !(options & GTK_IMHTML_NO_COLOURS) && (imhtml->format_functions & GTK_IMHTML_FORECOLOR)) {
-							font->fore = color;
+							font->fore = parse_css_color(color);
 							gtk_imhtml_toggle_forecolor(imhtml, font->fore);
 						} else {
 							if (oldfont && oldfont->fore)
@@ -2991,7 +3061,7 @@
 						}
 
 						if (background && !(options & GTK_IMHTML_NO_COLOURS) && (imhtml->format_functions & GTK_IMHTML_BACKCOLOR)) {
-							font->back = background;
+							font->back = parse_css_color(background);
 							gtk_imhtml_toggle_backcolor(imhtml, font->back);
 						} else {
 							if (oldfont && oldfont->back)
--- a/pidgin/gtkstatusbox.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/pidgin/gtkstatusbox.c	Sat Oct 25 18:09:05 2008 +0000
@@ -397,7 +397,8 @@
 	status_box->icon_box = gtk_event_box_new();
 	gtk_widget_set_parent(status_box->icon_box, GTK_WIDGET(status_box));
 	gtk_widget_show(status_box->icon_box);
-#if 0
+
+#if GTK_CHECK_VERSION(2,12,0)
 	gtk_widget_set_tooltip_text(status_box->icon_box,
 			status_box->account ? _("Click to change your buddyicon for this account.") :
 				_("Click to change your buddyicon for all accounts."));
--- a/pidgin/plugins/notify.c	Tue Oct 21 05:26:38 2008 +0000
+++ b/pidgin/plugins/notify.c	Sat Oct 25 18:09:05 2008 +0000
@@ -766,8 +766,7 @@
 	/* Urgent method button */
 	toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint"));
 #else
-	/* TODO: When we're not string frozen, mark for translation */
-	toggle = gtk_check_button_new_with_mnemonic("_Flash window");
+	toggle = gtk_check_button_new_with_mnemonic(_("_Flash window"));
 #endif
 	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),