core (xmpp): check that entity_jid is actually a jid in SatRosterProtocol.isJidInRoster
This commit is contained in:
parent
7924b601ab
commit
e2a5f7394e
1 changed files with 8 additions and 0 deletions
|
|
@ -1010,6 +1010,10 @@ class SatMessageProtocol(xmppim.MessageProtocol):
|
|||
xmppim.MessageProtocol.__init__(self)
|
||||
self.host = host
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
return self.parent
|
||||
|
||||
def parseMessage(self, message_elt):
|
||||
"""Parse a message XML and return message_data
|
||||
|
||||
|
|
@ -1141,6 +1145,7 @@ class SatMessageProtocol(xmppim.MessageProtocol):
|
|||
media_type = mimetypes.guess_type(attachment['name'], strict=False)[0]
|
||||
if media_type:
|
||||
attachment[C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE] = media_type
|
||||
|
||||
return data
|
||||
|
||||
def skipEmptyMessage(self, data):
|
||||
|
|
@ -1431,6 +1436,9 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
|
|||
|
||||
def isJidInRoster(self, entity_jid):
|
||||
"""Return True if jid is in roster"""
|
||||
if not isinstance(entity_jid, jid.JID):
|
||||
raise exceptions.InternalError(
|
||||
f"a JID is expected, not {type(entity_jid)}: {entity_jid!r}")
|
||||
return entity_jid in self._jids
|
||||
|
||||
def isPresenceAuthorised(self, entity_jid):
|
||||
|
|
|
|||
Loading…
Reference in a new issue