mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +01:00
Add Roster.isSubscribedToMyPresence(String)
This commit is contained in:
parent
b06c3e3607
commit
bf9fb7d2d9
1 changed files with 26 additions and 0 deletions
|
@ -697,6 +697,32 @@ public class Roster {
|
||||||
return Collections.unmodifiableList(res);
|
return Collections.unmodifiableList(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given JID is subscribed to the user's presence.
|
||||||
|
* <p>
|
||||||
|
* If the JID is subscribed to the user's presence then it is allowed to see the presence and
|
||||||
|
* will get notified about presence changes.
|
||||||
|
* </p>
|
||||||
|
* Note that if the roster is not loaded, then this method will always return false.
|
||||||
|
*
|
||||||
|
* @param jid
|
||||||
|
* @return true if the given JID is allowed to see the users presence.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
public boolean isSubscribedToMyPresence(String jid) {
|
||||||
|
RosterEntry entry = getEntry(jid);
|
||||||
|
if (entry == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (entry.getType()) {
|
||||||
|
case from:
|
||||||
|
case both:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key to use in the presenceMap for a fully qualified XMPP ID.
|
* Returns the key to use in the presenceMap for a fully qualified XMPP ID.
|
||||||
* The roster can contain any valid address format such us "domain/resource",
|
* The roster can contain any valid address format such us "domain/resource",
|
||||||
|
|
Loading…
Reference in a new issue