Update idle away to run on vista.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7265 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-02-24 21:58:19 +00:00
committed by derek
parent abc4072fb6
commit 2ad2e2fdc7
3 changed files with 12 additions and 10 deletions

View File

@ -8,7 +8,7 @@
<sourceFolder url="file://$MODULE_DIR$/../../src/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/../../src/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/../../target" /> <excludeFolder url="file://$MODULE_DIR$/../../target" />
</content> </content>
<orderEntry type="jdk" jdkName="JDK 1.5.0" jdkType="JavaSDK" /> <orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported=""> <orderEntry type="module-library" exported="">
<library> <library>

Binary file not shown.

View File

@ -29,14 +29,14 @@ import org.jivesoftware.sparkimpl.plugin.manager.Features;
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences; import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
import org.jivesoftware.sparkimpl.settings.local.SettingsManager; import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
import javax.swing.SwingUtilities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import javax.swing.SwingUtilities;
/** /**
* This manager is responsible for the handling of the XMPPConnection used within Spark. This is used * This manager is responsible for the handling of the XMPPConnection used within Spark. This is used
* for the changing of the users presence, the handling of connection errors and the ability to add * for the changing of the users presence, the handling of connection errors and the ability to add
@ -57,7 +57,7 @@ public final class SessionManager implements ConnectionListener {
private List presenceListeners = new ArrayList(); private List presenceListeners = new ArrayList();
private String userBareAddress; private String userBareAddress;
private boolean unavaliable = false; private boolean unavailable = false;
private DiscoverItems discoverItems; private DiscoverItems discoverItems;
private int previousPriority = -1; private int previousPriority = -1;
@ -82,7 +82,7 @@ public final class SessionManager implements ConnectionListener {
// create workgroup session // create workgroup session
personalDataManager = new PrivateDataManager(getConnection()); personalDataManager = new PrivateDataManager(getConnection());
// Use Idle Listener if running on windows.
if (Spark.isWindows()) { if (Spark.isWindows()) {
try { try {
setIdleListener(); setIdleListener();
@ -258,6 +258,8 @@ public final class SessionManager implements ConnectionListener {
/** /**
* Sets the Idle Timeout for this instance of Spark. * Sets the Idle Timeout for this instance of Spark.
*
* @throws Exception thrown is an error occurs loading native library.
*/ */
private void setIdleListener() throws Exception { private void setIdleListener() throws Exception {
@ -266,7 +268,7 @@ public final class SessionManager implements ConnectionListener {
timer.scheduleAtFixedRate(new TimerTask() { timer.scheduleAtFixedRate(new TimerTask() {
public void run() { public void run() {
LocalPreferences localPref = SettingsManager.getLocalPreferences(); LocalPreferences localPref = SettingsManager.getLocalPreferences();
int delay = 0; int delay;
if (localPref.isIdleOn()) { if (localPref.isIdleOn()) {
delay = localPref.getIdleTime() * 60000; delay = localPref.getIdleTime() * 60000;
} }
@ -287,7 +289,7 @@ public final class SessionManager implements ConnectionListener {
Workspace workspace = SparkManager.getWorkspace(); Workspace workspace = SparkManager.getWorkspace();
Presence presence = workspace.getStatusBar().getPresence(); Presence presence = workspace.getStatusBar().getPresence();
if (workspace != null && presence.getMode() == Presence.Mode.available) { if (workspace != null && presence.getMode() == Presence.Mode.available) {
unavaliable = true; unavailable = true;
StatusItem away = workspace.getStatusBar().getStatusItem("Away"); StatusItem away = workspace.getStatusBar().getStatusItem("Away");
Presence p = away.getPresence(); Presence p = away.getPresence();
if (isLocked) { if (isLocked) {
@ -309,12 +311,12 @@ public final class SessionManager implements ConnectionListener {
} }
} }
else { else {
if (unavaliable) { if (unavailable) {
setAvailableIfActive(); setAvailableIfActive();
} }
} }
} }
}, 1000, 1000); }, 11000, 500);
} }
private void setAvailableIfActive() { private void setAvailableIfActive() {
@ -333,7 +335,7 @@ public final class SessionManager implements ConnectionListener {
} }
changePresence(presence); changePresence(presence);
unavaliable = false; unavailable = false;
} }
} }