Philipp Hörist pushed to branch omemo_integration at gajim / gajim
Commits:
588a8123 by Philipp Hörist at 2022-10-23T02:13:03+02:00
cq: Fix storage annotations
- - - - -
dc4ae5df by Philipp Hörist at 2022-10-23T11:39:58+02:00
fix: Fix import
- - - - -
3 changed files:
- gajim/common/omemo/state.py
- gajim/common/storage/omemo.py
- pyrightconfig.json
Changes:
=====================================
gajim/common/omemo/state.py
=====================================
@@ -37,7 +37,7 @@
from omemo_dr.sessioncipher import SessionCipher
from omemo_dr.state.prekeybundle import PreKeyBundle
from omemo_dr.util.keyhelper import KeyHelper
-from omemo_dr.duplicatemessagexception import DuplicateMessageException
+from omemo_dr.exceptions import DuplicateMessageException
from gajim.common import app
from gajim.common import configpaths
=====================================
gajim/common/storage/omemo.py
=====================================
@@ -103,7 +103,7 @@ def _namedtuple_factory(cursor: sqlite3.Cursor,
fields.append(col_name.lower())
else:
fields.append(col[0])
- return namedtuple('Row', fields)(*row)
+ return namedtuple('Row', fields)(*row) # pyright: ignore
def _generate_axolotl_keys(self) -> None:
identity_key_pair = KeyHelper.generateIdentityKeyPair()
@@ -628,7 +628,7 @@ def storeLocalData(self,
self._con.execute(query, (device_id, public_key, private_key))
self._con.commit()
- def saveIdentity(self, recipientId: int, identityKey: IdentityKey) -> None:
+ def saveIdentity(self, recipientId: str, identityKey: IdentityKey) -> None:
query = '''INSERT INTO identities
(recipient_id, public_key, trust, shown)
VALUES(?, ?, ?, ?)'''
@@ -769,11 +769,11 @@ def getIdentityLastSeen(self,
identity_key: IdentityKey
) -> Optional[int]:
- identity_key = identity_key.getPublicKey().serialize()
+ serialized = identity_key.getPublicKey().serialize()
query = '''SELECT timestamp FROM identities
WHERE recipient_id = ? AND public_key = ?'''
result = self._con.execute(query, (recipient_id,
- identity_key)).fetchone()
+ serialized)).fetchone()
return result.timestamp if result is not None else None
def setIdentityLastSeen(self,
@@ -782,11 +782,11 @@ def setIdentityLastSeen(self,
) -> None:
timestamp = int(time.time())
- identity_key = identity_key.getPublicKey().serialize()
+ serialized = identity_key.getPublicKey().serialize()
self._log.info('Set last seen for %s %s', recipient_id, timestamp)
query = '''UPDATE identities SET timestamp = ?
WHERE recipient_id = ? AND public_key = ?'''
- self._con.execute(query, (timestamp, recipient_id, identity_key))
+ self._con.execute(query, (timestamp, recipient_id, serialized))
self._con.commit()
def getUnacknowledgedCount(self, recipient_id: str, device_id: int) -> int:
@@ -796,6 +796,6 @@ def getUnacknowledgedCount(self, recipient_id: str,
device_id: int) -> int:
state = record.getSessionState()
return state.getSenderChainKey().getIndex()
- def getSubDeviceSessions(self) -> None:
+ def getSubDeviceSessions(self, recipientId: str) -> list[int]:
# Not used
- return None
+ return []
=====================================
pyrightconfig.json
=====================================
@@ -8,7 +8,6 @@
"exclude": [
"**/__pycache__",
".git",
- "gajim/common/storage/omemo.py"
],
"include": [
"launch.py",
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/67b099048600e8a1cde41f63ba882b333ffac80f...dc4ae5df64f4f11fbeb3cdf6228fedc36efc8660
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/67b099048600e8a1cde41f63ba882b333ffac80f...dc4ae5df64f4f11fbeb3cdf6228fedc36efc8660
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits