Mercurial > pidgin
comparison src/protocols/msn/msn.c @ 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 | a226ebf4be47 |
children | 2a09a177ed5f |
comparison
equal
deleted
inserted
replaced
2218:6d5f7cbf1882 | 2219:20a4d5da0b95 |
---|---|
104 strncpy(hex, msg + ++i, 2); hex[2] = 0; | 104 strncpy(hex, msg + ++i, 2); hex[2] = 0; |
105 /* i is pointing to the start of the number */ | 105 /* i is pointing to the start of the number */ |
106 i++; /* now it's at the end and at the start of the for loop | 106 i++; /* now it's at the end and at the start of the for loop |
107 will be at the next character */ | 107 will be at the next character */ |
108 buf[j++] = strtol(hex, NULL, 16); | 108 buf[j++] = strtol(hex, NULL, 16); |
109 } | |
110 buf[j] = 0; | |
111 | |
112 return buf; | |
113 } | |
114 | |
115 static char *url_encode(const char *msg) | |
116 { | |
117 static char buf[MSN_BUF_LEN]; | |
118 int i, j = 0; | |
119 | |
120 bzero(buf, sizeof(buf)); | |
121 for (i = 0; i < strlen(msg); i++) { | |
122 if (isalnum(msg[i])) | |
123 buf[j++] = msg[i]; | |
124 else { | |
125 sprintf(buf + j, "%%%02x", (unsigned char)msg[i]); | |
126 j += 3; | |
127 } | |
109 } | 128 } |
110 buf[j] = 0; | 129 buf[j] = 0; |
111 | 130 |
112 return buf; | 131 return buf; |
113 } | 132 } |
809 | 828 |
810 GET_NEXT(tmp); | 829 GET_NEXT(tmp); |
811 GET_NEXT(tmp); | 830 GET_NEXT(tmp); |
812 GET_NEXT(tmp); | 831 GET_NEXT(tmp); |
813 GET_NEXT(tmp); | 832 GET_NEXT(tmp); |
814 friend = tmp; | 833 friend = url_decode(tmp); |
815 | 834 |
816 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); | 835 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); |
817 } else if (!g_strncasecmp(buf, "REM", 3)) { | 836 } else if (!g_strncasecmp(buf, "REM", 3)) { |
818 } else if (!g_strncasecmp(buf, "RNG", 3)) { | 837 } else if (!g_strncasecmp(buf, "RNG", 3)) { |
819 struct msn_switchboard *ms; | 838 struct msn_switchboard *ms; |
996 resp = tmp; | 1015 resp = tmp; |
997 GET_NEXT(tmp); | 1016 GET_NEXT(tmp); |
998 GET_NEXT(tmp); | 1017 GET_NEXT(tmp); |
999 friend = tmp; | 1018 friend = tmp; |
1000 GET_NEXT(tmp); | 1019 GET_NEXT(tmp); |
1020 friend = url_decode(friend); | |
1001 | 1021 |
1002 /* so here, we're either getting the challenge or the OK */ | 1022 /* so here, we're either getting the challenge or the OK */ |
1003 if (!g_strcasecmp(resp, "OK")) { | 1023 if (!g_strcasecmp(resp, "OK")) { |
1004 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); | 1024 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", friend); |
1005 | 1025 |
1397 { | 1417 { |
1398 struct gaim_connection *gc = data; | 1418 struct gaim_connection *gc = data; |
1399 struct msn_data *md = gc->proto_data; | 1419 struct msn_data *md = gc->proto_data; |
1400 char buf[MSN_BUF_LEN]; | 1420 char buf[MSN_BUF_LEN]; |
1401 | 1421 |
1402 g_snprintf(buf, sizeof(buf), "REA %d %s %s\n", ++md->trId, gc->username, entry); | 1422 g_snprintf(buf, sizeof(buf), "REA %d %s %s\n", ++md->trId, gc->username, url_encode(entry)); |
1403 if (msn_write(md->fd, buf, strlen(buf)) < 0) { | 1423 if (msn_write(md->fd, buf, strlen(buf)) < 0) { |
1404 hide_login_progress(gc, "Write error"); | 1424 hide_login_progress(gc, "Write error"); |
1405 signoff(gc); | 1425 signoff(gc); |
1406 return; | 1426 return; |
1407 } | 1427 } |