# HG changeset patch # User Evan Schoenberg # Date 1143168508 0 # Node ID a0969be53e17da41abf4f1a57a93d5e64d53a547 # Parent 73f8fa605e5af30a5c0d8429092c60ac0b355d1a [gaim-migrate @ 15937] Patch 1452620 from sadrul to improve Yahoo idle handling: "If you are away with no status-message, and you want to set the account as idle, then the account becomes `online'. When you come back from idle, and you have `away' selected in the statusbox, then the account becomes online." committer: Tailor Script diff -r 73f8fa605e5a -r a0969be53e17 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Thu Mar 23 22:09:03 2006 +0000 +++ b/src/protocols/yahoo/yahoo.c Fri Mar 24 02:48:28 2006 +0000 @@ -3235,25 +3235,31 @@ struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = NULL; char *msg = NULL, *msg2 = NULL; - - if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) + GaimStatus *status = NULL; + + if (idle && yd->current_status != YAHOO_STATUS_IDLE) yd->current_status = YAHOO_STATUS_IDLE; - else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) - yd->current_status = YAHOO_STATUS_AVAILABLE; + else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { + status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); + yd->current_status = get_yahoo_status_from_gaim_status(status); + } pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash_int(pkt, 10, yd->current_status); if (yd->current_status == YAHOO_STATUS_CUSTOM) { const char *tmp; - GaimStatus *status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); + if (status == NULL) + status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); tmp = gaim_status_get_attr_string(status, "message"); if (tmp != NULL) { msg = yahoo_string_encode(gc, tmp, NULL); msg2 = gaim_markup_strip_html(msg); yahoo_packet_hash_str(pkt, 19, msg2); } else { - yahoo_packet_hash_str(pkt, 19, ""); + /* get_yahoo_status_from_gaim_status() returns YAHOO_STATUS_CUSTOM for + * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ + yahoo_packet_hash_str(pkt, 19, _("Away")); } } else { yahoo_packet_hash_str(pkt, 19, "");