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
1 changed files with 6 additions and 1 deletions

View File

@ -827,7 +827,9 @@ public class Roster extends Manager {
* 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.
* 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>
* 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
*/
public boolean isSubscribedToMyPresence(String jid) {
if (connection().getServiceName().equals(jid)) {
return true;
}
RosterEntry entry = getEntry(jid);
if (entry == null) {
return false;