pidgin: 9116aec2: Stop escaping all characters in the disp...

qulogic at pidgin.im qulogic at pidgin.im
Sun Nov 28 03:25:08 EST 2010


----------------------------------------------------------------------
Revision: 9116aec2b9157c0500ab9560d849627e1f9ea2e6
Parent:   a0f1fbdb08e486622f76673697309a68ceb998fb
Author:   qulogic at pidgin.im
Date:     11/28/10 02:24:22
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9116aec2b9157c0500ab9560d849627e1f9ea2e6

Changelog: 

Stop escaping all characters in the display name. It's only necessary
to escape percent and space, and the UTF-8 can be left alone.

Fixes #8508.

Changes against parent a0f1fbdb08e486622f76673697309a68ceb998fb

  patched  ChangeLog
  patched  libpurple/protocols/msn/msn.c

-------------- next part --------------
============================================================
--- ChangeLog	a81b7045951168a42519f5c2cb4fdc928d4ad61c
+++ ChangeLog	4b18c939866c750f499ddb350b8e7452b18fd3dd
@@ -14,7 +14,10 @@ version 2.7.8 (??/??/????):
 	  libgadu to 1.9.0. (#12789)
 
 	MSN:
-	* Don't show ourselves in the list of endpoints that can be disconnected.
+	* Stop showing ourselves in the list of endpoints that can be
+	  disconnected.
+	* Allow full-size display names, by not escaping (most) non-English
+	  characters. (#8508)
 
 version 2.7.7 (11/23/2010):
 	General:
============================================================
--- libpurple/protocols/msn/msn.c	f27a3e5c3f33506a632fd969231ca755bf7d538e
+++ libpurple/protocols/msn/msn.c	e7cc4cee4d52253881fdcaf46b8fe5e08e8c3117
@@ -250,24 +250,44 @@ msn_set_public_alias(PurpleConnection *p
 	MsnSession *session;
 	MsnTransaction *trans;
 	PurpleAccount *account;
-	const char *real_alias;
+	char real_alias[BUDDY_ALIAS_MAXLEN+1];
 	struct public_alias_closure *closure;
 
 	session = purple_connection_get_protocol_data(pc);
 	cmdproc = session->notification->cmdproc;
 	account = purple_connection_get_account(pc);
 
-	if (alias && *alias)
-	{
-		char *tmp = g_strdup(alias);
-		real_alias = purple_url_encode(g_strstrip(tmp));
-		g_free(tmp);
-	}
-	else
-		real_alias = "";
+	if (alias && *alias) {
+		int i = 0;
+		while (isspace(*alias))
+			alias++;
 
-	if (strlen(real_alias) > BUDDY_ALIAS_MAXLEN)
-	{
+		for (; *alias && i < BUDDY_ALIAS_MAXLEN; alias++) {
+			if (*alias == '%') {
+				if (i > BUF_LEN - 4)
+					break;
+				real_alias[i++] = '%';
+				real_alias[i++] = '2';
+				real_alias[i++] = '5';
+			} else if (*alias == ' ') {
+				if (i > BUF_LEN - 4)
+					break;
+				real_alias[i++] = '%';
+				real_alias[i++] = '2';
+				real_alias[i++] = '0';
+			} else {
+				real_alias[i++] = *alias;
+			}
+		}
+
+		while (i && isspace(real_alias[i - 1]))
+			i--;
+
+		real_alias[i] = '\0';
+	} else
+		real_alias[0] = '\0';
+
+	if (*alias) {
 		if (failure_cb) {
 			struct public_alias_closure *closure =
 				g_new0(struct public_alias_closure, 1);
@@ -282,8 +302,8 @@ msn_set_public_alias(PurpleConnection *p
 		return;
 	}
 
-	if (*real_alias == '\0') {
-		real_alias = purple_url_encode(purple_account_get_username(account));
+	if (real_alias[0] == '\0') {
+		strcpy(real_alias, purple_account_get_username(account));
 	}
 
 	closure = g_new0(struct public_alias_closure, 1);


More information about the Commits mailing list