pidgin: e9fdd89a: jabber: Strip the '/' off of a JID in ja..

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Aug 22 02:25:55 EDT 2009


-----------------------------------------------------------------
Revision: e9fdd89af79c9970da8f644c0aef24cecf43fed8
Ancestor: fdf3ae9383614c0dc53e1d9b17637e50e0819acb
Author: darkrain42 at pidgin.im
Date: 2009-08-22T06:00:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e9fdd89af79c9970da8f644c0aef24cecf43fed8

Modified files:
        libpurple/protocols/jabber/jutil.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jutil.c	a8cbf30acbf26b6f9c31c79938b684abc969ef78
+++ libpurple/protocols/jabber/jutil.c	ac608eab4a23bf8aac38a987c7e1c36cc654938f
@@ -506,9 +506,24 @@ const char *jabber_normalize(const Purpl
 	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;
 


More information about the Commits mailing list