/cpw/tomkiewicz/gg11: e77345d3a628: Merge from trunk

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Mon Nov 5 20:30:17 EST 2012


Changeset: e77345d3a62836ca175e2b53a79a7900be1ae246
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-11-06 02:30 +0100
Branch:	 default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/e77345d3a628

Description:

Merge from trunk

diffstat:

 configure.ac                               |  127 ++++-
 finch/gntsound.c                           |    4 +
 libpurple/Makefile.am                      |    2 +
 libpurple/http.c                           |   67 +-
 libpurple/http.h                           |    6 +-
 libpurple/media/backend-fs2.c              |  116 +++-
 libpurple/mediamanager.c                   |   66 +-
 libpurple/protocols/jabber/Makefile.am     |    6 +-
 libpurple/protocols/jabber/jingle/jingle.c |   14 +-
 libpurple/tests/test_util.c                |    2 +-
 pidgin/gtkconv.c                           |   85 +-
 pidgin/gtkdebug.c                          |   15 +
 pidgin/gtkdialogs.c                        |    5 +-
 pidgin/gtkdocklet.c                        |   23 -
 pidgin/gtkmedia.c                          |    4 +-
 pidgin/gtkprefs.c                          |  728 +++++++++++++++++++++++++++++
 pidgin/gtksound.c                          |    4 +
 pidgin/gtkutils.c                          |    1 +
 pidgin/gtkwebview.c                        |    1 +
 pidgin/pidgin.h                            |    4 -
 pidgin/plugins/Makefile.am                 |    4 -
 21 files changed, 1089 insertions(+), 195 deletions(-)

diffs (truncated from 2022 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -848,32 +848,99 @@ dnl ####################################
 AC_ARG_ENABLE(gstreamer,
 	[AC_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
 	enable_gst="$enableval", enable_gst="yes")
+AC_ARG_WITH(gstreamer, [AC_HELP_STRING([--with-gstreamer=<version>],
+		[compile with GStreamer 0.10 or 1.0 interface (default: auto)])],
+	with_gstreamer="$withval", with_gstreamer="auto")
 if test "x$enable_gst" != "xno"; then
-	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
-		AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
-		AC_SUBST(GSTREAMER_CFLAGS)
-		AC_SUBST(GSTREAMER_LIBS)
-	], [
-		AC_MSG_RESULT(no)
-		enable_gst="no"
-		if test "x$force_deps" = "xyes" ; then
-			AC_MSG_ERROR([
+	if test "x$with_gstreamer" == "xauto"; then
+		PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [
+			AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
+			with_gstreamer="1.0"
+			AC_SUBST(GSTREAMER_CFLAGS)
+			AC_SUBST(GSTREAMER_LIBS)
+			dnl Check whether forking stuff is required for this version.
+		], [
+			PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
+				AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
+				with_gstreamer="0.10"
+				AC_SUBST(GSTREAMER_CFLAGS)
+				AC_SUBST(GSTREAMER_LIBS)
+			], [
+				AC_MSG_RESULT(no)
+				enable_gst="no"
+				if test "x$force_deps" = "xyes" ; then
+					AC_MSG_ERROR([
 GStreamer development headers not found.
 Use --disable-gstreamer if you do not need GStreamer (sound) support.
 ])
-		fi])
+				fi
+			])
+		])
+	elif test "x$with_gstreamer" == "x1.0"; then
+		PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0], [
+			AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer 1.0 for playing sounds])
+			AC_SUBST(GSTREAMER_CFLAGS)
+			AC_SUBST(GSTREAMER_LIBS)
+		], [
+			AC_MSG_RESULT(no)
+			enable_gst="no"
+			if test "x$force_deps" = "xyes" ; then
+				AC_MSG_ERROR([
+GStreamer development headers not found.
+Use --disable-gstreamer if you do not need GStreamer (sound) support.
+])
+			fi
+		])
+	elif test "x$with_gstreamer" == "x0.10"; then
+		PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
+			AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer 0.10 for playing sounds])
+			AC_SUBST(GSTREAMER_CFLAGS)
+			AC_SUBST(GSTREAMER_LIBS)
+		], [
+			AC_MSG_RESULT(no)
+			enable_gst="no"
+			if test "x$force_deps" = "xyes" ; then
+				AC_MSG_ERROR([
+GStreamer development headers not found.
+Use --disable-gstreamer if you do not need GStreamer (sound) support.
+])
+			fi
+		])
+	else
+		AC_MSG_ERROR([--with-gstreamer must specify one of 0.10, 1.0 or auto.])
+	fi
+fi
+
+dnl #######################################################################
+dnl # Check for GStreamer Video
+dnl #######################################################################
+if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x1.0"; then
+	AC_ARG_ENABLE(gstreamer-video,
+		[AC_HELP_STRING([--disable-gstreamer-video], [compile without GStreamer 1.0 Video Overlay support])],
+			enable_gstvideo="$enableval", enable_gstvideo="yes")
+	if test "x$enable_gstvideo" != "xno"; then
+		PKG_CHECK_MODULES(GSTVIDEO, [gstreamer-video-1.0], [
+			AC_DEFINE(USE_GSTVIDEO, 1, [Use GStreamer Video Overlay support])
+			AC_SUBST(GSTVIDEO_CFLAGS)
+			AC_SUBST(GSTVIDEO_LIBS)
+		], [
+			enable_gstvideo="no"
+		])
+	fi
+else
+	enable_gstvideo="no"
 fi
 
 dnl #######################################################################
 dnl # Check for GStreamer Interfaces
 dnl #######################################################################
