changeset 28721:f10741a709a9

jabber: Should have looked for this function earlier.
author Paul Aurich <paul@darkrain42.org>
date Tue, 01 Dec 2009 00:30:22 +0000
parents 295d814b76ac
children 1c1910b17ae5
files libpurple/protocols/jabber/auth_scram.c
diffstat 1 files changed, 5 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth_scram.c	Mon Nov 30 20:35:41 2009 +0000
+++ b/libpurple/protocols/jabber/auth_scram.c	Tue Dec 01 00:30:22 2009 +0000
@@ -363,21 +363,12 @@
 
 static gchar *escape_username(const gchar *in)
 {
-	GString *s = g_string_new(in);
-	gchar *c;
-	gsize i = 0;
+	gchar *tmp, *tmp2;
 
-	c = s->str;
-	while (*c) {
-		if (*c == ',' || *c == '=') {
-			g_string_erase(s, i, 1);
-			g_string_insert(s, i, *c == ',' ? "=2C" : "=3D");
-		}
-
-		++c; ++i;
-	}
-
-	return g_string_free(s, FALSE);
+	tmp = purple_strreplace(in, "=", "=3D");
+	tmp2 = purple_strreplace(tmp, ",", "=2D");
+	g_free(tmp);
+	return tmp2;
 }
 
 static xmlnode *scram_start(JabberStream *js, xmlnode *mechanisms)