changeset 22430:d83adbf0c92c

merge of '372b94fab52b770bd853506200652575d0588539' and 'e4b22781fe6c2a7cd1133ee36a308ede967be25e'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 06 Mar 2008 15:55:39 +0000
parents b0b8c94118c8 (current diff) eab5bc54e163 (diff)
children 85193a3dca5e b7be2d6f96a3
files
diffstat 6 files changed, 87 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Thu Mar 06 15:54:30 2008 +0000
+++ b/configure.ac	Thu Mar 06 15:55:39 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/libpurple/protocols/oscar/oscar.c	Thu Mar 06 15:54:30 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Mar 06 15:55:39 2008 +0000
@@ -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/yahoo/yahoo.c	Thu Mar 06 15:54:30 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Thu Mar 06 15:55:39 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	Thu Mar 06 15:54:30 2008 +0000
+++ b/libpurple/proxy.c	Thu Mar 06 15:55:39 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/gtkmain.c	Thu Mar 06 15:54:30 2008 +0000
+++ b/pidgin/gtkmain.c	Thu Mar 06 15:55:39 2008 +0000
@@ -99,7 +99,6 @@
 	SIGTERM,
 	SIGQUIT,
 	SIGCHLD,
-	SIGALRM,
 	-1
 };
 
@@ -140,38 +139,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)
@@ -188,9 +160,6 @@
 		snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
 		perror(errmsg);
 	}
-
-	/* Restore signal catching */
-	signal(SIGALRM, sighandler);
 }
 
 char *segfault_message;
@@ -220,12 +189,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	Thu Mar 06 15:54:30 2008 +0000
+++ b/pidgin/gtksound.c	Thu Mar 06 15:55:39 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."),