besser82 / rpms / pidgin

Forked from rpms/pidgin 6 years ago
Clone
Blob Blame History Raw
http://developer.pidgin.im/viewmtn/revision/info/40005b889ee276fbcd0a4e886a68d8a8cce45698
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099

#
#
# patch "libpurple/protocols/yahoo/libymsg.c"
#  from [87ad7ef7612ac888772e8afa7bcb20743f1b3d9c]
#    to [9f4d92c3fc86e7a91514246a63ebbd3b9c5c6f05]
#
============================================================
--- libpurple/protocols/yahoo/libymsg.c	87ad7ef7612ac888772e8afa7bcb20743f1b3d9c
+++ libpurple/protocols/yahoo/libymsg.c	9f4d92c3fc86e7a91514246a63ebbd3b9c5c6f05
@@ -220,7 +220,12 @@ static void yahoo_process_status(PurpleC
 			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);
+				{
+					if(pkt->service == YAHOO_SERVICE_STATUS_15)
+						f->idle = -1;
+					else
+						f->idle = time(NULL);
+				}
 			} else
 				f->idle = 0;
 
@@ -253,15 +258,20 @@ static void yahoo_process_status(PurpleC
 			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);
+				{
+					if(pkt->service == YAHOO_SERVICE_STATUS_15)
+						f->idle = -1;
+					else
+						f->idle = time(NULL);
+				}
 			}
 
 			break;
-		case 138: /* either we're not idle, or we are but won't say how long */
+		case 138: /* when value is 1, either we're not idle, or we are but won't say how long */
 			if (!f)
 				break;
 
-			if (f->idle)
+			if( (strtol(pair->value, NULL, 10) == 1) && (f->idle) )
 				f->idle = -1;
 			break;
 		case 137: /* usually idle time in seconds, sometimes login time */