/soc/2012/michael/android: cdb701c2c7f7: Merged changes from main.

Michael Zangl michael at soc.pidgin.im
Sat Jul 7 03:34:19 EDT 2012


Changeset: cdb701c2c7f7aba3bc8f1436b4a72052ad06c3e8
Author:	 Michael Zangl <michael at soc.pidgin.im>
Date:	 2012-06-24 10:31 +0200
Branch:	 soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/cdb701c2c7f7

Description:

Merged changes from main.

diffstat:

 ChangeLog                                 |    31 +-
 ChangeLog.API                             |     6 +
 libpurple/protocols/irc/irc.c             |    29 +-
 libpurple/protocols/irc/irc.h             |     3 +-
 libpurple/protocols/irc/msgs.c            |    79 +-
 libpurple/protocols/jabber/jabber.c       |    30 +-
 libpurple/protocols/jabber/usermood.c     |    65 +-
 libpurple/protocols/jabber/usermood.h     |    17 +-
 libpurple/protocols/msn/contact.c         |     7 +-
 libpurple/protocols/msn/msg.c             |    48 +-
 libpurple/proxy.c                         |    24 +-
 libpurple/stun.c                          |     2 +
 pidgin/gtkblist.c                         |    20 +-
 pidgin/gtkblist.h                         |     2 -
 pidgin/gtkconv.c                          |     2 +-
 pidgin/gtkdialogs.c                       |     1 +
 pidgin/gtklog.c                           |     8 +
 pidgin/themes/Contents/Resources/main.css |     7 +-
 pidgin/themes/Template.html               |    20 +-
 po/ChangeLog                              |     6 +
 po/de.po                                  |  1414 +++++++++++++---------------
 po/pl.po                                  |     7 +-
 22 files changed, 933 insertions(+), 895 deletions(-)

