Commit bc4a4d08 authored by Tijmen de Mes's avatar Tijmen de Mes

Fixed imdn and propagate account object

parent 8d204ef8
...@@ -1140,11 +1140,11 @@ class MessageManager(object, metaclass=Singleton): ...@@ -1140,11 +1140,11 @@ class MessageManager(object, metaclass=Singleton):
self._send_message(outgoing_message) self._send_message(outgoing_message)
def send_imdn_message(self, session, id, timestamp, state, account=None): def send_imdn_message(self, session, id, timestamp, state, account=None):
if not session.account.sms.use_cpim and not session.account.sms.enable_imdn and account is None: if account is None and not session.account.sms.use_cpim or not session.account.sms.enable_imdn:
return
if account is not None and not account.sms.use_cpim and not account.sms.enable_imdn:
return return
if account is not None:
if not account.sms.use_cpim or not account.sms.enable_imdn:
return
log.debug(f"-- Attempt to send imdn for {id}: {state}") log.debug(f"-- Attempt to send imdn for {id}: {state}")
if state == 'delivered': if state == 'delivered':
......
...@@ -185,7 +185,7 @@ class MessageStream(object, metaclass=MediaStreamType): ...@@ -185,7 +185,7 @@ class MessageStream(object, metaclass=MediaStreamType):
log.warning(f'Decryption failed for {msg_id}, this is not a PGPMessage, error: {e}') log.warning(f'Decryption failed for {msg_id}, this is not a PGPMessage, error: {e}')
return return
key_list = [(session.account.id, self.private_key)] if self.private_key is not None else [] key_list = [(session.account, self.private_key)] if self.private_key is not None else []
key_list.extend(self.other_private_keys) key_list.extend(self.other_private_keys)
error = None error = None
...@@ -193,7 +193,7 @@ class MessageStream(object, metaclass=MediaStreamType): ...@@ -193,7 +193,7 @@ class MessageStream(object, metaclass=MediaStreamType):
try: try:
decrypted_message = key.decrypt(pgpMessage) decrypted_message = key.decrypt(pgpMessage)
except (PGPDecryptionError, PGPError) as error: except (PGPDecryptionError, PGPError) as error:
log.debug(f'-- Decryption failed for {msg_id} with account key {account}, error: {error}') log.debug(f'-- Decryption failed for {msg_id} with account key {account.id}, error: {error}')
continue continue
else: else:
message.content = decrypted_message.message.decode() if isinstance(decrypted_message.message, bytearray) else decrypted_message.message message.content = decrypted_message.message.decode() if isinstance(decrypted_message.message, bytearray) else decrypted_message.message
...@@ -268,5 +268,4 @@ class MessageStream(object, metaclass=MediaStreamType): ...@@ -268,5 +268,4 @@ class MessageStream(object, metaclass=MediaStreamType):
loaded_key = self._load_key(str(account.id), public_key=False) loaded_key = self._load_key(str(account.id), public_key=False)
if loaded_key is None: if loaded_key is None:
continue continue
self.other_private_keys.append((account.id, loaded_key)) self.other_private_keys.append((account, loaded_key))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment