1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 14:55:58 +01:00

Consider XMPP service name in isSubscribedToMyPresence()

This commit is contained in:
Florian Schmaus 2015-01-27 09:45:50 +01:00
parent ed4d815fba
commit e493500cfe

View file

@ -827,7 +827,9 @@ public class Roster extends Manager {
* Check if the given JID is subscribed to the user's presence. * Check if the given JID is subscribed to the user's presence.
* <p> * <p>
* If the JID is subscribed to the user's presence then it is allowed to see the presence and * 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. * will get notified about presence changes. Also returns true, if the JID is the service
* name of the XMPP connection (the "XMPP domain"), i.e. the XMPP service is treated like
* having an implicit subscription to the users presence.
* </p> * </p>
* Note that if the roster is not loaded, then this method will always return false. * Note that if the roster is not loaded, then this method will always return false.
* *
@ -836,6 +838,9 @@ public class Roster extends Manager {
* @since 4.1 * @since 4.1
*/ */
public boolean isSubscribedToMyPresence(String jid) { public boolean isSubscribedToMyPresence(String jid) {
if (connection().getServiceName().equals(jid)) {
return true;
}
RosterEntry entry = getEntry(jid); RosterEntry entry = getEntry(jid);
if (entry == null) { if (entry == null) {
return false; return false;