changeset 22885:e04a69cf1d8e

propagate from branch 'im.pidgin.pidgin' (head 6ff3e48f37ce327ca03e8d3394cac62e40b6fe05) to branch 'im.pidgin.pidgin.custom_smiley' (head 50551dcda7246e564389e053651a71209c09e94c)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 07 Mar 2008 21:32:09 +0000
parents fdda2b8a4146 (current diff) d0675c9e0eaa (diff)
children 0ae4d67bd6b1
files pidgin/gtkconv.c pidgin/gtkmain.c
diffstat 14 files changed, 125 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 05 17:18:09 2008 +0000
+++ b/ChangeLog	Fri Mar 07 21:32:09 2008 +0000
@@ -1,5 +1,11 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
+version 2.4.1 ():
+	libpurple
+	* Treat AIM Unicode messages as UTF-16 rather than UCS-2; this
+	  should have no functional effect, other than continued support
+	  on systems which have dropped UCS-2 conversions.
+
 version 2.4.0 (02/29/2008):
 	libpurple:
 	* Added support for offline messages for AIM accounts (thanks to
--- a/configure.ac	Wed Mar 05 17:18:09 2008 +0000
+++ b/configure.ac	Fri Mar 07 21:32:09 2008 +0000
@@ -662,7 +662,7 @@
 	[AC_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
 	enable_gst="$enableval", enable_gst="yes")
 if test "x$enable_gst" != "xno"; then
-	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
+	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10 >= 0.10.10], [
 		AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
 		AC_SUBST(GSTREAMER_CFLAGS)
 		AC_SUBST(GSTREAMER_LIBS)
--- a/finch/gntblist.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/finch/gntblist.c	Fri Mar 07 21:32:09 2008 +0000
@@ -2610,11 +2610,13 @@
 {
 	PurpleAccount *account;
 	const char *username;
+	PurpleConversation *conv;
 
 	account  = purple_request_fields_get_account(fields, "account");
 	username = purple_request_fields_get_string(fields,  "screenname");
 
-	purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
+	conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username);
+	purple_conversation_present(conv);
 }
 
 static void
--- a/finch/gntconv.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/finch/gntconv.c	Fri Mar 07 21:32:09 2008 +0000
@@ -660,8 +660,10 @@
 	PurpleAccount *account;
 	PurpleBlistNode *convnode = NULL;
 
-	if (ggc)
+	if (ggc) {
+		gnt_window_present(ggc->window);
 		return;
+	}
 
 	account = purple_conversation_get_account(conv);
 	cc = find_conv_with_contact(account, purple_conversation_get_name(conv));
--- a/finch/gntsound.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/finch/gntsound.c	Fri Mar 07 21:32:09 2008 +0000
@@ -358,6 +358,11 @@
 	
 #ifdef USE_GSTREAMER
 	purple_debug_info("sound", "Initializing sound output drivers.\n");
+#if (GST_VERSION_MAJOR > 0 || \
+	(GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \
+	 (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 10))
+	gst_registry_fork_set_enabled(FALSE);
+#endif
 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
 		purple_notify_error(NULL, _("GStreamer Failure"),
 					_("GStreamer failed to initialize."),
--- a/finch/libgnt/gntentry.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/finch/libgnt/gntentry.c	Fri Mar 07 21:32:09 2008 +0000
@@ -419,7 +419,7 @@
 }
 
 static gboolean
-history_prev(GntBindable *bind, GList *null)
+history_next(GntBindable *bind, GList *null)
 {
 	GntEntry *entry = GNT_ENTRY(bind);
 	if (entry->histlength && entry->history->prev)
@@ -436,7 +436,7 @@
 }
 
 static gboolean
