mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Spark-1777 (#202)
This commit is contained in:
@ -42,18 +42,15 @@ public class UserIdlePlugin extends TimerTask implements Plugin {
|
|||||||
private boolean hasChanged = false;
|
private boolean hasChanged = false;
|
||||||
public static LocalPreferences pref = SettingsManager.getLocalPreferences();
|
public static LocalPreferences pref = SettingsManager.getLocalPreferences();
|
||||||
public static Presence latestPresence;
|
public static Presence latestPresence;
|
||||||
private static boolean DesktopLockStatus;
|
|
||||||
private static String statustext;
|
private static String statustext;
|
||||||
private boolean IsLocked;
|
private static boolean IsLocked;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean getFromLockListener() {
|
|
||||||
return IsLocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean getDesktopLockStatus() {
|
public static boolean getDesktopLockStatus() {
|
||||||
|
|
||||||
return DesktopLockStatus;
|
return IsLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,7 +112,7 @@ public class UserIdlePlugin extends TimerTask implements Plugin {
|
|||||||
|
|
||||||
|
|
||||||
private void setOnline() {
|
private void setOnline() {
|
||||||
DesktopLockStatus = false;
|
|
||||||
|
|
||||||
if (PhonePlugin.onPhonePresence != null) {
|
if (PhonePlugin.onPhonePresence != null) {
|
||||||
SparkManager.getSessionManager().changePresence(PhonePlugin.onPhonePresence);
|
SparkManager.getSessionManager().changePresence(PhonePlugin.onPhonePresence);
|
||||||
@ -150,17 +147,13 @@ public class UserIdlePlugin extends TimerTask implements Plugin {
|
|||||||
|
|
||||||
// Windows Desktop Lock
|
// Windows Desktop Lock
|
||||||
if (Spark.isWindows()) {
|
if (Spark.isWindows()) {
|
||||||
if (getFromLockListener() && !getDesktopLockStatus()) {
|
if (IsLocked && !hasChanged) {
|
||||||
setIdle();
|
setIdle();
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
DesktopLockStatus = true;
|
} else if ((getIdleTime() / 1000 > (pref.getIdleTime() * 60)) && !hasChanged && !IsLocked) {
|
||||||
} else if (!getFromLockListener() && getDesktopLockStatus()) {
|
|
||||||
setOnline();
|
|
||||||
hasChanged = false;
|
|
||||||
} else if ((getIdleTime() / 1000 > (pref.getIdleTime() * 60)) && !hasChanged) {
|
|
||||||
setIdle();
|
setIdle();
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if ((getIdleTime() / 1000 < 10) && hasChanged && !getDesktopLockStatus()) {
|
} else if ((getIdleTime() / 1000 < 10) && hasChanged && !IsLocked) {
|
||||||
setOnline();
|
setOnline();
|
||||||
hasChanged = false;
|
hasChanged = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user