changeset 13558:a0969be53e17

[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 <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 24 Mar 2006 02:48:28 +0000
parents 73f8fa605e5a
children bbbde2f5c03b
files src/protocols/yahoo/yahoo.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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, "");