xep_0384: only clean specified session for a user; use existing storeSession method
Thanks Syndace Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
3fdb7cc953
commit
1f6c13fdd1
1 changed files with 3 additions and 6 deletions
|
@ -78,7 +78,7 @@ class SyncFileStorage(omemo.Storage):
|
|||
|
||||
return self.__sessions.get(bare_jid, {}).get(device_id, None)
|
||||
|
||||
def storeSession(self, callback, bare_jid: str, device_id: int, session) -> None:
|
||||
def storeSession(self, _callback, bare_jid: str, device_id: int, session) -> None:
|
||||
self.__sessions[bare_jid] = self.__sessions.get(bare_jid, {})
|
||||
self.__sessions[bare_jid][device_id] = session
|
||||
|
||||
|
@ -86,11 +86,8 @@ class SyncFileStorage(omemo.Storage):
|
|||
with open(filepath, 'w') as f:
|
||||
json.dump(self.__sessions, f)
|
||||
|
||||
def deleteSession(self, callback, bare_jid: str, device_id: int) -> None:
|
||||
self.__sessions[bare_jid] = {}
|
||||
|
||||
filepath = os.path.join(self.storage_dir, 'sessions.json')
|
||||
os.remove(filepath)
|
||||
def deleteSession(self, _callback, bare_jid: str, device_id: int) -> None:
|
||||
return self.storeSession(None, bare_jid, device_id, {})
|
||||
|
||||
def loadActiveDevices(self, _callback, bare_jid: str) -> Optional[List[int]]:
|
||||
if not self.__devices:
|
||||
|
|
Loading…
Reference in a new issue