public class JabberPresenceService extends java.lang.Object implements PresenceCode
Deals with all presence broadcast and receiving. The service offers easy ways to set your presence and also obtain presence.
NOTE: The presence works in conjunction with the Roster. Here is usually what happens. (1) When you subscribe to a presence, the user will appear in your roster (with no group and no nickname) automatically. (2) When you unsubscribe from a presence, the user will remain in the roster and must be explicitly removed. However, you will not receive any presence notification even though the person is in your roster.
The recommended way in adding and removing subscriptions is through the Roster first. Take a look at RosterService to see what the recommended way in adding and removing users.
SHOW_AWAY, SHOW_CHAT, SHOW_DO_NOT_DISTURB, SHOW_EXTENDED_AWAY, SHOW_ONLINE, TYPE_AVAILABLE, TYPE_INVISIBLE, TYPE_PROBE, TYPE_SUBSCRIBE, TYPE_SUBSCRIBED, TYPE_UNAVAILABLE, TYPE_UNSUBSCRIBE, TYPE_UNSUBSCRIBED| Constructor and Description |
|---|
JabberPresenceService(JabberSession session) |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptSubscribe(JabberPresenceMessage msg)
when you receive a subscribe message, you may pass that subscribe message to this
method to accept the subscription.
|
void |
denySubscribe(JabberPresenceMessage msg)
Takes a subscription request message and uses it to return a reply that declines the subscription request.
|
void |
sendSubscribed(JID jid)
sends a "subscribed" (not subscribe) message to the jid, essentially
giving permission to the JID to know about your subscription.
|
void |
sendUnsubscribed(JID jid)
sends a "unsubscribed" (not unsubscribe) message to the jid, essentially
cancelling any permission given previous to be subscribed to you.
|
void |
setToAvailable(java.lang.String showState,
java.lang.String status,
boolean wait)
sets status to available with optional show state and status line.
|
void |
setToUnavailable()
Sets the status to unavailable.
|
void |
subscribe(JID jid)
request to subscribe to a JID's presence.
|
void |
unsubscribe(JID jid)
unsubscribe from the jid so as not to receive further presence notifications from that jid.
|
public JabberPresenceService(JabberSession session)
public void setToAvailable(java.lang.String showState,
java.lang.String status,
boolean wait)
throws SendMessageFailedException
showState - optional parameter to set the show state (chat, away, extended away, etc), null if not setting a statestatus - the status to set, or null if not setting a status textwait - true if the caller wants to wait until there is a reply to the messageSendMessageFailedExceptionpublic void setToUnavailable()
throws SendMessageFailedException
SendMessageFailedExceptionpublic void subscribe(JID jid) throws SendMessageFailedException
SendMessageFailedExceptionpublic void unsubscribe(JID jid) throws SendMessageFailedException
SendMessageFailedExceptionpublic void sendSubscribed(JID jid) throws SendMessageFailedException
SendMessageFailedExceptionpublic void sendUnsubscribed(JID jid) throws SendMessageFailedException
SendMessageFailedExceptionpublic void acceptSubscribe(JabberPresenceMessage msg) throws SendMessageFailedException
msg - the subscribe message sent by the remoteSendMessageFailedExceptionpublic void denySubscribe(JabberPresenceMessage msg) throws SendMessageFailedException
msg - the subscribe message sent by the remoteSendMessageFailedExceptionCopyright © 2001-2005 Echomine. All Rights Reserved.