diff --git a/matrix/encryption.py b/matrix/encryption.py index 9c867b0..2970041 100644 --- a/matrix/encryption.py +++ b/matrix/encryption.py @@ -39,10 +39,14 @@ except NameError: import matrix.globals try: - from olm.account import Account, OlmAccountError - from olm.session import (Session, InboundSession, OutboundSession, - OlmSessionError, OlmPreKeyMessage) - from olm.group_session import ( + from olm import ( + Account, + OlmAccountError, + Session, + InboundSession, + OutboundSession, + OlmSessionError, + OlmPreKeyMessage, InboundGroupSession, OutboundGroupSession, OlmGroupSessionError @@ -787,7 +791,7 @@ class Olm(): cursor.execute("""update olmsessions set pickle=? where user = ? and session_id = ? and device_id = ?""", - (session.pickle(), user, session.id(), + (session.pickle(), user, session.id, device_id)) self.database.commit() @@ -800,7 +804,7 @@ class Olm(): for session in session_dict.values(): cursor.execute("""update inbound_group_sessions set pickle=? where room_id = ? and session_id = ?""", - (session.pickle(), room_id, session.id())) + (session.pickle(), room_id, session.id)) self.database.commit() cursor.close() @@ -809,7 +813,7 @@ class Olm(): cursor = self.database.cursor() cursor.execute("insert into olmsessions values(?,?,?,?)", - (user, device_id, session.id(), session.pickle())) + (user, device_id, session.id, session.pickle())) self.database.commit() diff --git a/matrix/server.py b/matrix/server.py index 98c6c69..163b4be 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -556,7 +556,7 @@ class MatrixServer: def upload_keys(self, device_keys=False, one_time_keys=False): keys = self.olm.account.identity_keys() if device_keys else None - one_time_keys = (self.olm.account.one_time_keys()["curve25519"] if + one_time_keys = (self.olm.account.one_time_keys["curve25519"] if one_time_keys else None) message = MatrixKeyUploadMessage(self.client, self.user_id, @@ -566,7 +566,7 @@ class MatrixServer: @encrypt_enabled def check_one_time_keys(self, key_count): - max_keys = self.olm.account.max_one_time_keys() + max_keys = self.olm.account.max_one_time_keys key_count = (max_keys / 2) - key_count