Ensure data path works on most FS
Also following the same changes in python-omemo. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
d81c7865a6
commit
f755df9dba
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,8 @@
|
|||
|
||||
import os
|
||||
import asyncio
|
||||
import base64
|
||||
import hashlib
|
||||
import logging
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
|
@ -60,7 +62,10 @@ class Plugin(E2EEPlugin):
|
|||
|
||||
self.info = lambda i: self.api.information(i, 'Info')
|
||||
|
||||
data_dir = os.path.join(DATA_HOME, 'omemo', self.core.xmpp.boundjid.bare)
|
||||
jid_str = self.core.xmpp.boundjid.bare.encode('US-ASCII')
|
||||
digest = hashlib.sha256(jid_str).digest()
|
||||
hashed_jid = base64.b32encode(digest).decode('US-ASCII')
|
||||
data_dir = os.path.join(DATA_HOME, 'omemo', hashed_jid)
|
||||
os.makedirs(data_dir, exist_ok=True)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue