Mercurial > pidgin.yaz
comparison src/protocols/yahoo/yahoo.c @ 6629:bdc448cf4cb6
[gaim-migrate @ 7153]
Tim Ringenbach (marv_sf) writes:
" This patch makes sending colors in yahoo work. It also
makes a few changing to receiving them, and addresses
most of the problems with that patch (which I think
were all related to the fact it didn't do outgoing colors).
It now handles bold, italic, underline, font face, font
size, and font color in both directions. It disables
the background color button if the prpl is yahoo (in a
generic way), and farthermore strips out any <body>
tags that the user might try to type anyway (the yahoo
server purposely mangles them).
It also adds a line to g_strescape some debug messages
because I got tired them of changing the color of my
terminal.
I think I got all the bugs out. If you run with -d or
open the debug window, it will show you what both
conversion function returned, which should help track
down any problems."
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 26 Aug 2003 01:34:51 +0000 |
parents | 156e6643f9db |
children | 889279abb909 |
comparison
equal
deleted
inserted
replaced
6628:31b39f6c2142 | 6629:bdc448cf4cb6 |
---|---|
202 static void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len) | 202 static void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len) |
203 { | 203 { |
204 int pos = 0; | 204 int pos = 0; |
205 | 205 |
206 while (pos + 1 < len) { | 206 while (pos + 1 < len) { |
207 char key[64], *value = NULL; | 207 char key[64], *value = NULL, *esc; |
208 int accept; | 208 int accept; |
209 int x; | 209 int x; |
210 | 210 |
211 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); | 211 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); |
212 | 212 |
236 } | 236 } |
237 value[x] = 0; | 237 value[x] = 0; |
238 pair->value = g_strdup(value); | 238 pair->value = g_strdup(value); |
239 g_free(value); | 239 g_free(value); |
240 pkt->hash = g_slist_append(pkt->hash, pair); | 240 pkt->hash = g_slist_append(pkt->hash, pair); |
241 esc = g_strescape(pair->value, NULL); | |
241 gaim_debug(GAIM_DEBUG_MISC, "yahoo", | 242 gaim_debug(GAIM_DEBUG_MISC, "yahoo", |
242 "Key: %d \tValue: %s\n", pair->key, pair->value); | 243 "Key: %d \tValue: %s\n", pair->key, esc); |
244 g_free(esc); | |
243 } else { | 245 } else { |
244 g_free(pair); | 246 g_free(pair); |
245 } | 247 } |
246 pos += 2; | 248 pos += 2; |
247 | 249 |
973 | 975 |
974 static void yahoo_login(GaimAccount *account) { | 976 static void yahoo_login(GaimAccount *account) { |
975 GaimConnection *gc = gaim_account_get_connection(account); | 977 GaimConnection *gc = gaim_account_get_connection(account); |
976 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); | 978 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
977 | 979 |
980 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR; | |
981 | |
978 gaim_connection_update_progress(gc, _("Connecting"), 1, 2); | 982 gaim_connection_update_progress(gc, _("Connecting"), 1, 2); |
979 | 983 |
980 yd->fd = -1; | 984 yd->fd = -1; |
981 yd->hash = g_hash_table_new(g_str_hash, g_str_equal); | 985 yd->hash = g_hash_table_new(g_str_hash, g_str_equal); |
982 yd->games = g_hash_table_new(g_str_hash, g_str_equal); | 986 yd->games = g_hash_table_new(g_str_hash, g_str_equal); |
1195 | 1199 |
1196 static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, int len, GaimImFlags flags) | 1200 static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, int len, GaimImFlags flags) |
1197 { | 1201 { |
1198 struct yahoo_data *yd = gc->proto_data; | 1202 struct yahoo_data *yd = gc->proto_data; |
1199 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); | 1203 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); |
1200 char *msg = g_strdup(what); | 1204 char *msg = yahoo_html_to_codes(what); |
1201 | 1205 |
1202 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); | 1206 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); |
1203 yahoo_packet_hash(pkt, 5, who); | 1207 yahoo_packet_hash(pkt, 5, who); |
1204 yahoo_packet_hash(pkt, 14, msg); | 1208 yahoo_packet_hash(pkt, 14, msg); |
1205 yahoo_packet_hash(pkt, 97, "1"); | 1209 yahoo_packet_hash(pkt, 97, "1"); |
1206 | 1210 |
1207 yahoo_send_packet(yd, pkt); | 1211 yahoo_send_packet(yd, pkt); |
1208 | 1212 |
1209 yahoo_packet_free(pkt); | 1213 yahoo_packet_free(pkt); |
1210 | 1214 |
1215 g_free(msg); | |
1216 | |
1211 return 1; | 1217 return 1; |
1212 } | 1218 } |
1213 | 1219 |
1214 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) | 1220 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) |
1215 { | 1221 { |
1547 static GaimPlugin *my_protocol = NULL; | 1553 static GaimPlugin *my_protocol = NULL; |
1548 | 1554 |
1549 static GaimPluginProtocolInfo prpl_info = | 1555 static GaimPluginProtocolInfo prpl_info = |
1550 { | 1556 { |
1551 GAIM_PROTO_YAHOO, | 1557 GAIM_PROTO_YAHOO, |
1552 OPT_PROTO_MAIL_CHECK | OPT_PROTO_USE_POINTSIZE, | 1558 OPT_PROTO_MAIL_CHECK, |
1553 NULL, | 1559 NULL, |
1554 NULL, | 1560 NULL, |
1555 yahoo_list_icon, | 1561 yahoo_list_icon, |
1556 yahoo_list_emblems, | 1562 yahoo_list_emblems, |
1557 yahoo_status_text, | 1563 yahoo_status_text, |