changeset 28405:2c85f44113b4

jabber: Strip the '/' off of a JID in jabber_normalize. This is what Pidgin did pre-2.6.0 and breaks the log directories for accounts with no resource. Closes #9959.
author Paul Aurich <paul@darkrain42.org>
date Sat, 22 Aug 2009 06:00:18 +0000
parents 15833e4f2e09
children 694c8aa30300
files libpurple/protocols/jabber/jutil.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jutil.c	Sat Aug 22 05:38:56 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.c	Sat Aug 22 06:00:18 2009 +0000
@@ -506,8 +506,23 @@
 	JabberStream *js = gc ? gc->proto_data : NULL;
 	static char buf[3072]; /* maximum legal length of a jabber jid */
 	JabberID *jid;
+	char *tmp;
+	size_t len = strlen(in);
 
-	jid = jabber_id_new(in);
+	/*
+	 * If the JID ends with a '/', jabber_id_new is going to throw it away as
+	 * invalid.  However, this is what the UI generates for a JID with no
+	 * resource. Deal with that by dropping away the '/'...
+	 */
+	if (in[len - 1] == '/')
+		tmp = g_strndup(in, len - 1);
+	else
+		tmp = (gchar *)in;
+
+	jid = jabber_id_new(tmp);
+
+	if (tmp != in)
+		g_free(tmp);
 
 	if(!jid)
 		return NULL;