Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gajim/common/storage/base.py')
-rw-r--r--gajim/common/storage/base.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/gajim/common/storage/base.py b/gajim/common/storage/base.py
index 107c1b65d..9037a6e1b 100644
--- a/gajim/common/storage/base.py
+++ b/gajim/common/storage/base.py
@@ -37,6 +37,7 @@ from nbxmpp.protocol import Iq
from nbxmpp.protocol import JID
from nbxmpp.structs import CommonError
from nbxmpp.structs import DiscoInfo
+from nbxmpp.structs import ReplyData
from nbxmpp.structs import RosterItem
_T = TypeVar('_T')
@@ -68,6 +69,22 @@ sqlite3.register_converter('common_error', _convert_common_error)
sqlite3.register_adapter(CommonError, _adapt_common_error)
+def _convert_reply_data(reply_data: bytes) -> ReplyData:
+ data = json.loads(reply_data)
+ return ReplyData(to=data['to'],
+ id=data['id'],
+ fallback_start=data['fallback_start'],
+ fallback_end=data['fallback_end'])
+
+
+def _adapt_reply_data(reply_data: ReplyData) -> str:
+ return json.dumps(reply_data._asdict())
+
+
+sqlite3.register_converter('reply_data', _convert_reply_data)
+sqlite3.register_adapter(ReplyData, _adapt_reply_data)
+
+
def _convert_marker(marker: bytes):
return 'received' if int(marker) == 0 else 'displayed'