comparison libpurple/protocols/yahoo/yahoo.c @ 27855:0e732ea68e50

put a type 97 hash on sending a custom status mesagge in yahoo_set_idle()
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 11 Jun 2008 13:04:34 +0000
parents d201287d3a0e
children ea73d3aca380
comparison
equal deleted inserted replaced
27854:fcd28c88459b 27855:0e732ea68e50
3742 3742
3743 return; 3743 return;
3744 } 3744 }
3745 3745
3746 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); 3746 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
3747 if(!pkt) { // yaz 3747 if(!pkt) { // yaz
3748 purple_debug_info("yahoo", "yahoo_set_idle: pkt == NULL\n"); 3748 purple_debug_info("yahoo", "yahoo_set_idle: pkt == NULL\n");
3749 return; 3749 return;
3750 } 3750 }
3751
3751 yahoo_packet_hash_int(pkt, 10, yd->current_status); 3752 yahoo_packet_hash_int(pkt, 10, yd->current_status);
3752 3753
3753 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3754 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
3754 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); 3755 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
3755 yahoo_packet_hash_str(pkt, 19, conv_msg); 3756 yahoo_packet_hash_str(pkt, 19, conv_msg);
3798 } 3799 }
3799 3800
3800 yahoo_packet_hash_int(pkt, 10, yd->current_status); 3801 yahoo_packet_hash_int(pkt, 10, yd->current_status);
3801 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3802 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
3802 const char *tmp; 3803 const char *tmp;
3804 gboolean utf8 = TRUE;
3803 if (status == NULL) 3805 if (status == NULL)
3804 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); 3806 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc)));
3805 tmp = purple_status_get_attr_string(status, "message"); 3807 tmp = purple_status_get_attr_string(status, "message");
3806 if (tmp != NULL) { 3808 if (tmp != NULL) {
3807 msg = yahoo_string_encode(gc, tmp, NULL); 3809 msg = yahoo_string_encode(gc, tmp, &utf8);
3808 msg2 = purple_markup_strip_html(msg); 3810 msg2 = purple_markup_strip_html(msg);
3811 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
3809 yahoo_packet_hash_str(pkt, 19, msg2); // yaz: pkt may be NULL. 3812 yahoo_packet_hash_str(pkt, 19, msg2); // yaz: pkt may be NULL.
3810 } else { 3813 } else {
3811 /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for 3814 /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for
3812 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ 3815 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */
3813 yahoo_packet_hash_str(pkt, 19, _("Away")); 3816 yahoo_packet_hash_str(pkt, 19, _("Away"));