Openfire 3.5.2 Javadoc

org.jivesoftware.openfire
Interface PresenceManager

All Known Implementing Classes:
PresenceManagerImpl

public interface PresenceManager

The presence manager tracks on a global basis who's online. The presence monitor watches and reports on what users are present on the server, and in other jabber domains that it knows about. The presence manager does not know about invisible users (they are invisible).

Author:
Iain Shigeoka

Field Summary
static int SORT_ONLINE_TIME
          Sort by online time.
static int SORT_USERNAME
          Sort by username.
 
Method Summary
 boolean canProbePresence(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.
 Presence getPresence(User user)
          Returns the user's current presence, or null if the user is unavailable.
 Collection<Presence> getPresences(String username)
          Returns all presences for the user, or null if the user is unavailable.
 void handleProbe(Presence packet)
          Handle a presence probe sent by a remote server.
 boolean isAvailable(User user)
          Returns the availability of the user.
 void probePresence(JID prober, JID probee)
          Probes the presence of the given XMPPAddress and attempts to send it to the given user.
 void sendUnavailableFromSessions(JID recipientJID, JID userJID)
          Sends unavailable presence from all of the user's available resources to the remote user.
 void userAvailable(Presence presence)
          Notification message saying that the sender of the given presence just became available.
 void userUnavailable(Presence presence)
          Notification message saying that the sender of the given presence just became unavailable.
 

Field Detail

SORT_USERNAME

static final int SORT_USERNAME
Sort by username.

See Also:
Constant Field Values

SORT_ONLINE_TIME

static final int SORT_ONLINE_TIME
Sort by online time.

See Also:
Constant Field Values
Method Detail

isAvailable

boolean isAvailable(User user)

Returns the availability of the user.

Parameters:
user - the user who's availability is in question
Returns:
true if the user as available for messaging (1 or more available sessions)

getPresence

Presence getPresence(User user)
Returns the user's current presence, or null if the user is unavailable. If the user is connected with more than one session, the user's "most available" presence status is returned.

Parameters:
user - the user.
Returns:
the user's current presence.

getPresences

Collection<Presence> getPresences(String username)
Returns all presences for the user, or null if the user is unavailable.

Parameters:
username - the name of the user.
Returns:
the Presence packets for all the users's connected sessions.

probePresence

void probePresence(JID prober,
                   JID probee)
Probes the presence of the given XMPPAddress and attempts to send it to the given user. If the user probing the presence is using his bare JID then the probee's presence will be sent to all connected resources of the prober.

Parameters:
prober - The user requesting the probe
probee - The XMPPAddress whos presence we would like sent have have probed

handleProbe

void handleProbe(Presence packet)
                 throws UnauthorizedException
Handle a presence probe sent by a remote server. The logic to apply is the following: If the remote user is not in the local user's roster with a subscription state of "From", or "Both", then return a presence stanza of type "error" in response to the presence probe. Otherwise, answer the presence of the local user sessions or the last unavailable presence.

Parameters:
packet - the received probe presence from a remote server.
Throws:
UnauthorizedException

canProbePresence

boolean canProbePresence(JID prober,
                         String probee)
                         throws UserNotFoundException
Returns true if the the prober is allowed to see the presence of the probee.

Parameters:
prober - the user that is trying to probe the presence of another user.
probee - the username of the uset that is being probed.
Returns:
true if the the prober is allowed to see the presence of the probee.
Throws:
UserNotFoundException - If the probee does not exist in the local server or the prober is not present in the roster of the probee.

sendUnavailableFromSessions

void sendUnavailableFromSessions(JID recipientJID,
                                 JID userJID)
Sends unavailable presence from all of the user's available resources to the remote user. When a remote user unsubscribes from the presence of a local user then the server should send to the remote user unavailable presence from all of the local user's available resources. Moreover, if the recipient user is a local user then the unavailable presence will be sent to all user resources.

Parameters:
recipientJID - JID of the remote user that will receive the unavailable presences.
userJID - JID of the local user.

userAvailable

void userAvailable(Presence presence)
Notification message saying that the sender of the given presence just became available.

Parameters:
presence - the presence sent by the available user.

userUnavailable

void userUnavailable(Presence presence)
Notification message saying that the sender of the given presence just became unavailable.

Parameters:
presence - the presence sent by the unavailable user.

getLastPresenceStatus

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.

Parameters:
user - the user to return his last status information
Returns:
the status sent by the user in his last unavailable presence or null if the user is online or never set such information.

getLastActivity

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.

Parameters:
user - the user to return his information.
Returns:
the number of milliseconds since the user went offline or -1 if such information is not available or if the user is online.

Openfire 3.5.2 Javadoc

Copyright © 2003-2007 Jive Software.