/soc/2013/ankitkv/gobjectification: 85144a4a7942: Merged default...

Ankit Vani a at nevitus.org
Sun Oct 6 08:45:37 EDT 2013


Changeset: 85144a4a7942b13211c5392ebcb449b5151b6a3b
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-06 18:13 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/85144a4a7942

Description:

Merged default branch

diffstat:

 configure.ac                               |  37 +++++++++++++++
 finch/gntmedia.c                           |   4 +-
 finch/gntnotify.c                          |  48 +++++++++++---------
 finch/plugins/gnttinyurl.c                 |   2 +-
 finch/plugins/lastlog.c                    |   2 +-
 libpurple/glibcompat.h                     |  14 ++++++
 libpurple/media/backend-fs2.c              |  70 ++++++++++++++++++++++++++++-
 libpurple/plugins/keyrings/gnomekeyring.c  |   4 +-
 libpurple/plugins/perl/common/Cipher.xs    |   8 +-
 libpurple/plugins/perl/perl-common.h       |   6 ++
 libpurple/plugins/ssl/ssl-gnutls.c         |   4 +-
 libpurple/protocols/gg/Makefile.am         |   2 +-
 libpurple/protocols/jabber/jabber.h        |   2 +-
 libpurple/protocols/jabber/si.c            |   6 +-
 libpurple/protocols/msn/msnutils.c         |   2 +-
 libpurple/protocols/mxit/chunk.c           |   2 +-
 libpurple/protocols/myspace/myspace.c      |   3 +-
 libpurple/protocols/oscar/family_feedbag.c |   4 +-
 libpurple/protocols/oscar/oscar.c          |  14 +++---
 libpurple/protocols/oscar/tlv.c            |  10 ++--
 libpurple/protocols/oscar/userinfo.c       |  20 ++++----
 libpurple/util.c                           |   6 +-
 libpurple/xfer.c                           |  13 ++---
 libpurple/xfer.h                           |   9 +--
 pidgin/gtkimhtml.c                         |   2 +-
 pidgin/gtksourceiter.c                     |  18 ++++---
 26 files changed, 217 insertions(+), 95 deletions(-)

diffs (truncated from 835 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1493,6 +1493,19 @@ AC_SUBST(CFLAGS)
 
 AC_PATH_PROG(pidginpath, pidgin)
 
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
+	#if !defined(__clang__)
+	#error
+	#endif
+])], have_clang=yes, have_clang=no)
+
+if test "x$have_clang" = "xyes"; then
+	GLIB_LIBS=`echo $GLIB_LIBS | $sedpath 's/-pthread/-lpthread/'`
+
+	dnl Enable address sanitizer.
+	CFLAGS="$CFLAGS -faddress-sanitizer -g -fno-omit-frame-pointer -fno-inline -fno-optimize-sibling-calls"
+fi
+
 dnl #######################################################################
 dnl # Check for D-Bus libraries
 dnl #######################################################################
@@ -1989,6 +2002,30 @@ Use --disable-perl if you do not need Pe
 ])
 fi
 
+if test "$enable_perl" = yes ; then
+	AC_CACHE_CHECK(for new SvUPGRADE in perl API, ac_cv_perl_have_new_svupgrade, [
+		orig_CFLAGS="$CFLAGS"
+		CFLAGS="$CFLAGS $PERL_CFLAGS"
+		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+			#include <EXTERN.h>
+			#include <perl.h>
+		]], [[
+			PerlInterpreter *my_perl;
+			SV *sv;
+			if (!SvUPGRADE(sv, SVt_PV)) {
+				/* SvUPGRADE is an expression, so it doesn't
+				 * terminate in case of failure */
+			}
+		]])],
+			[ac_cv_perl_have_new_svupgrade=no],
+			[ac_cv_perl_have_new_svupgrade=yes])
+		CFLAGS="$orig_CFLAGS"
+		])
+	if test $ac_cv_perl_have_new_svupgrade = yes; then
+		AC_DEFINE(HAVE_NEW_SVUPGRADE, 1, [Define if you have SvUPGRADE terminating in case of failure.])
+	fi
+fi
+
 dnl #######################################################################
 dnl # SSL support
 dnl #
diff --git a/finch/gntmedia.c b/finch/gntmedia.c
--- a/finch/gntmedia.c
+++ b/finch/gntmedia.c
@@ -408,9 +408,9 @@ call_cmd_cb(PurpleConversation *conv, co
 	if (!purple_prpl_initiate_media(account,
 			purple_conversation_get_name(conv),
 			PURPLE_MEDIA_AUDIO))
-		return PURPLE_CMD_STATUS_FAILED;
+		return PURPLE_CMD_RET_FAILED;
 
-	return PURPLE_CMD_STATUS_OK;
+	return PURPLE_CMD_RET_OK;
 }
 
 static GstElement *