-if test "x$enable_gst" != "xno"; then
+if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x0.10"; then
 	AC_ARG_ENABLE(gstreamer-interfaces,
-		[AC_HELP_STRING([--disable-gstreamer-interfaces], [compile without GStreamer interface support])],
+		[AC_HELP_STRING([--disable-gstreamer-interfaces], [compile without GStreamer 0.10 interface support])],
 			enable_gstinterfaces="$enableval", enable_gstinterfaces="yes")
 	if test "x$enable_gstinterfaces" != "xno"; then
 		PKG_CHECK_MODULES(GSTINTERFACES, [gstreamer-interfaces-0.10], [
-			AC_DEFINE(USE_GSTINTERFACES, 1, [Use GStreamer interfaces for X overlay support])
+			AC_DEFINE(USE_GSTINTERFACES, 1, [Use GStreamer 0.10 interfaces for X overlay support])
 			AC_SUBST(GSTINTERFACES_CFLAGS)
 			AC_SUBST(GSTINTERFACES_LIBS)
 		], [
@@ -891,20 +958,29 @@ AC_ARG_ENABLE(farstream,
 	[AC_HELP_STRING([--disable-farstream], [compile without farstream support])],
 	enable_farstream="$enableval", enable_farstream="yes")
 if test "x$enable_farstream" != "xno"; then
-	PKG_CHECK_MODULES(FARSTREAM, [farstream-0.1], [
-		AC_SUBST(FARSTREAM_CFLAGS)
-		AC_SUBST(FARSTREAM_LIBS)
- 	], [
-		# Try farsight.
-		PKG_CHECK_MODULES(FARSTREAM, [farsight2-0.10 >= 0.0.9], [
-		        AC_DEFINE(HAVE_FARSIGHT, 1, [Use Farsight instead of Farstream])
+	if test "x$with_gstreamer" == "x1.0"; then
+		PKG_CHECK_MODULES(FARSTREAM, [farstream-0.2], [
 			AC_SUBST(FARSTREAM_CFLAGS)
 			AC_SUBST(FARSTREAM_LIBS)
-		], [
+ 		], [
 		        enable_farstream="no"
 		])
- 	])
- fi
+	else
+		PKG_CHECK_MODULES(FARSTREAM, [farstream-0.1], [
+			AC_SUBST(FARSTREAM_CFLAGS)
+			AC_SUBST(FARSTREAM_LIBS)
+ 		], [
+			# Try farsight.
+			PKG_CHECK_MODULES(FARSTREAM, [farsight2-0.10 >= 0.0.9], [
+			        AC_DEFINE(HAVE_FARSIGHT, 1, [Use Farsight instead of Farstream])
+				AC_SUBST(FARSTREAM_CFLAGS)
+				AC_SUBST(FARSTREAM_LIBS)
+			], [
+			        enable_farstream="no"
+			])
+ 		])
+	fi
+fi
 
 dnl #######################################################################
 dnl # Check for Voice and Video support
@@ -913,7 +989,9 @@ AC_ARG_ENABLE(vv,
 	[AC_HELP_STRING([--disable-vv], [compile without voice and video support])],
 	enable_vv="$enableval", enable_vv="yes")
 if test "x$enable_vv" != "xno"; then
-	if test "x$enable_gst" != "xno" -a "x$enable_gstinterfaces" != "xno" -a "x$enable_farstream" != "xno"; then
+	if test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x1.0" -a "x$enable_gstvideo" != "xno" -a "x$enable_farstream" != "xno"; then
+		AC_DEFINE(USE_VV, 1, [Use voice and video])
+	elif test "x$enable_gst" != "xno" -a "x$with_gstreamer" == "x0.10" -a "x$enable_gstinterfaces" != "xno" -a "x$enable_farstream" != "xno"; then
 		AC_DEFINE(USE_VV, 1, [Use voice and video])
 	else
 		enable_vv="no"
@@ -2679,6 +2757,7 @@ echo Protocols to build dynamically : $D
 echo Protocols to link statically.. : $STATIC_PRPLS
 echo
 echo Build with GStreamer support.. : $enable_gst
+echo Build for GStreamer version... : $with_gstreamer
 echo Build with D-Bus support...... : $enable_dbus
 echo Build with voice and video.... : $enable_vv
 if test "x$enable_dbus" = "xyes" ; then
diff --git a/finch/gntsound.c b/finch/gntsound.c
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -553,7 +553,11 @@ finch_sound_play_file(const char *filena
 		return;
 	}
 
+#if GST_CHECK_VERSION(1,0,0)
+	play = gst_element_factory_make("playbin", "play");
+#else
 	play = gst_element_factory_make("playbin2", "play");
+#endif
 
 	if (play == NULL) {
 		return;
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -310,6 +310,7 @@ libpurple_la_LIBADD = \
 	$(INTLLIBS) \
 	$(FARSTREAM_LIBS) \
 	$(GSTREAMER_LIBS) \
+	$(GSTVIDEO_LIBS) \
 	$(GSTINTERFACES_LIBS) \
 	$(IDN_LIBS) \
 	ciphers/libpurple-ciphers.la \
@@ -326,6 +327,7 @@ AM_CPPFLAGS = \
 	$(LIBXML_CFLAGS) \
 	$(FARSTREAM_CFLAGS) \
 	$(GSTREAMER_CFLAGS) \
+	$(GSTVIDEO_CFLAGS) \
 	$(GSTINTERFACES_CFLAGS) \
 	$(IDN_CFLAGS) \
 	$(NETWORKMANAGER_CFLAGS)
diff --git a/libpurple/http.c b/libpurple/http.c
--- a/libpurple/http.c
+++ b/libpurple/http.c
@@ -66,6 +66,8 @@ struct _PurpleHttpRequest
 	int contents_length;
 	PurpleHttpContentReader contents_reader;
 	gpointer contents_reader_data;
+	PurpleHttpContentWriter response_writer;
+	gpointer response_writer_data;
 
 	int timeout;
 	int max_redirects;
@@ -524,17 +526,9 @@ static void _purple_http_gen_headers(Pur
 
 	proxy_username = purple_proxy_info_get_username(proxy);
 	if (proxy_http && proxy_username != NULL && proxy_username[0] != '\0') {
-		char hostname[256];
 		gchar *proxy_auth, *ntlm_type1, *tmp;
 		int len;
 
-		if (gethostname(hostname, sizeof(hostname)) < 0 ||
-			hostname[0] == '\0') {
-			purple_debug_warning("http", "gethostname() failed "
-				"- is your hostname set?");
-			strcpy(hostname, "localhost");
-		}
-
 		proxy_password = purple_proxy_info_get_password(proxy);
 		if (proxy_password == NULL)
 			proxy_password = "";
@@ -545,7 +539,7 @@ static void _purple_http_gen_headers(Pur
 		memset(tmp, 0, len);
 		g_free(tmp);
 
-		ntlm_type1 = purple_ntlm_gen_type1(hostname, "");
+		ntlm_type1 = purple_ntlm_gen_type1(purple_get_host_name(), "");
 
 		g_string_append_printf(h, "Proxy-Authorization: Basic %s\r\n",
 			proxy_auth);
@@ -658,23 +652,41 @@ static gboolean _purple_http_recv_header
 	return TRUE;
 }
 
-static void _purple_http_recv_body_data(PurpleHttpConnection *hc,
+static gboolean _purple_http_recv_body_data(PurpleHttpConnection *hc,
 	const gchar *buf, int len)
 {
+	int current_offset = hc->data_length_got;
+
 	if (hc->request->max_length >= 0) {
 		if (hc->data_length_got + len > hc->request->max_length) {
 			len = hc->request->max_length - hc->data_length_got;
 			hc->length_expected = hc->length_got;
 		}
-		hc->data_length_got += len;
 	}
+	hc->data_length_got += len;
+
+	if (len == 0)
+		return TRUE;
+
+	if (hc->request->response_writer != NULL) {
+		gboolean succ;
+		succ = hc->request->response_writer(hc, hc->response, buf,
+			current_offset, len, hc->request->response_writer_data);
+		if (!succ) {
+			purple_debug_error("http",
+				"Cannot write using callback\n");
+			_purple_http_error(hc,
+				_("Error handling retrieved data"));
+			return FALSE;
+		}
+	} else {
+		if (hc->response->contents == NULL)
+			hc->response->contents = g_string_new("");
+		g_string_append_len(hc->response->contents, buf, len);
+	}
 
 	purple_http_conn_notify_progress_watcher(hc);
-
-	if (len == 0)
-		return;
-
-	g_string_append_len(hc->response->contents, buf, len);
+	return TRUE;
 }
 
 static gboolean _purple_http_recv_body_chunked(PurpleHttpConnection *hc,
@@ -703,8 +715,9 @@ static gboolean _purple_http_recv_body_c
 				got_now = hc->chunk_length - hc->chunk_got;
 			hc->chunk_got += got_now;



More information about the Commits mailing list