/dev/tomkiewicz/e2ee: ea64bce9423c: Merge with main

Tomasz Wasilczyk twasilczyk at pidgin.im
Sat Oct 5 04:04:40 EDT 2013


Changeset: ea64bce9423c5c8baa4196b84e7318e89578825a
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2013-10-05 10:04 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/e2ee/rev/ea64bce9423c

Description:

Merge with main

diffstat:

 configure.ac                               |  37 +++++++++++++++
 finch/gntmedia.c                           |   4 +-
 finch/gntnotify.c                          |  48 +++++++++++---------
 finch/plugins/gnttinyurl.c                 |   2 +-
 finch/plugins/lastlog.c                    |   2 +-
 libpurple/ft.c                             |   9 +--
 libpurple/ft.h                             |  13 ++---
 libpurple/glibcompat.h                     |  14 ++++++
 libpurple/media/backend-fs2.c              |  70 ++++++++++++++++++++++++++++-
 libpurple/plugins/keyrings/gnomekeyring.c  |   4 +-
 libpurple/plugins/perl/common/Cipher.xs    |  10 ++--
 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 +-
 pidgin/gtkimhtml.c                         |   2 +-
 pidgin/gtksourceiter.c                     |  18 ++++---
 26 files changed, 218 insertions(+), 96 deletions(-)

diffs (truncated from 844 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1490,6 +1490,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 #######################################################################
@@ -1986,6 +1999,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/ft.c b/libpurple/ft.c
--- a/libpurple/ft.c
+++ b/libpurple/ft.c
@@ -844,7 +844,7 @@ purple_xfer_get_progress(const PurpleXfe
 			(double)purple_xfer_get_size(xfer));
 }
 
-unsigned int
+guint16
 purple_xfer_get_local_port(const PurpleXfer *xfer)
 {
 	g_return_val_if_fail(xfer != NULL, -1);
@@ -860,7 +860,7 @@ purple_xfer_get_remote_ip(const PurpleXf
 	return xfer->remote_ip;
 }
 
-unsigned int
+guint16
 purple_xfer_get_remote_port(const PurpleXfer *xfer)
 {
 	g_return_val_if_fail(xfer != NULL, -1);
@@ -981,7 +981,7 @@ purple_xfer_set_size(PurpleXfer *xfer, g
 }
 
 void
-purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port)
+purple_xfer_set_local_port(PurpleXfer *xfer, guint16 local_port)
 {
 	g_return_if_fail(xfer != NULL);
 
@@ -1509,8 +1509,7 @@ purple_xfer_prpl_ready(PurpleXfer *xfer)
 }
 
 void
-purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip,
-				unsigned int port)
+purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, guint16 port)
 {
 	PurpleInputCondition cond;
 	PurpleXferType type;
diff --git a/libpurple/ft.h b/libpurple/ft.h
--- a/libpurple/ft.h
+++ b/libpurple/ft.h
@@ -145,8 +145,8 @@ struct _PurpleXfer
 	FILE *dest_fp;                /**< The destination file pointer.       */
 
 	char *remote_ip;              /**< The remote IP address.              */
-	int local_port;               /**< The local port.                     */
-	int remote_port;              /**< The remote port.                    */
+	guint16 local_port;           /**< The local port.                     */
+	guint16 remote_port;          /**< The remote port.                    */
 
 	int fd;                       /**< The socket file descriptor.         */
 	int watcher;                  /**< Watcher.                            */
@@ -394,7 +394,7 @@ double purple_xfer_get_progress(const Pu
  *
  * @return The port number on this end.
  */
-unsigned int purple_xfer_get_local_port(const PurpleXfer *xfer);
+guint16 purple_xfer_get_local_port(const PurpleXfer *xfer);
 
 /**
  * Returns the remote IP address in the file transfer.
@@ -412,7 +412,7 @@ const char *purple_xfer_get_remote_ip(co
  *
  * @return The port number on the other end.
  */
-unsigned int purple_xfer_get_remote_port(const PurpleXfer *xfer);
+guint16 purple_xfer_get_remote_port(const PurpleXfer *xfer);
 
 /**
  * Returns the time the transfer of a file started.
@@ -502,7 +502,7 @@ void purple_xfer_set_size(PurpleXfer *xf
  * @param xfer          The file transfer.
  * @param local_port    The local port.
  */
-void purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port);
+void purple_xfer_set_local_port(PurpleXfer *xfer, guint16 local_port);
 
 /**
  * Sets the current working position in the active file transfer.  This
@@ -668,8 +668,7 @@ purple_xfer_read_file(PurpleXfer *xfer, 
  * @param ip   The IP address to connect to.
  * @param port The port to connect to.
  */
-void purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip,
-					 unsigned int port);
+void purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, guint16 port);
 
 /**
  * Ends a file transfer.
diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h



More information about the Commits mailing list