changeset 2139:f8401024ab28

core (roster): added isPresenceAuthorised to check if an entity is authorised to see our presence
author Goffi <goffi@goffi.org>
date Mon, 06 Feb 2017 20:46:59 +0100
parents 6e509ee853a8
children f79935f41125
files src/core/xmpp.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/xmpp.py	Sun Feb 05 15:00:01 2017 +0100
+++ b/src/core/xmpp.py	Mon Feb 06 20:46:59 2017 +0100
@@ -430,6 +430,16 @@
         """Return True if jid is in roster"""
         return entity_jid in self._jids
 
+    def isPresenceAuthorised(self, entity_jid):
+        """Return True if entity is authorised to see our presence"""
+        import pudb
+        pudb.set_trace()
+        try:
+            item = self._jids[entity_jid.userhostJID()]
+        except KeyError:
+            return False
+        return item.subscriptionFrom
+
     def getItems(self):
         """Return all items of the roster"""
         return self._jids.values()