public final class PresenceManager extends Manager
Manages subscription requests and presences.
This class allows to request, approve, deny and unsubscribe subscriptions.
This class is unconditionally thread-safe.Modifier and Type | Method and Description |
---|---|
java.lang.String |
approveSubscription(Jid jid)
Approves a subscription request.
|
java.lang.String |
denySubscription(Jid jid)
Cancels a previously granted subscription or denies a subscription request.
|
Presence |
getLastSentPresence()
Gets the last sent (non-directed) presence, that has been broadcast by the server.
|
java.util.Collection<Presence> |
getLastSentPresences()
Gets the last sent presences, that have been sent, including directed presences.
|
Presence |
getPresence(Jid jid)
Gets the presence for a given contact.
|
java.lang.String |
requestSubscription(Jid jid,
java.lang.String status)
Sends a subscription request to a potential contact.
|
java.lang.String |
unsubscribe(Jid jid)
Unsubscribes from a contact’s presence.
|
isEnabled, setEnabled
public final Presence getPresence(Jid jid)
Gets the presence for a given contact.
If the given JID is a bare JID, and the contact has sent multiple presences with different resources, the “best” presence is returned, i.e. the presence with the highest priority or the presence with the “most available” <show/>
element.
If the JID is a full JID, the exact presence of that JID is returned.
If no presence could be found an unavailable presence is returned.
jid
- The JID.public final java.lang.String requestSubscription(Jid jid, java.lang.String status)
Sends a subscription request to a potential contact.
jid
- The contact’s JID.status
- The status, which is used for additional information during the subscription request.public final java.lang.String approveSubscription(Jid jid)
Approves a subscription request.
jid
- The contact’s JID, who has previously requested a subscription.public final java.lang.String denySubscription(Jid jid)
Cancels a previously granted subscription or denies a subscription request.
This basically means that the contact won’t receive presence information from you.
jid
- The contact’s JID, whose subscription is denied or canceled.public final java.lang.String unsubscribe(Jid jid)
Unsubscribes from a contact’s presence.
That basically means, that you will not receive any presence information from the contact anymore.
jid
- The contact’s JID.public final Presence getLastSentPresence()
Gets the last sent (non-directed) presence, that has been broadcast by the server.
public final java.util.Collection<Presence> getLastSentPresences()
Gets the last sent presences, that have been sent, including directed presences.
Copyright © 2014–2019 XMPP.rocks. All rights reserved.