comparison sat/core/xmpp.py @ 3585:31628770a15a

core (xmpp): renamed `SatRosterProtocol.presenceSubscribed` to `isSubscribedFrom` (and added `isSubscribedTo`)
author Goffi <goffi@goffi.org>
date Wed, 28 Jul 2021 22:15:31 +0200
parents 813595f88612
children 09f5ac48ffe3
comparison
equal deleted inserted replaced
3584:edc79cefe968 3585:31628770a15a
1550 if not isinstance(entity_jid, jid.JID): 1550 if not isinstance(entity_jid, jid.JID):
1551 raise exceptions.InternalError( 1551 raise exceptions.InternalError(
1552 f"a JID is expected, not {type(entity_jid)}: {entity_jid!r}") 1552 f"a JID is expected, not {type(entity_jid)}: {entity_jid!r}")
1553 return entity_jid in self._jids 1553 return entity_jid in self._jids
1554 1554
1555 def isPresenceAuthorised(self, entity_jid): 1555 def isSubscribedFrom(self, entity_jid: jid.JID) -> bool:
1556 """Return True if entity is authorised to see our presence""" 1556 """Return True if entity is authorised to see our presence"""
1557 try: 1557 try:
1558 item = self._jids[entity_jid.userhostJID()] 1558 item = self._jids[entity_jid.userhostJID()]
1559 except KeyError: 1559 except KeyError:
1560 return False 1560 return False
1561 return item.subscriptionFrom 1561 return item.subscriptionFrom
1562
1563 def isSubscribedTo(self, entity_jid: jid.JID) -> bool:
1564 """Return True if we are subscribed to entity"""
1565 try:
1566 item = self._jids[entity_jid.userhostJID()]
1567 except KeyError:
1568 return False
1569 return item.subscriptionTo
1562 1570
1563 def getItems(self): 1571 def getItems(self):
1564 """Return all items of the roster""" 1572 """Return all items of the roster"""
1565 return list(self._jids.values()) 1573 return list(self._jids.values())
1566 1574