-history_next(GntBindable *bind, GList *null)
+history_prev(GntBindable *bind, GList *null)
 {
 	GntEntry *entry = GNT_ENTRY(bind);
 	if (entry->histlength && entry->history->next)
@@ -904,10 +904,12 @@
 				GNT_KEY_DOWN, NULL);
 	gnt_bindable_class_register_action(bindable, "suggest-prev", suggest_prev,
 				GNT_KEY_UP, NULL);
-	gnt_bindable_class_register_action(bindable, "history-prev", history_prev,
+	gnt_bindable_class_register_action(bindable, "history-next", history_next,
 				GNT_KEY_CTRL_DOWN, NULL);
-	gnt_bindable_class_register_action(bindable, "history-next", history_next,
+	gnt_bindable_class_register_action(bindable, "history-prev", history_prev,
 				GNT_KEY_CTRL_UP, NULL);
+	gnt_bindable_register_binding(bindable, "history-prev", GNT_KEY_CTRL_P, NULL);
+	gnt_bindable_register_binding(bindable, "history-next", GNT_KEY_CTRL_N, NULL);
 	gnt_bindable_class_register_action(bindable, "clipboard-paste", clipboard_paste,
 				GNT_KEY_CTRL_V, NULL);
 
--- a/libpurple/protocols/oscar/family_locate.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Fri Mar 07 21:32:09 2008 +0000
@@ -1031,7 +1031,7 @@
  * restricted to a few choices.  I am currently aware of:
  *
  * us-ascii		Just that
- * unicode-2-0		UCS2-BE
+ * unicode-2-0		UTF-16BE
  *
  * profile_len and awaymsg_len MUST be set similarly, and they MUST
  * be the length of their respective strings in bytes.
--- a/libpurple/protocols/oscar/oscar.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Fri Mar 07 21:32:09 2008 +0000
@@ -245,7 +245,7 @@
 	}
 
 	/*
-	 * Must we send this message as UNICODE (in the UCS-2BE encoding)?
+	 * Must we send this message as UNICODE (in the UTF-16BE encoding)?
 	 */
 	while (utf8[i])
 	{
@@ -314,14 +314,14 @@
 	} else if (!g_ascii_strcasecmp(encoding, "unicode-2-0")) {
 		/* Some official ICQ clients are apparently total crack,
 		 * and have been known to save a UTF-8 string converted
-		 * from the locale character set to UCS-2 (not from UTF-8
-		 * to UCS-2!) in the away message.  This hack should find
+		 * from the locale character set to UTF-16 (not from UTF-8
+		 * to UTF-16!) in the away message.  This hack should find
 		 * and do something (un)reasonable with that, and not
 		 * mess up too much else. */
 		const gchar *charset = purple_account_get_string(account, "encoding", NULL);
 		if (charset) {
 			gsize len;
-			utf8 = g_convert(text, textlen, charset, "UCS-2BE", &len, NULL, NULL);
+			utf8 = g_convert(text, textlen, charset, "UTF-16BE", &len, NULL, NULL);
 			if (!utf8 || len != textlen || !g_utf8_validate(utf8, -1, NULL)) {
 				g_free(utf8);
 				utf8 = NULL;
@@ -330,7 +330,7 @@
 			}
 		}
 		if (!utf8)
-			utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL);
+			utf8 = g_convert(text, textlen, "UTF-8", "UTF-16BE", NULL, NULL, NULL);
 	} else if (g_ascii_strcasecmp(encoding, "utf-8")) {
 		purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", "
 						   "attempting to convert to UTF-8 anyway\n", encoding);
