mcabber/src/screen.c
changeset 940 fc30221b952d
parent 939 12fa2ae6445d
child 944 aec71ebf98fa
equal deleted inserted replaced
939:12fa2ae6445d 940:fc30221b952d
  1298       oldmsg = NULL;
  1298       oldmsg = NULL;
  1299     }
  1299     }
  1300   }
  1300   }
  1301 }
  1301 }
  1302 
  1302 
  1303 unsigned int scr_GetAutoAwayTimeout()
  1303 unsigned int scr_GetAutoAwayTimeout(time_t now)
  1304 {
  1304 {
       
  1305   enum imstatus cur_st;
  1305   unsigned int autoaway_timeout = settings_opt_get_int("autoaway");
  1306   unsigned int autoaway_timeout = settings_opt_get_int("autoaway");
  1306   time_t now;
       
  1307 
  1307 
  1308   if (Autoaway || !autoaway_timeout)
  1308   if (Autoaway || !autoaway_timeout)
  1309     return (unsigned)INT_MAX;
  1309     return 86400;
  1310 
  1310 
  1311   time(&now);
  1311   cur_st = jb_getstatus();
  1312   if (now > LastActivity + (time_t)autoaway_timeout)
  1312   // Auto-away is disabled for the following states
       
  1313   if ((cur_st != available) && (cur_st != freeforchat))
       
  1314     return 86400;
       
  1315 
       
  1316   if (now >= LastActivity + (time_t)autoaway_timeout)
  1313     return 0;
  1317     return 0;
  1314   else
  1318   else
  1315     return LastActivity + (time_t)autoaway_timeout - now;
  1319     return LastActivity + (time_t)autoaway_timeout - now;
  1316 }
  1320 }
  1317 
  1321