comparison libpurple/protocols/yahoo/libymsg.c @ 28603:860998956a4d

Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Tue, 08 Sep 2009 15:44:23 +0000
parents c51f00627af4
children cd3beebb1d13 3d5f1cde625a
comparison
equal deleted inserted replaced
28602:c51f00627af4 28603:860998956a4d
218 f->away = 0; 218 f->away = 0;
219 219
220 if (f->status == YAHOO_STATUS_IDLE) { 220 if (f->status == YAHOO_STATUS_IDLE) {
221 /* Idle may have already been set in a more precise way in case 137 */ 221 /* Idle may have already been set in a more precise way in case 137 */
222 if (f->idle == 0) 222 if (f->idle == 0)
223 f->idle = time(NULL); 223 {
224 if(pkt->service == YAHOO_SERVICE_STATUS_15)
225 f->idle = -1;
226 else
227 f->idle = time(NULL);
228 }
224 } else 229 } else
225 f->idle = 0; 230 f->idle = 0;
226 231
227 if (f->status != YAHOO_STATUS_CUSTOM) 232 if (f->status != YAHOO_STATUS_CUSTOM)
228 yahoo_friend_set_status_message(f, NULL); 233 yahoo_friend_set_status_message(f, NULL);
251 256
252 f->away = strtol(pair->value, NULL, 10); 257 f->away = strtol(pair->value, NULL, 10);
253 if (f->away == 2) { 258 if (f->away == 2) {
254 /* Idle may have already been set in a more precise way in case 137 */ 259 /* Idle may have already been set in a more precise way in case 137 */
255 if (f->idle == 0) 260 if (f->idle == 0)
256 f->idle = time(NULL); 261 {
262 if(pkt->service == YAHOO_SERVICE_STATUS_15)
263 f->idle = -1;
264 else
265 f->idle = time(NULL);
266 }
257 } 267 }
258 268
259 break; 269 break;
260 case 138: /* either we're not idle, or we are but won't say how long */ 270 case 138: /* when value is 1, either we're not idle, or we are but won't say how long */
261 if (!f) 271 if (!f)
262 break; 272 break;
263 273
264 if (f->idle) 274 if( (strtol(pair->value, NULL, 10) == 1) && (f->idle) )
265 f->idle = -1; 275 f->idle = -1;
266 break; 276 break;
267 case 137: /* usually idle time in seconds, sometimes login time */ 277 case 137: /* usually idle time in seconds, sometimes login time */
268 if (!f) 278 if (!f)
269 break; 279 break;