diff src/core/xmpp.py @ 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 cc3a6aea9508
children 1d3f73e065e1
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()