encryption: Fix account loading for python3.

This commit is contained in:
poljar (Damir Jelić) 2018-06-07 14:43:38 +02:00
parent 86ae77c38c
commit 5c6389fc47

View file

@ -759,15 +759,31 @@ class Olm():
inbound_group_sessions = defaultdict(dict)
try:
account = Account.from_pickle(bytes(account_pickle, "utf-8"))
try:
account_pickle = bytes(account_pickle, "utf-8")
except TypeError:
pass
account = Account.from_pickle(account_pickle)
for db_session in db_sessions:
session_pickle = db_session[2]
try:
session_pickle = bytes(session_pickle, "utf-8")
except TypeError:
pass
sessions[db_session[0]][db_session[1]].append(
Session.from_pickle(bytes(db_session[2], "utf-8")))
Session.from_pickle(session_pickle))
for db_session in db_inbound_group_sessions:
session = InboundGroupSession.from_pickle(
bytes(db_session[1], "utf-8"))
session_pickle = db_session[1]
try:
session_pickle = bytes(session_pickle, "utf-8")
except TypeError:
pass
session = InboundGroupSession.from_pickle(session_pickle)
inbound_group_sessions[db_session[0]][session.id] = session
return cls(user, device_id, session_path, database, account,