[omemo] Adapt to Gajim changes

This commit is contained in:
wurstsalat
2021-10-24 23:18:07 +02:00
parent 765a660c38
commit 92e27970f7
2 changed files with 6 additions and 8 deletions

View File

@@ -82,8 +82,9 @@ class DeviceManager:
def get_devices_for_encryption(self, jid): def get_devices_for_encryption(self, jid):
devices_for_encryption = [] devices_for_encryption = []
# TODO: client = app.get_client(self._account)
if app.contacts.get_groupchat_contact(self._account, jid) is not None: contact = client.get_module('Contacts').get_contact(jid)
if contact.is_groupchat:
devices_for_encryption = self._get_devices_for_muc_encryption(jid) devices_for_encryption = self._get_devices_for_muc_encryption(jid)
else: else:
devices_for_encryption = self._get_devices_for_encryption(jid) devices_for_encryption = self._get_devices_for_encryption(jid)

View File

@@ -21,7 +21,6 @@ from pathlib import Path
from nbxmpp.namespaces import Namespace from nbxmpp.namespaces import Namespace
from nbxmpp.protocol import NodeProcessed from nbxmpp.protocol import NodeProcessed
from nbxmpp.protocol import JID
from nbxmpp.errors import StanzaError from nbxmpp.errors import StanzaError
from nbxmpp.const import PresenceType from nbxmpp.const import PresenceType
from nbxmpp.const import Affiliation from nbxmpp.const import Affiliation
@@ -257,16 +256,14 @@ class OMEMO(BaseModule):
'trust': GajimTrust[trust.name]}) 'trust': GajimTrust[trust.name]})
def _process_muc_message(self, properties): def _process_muc_message(self, properties):
room_jid = properties.jid.bare
resource = properties.jid.resource resource = properties.jid.resource
if properties.muc_ofrom is not None: if properties.muc_ofrom is not None:
# History Message from MUC # History Message from MUC
return properties.muc_ofrom.bare return properties.muc_ofrom.bare
# TODO: contact = self._con.get_module('Contacts').get_contact(properties.jid)
contact = app.contacts.get_gc_contact(self._account, room_jid, resource) if contact.real_jid is not None:
if contact is not None: return contact.real_jid.bare
return JID.from_string(contact.jid).bare
self._log.info('Groupchat: Last resort trying to find SID in DB') self._log.info('Groupchat: Last resort trying to find SID in DB')
from_jid = self.backend.storage.getJidFromDevice(properties.omemo.sid) from_jid = self.backend.storage.getJidFromDevice(properties.omemo.sid)