diff --git a/finch/gntnotify.c b/finch/gntnotify.c
--- a/finch/gntnotify.c
+++ b/finch/gntnotify.c
@@ -47,20 +47,20 @@ static struct
 } emaildialog;
 
 static void
-notify_msg_window_destroy_cb(GntWidget *window, PurpleNotifyMsgType type)
+notify_msg_window_destroy_cb(GntWidget *window, PurpleNotifyType type)
 {
 	purple_notify_close(type, window);
 }
 
 static void *
-finch_notify_message(PurpleNotifyMsgType type, const char *title,
-	const char *primary, const char *secondary,
+finch_notify_common(PurpleNotifyType ntype, PurpleNotifyMsgType msgtype,
+	const char *title, const char *primary, const char *secondary,
 	PurpleRequestCommonParameters *cpar)
 {
 	GntWidget *window, *button;
 	GntTextFormatFlags pf = 0, sf = 0;
 
-	switch (type)
+	switch (msgtype)
 	{
 		case PURPLE_NOTIFY_MSG_ERROR:
 			sf |= GNT_TEXT_FLAG_BOLD;
@@ -85,24 +85,16 @@ finch_notify_message(PurpleNotifyMsgType
 
 	if (secondary) {
 		GntWidget *msg;
-		/* XXX: This is broken.  type is PurpleNotifyMsgType, not
-		 * PurpleNotifyType.  Also, the if() followed by the
-		 * inner switch doesn't make much sense.
-		 */
-		if ((int)type == (int)PURPLE_NOTIFY_FORMATTED) {
+		if (ntype == PURPLE_NOTIFY_FORMATTED) {
 			int width = -1, height = -1;
 			char *plain = (char*)secondary;
 			msg = gnt_text_view_new();
 			gnt_text_view_set_flag(GNT_TEXT_VIEW(msg), GNT_TEXT_VIEW_TOP_ALIGN | GNT_TEXT_VIEW_NO_SCROLL);
-			switch ((int)type) {
-				case (int)PURPLE_NOTIFY_FORMATTED:
-					plain = purple_markup_strip_html(secondary);
-					if (gnt_util_parse_xhtml_to_textview(secondary, GNT_TEXT_VIEW(msg)))
-						break;
-					/* Fallthrough */
-				default:
-					gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(msg), plain, sf);
-			}
+
+			plain = purple_markup_strip_html(secondary);
+			if (!gnt_util_parse_xhtml_to_textview(secondary, GNT_TEXT_VIEW(msg)))
+				gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(msg), plain, sf);
+
 			gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(msg), button);
 			gnt_util_get_text_bound(plain, &width, &height);
 			gnt_widget_set_size(msg, width + 3, height + 1);
@@ -119,7 +111,7 @@ finch_notify_message(PurpleNotifyMsgType
 	g_signal_connect_swapped(G_OBJECT(button), "activate",
 			G_CALLBACK(gnt_widget_destroy), window);
 	g_signal_connect(G_OBJECT(window), "destroy",
-			G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type));
+			G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(ntype));
 
 	gnt_widget_show(window);
 	return window;
@@ -146,6 +138,15 @@ static void finch_close_notify(PurpleNot
 	gnt_widget_destroy(widget);
 }
 
+static void *
+finch_notify_message(PurpleNotifyMsgType type, const char *title,
+	const char *primary, const char *secondary,
+	PurpleRequestCommonParameters *cpar)
+{
+	return finch_notify_common(PURPLE_NOTIFY_MESSAGE, type, title, primary,
+		secondary, cpar);
+}
+
 static void *finch_notify_formatted(const char *title, const char *primary,
 		const char *secondary, const char *text)
 {
@@ -157,7 +158,8 @@ static void *finch_notify_formatted(cons
 	void *ret;
 
 	purple_markup_html_to_xhtml(t, &xhtml, NULL);
-	ret = finch_notify_message(PURPLE_NOTIFY_FORMATTED, title, primary, xhtml, NULL);
+	ret = finch_notify_common(PURPLE_NOTIFY_FORMATTED,
+		PURPLE_NOTIFY_MSG_INFO, title, primary, xhtml, NULL);
 
 	g_free(t);
 	g_free(xhtml);
@@ -250,7 +252,8 @@ finch_notify_emails(PurpleConnection *gc
 		return NULL;
 	}
 
-	ret = finch_notify_message(PURPLE_NOTIFY_EMAIL, _("New Mail"), _("You have mail!"), message->str, NULL);
+	ret = finch_notify_common(PURPLE_NOTIFY_EMAIL, PURPLE_NOTIFY_MSG_INFO,
+		_("New Mail"), _("You have mail!"), message->str, NULL);
 	g_string_free(message, TRUE);
 	return ret;
 }
@@ -504,7 +507,8 @@ finch_notify_searchresults(PurpleConnect
 static void *
 finch_notify_uri(const char *url)
 {
-	return finch_notify_message(PURPLE_NOTIFY_URI, _("URI"), url, NULL, NULL);
+	return finch_notify_common(PURPLE_NOTIFY_URI, PURPLE_NOTIFY_MSG_INFO,
+		_("URI"), url, NULL, NULL);
 }
 
 static PurpleNotifyUiOps ops =
diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c
--- a/finch/plugins/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl.c
@@ -384,7 +384,7 @@ tinyurl_notify_uri(const char *uri)
 	/* XXX: The following expects that finch_notify_message gets called. This
 	 * may not always happen, e.g. when another plugin sets its own
 	 * notify_message. So tread carefully. */
-	win = purple_notify_message(NULL, PURPLE_NOTIFY_URI, _("URI"), uri,
+	win = purple_notify_message(NULL, PURPLE_NOTIFY_MSG_INFO, _("URI"), uri,
 			_("Please wait while TinyURL fetches a shorter URL ..."), NULL, NULL, NULL);
 	if (!GNT_IS_WINDOW(win) || !g_object_get_data(G_OBJECT(win), "info-widget"))
 		return win;
diff --git a/finch/plugins/lastlog.c b/finch/plugins/lastlog.c
--- a/finch/plugins/lastlog.c
+++ b/finch/plugins/lastlog.c
@@ -88,7 +88,7 @@ lastlog_cb(PurpleConversation *conv, con
 
 	g_signal_connect(G_OBJECT(win), "key_pressed", G_CALLBACK(window_kpress_cb), tv);
 	g_strfreev(strings);
-	return PURPLE_CMD_STATUS_OK;
+	return PURPLE_CMD_RET_OK;
 }
 
 static gboolean
diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -25,6 +25,20 @@
  * Also, any public API should not depend on this file.
  */
 
+#ifdef __clang__
+
+#undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+	_Pragma ("clang diagnostic push") \
+	_Pragma ("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+
+#undef G_GNUC_END_IGNORE_DEPRECATIONS
+#define G_GNUC_END_IGNORE_DEPRECATIONS \
+	_Pragma ("clang diagnostic pop")
+
+#endif /* __clang__ */
+
+
 #if !GLIB_CHECK_VERSION(2, 32, 0)
 
 #define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -181,6 +181,66 @@ static void
 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
 {}
 
+static FsCandidateType
+purple_media_candidate_type_to_fs(PurpleMediaCandidateType type)
+{
+	switch (type) {
+		case PURPLE_MEDIA_CANDIDATE_TYPE_HOST:
+			return FS_CANDIDATE_TYPE_HOST;
+		case PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX:
+			return FS_CANDIDATE_TYPE_SRFLX;
+		case PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX:
+			return FS_CANDIDATE_TYPE_PRFLX;
+		case PURPLE_MEDIA_CANDIDATE_TYPE_RELAY:
+			return FS_CANDIDATE_TYPE_RELAY;
+		case PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST:
+			return FS_CANDIDATE_TYPE_MULTICAST;
+	}
+	g_return_val_if_reached(FS_CANDIDATE_TYPE_HOST);
+}
+
+static PurpleMediaCandidateType
+purple_media_candidate_type_from_fs(FsCandidateType type)
+{
+	switch (type) {
+		case FS_CANDIDATE_TYPE_HOST:
+			return PURPLE_MEDIA_CANDIDATE_TYPE_HOST;
+		case FS_CANDIDATE_TYPE_SRFLX:
+			return PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX;
+		case FS_CANDIDATE_TYPE_PRFLX:
+			return PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX;
+		case FS_CANDIDATE_TYPE_RELAY:
+			return PURPLE_MEDIA_CANDIDATE_TYPE_RELAY;
+		case FS_CANDIDATE_TYPE_MULTICAST:
+			return PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST;
+	}
+	g_return_val_if_reached(PURPLE_MEDIA_CANDIDATE_TYPE_HOST);
+}
+
+static FsNetworkProtocol
+purple_media_network_protocol_to_fs(PurpleMediaNetworkProtocol protocol)
+{
+	switch (protocol) {
+		case PURPLE_MEDIA_NETWORK_PROTOCOL_UDP:
+			return FS_NETWORK_PROTOCOL_UDP;
+		case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP:
+			return FS_NETWORK_PROTOCOL_TCP;
+	}
+	g_return_val_if_reached(FS_NETWORK_PROTOCOL_TCP);
+}
+
+static PurpleMediaNetworkProtocol
+purple_media_network_protocol_from_fs(FsNetworkProtocol protocol)
+{
+	switch (protocol) {
+		case FS_NETWORK_PROTOCOL_UDP:
+			return PURPLE_MEDIA_NETWORK_PROTOCOL_UDP;
+		case FS_NETWORK_PROTOCOL_TCP:
+			return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP;
+	}
+	g_return_val_if_reached(PURPLE_MEDIA_NETWORK_PROTOCOL_TCP);
+}
+
 #if GST_CHECK_VERSION(1,0,0)
 static GstPadProbeReturn



More information about the Commits mailing list