comparison src/protocols/yahoo/yahoo.c @ 9828:e8334906b2fb

[gaim-migrate @ 10699] This stops you from sending a message that's too large on Yahoo! Thanks to Joe Shaw for pointing out a 2000 byte limit, which I haven't bothered to double check myself yet. He provided his own patch, but I did this instead, because he was dropping all packets over 2000 bytes, and I'm not completely sure that's needed yet, and this way is less likely to break something. Hmm I wonder how large conferences work. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 22 Aug 2004 18:50:33 +0000
parents 68368058ee03
children d9ee6b227c77
comparison
equal deleted inserted replaced
9827:430ef8fc963d 9828:e8334906b2fb
2834 struct yahoo_data *yd = gc->proto_data; 2834 struct yahoo_data *yd = gc->proto_data;
2835 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); 2835 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
2836 char *msg = yahoo_html_to_codes(what); 2836 char *msg = yahoo_html_to_codes(what);
2837 char *msg2; 2837 char *msg2;
2838 gboolean utf8 = TRUE; 2838 gboolean utf8 = TRUE;
2839 int ret = 1;
2839 2840
2840 msg2 = yahoo_string_encode(gc, msg, &utf8); 2841 msg2 = yahoo_string_encode(gc, msg, &utf8);
2841 2842
2842 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc)); 2843 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2843 yahoo_packet_hash(pkt, 5, who); 2844 yahoo_packet_hash(pkt, 5, who);
2851 if (!yd->picture_url) 2852 if (!yd->picture_url)
2852 yahoo_packet_hash(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ 2853 yahoo_packet_hash(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */
2853 else 2854 else
2854 yahoo_packet_hash(pkt, 206, "2"); 2855 yahoo_packet_hash(pkt, 206, "2");
2855 2856
2856 yahoo_send_packet(yd, pkt); 2857 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */
2858 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000)
2859 yahoo_send_packet(yd, pkt);
2860 else
2861 ret = -E2BIG;
2857 2862
2858 yahoo_packet_free(pkt); 2863 yahoo_packet_free(pkt);
2859 2864
2860 g_free(msg); 2865 g_free(msg);
2861 g_free(msg2); 2866 g_free(msg2);
2862 2867
2863 return 1; 2868 return ret;
2864 } 2869 }
2865 2870
2866 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) 2871 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ)
2867 { 2872 {
2868 struct yahoo_data *yd = gc->proto_data; 2873 struct yahoo_data *yd = gc->proto_data;