changeset 22121:0a0fa9fd5feb

Remove `yahoo_convert_to_numeric`, which I apparently did not examine closely enough. Given the purpose, `g_markup_escape_text` should work well enough in its stead. Refs #3295.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Wed, 16 Jan 2008 06:58:48 +0000
parents a6715d41e062
children f55f84a1e3f7 840e7e1b6dac df77b89a4025
files libpurple/protocols/yahoo/util.c libpurple/protocols/yahoo/yahoo.h libpurple/protocols/yahoo/yahoo_aliases.c
diffstat 3 files changed, 5 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/util.c	Wed Jan 16 06:29:52 2008 +0000
+++ b/libpurple/protocols/yahoo/util.c	Wed Jan 16 06:58:48 2008 +0000
@@ -164,20 +164,6 @@
 		return g_strdup("");
 }
 
-char *yahoo_convert_to_numeric(const char *str)
-{
-	char *retstr, buf[7];
-	const char *p;
-
-	retstr = (char*)malloc(strlen(str) * 6 + 1);
-	memset(retstr, 0x00, sizeof(retstr));
-	for (p = str; *p; p++) {
-		sprintf(buf, "&#%d;", (unsigned char)*p);
-		strcat(retstr, buf);
-	}
-	return retstr;
-}
-
 /*
  * I found these on some website but i don't know that they actually
  * work (or are supposed to work). I didn't implement them yet.
--- a/libpurple/protocols/yahoo/yahoo.h	Wed Jan 16 06:29:52 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.h	Wed Jan 16 06:58:48 2008 +0000
@@ -218,8 +218,6 @@
  */
 char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8);
 
-char *yahoo_convert_to_numeric(const char *str);
-
 /* previously-static functions, now needed for yahoo_profile.c */
 void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
 
--- a/libpurple/protocols/yahoo/yahoo_aliases.c	Wed Jan 16 06:29:52 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_aliases.c	Wed Jan 16 06:58:48 2008 +0000
@@ -226,18 +226,17 @@
 {
 	struct yahoo_data *yd;
 	struct YahooUser *yu;
-	char *content, *url, *request, *webpage, *webaddress, *strtmp;
+	char *content, *url, *request, *webpage, *webaddress, *strtmp, *alias_jp;
 	int inttmp;
 	struct callback_data *cb;
 	PurpleBuddy *buddy;
 	PurpleUtilFetchUrlData *url_data;
-	char *alias_jp, *converted_alias_jp;
 
 	g_return_if_fail(alias != NULL);
 	g_return_if_fail(who != NULL);
 	g_return_if_fail(gc != NULL);
 
-	purple_debug_info("yahoo", "Sending '%s' as new alias for user '%s'.\n",alias, who);
+	purple_debug_info("yahoo", "Sending '%s' as new alias for user '%s'.\n", alias, who);
 
 	buddy = purple_find_buddy(gc->account, who);
 	if (buddy == NULL || buddy->proto_data == NULL) {
@@ -254,16 +253,15 @@
 	cb->gc = gc;
 
 	/*  Build all the info to make the web request */
-	url = yd->jp? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL;
+	url = yd->jp ? YAHOOJP_ALIAS_UPDATE_URL : YAHOO_ALIAS_UPDATE_URL;
 	purple_url_parse(url, &webaddress, &inttmp, &webpage, &strtmp, &strtmp);
 
 	if (yd->jp) {
 		alias_jp = g_convert(alias, strlen(alias), "EUC-JP", "UTF-8", NULL, NULL, NULL);
-		converted_alias_jp = yahoo_convert_to_numeric(alias_jp);
 		content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n"
 		                          "<ct e=\"1\"  yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
-		                          gc->account->username, who, yu->id, converted_alias_jp);
-		free(converted_alias_jp);
+		                          gc->account->username, who, yu->id,
+								  g_markup_escape_text(alias_jp, strlen(alias_jp)));
 		g_free(alias_jp);
 	}
 	else {