From e493500cfeea3bb737d5c49ab4915f2cd39dca59 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 27 Jan 2015 09:45:50 +0100 Subject: [PATCH] Consider XMPP service name in isSubscribedToMyPresence() --- .../main/java/org/jivesoftware/smack/roster/Roster.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index 17535ace0..3bb9b3ea0 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -827,7 +827,9 @@ public class Roster extends Manager { * Check if the given JID is subscribed to the user's presence. *

* 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. *

* 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;