comparison src/protocols/napster/napster.c @ 8495:a88124e46fc6

[gaim-migrate @ 9230] Escape napster text. I'm pretty sure Napster isn't supposed to support HTML tags. Also, I can connect to a local napster server with no problems, but when I try to connect to remote napster servers I get an error when reading, and strerror(errno) says "Success." Anyone know what's up with that? Maybe there isn't enough data in the TCP stream or something and the socket is non-blocking, so it just returns? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 24 Mar 2004 01:46:46 +0000
parents 143d0b29ba82
children e3c059c3d92d
comparison
equal deleted inserted replaced
8494:8a1421dcef60 8495:a88124e46fc6
238 do { 238 do {
239 int tmp = read(source, buf + i, len - i); 239 int tmp = read(source, buf + i, len - i);
240 if (tmp <= 0) { 240 if (tmp <= 0) {
241 g_free(buf); 241 g_free(buf);
242 buf = g_strdup_printf(_("Unable to read message from server. Command is %hd, length is %hd."), len, command); 242 buf = g_strdup_printf(_("Unable to read message from server. Command is %hd, length is %hd."), len, command);
243 /* Change this to use the line below when we're not in string freeze */
244 /* buf = g_strdup_printf(_("Unable to read message from server: %s. Command is %hd, length is %hd."), strerror(errno), len, command); */
243 gaim_connection_error(gc, buf); 245 gaim_connection_error(gc, buf);
244 g_free(buf); 246 g_free(buf);
245 return; 247 return;
246 } 248 }
247 i += tmp; 249 i += tmp;
278 serv_got_update(gc, buf, 0, 0, 0, 0, 0); 280 serv_got_update(gc, buf, 0, 0, 0, 0, 0);
279 break; 281 break;
280 282
281 case 205: /* MSG_CLIENT_PRIVMSG */ 283 case 205: /* MSG_CLIENT_PRIVMSG */
282 res = g_strsplit(buf, " ", 2); 284 res = g_strsplit(buf, " ", 2);
283 serv_got_im(gc, res[0], res[1], 0, time(NULL)); 285 buf2 = gaim_escape_html(res[1]);
286 serv_got_im(gc, res[0], buf2, 0, time(NULL));
287 g_free(buf2);
284 g_strfreev(res); 288 g_strfreev(res);
285 break; 289 break;
286 290
287 case 209: /* MSG_SERVER_USER_SIGNON */ 291 case 209: /* MSG_SERVER_USER_SIGNON */
288 /* USERNAME SPEED */ 292 /* USERNAME SPEED */
337 g_strfreev(res); 341 g_strfreev(res);
338 break; 342 break;
339 343
340 case 404: /* MSG_SERVER_NOSUCH */ 344 case 404: /* MSG_SERVER_NOSUCH */
341 /* abused by opennap servers to broadcast stuff */ 345 /* abused by opennap servers to broadcast stuff */
342 serv_got_im(gc, "server", buf, 0, time(NULL)); 346 buf2 = gaim_escape_html(buf);
347 serv_got_im(gc, "server", buf2, 0, time(NULL));
348 g_free(buf2);
343 break; 349 break;
344 350
345 case 405: /* MSG_SERVER_JOIN_ACK */ 351 case 405: /* MSG_SERVER_JOIN_ACK */
346 c = nap_find_chat(gc, buf); 352 c = nap_find_chat(gc, buf);
347 if (!c) 353 if (!c)
390 break; 396 break;
391 397
392 case 621: 398 case 621:
393 case 622: /* MSG_CLIENT_MOTD */ 399 case 622: /* MSG_CLIENT_MOTD */
394 /* also replaces MSG_SERVER_MOTD, so we should display it */ 400 /* also replaces MSG_SERVER_MOTD, so we should display it */
395 serv_got_im(gc, "motd", buf, 0, time(NULL)); 401 buf2 = gaim_escape_html(buf);
402 serv_got_im(gc, "motd", buf2, 0, time(NULL));
403 g_free(buf2);
396 break; 404 break;
397 405
398 case 627: /* MSG_CLIENT_WALLOP */ 406 case 627: /* MSG_CLIENT_WALLOP */
399 /* abused by opennap server maintainers to broadcast stuff */ 407 /* abused by opennap server maintainers to broadcast stuff */
400 serv_got_im(gc, "wallop", buf, 0, time(NULL)); 408 buf2 = gaim_escape_html(buf);
409 serv_got_im(gc, "wallop", buf2, 0, time(NULL));
410 g_free(buf2);
401 break; 411 break;
402 412
403 case 628: /* MSG_CLIENT_ANNOUNCE */ 413 case 628: /* MSG_CLIENT_ANNOUNCE */
404 serv_got_im(gc, "announce", buf, 0, time(NULL)); 414 buf2 = gaim_escape_html(buf);
415 serv_got_im(gc, "announce", buf2, 0, time(NULL));
416 g_free(buf);
405 break; 417 break;
406 418
407 case 748: /* MSG_SERVER_GHOST */ 419 case 748: /* MSG_SERVER_GHOST */
408 /* Looks like someone logged in as us! =-O */ 420 /* Looks like someone logged in as us! =-O */
409 gaim_notify_error(gc, NULL, 421 gaim_notify_error(gc, NULL,