@@ -423,7 +423,7 @@
 		return NULL;
 
 	if (charset == AIM_CHARSET_UNICODE) {
-		charsetstr1 = "UCS-2BE";
+		charsetstr1 = "UTF-16BE";
 		charsetstr2 = "UTF-8";
 	} else if (charset == AIM_CHARSET_CUSTOM) {
 		if ((sourcesn != NULL) && aim_snvalid_icq(sourcesn))
@@ -495,7 +495,7 @@
 	 * If we're sending to an ICQ user, and they are in our
 	 * buddy list, and they are advertising the Unicode
 	 * capability, and they are online, then attempt to send
-	 * as UCS-2BE.
+	 * as UTF-16BE.
 	 */
 	if ((destsn != NULL) && aim_snvalid_icq(destsn))
 		userinfo = aim_locate_finduserinfo(od, destsn);
@@ -506,7 +506,7 @@
 		b = purple_find_buddy(account, destsn);
 		if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b)))
 		{
-			*msg = g_convert(from, -1, "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
+			*msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, NULL);
 			if (*msg != NULL)
 			{
 				*charset = AIM_CHARSET_UNICODE;
@@ -538,9 +538,9 @@
 	}
 
 	/*
-	 * Nothing else worked, so send as UCS-2BE.
+	 * Nothing else worked, so send as UTF-16BE.
 	 */
-	*msg = g_convert(from, -1, "UCS-2BE", "UTF-8", NULL, &msglen, &err);
+	*msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, &err);
 	if (*msg != NULL) {
 		*charset = AIM_CHARSET_UNICODE;
 		*charsubset = 0x0000;
@@ -4436,7 +4436,7 @@
 
 	charset = oscar_charset_check(str);
 	if (charset == AIM_CHARSET_UNICODE) {
-		encoded = g_convert(str, -1, "UCS-2BE", "UTF-8", NULL, ret_len, NULL);
+		encoded = g_convert(str, -1, "UTF-16BE", "UTF-8", NULL, ret_len, NULL);
 		*encoding = "unicode-2-0";
 	} else if (charset == AIM_CHARSET_CUSTOM) {
 		encoded = g_convert(str, -1, "ISO-8859-1", "UTF-8", NULL, ret_len, NULL);
@@ -4980,11 +4980,18 @@
 		switch (curitem->type) {
 			case 0x0000: { /* Buddy */
 				if (curitem->name) {
-					struct aim_ssi_item *groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000);
-					char *gname = groupitem ? groupitem->name : NULL;
-					char *gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL;
-					char *alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name);
-					char *alias_utf8;
+					struct aim_ssi_item *groupitem;
+					char *gname, *gname_utf8, *alias, *alias_utf8;
+
+					groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000);
+					gname = groupitem ? groupitem->name : NULL;
+					if (gname != NULL) {
+						if (g_utf8_validate(gname, -1, NULL))
+							gname_utf8 = g_strdup(gname);
+						else
+							gname_utf8 = oscar_utf8_try_convert(gc->account, gname);
+					} else
+						gname_utf8 = NULL;
 
 					g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans"));
 					if (g == NULL) {
@@ -4992,15 +4999,14 @@
 						purple_blist_add_group(g, NULL);
 					}
 
-					if (alias != NULL)
-					{
+					alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name);
+					if (alias != NULL) {
 						if (g_utf8_validate(alias, -1, NULL))
 							alias_utf8 = g_strdup(alias);
 						else
 							alias_utf8 = oscar_utf8_try_convert(account, alias);
 						g_free(alias);
-					}
-					else
+					} else
 						alias_utf8 = NULL;
 
 					b = purple_find_buddy_in_group(gc->account, curitem->name, g);
@@ -5039,8 +5045,18 @@
 			} break;
 
 			case 0x0001: { /* Group */
-				char *gname = curitem->name;
-				char *gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL;
+				char *gname;
+				char *gname_utf8;
+
+				gname = curitem->name;
+				if (gname != NULL) {
+					if (g_utf8_validate(gname, -1, NULL))
+						gname_utf8 = g_strdup(gname);
+					else
+						gname_utf8 = oscar_utf8_try_convert(gc->account, gname);
+				} else
+					gname_utf8 = NULL;
+
 				if (gname_utf8 != NULL && purple_find_group(gname_utf8) == NULL) {
 					g = purple_group_new(gname_utf8);
 					purple_blist_add_group(g, NULL);
--- a/libpurple/protocols/oscar/oscar.h	Wed Mar 05 17:18:09 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Fri Mar 07 21:32:09 2008 +0000
@@ -754,7 +754,7 @@
 #define AIM_IMFLAGS_TYPINGNOT			0x1000 /* typing notification */
 
 #define AIM_CHARSET_ASCII		0x0000
-#define AIM_CHARSET_UNICODE	0x0002 /* UCS-2BE */
+#define AIM_CHARSET_UNICODE	0x0002 /* UTF-16BE */
 #define AIM_CHARSET_CUSTOM	0x0003
 
 /*
--- a/libpurple/protocols/yahoo/yahoo.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Mar 07 21:32:09 2008 +0000
@@ -2035,9 +2035,9 @@
 	PurpleBuddy *b;
 	GSList *l;
 	gchar *who = NULL;
-	gchar *sn = NULL;
+	gchar *me = NULL;
 	gchar buf[BUF_LONG];
-	gint ignore = 0;
+	gboolean ignore = TRUE;
 	gint status = 0;
 
 	for (l = pkt->hash; l; l = l->next) {
@@ -2047,10 +2047,11 @@
 			who = pair->value;
 			break;
 		case 1:
-			sn = pair->value;
+			me = pair->value;
 			break;
 		case 13:
-			ignore = strtol(pair->value, NULL, 10);
+			/* 1 == ignore, 2 == unignore */
+			ignore = (strtol(pair->value, NULL, 10) == 1);
 			break;
 		case 66:
 			status = strtol(pair->value, NULL, 10);
@@ -2060,23 +2061,40 @@
 		}
 	}
 
