Mercurial > pidgin.yaz
changeset 2219:20a4d5da0b95
[gaim-migrate @ 2229]
thanks to Ryan Speed for pointing this out. I hope this doesn't break things. I'm sure Ryan'll let me know ;)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 06 Sep 2001 01:37:51 +0000 |
parents | 6d5f7cbf1882 |
children | 8b7ba25a7ece |
files | src/protocols/msn/msn.c |
diffstat | 1 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/msn/msn.c Thu Sep 06 00:27:11 2001 +0000 +++ b/src/protocols/msn/msn.c Thu Sep 06 01:37:51 2001 +0000 @@ -112,6 +112,25 @@ return buf; } +static char *url_encode(const char *msg) +{ + static char buf[MSN_BUF_LEN]; + int i, j = 0; + + bzero(buf, sizeof(buf)); + for (i = 0; i < strlen(msg); i++) { + if (isalnum(msg[i])) + buf[j++] = msg[i]; + else { + sprintf(buf + j, "%%%02x", (unsigned char)msg[i]); + j += 3; + } + } + buf[j] = 0; + + return buf; +} + static char *handle_errcode(char *buf, gboolean show) { int errcode; @@ -811,7 +830,7 @@ GET_NEXT(tmp); GET_NEXT(tmp); GET_NEXT(tmp); - friend = tmp; + friend = url_decode(tmp); g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); } else if (!g_strncasecmp(buf, "REM", 3)) { @@ -998,6 +1017,7 @@ GET_NEXT(tmp); friend = tmp; GET_NEXT(tmp); + friend = url_decode(friend); /* so here, we're either getting the challenge or the OK */ if (!g_strcasecmp(resp, "OK")) { @@ -1399,7 +1419,7 @@ struct msn_data *md = gc->proto_data; char buf[MSN_BUF_LEN]; - g_snprintf(buf, sizeof(buf), "REA %d %s %s\n", ++md->trId, gc->username, entry); + g_snprintf(buf, sizeof(buf), "REA %d %s %s\n", ++md->trId, gc->username, url_encode(entry)); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); signoff(gc);