Mercurial > libervia-backend
comparison sat/core/constants.py @ 3911:8289ac1b34f4
plugin XEP-0384: Fully reworked to adjust to the reworked python-omemo:
- support for both (modern) OMEMO under the `urn:xmpp:omemo:2` namespace and (legacy) OMEMO under the `eu.siacs.conversations.axolotl` namespace
- maintains one identity across both versions of OMEMO
- migrates data from the old plugin
- includes more features for protocol stability
- uses SCE for modern OMEMO
- fully type-checked, linted and format-checked
- added type hints to various pieces of backend code used by the plugin
- added stubs for some Twisted APIs used by the plugin under stubs/ (use `export MYPYPATH=stubs/` before running mypy)
- core (xmpp): enabled `send` trigger and made it an asyncPoint
fix 375
author | Syndace <me@syndace.dev> |
---|---|
date | Tue, 23 Aug 2022 21:06:24 +0200 |
parents | a58715ffa445 |
children | e345d93fb6e5 |
comparison
equal
deleted
inserted
replaced
3910:199598223f82 | 3911:8289ac1b34f4 |
---|---|
20 from xdg import BaseDirectory | 20 from xdg import BaseDirectory |
21 from os.path import expanduser, realpath | 21 from os.path import expanduser, realpath |
22 except ImportError: | 22 except ImportError: |
23 BaseDirectory = None | 23 BaseDirectory = None |
24 from os.path import dirname | 24 from os.path import dirname |
25 from typing_extensions import Final | |
25 import sat | 26 import sat |
26 | 27 |
27 | 28 |
28 class Const(object): | 29 class Const(object): |
29 | 30 |
124 MESS_EXTRA_INFO = "info_type" | 125 MESS_EXTRA_INFO = "info_type" |
125 EXTRA_INFO_DECR_ERR = "DECRYPTION_ERROR" | 126 EXTRA_INFO_DECR_ERR = "DECRYPTION_ERROR" |
126 EXTRA_INFO_ENCR_ERR = "ENCRYPTION_ERROR" | 127 EXTRA_INFO_ENCR_ERR = "ENCRYPTION_ERROR" |
127 | 128 |
128 # encryption is a key for plugins | 129 # encryption is a key for plugins |
129 MESS_KEY_ENCRYPTION = "ENCRYPTION" | 130 MESS_KEY_ENCRYPTION: Final = "ENCRYPTION" |
130 # encrypted is a key for frontends | 131 # encrypted is a key for frontends |
131 MESS_KEY_ENCRYPTED = "encrypted" | 132 MESS_KEY_ENCRYPTED = "encrypted" |
132 MESS_KEY_TRUSTED = "trusted" | 133 MESS_KEY_TRUSTED = "trusted" |
133 | 134 |
134 MESS_KEY_ATTACHMENTS = "attachments" | 135 MESS_KEY_ATTACHMENTS = "attachments" |
429 """@return (bool): bool value for associated constant""" | 430 """@return (bool): bool value for associated constant""" |
430 assert isinstance(value, str) | 431 assert isinstance(value, str) |
431 return value.lower() in (cls.BOOL_TRUE, "1", "yes", "on") | 432 return value.lower() in (cls.BOOL_TRUE, "1", "yes", "on") |
432 | 433 |
433 @classmethod | 434 @classmethod |
434 def boolConst(cls, value): | 435 def boolConst(cls, value: bool) -> str: |
435 """@return (str): constant associated to bool value""" | 436 """@return (str): constant associated to bool value""" |
436 assert isinstance(value, bool) | 437 assert isinstance(value, bool) |
437 return cls.BOOL_TRUE if value else cls.BOOL_FALSE | 438 return cls.BOOL_TRUE if value else cls.BOOL_FALSE |
438 | 439 |
439 | 440 |