Commit 10a9ce80 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Added support for presence events. JM-820

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5197 b35dd754-fafc-0310-a699-88a17e54d16e
parent c69a8076
...@@ -21,6 +21,7 @@ import org.jivesoftware.wildfire.net.SASLAuthentication; ...@@ -21,6 +21,7 @@ import org.jivesoftware.wildfire.net.SASLAuthentication;
import org.jivesoftware.wildfire.net.SocketConnection; import org.jivesoftware.wildfire.net.SocketConnection;
import org.jivesoftware.wildfire.privacy.PrivacyList; import org.jivesoftware.wildfire.privacy.PrivacyList;
import org.jivesoftware.wildfire.privacy.PrivacyListManager; import org.jivesoftware.wildfire.privacy.PrivacyListManager;
import org.jivesoftware.wildfire.user.PresenceEventDispatcher;
import org.jivesoftware.wildfire.user.User; import org.jivesoftware.wildfire.user.User;
import org.jivesoftware.wildfire.user.UserManager; import org.jivesoftware.wildfire.user.UserManager;
import org.jivesoftware.wildfire.user.UserNotFoundException; import org.jivesoftware.wildfire.user.UserNotFoundException;
...@@ -655,16 +656,26 @@ public class ClientSession extends Session { ...@@ -655,16 +656,26 @@ public class ClientSession extends Session {
// an available presence again the session will be initialized again thus receiving // an available presence again the session will be initialized again thus receiving
// offline messages and offline presence subscription requests // offline messages and offline presence subscription requests
setInitialized(false); setInitialized(false);
// Notify listeners that the session is no longer available
PresenceEventDispatcher.unavailableSession(this, presence);
} }
else if (!oldPresence.isAvailable() && this.presence.isAvailable()) { else if (!oldPresence.isAvailable() && this.presence.isAvailable()) {
// The client is available // The client is available
sessionManager.sessionAvailable(this); sessionManager.sessionAvailable(this);
wasAvailable = true; wasAvailable = true;
// Notify listeners that the session is now available
PresenceEventDispatcher.availableSession(this, presence);
} else } else
if (this.presence.isAvailable() && oldPresence.getPriority() != this.presence.getPriority()) if (this.presence.isAvailable() && oldPresence.getPriority() != this.presence.getPriority())
{ {
// The client has changed the priority of his presence // The client has changed the priority of his presence
sessionManager.changePriority(getAddress(), this.presence.getPriority()); sessionManager.changePriority(getAddress(), this.presence.getPriority());
// Notify listeners that the priority of the session/resource has changed
PresenceEventDispatcher.presencePriorityChanged(this, presence);
}
else if (this.presence.isAvailable()) {
// Notify listeners that the show or status value of the presence has changed
PresenceEventDispatcher.presenceChanged(this, presence);
} }
return oldPresence; return oldPresence;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment