comparison src/protocols/yahoo/util.c @ 8375:1556970088d4

[gaim-migrate @ 9102] quoth marv: " I like "What You Get Is What You Get" better. This fixes a problem where yahoo was sending < and > to the core when it wasn't html, and so gtkimhtml wasn't displaying part of the message. It's fixed by making the prpl escape it first. While I was add it, it made it display "Buzz!!" when someone buzzes you, instead of it saying that they said <ding>. Note that the official client uses red letters, all caps, and 3 !'s, and makes the window shake, so what we do is pretty mild. I also fixed a compile warning." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 01 Mar 2004 05:13:45 +0000
parents ee32e030c9be
children 7e9fdaab7163
comparison
equal deleted inserted replaced
8374:e7463be62fb1 8375:1556970088d4
168 g_hash_table_insert(ht, "</yellow>", "</FONT>"); 168 g_hash_table_insert(ht, "</yellow>", "</FONT>");
169 169
170 /* remove these once we have proper support for <FADE> and <ALT> */ 170 /* remove these once we have proper support for <FADE> and <ALT> */
171 g_hash_table_insert(ht, "</fade>", ""); 171 g_hash_table_insert(ht, "</fade>", "");
172 g_hash_table_insert(ht, "</alt>", ""); 172 g_hash_table_insert(ht, "</alt>", "");
173
174 /* these are the normal html yahoo sends (besides <font>).
175 * anything else will get turned into &lt;tag&gt;, so if I forgot
176 * about something, please add it. Why Yahoo! has to send unescaped
177 * <'s and >'s that aren't supposed to be html is beyond me.
178 */
179 g_hash_table_insert(ht, "<b>", "<b>");
180 g_hash_table_insert(ht, "<i>", "<i>");
181 g_hash_table_insert(ht, "<u>", "<u>");
182
183 g_hash_table_insert(ht, "</b>", "</b>");
184 g_hash_table_insert(ht, "</i>", "</i>");
185 g_hash_table_insert(ht, "</u>", "</u>");
173 } 186 }
174 187
175 void yahoo_dest_colorht() 188 void yahoo_dest_colorht()
176 { 189 {
177 g_hash_table_destroy(ht); 190 g_hash_table_destroy(ht);
257 j = i; 270 j = i;
258 271
259 while (j++ < xs) { 272 while (j++ < xs) {
260 if (x[j] != '>') 273 if (x[j] != '>')
261 if (j == xs) { 274 if (j == xs) {
262 g_string_append_c(s, '<'); 275 g_string_append(s, "&lt;");
263 nomoreendtags = 1; 276 nomoreendtags = 1;
264 } 277 }
265 else 278 else
266 continue; 279 continue;
267 else { 280 else {
280 break; 293 break;
281 294
282 } else if (!strncmp(tmp->str, "<font ", 6)) { 295 } else if (!strncmp(tmp->str, "<font ", 6)) {
283 _font_tags_fix_size(tmp, s); 296 _font_tags_fix_size(tmp, s);
284 } else { 297 } else {
285 g_string_append_c(s, '<'); 298 g_string_append(s, "&lt;");
286 g_string_free(tmp, TRUE); 299 g_string_free(tmp, TRUE);
287 break; 300 break;
288 } 301 }
289 302
290 i = j; 303 i = j;
295 } 308 }
296 309
297 310
298 311
299 } else { 312 } else {
300 g_string_append_c(s, x[i]); 313 if (x[i] == '<')
314 g_string_append(s, "&lt;");
315 else if (x[i] == '>')
316 g_string_append(s, "&gt;");
317 else
318 g_string_append_c(s, x[i]);
301 } 319 }
302 } 320 }
303 321
304 ret = s->str; 322 ret = s->str;
305 g_string_free(s, FALSE); 323 g_string_free(s, FALSE);