public class PresenceManagerImpl extends BasicModule implements PresenceManager, UserEventListener, XMPPServerListener
SORT_ONLINE_TIME, SORT_USERNAME
Constructor and Description |
---|
PresenceManagerImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
canProbePresence(org.xmpp.packet.JID prober,
String probee)
Returns true if the the prober is allowed to see the presence of the probee.
|
long |
getLastActivity(User user)
Returns the number of milliseconds since the user went offline or -1 if such information
is not available or if the user is online.
|
String |
getLastPresenceStatus(User user)
Returns the status sent by the user in his last unavailable presence or null if the
user is online or never set such information.
|
org.xmpp.packet.Presence |
getPresence(User user)
Returns the user's current presence, or null if the user is unavailable.
|
Collection<org.xmpp.packet.Presence> |
getPresences(String username)
Returns all presences for the user, or null if the user is unavailable.
|
void |
handleProbe(org.xmpp.packet.Presence packet)
Handle a presence probe sent by a remote server.
|
void |
initialize(XMPPServer server)
Initializes the basic module.
|
boolean |
isAvailable(User user)
Returns the availability of the user.
|
void |
probePresence(org.xmpp.packet.JID prober,
org.xmpp.packet.JID probee)
Probes the presence of the given XMPPAddress and attempts to send it to the given user.
|
void |
sendUnavailableFromSessions(org.xmpp.packet.JID recipientJID,
org.xmpp.packet.JID userJID)
Sends unavailable presence from all of the user's available resources to the remote user.
|
void |
serverStarted()
Notification message indicating that the server has been started.
|
void |
serverStopping()
Notification message indication that the server is about to be stopped.
|
void |
start()
Starts the basic module.
|
void |
stop()
Stops the basic module.
|
void |
userAvailable(org.xmpp.packet.Presence presence)
Notification message saying that the sender of the given presence just became available.
|
void |
userCreated(User user,
Map<String,Object> params)
A user was created.
|
void |
userDeleting(User user,
Map<String,Object> params)
A user is being deleted.
|
void |
userModified(User user,
Map<String,Object> params)
A user's name, email, or an extended property was changed.
|
void |
userUnavailable(org.xmpp.packet.Presence presence)
Notification message saying that the sender of the given presence just became unavailable.
|
destroy, getName
public boolean isAvailable(User user)
PresenceManager
Returns the availability of the user.
isAvailable
in interface PresenceManager
user
- the user who's availability is in questionpublic org.xmpp.packet.Presence getPresence(User user)
PresenceManager
getPresence
in interface PresenceManager
user
- the user.public Collection<org.xmpp.packet.Presence> getPresences(String username)
PresenceManager
getPresences
in interface PresenceManager
username
- the name of the user.public String getLastPresenceStatus(User user)
PresenceManager
getLastPresenceStatus
in interface PresenceManager
user
- the user to return his last status informationpublic long getLastActivity(User user)
PresenceManager
getLastActivity
in interface PresenceManager
user
- the user to return his information.public void userAvailable(org.xmpp.packet.Presence presence)
PresenceManager
userAvailable
in interface PresenceManager
presence
- the presence sent by the available user.public void userUnavailable(org.xmpp.packet.Presence presence)
PresenceManager
userUnavailable
in interface PresenceManager
presence
- the presence sent by the unavailable user.public void handleProbe(org.xmpp.packet.Presence packet) throws UnauthorizedException
PresenceManager
handleProbe
in interface PresenceManager
packet
- the received probe presence from a remote server.UnauthorizedException
public boolean canProbePresence(org.xmpp.packet.JID prober, String probee) throws UserNotFoundException
PresenceManager
canProbePresence
in interface PresenceManager
prober
- the user that is trying to probe the presence of another user.probee
- the username of the uset that is being probed.UserNotFoundException
- If the probee does not exist in the local server or the prober
is not present in the roster of the probee.public void probePresence(org.xmpp.packet.JID prober, org.xmpp.packet.JID probee)
PresenceManager
probePresence
in interface PresenceManager
prober
- The user requesting the probeprobee
- The XMPPAddress whos presence we would like sent have have probedpublic void sendUnavailableFromSessions(org.xmpp.packet.JID recipientJID, org.xmpp.packet.JID userJID)
PresenceManager
sendUnavailableFromSessions
in interface PresenceManager
recipientJID
- JID of the remote user that will receive the unavailable presences.userJID
- JID of the local user.public void userCreated(User user, Map<String,Object> params)
UserEventListener
userCreated
in interface UserEventListener
user
- the user.params
- event parameters.public void userDeleting(User user, Map<String,Object> params)
UserEventListener
userDeleting
in interface UserEventListener
user
- the user.params
- event parameters.public void userModified(User user, Map<String,Object> params)
UserEventListener
userModified
in interface UserEventListener
user
- the user.params
- event parameters.public void initialize(XMPPServer server)
BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
initialize
in interface Module
initialize
in class BasicModule
server
- the server hosting this module.public void start() throws IllegalStateException
BasicModule
Starts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
start
in interface Module
start
in class BasicModule
IllegalStateException
- If start is called before initialize
successfully returnspublic void stop()
BasicModule
Stops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
stop
in interface Module
stop
in class BasicModule
public void serverStarted()
XMPPServerListener
serverStarted
in interface XMPPServerListener
public void serverStopping()
XMPPServerListener
serverStopping
in interface XMPPServerListener
Copyright © 2003-2008 Jive Software.