changeset 10141:e47d1bf844c9

[gaim-migrate @ 11212] This is the HEAD version of Evan's patch, which does what the oldstatus version did, has the same modifications by me as the oldstatus version, but also makes idle times work again in HEAD for yahoo buddies. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 25 Oct 2004 19:36:23 +0000
parents eab672917bcd
children faab1d04dedf
files src/protocols/yahoo/yahoo.c
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Mon Oct 25 13:45:52 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Mon Oct 25 19:36:23 2004 +0000
@@ -366,7 +366,7 @@
 		else
 			status = "away";
 		break;
-	case YAHOO_STATUS_IDLE: /* FIXME: handle this */
+	case YAHOO_STATUS_IDLE:
 		break;
 	default:
 		gaim_debug_warning("yahoo", "Warning, unknown status %d\n", f->status);
@@ -381,6 +381,10 @@
 			gaim_prpl_got_user_status(gaim_connection_get_account(gc), name, status, NULL);
 	}
 
+	if (f->idle != 0)
+		gaim_prpl_got_user_idle(gaim_connection_get_account(gc), name, TRUE, f->idle);	
+	else
+		gaim_prpl_got_user_idle(gaim_connection_get_account(gc), name, FALSE, 0);	
 }
 
 static void yahoo_process_status(GaimConnection *gc, struct yahoo_packet *pkt)
@@ -447,10 +451,14 @@
 				f->away = 1;
 			else
 				f->away = 0;
-			if (f->status == YAHOO_STATUS_IDLE)
-				f->idle = time(NULL);
-			else
+
+			if (f->status == YAHOO_STATUS_IDLE) {
+				/* Idle may have already been set in a more precise way in case 137 */
+				if (f->idle == 0)
+					f->idle = time(NULL);
+			} else
 				f->idle = 0;
+
 			if (f->status != YAHOO_STATUS_CUSTOM)
 				yahoo_friend_set_status_message(f, NULL);
 
@@ -473,9 +481,14 @@
 			 * mean idle. */
 			if (f->status == YAHOO_STATUS_AVAILABLE)
 				break;
+
 			f->away = strtol(pair->value, NULL, 10);
-			if (f->away == 2)
-				f->idle = time(NULL);
+			if (f->away == 2) {
+				/* Idle may have already been set in a more precise way in case 137 */
+				if (f->idle == 0)
+					f->idle = time(NULL);
+			}
+
 			break;
 		case 138: /* either we're not idle, or we are but won't say how long */
 			if (!f)