Mercurial > pidgin
comparison src/protocols/yahoo/yahoo.c @ 6513:63c449a1022f
[gaim-migrate @ 7030]
Tim Ringenbach (marv_sf) writes:
" This processes yahoo's weird color codes, and turns
them into normal html. It also strips about fade, alt,
and snd tags, while its at it.
This doesn't make gaim send valid yahoo color codes,
however.
If you don't like some aspect of this patch, let me
know and I'll fix it.
Actually, I added a couple files, and cvs diff wouldn't
cooperate, so I just tarred up the patch and the new
files. Maybe I should have just stuck it all in
yahoo.c. Oh well, you can make me redo it if you don't
like it."
someone test this and provide patches for any bugs.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 20 Aug 2003 01:17:26 +0000 |
parents | fb64cc87bc96 |
children | 64d952098596 |
comparison
equal
deleted
inserted
replaced
6512:22acbf225a53 | 6513:63c449a1022f |
---|---|
31 #include "request.h" | 31 #include "request.h" |
32 #include "server.h" | 32 #include "server.h" |
33 #include "util.h" | 33 #include "util.h" |
34 #include "html.h" | 34 #include "html.h" |
35 | 35 |
36 #include "yahoo.h" | |
36 #include "md5.h" | 37 #include "md5.h" |
37 | 38 |
38 /* XXX */ | 39 /* XXX */ |
39 #include "gtkinternal.h" | 40 #include "gtkinternal.h" |
40 #include "ui.h" | 41 #include "ui.h" |
562 from = pair->value; | 563 from = pair->value; |
563 if (pair->key == 15) | 564 if (pair->key == 15) |
564 tm = strtol(pair->value, NULL, 10); | 565 tm = strtol(pair->value, NULL, 10); |
565 if (pair->key == 14) { | 566 if (pair->key == 14) { |
566 char *m; | 567 char *m; |
567 int i, j; | |
568 | 568 |
569 msg = pair->value; | 569 msg = pair->value; |
570 | 570 |
571 strip_linefeed(msg); | 571 strip_linefeed(msg); |
572 m = msg; | 572 m = yahoo_codes_to_html(msg); |
573 for (i = 0, j = 0; m[i]; i++) { | 573 serv_got_im(gc, from, m, 0, tm, -1); |
574 if (m[i] == 033) { | 574 g_free(m); |
575 while (m[i] && (m[i] != 'm')) | |
576 i++; | |
577 if (!m[i]) | |
578 i--; | |
579 continue; | |
580 } | |
581 msg[j++] = m[i]; | |
582 } | |
583 msg[j] = 0; | |
584 serv_got_im(gc, from, msg, 0, tm, -1); | |
585 | 575 |
586 tm = time(NULL); | 576 tm = time(NULL); |
587 } | 577 } |
588 l = l->next; | 578 l = l->next; |
589 } | 579 } |
1391 yahoo_packet_hash(pkt, 65, group); | 1381 yahoo_packet_hash(pkt, 65, group); |
1392 yahoo_send_packet(yd, pkt); | 1382 yahoo_send_packet(yd, pkt); |
1393 yahoo_packet_free(pkt); | 1383 yahoo_packet_free(pkt); |
1394 } | 1384 } |
1395 | 1385 |
1386 static gboolean yahoo_unload_plugin(GaimPlugin *plugin) | |
1387 { | |
1388 yahoo_dest_colorht(); | |
1389 return TRUE; | |
1390 } | |
1391 | |
1396 static GaimPlugin *my_protocol = NULL; | 1392 static GaimPlugin *my_protocol = NULL; |
1397 | 1393 |
1398 static GaimPluginProtocolInfo prpl_info = | 1394 static GaimPluginProtocolInfo prpl_info = |
1399 { | 1395 { |
1400 GAIM_PROTO_YAHOO, | 1396 GAIM_PROTO_YAHOO, |
1467 N_("Yahoo Protocol Plugin"), | 1463 N_("Yahoo Protocol Plugin"), |
1468 NULL, /**< author */ | 1464 NULL, /**< author */ |
1469 GAIM_WEBSITE, /**< homepage */ | 1465 GAIM_WEBSITE, /**< homepage */ |
1470 | 1466 |
1471 NULL, /**< load */ | 1467 NULL, /**< load */ |
1472 NULL, /**< unload */ | 1468 yahoo_unload_plugin, /**< unload */ |
1473 NULL, /**< destroy */ | 1469 NULL, /**< destroy */ |
1474 | 1470 |
1475 NULL, /**< ui_info */ | 1471 NULL, /**< ui_info */ |
1476 &prpl_info /**< extra_info */ | 1472 &prpl_info /**< extra_info */ |
1477 }; | 1473 }; |
1490 YAHOO_PAGER_PORT); | 1486 YAHOO_PAGER_PORT); |
1491 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | 1487 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
1492 option); | 1488 option); |
1493 | 1489 |
1494 my_protocol = plugin; | 1490 my_protocol = plugin; |
1491 | |
1492 yahoo_init_colorht(); | |
1495 } | 1493 } |
1496 | 1494 |
1497 GAIM_INIT_PLUGIN(yahoo, init_plugin, info); | 1495 GAIM_INIT_PLUGIN(yahoo, init_plugin, info); |