Improves updating away status.

cusax-fix
Damian Minkov 14 years ago
parent fcb78cba3f
commit dad9377496

@ -203,6 +203,18 @@ public void removeIdleSystemChangeListener(
}
}
/**
* The time since last user input. The time the system has been idle.
* @return time the system has been idle.
*/
public long getTimeSinceLastInput()
{
if(SystemActivityNotifications.isLoaded())
return SystemActivityNotifications.getLastInput();
else
return -1;
}
/**
* Callback method when receiving notifications.
*

@ -355,6 +355,30 @@ else if(evt.getNewState().equals(
{
start();
}
else
{
// or check are we away
if(getSystemActivityNotificationsService()
.getTimeSinceLastInput()
> StatusUpdateThread.getTimer()*60*1000)
{
// we are away, so update the newly registered provider
// do it in new thread to give the provider
// time dispatch his status
new Thread(new Runnable()
{
public void run()
{
try{
Thread.sleep(1000);
}
catch(Throwable t){}
changeProtocolsToAway();
}
}).start();
}
}
}
}
}

@ -63,4 +63,12 @@ public void removeIdleSystemChangeListener(
* @return whether the supplied event id is supported.
*/
public boolean isSupported(int eventID);
/**
* The time since last user input. The time the system has been idle.
* Or -1 if there is no such information or error has occured.
* @return time the system has been idle.
*/
public long getTimeSinceLastInput();
}

Loading…
Cancel
Save