diffs (truncated from 2866 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,7 @@
 	  to the core (and UIs) as incoming messages (Thijs Alkemade).
 	  (#14529)
 	* Support file transfers up to ~9 EiB.
+	* Invalid user moods can no longer be sent to the server.
 
 	Plugins:
 	* The Voice/Video Settings plugin supports using the sndio GStreamer
@@ -46,8 +47,34 @@
 	* The Offline Message Emulation plugin now adds a note that the message
 	  was an offline message. (Flavius Anton) (#2497)
 
-version 2.10.4:
-	TODO
+version 2.10.5:
+	No changes
+
+version 2.10.4 (05/06/2012):
+	General:
+	* Support building against Farstream in addition to Farsight.
+	  (Olivier Crete) (#14936)
+
+	IRC:
+	* Disable periodic WHO timer.  IRC channel user lists will no
+	  longer automatically display away status, but libpurple will be
+	  much kinder to the network.
+	* Print unknown numerics to channel windows if we can associate
+	  them.  Thanks to Marien Zwart. (#15090)
+
+	MSN:
+	* Fix a possible crash when receiving messages with certain characters
+	  or character encodings.  Thanks to Fabian Yamaguchi for reporting
+	  this! (CVE-2012-2318)
+
+	XMPP:
+	* Fix a possible crash when receiving a series of specially crafted
+	  file transfer requests.  Thanks to José Valentín Gutiérrez for
+	  reporting this!  (CVE-2012-2214)
+
+	Windows-Specific Changes:
+	* Words added to spell check dictionaries are saved across restarts of
+	  Pidgin (#11886)
 
 version 2.10.3 (03/26/2012):
 	MSN:
diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -247,6 +247,12 @@
 		* xmlnode_set_attrib_with_namespace
 		* xmlnode_set_attrib_with_prefix
 
+version 2.10.5:
+	* No changes
+
+version 2.10.4:
+	* No changes
+
 version 2.10.3:
 	* No changes
 
diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c
--- a/libpurple/protocols/irc/irc.c
+++ b/libpurple/protocols/irc/irc.c
@@ -4,7 +4,7 @@
  * purple
  *
  * Copyright (C) 2003, Robbert Haarman <purple at inglorion.net>
- * Copyright (C) 2003, Ethan Blanton <eblanton at cs.purdue.edu>
+ * Copyright (C) 2003, 2012 Ethan Blanton <elb at pidgin.im>
  * Copyright (C) 2000-2003, Rob Flynn <rob at tgflinux.com>
  * Copyright (C) 1998-1999, Mark Spencer <markster at marko.net>
  *
@@ -41,8 +41,6 @@
 
 static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list);
 
-static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc);
-
 static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b);
 static GList *irc_status_types(PurpleAccount *account);
 static GList *irc_actions(PurplePlugin *plugin, gpointer context);
@@ -241,29 +239,6 @@
 }
 
 
-gboolean irc_who_channel_timeout(struct irc_conn *irc)
-{
-	// WHO all of our channels.
-	g_list_foreach(purple_get_conversations(), (GFunc)irc_who_channel, (gpointer)irc);
-	
-	return TRUE;
-}
-
-static void irc_who_channel(PurpleConversation *conv, struct irc_conn *irc)
-{
-	if (purple_conversation_get_account(conv) == irc->account
-	    && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT
-	    && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
-		char *buf = irc_format(irc, "vc", "WHO", purple_conversation_get_name(conv));
-		
-		purple_debug(PURPLE_DEBUG_INFO, "irc",
-			     "Performing periodic who on %s\n",
-			     purple_conversation_get_name(conv));
-		irc_send(irc, buf);
-		g_free(buf);
-	}
-}
-
 static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib)
 {
 	char *buf;
@@ -539,8 +514,6 @@
 	}
 	if (irc->timer)
 		purple_timeout_remove(irc->timer);
-	if (irc->who_channel_timer)
-		purple_timeout_remove(irc->who_channel_timer);
 	g_hash_table_destroy(irc->cmds);
 	g_hash_table_destroy(irc->msgs);
 	g_hash_table_destroy(irc->buddies);
diff --git a/libpurple/protocols/irc/irc.h b/libpurple/protocols/irc/irc.h
--- a/libpurple/protocols/irc/irc.h
+++ b/libpurple/protocols/irc/irc.h
@@ -3,7 +3,7 @@
  *
  * purple
  *
- * Copyright (C) 2003, Ethan Blanton <eblanton at cs.purdue.edu>
+ * Copyright (C) 2003, 2012 Ethan Blanton <elb at pidgin.im>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -56,7 +56,6 @@
 	int fd;
 	guint inpa;
 	guint timer;
-	guint who_channel_timer;
 	GHashTable *buddies;
 
 	gboolean ison_outstanding;
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -3,7 +3,7 @@
  *
  * purple
  *
- * Copyright (C) 2003, Ethan Blanton <eblanton at cs.purdue.edu>
+ * Copyright (C) 2003, 2012 Ethan Blanton <elb at pidgin.im>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,13 +110,80 @@
 	irc_blist_timeout(irc);
 	if (!irc->timer)
 		irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc);
-    if (!irc->who_channel_timer)
-        irc->who_channel_timer = purple_timeout_add_seconds(300, (GSourceFunc)irc_who_channel_timeout, (gpointer)irc);
 }
 
+/* This function is ugly, but it's really an error handler. */
 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