+	/*
+	 * status
+	 * 0  - ok
+	 * 2  - already in ignore list, could not add
+	 * 3  - not in ignore list, could not delete
+	 * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?)
+	 */
 	switch (status) {
-	case 12:
-		b = purple_find_buddy(gc->account, who);
-		g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
-					"user is on your buddy list.  Clicking \"Yes\" "
-					"will remove and ignore the buddy."), who);
-		purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
-						gc->account, who, NULL,
-						b,
-						G_CALLBACK(ignore_buddy),
-						G_CALLBACK(keep_buddy));
-		break;
-	case 2:
-	case 3:
-	case 0:
-	default:
-		break;
+		case 12:
+			purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s",
+							  who, (ignore ? "ignoring" : "unignoring"));
+
+			if (ignore) {
+				b = purple_find_buddy(gc->account, who);
+				g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
+											   "user is on your buddy list.  Clicking \"Yes\" "
+											   "will remove and ignore the buddy."), who);
+				purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
+									  gc->account, who, NULL,
+									  b,
+									  G_CALLBACK(ignore_buddy),
+									  G_CALLBACK(keep_buddy));
+				break;
+			}
+		case 2:
+			purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.",
+							  who);
+			break;
+		case 3:
+			purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete",
+							  who);
+		case 0:
+		default:
+			break;
 	}
 }
 
--- a/libpurple/proxy.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/libpurple/proxy.c	Fri Mar 07 21:32:09 2008 +0000
@@ -241,6 +241,20 @@
 	/* If we get this far then we know we're using an HTTP proxy */
 	info.type = PURPLE_PROXY_HTTP;
 
+	/* Free the old fields */
+	if (info.host) {
+		g_free(info.host);
+		info.host = NULL;
+	}
+	if (info.username) {
+		g_free(info.username);
+		info.username = NULL;
+	}
+	if (info.password) {
+		g_free(info.password);
+		info.password = NULL;
+	}
+
 	if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host",
 			&info.host, NULL, NULL, NULL))
 		return purple_global_proxy_get_info();
--- a/pidgin/gtkconv.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/pidgin/gtkconv.c	Fri Mar 07 21:32:09 2008 +0000
@@ -4738,6 +4738,8 @@
 
 	g_signal_connect_swapped(G_OBJECT(gtkconv->entry_buffer), "changed",
 				 G_CALLBACK(resize_imhtml_cb), gtkconv);