-	char *clean;
+	int i;
+	const char *end, *cur, *numeric = NULL;
+	char *clean, *tmp, *convname;
+	PurpleConversation *convo;
+
+	for (cur = args[0], i = 0; i < 4; i++) {
+		end = strchr(cur, ' ');
+		if (end == NULL) {
+			goto undirected;
+		}
+		/* Check for 3-digit numeric in second position */
+		if (i == 1) {
+			if (end - cur != 3
+			    || !isdigit(cur[0]) || !isdigit(cur[1])
+			    || !isdigit(cur[2])) {
+				goto undirected;
+			}
+			/* Save the numeric for printing to the channel */
+			numeric = cur;
+		}
+		/* Don't advance cur if we're on the final iteration. */
+		if (i != 3) {
+			cur = end + 1;
+		}
+	}
+
+	/* At this point, cur is the beginning of the fourth position,
+	 * end is the following space, and there are remaining
+	 * arguments.  We'll check to see if this argument is a
+	 * currently active conversation (private message or channel,
+	 * either one), and print the numeric to that conversation if it
+	 * is. */
+
+	tmp = g_strndup(cur, end - cur);
+	convname = purple_utf8_salvage(tmp);
+	g_free(tmp);
+
+	/* Check for an existing conversation */
+	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
+						      convname,
+						      irc->account);
+	g_free(convname);
+
+	if (convo == NULL) {
+		goto undirected;
+	}
+
+	/* end + 1 is the first argument past the target.  The initial
+	 * arguments we've skipped are routing info, numeric, recipient
+	 * (this account's nick, most likely), and target (this
+	 * channel).  If end + 1 is an ASCII :, skip it, because it's
+	 * meaningless in this context.  This won't catch all
+	 * :-arguments, but it'll catch the easy case. */
+	if (*++end == ':') {
+		end++;
+	}
+
+	/* We then print "numeric: remainder". */
+	clean = purple_utf8_salvage(end);
+	tmp = g_strdup_printf("%.3s: %s", numeric, clean);
+	g_free(clean);
+	purple_conversation_write(convo, "", tmp,
+				  PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG
+				  |PURPLE_MESSAGE_RAW|PURPLE_MESSAGE_NO_LINKIFY,
+				  time(NULL));
+	g_free(tmp);
+	return;
+
+  undirected:
 	/* This, too, should be escaped somehow (smarter) */
 	clean = purple_utf8_salvage(args[0]);
 	purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean);
@@ -459,6 +526,10 @@
 		
 		flags = purple_conv_chat_cb_get_flags(cb);
 
+		/* FIXME: I'm not sure this is really a good idea, now
+		 * that we no longer do periodic WHO.  It seems to me
+		 * like it's more likely to be confusing than not.
+		 * Comments? */
 		if (args[6][0] == 'G' && !(flags & PURPLE_CBFLAGS_AWAY)) {
 			purple_conv_chat_user_set_flags(chat, purple_conv_chat_cb_get_name(cb), flags | PURPLE_CBFLAGS_AWAY);
 		} else if(args[6][0] == 'H' && (flags & PURPLE_CBFLAGS_AWAY)) {
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -3575,16 +3575,32 @@
 	JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account));
 
 	if (js->pep) {
-		/* if no argument was given, unset mood */
+		gboolean ret;
+
 		if (!args || !args[0]) {
-			jabber_mood_set(js, NULL, NULL);
-		} else if (!args[1]) {
-			jabber_mood_set(js, args[0], NULL);
+			/* No arguments; unset mood */
+			ret = jabber_mood_set(js, NULL, NULL);
 		} else {
-			jabber_mood_set(js, args[0], args[1]);
+			/* At least one argument.  Relying on the list of arguments
+			 * being NULL-terminated.
+			 */
+			ret = jabber_mood_set(js, args[0], args[1]);
+			if (!ret) {
+				/* Let's try again */
+				char *tmp = g_strjoin(" ", args[0], args[1], NULL);
+				ret = jabber_mood_set(js, "undefined", tmp);
+				g_free(tmp);
+			}
 		}
 
-		return PURPLE_CMD_RET_OK;
+		if (ret) {
+			return PURPLE_CMD_RET_OK;
+		} else {
+			purple_conversation_write(conv, NULL,
+				_("Failed to specify mood"),
+				PURPLE_MESSAGE_ERROR, time(NULL));
+			return PURPLE_CMD_RET_FAILED;
+		}
 	} else {
 		/* account does not support PEP, can't set a mood */
 		purple_conversation_write(conv, NULL,
@@ -3713,7 +3729,7 @@
 	    			  PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM |
 	    			  PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
 	    			  "prpl-jabber", jabber_cmd_mood,
-	    			  _("mood: Set current user mood"), NULL);
+	    			  _("mood <mood> [text]: Set current user mood"), NULL);
 	commands = g_slist_prepend(commands, GUINT_TO_POINTER(id));



More information about the Commits mailing list