+	g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "realize",
+				 G_CALLBACK(resize_imhtml_cb), gtkconv);
 
 	default_formatize(gtkconv);
 	g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear",
@@ -5014,7 +5016,6 @@
 		gtk_widget_show(gtkconv->toolbar);
 	else
 		gtk_widget_hide(gtkconv->toolbar);
-	g_idle_add((GSourceFunc)resize_imhtml_cb, gtkconv);
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons"))
 		gtk_widget_show(gtkconv->infopane_hbox);
--- a/pidgin/gtkmain.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/pidgin/gtkmain.c	Fri Mar 07 21:32:09 2008 +0000
@@ -100,7 +100,6 @@
 	SIGTERM,
 	SIGQUIT,
 	SIGCHLD,
-	SIGALRM,
 	-1
 };
 
@@ -141,38 +140,11 @@
 #ifdef HAVE_SIGNAL_H
 static void sighandler(int sig);
 
-/**
- * Reap all our dead children.  Sometimes libpurple forks off a separate
- * process to do some stuff.  When that process exits we are
- * informed about it so that we can call waitpid() and let it
- * stop being a zombie.
- *
- * We used to do this immediately when our signal handler was
- * called, but because of GStreamer we now wait one second before
- * reaping anything.  Why?  For some reason GStreamer fork()s
- * during their initialization process.  I don't understand why...
- * but they do it, and there's nothing we can do about it.
- *
- * Anyway, so then GStreamer waits for its child to die and then
- * it continues with the initialization process.  This means that
- * we have a race condition where GStreamer is waitpid()ing for its
- * child to die and we're catching the SIGCHLD signal.  If GStreamer
- * is awarded the zombied process then everything is ok.  But if libpurple
- * reaps the zombie process then the GStreamer initialization sequence
- * fails.
- *
- * So the ugly solution is to wait a second to give GStreamer time to
- * reap that bad boy.
- *
- * GStreamer 0.10.10 and newer have a gst_register_fork_set_enabled()
- * function that can be called by applications to disable forking
- * during initialization.  But it's not in 0.10.0, so we shouldn't
- * use it.
- *
- * All of this child process reaping stuff is currently only used for
- * processes that were forked to play sounds.  It's not needed for
- * forked DNS child, which have their own waitpid() call.  It might
- * be wise to move this code into gtksound.c.
+/*
+ * This child process reaping stuff is currently only used for processes that
+ * were forked to play sounds.  It's not needed for forked DNS child, which
+ * have their own waitpid() call.  It might be wise to move this code into
+ * gtksound.c.
  */
 static void
 clean_pid(void)
@@ -189,9 +161,6 @@
 		snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
 		perror(errmsg);
 	}
-
-	/* Restore signal catching */
-	signal(SIGALRM, sighandler);
 }
 
 char *segfault_message;
@@ -221,12 +190,8 @@
 		abort();
 		break;
 	case SIGCHLD:
-		/* Restore signal catching */
-		signal(SIGCHLD, sighandler);
-		alarm(1);
-		break;
-	case SIGALRM:
 		clean_pid();
+		signal(SIGCHLD, sighandler);    /* restore signal catching on this one! */
 		break;
 	default:
 		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
--- a/pidgin/gtksound.c	Wed Mar 05 17:18:09 2008 +0000
+++ b/pidgin/gtksound.c	Fri Mar 07 21:32:09 2008 +0000
@@ -302,6 +302,7 @@
 
 #ifdef USE_GSTREAMER
 	purple_debug_info("sound", "Initializing sound output drivers.\n");
+	gst_registry_fork_set_enabled (FALSE);
 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
 		purple_notify_error(NULL, _("GStreamer Failure"),
 					_("GStreamer failed to initialize."),