core (types): Renamed libervia.backend.core.core_types.MessageData to MessageDataLegacy:
There are 2 concurrent models, this one is an historical legacy. The type to use the one from `libervia.backend.models.core`, and it will progressively be used everywhere and fully based on Pydantic.
This commit is contained in:
parent
8302d09cf6
commit
0df0b0a5d0
1 changed files with 21 additions and 18 deletions
|
|
@ -27,7 +27,7 @@ from twisted.words.protocols.jabber import jid
|
|||
from twisted.words.xish import domish
|
||||
|
||||
from libervia.backend.core.constants import Const as C
|
||||
from libervia.backend.core.core_types import MessageData, SatXMPPEntity
|
||||
from libervia.backend.core.core_types import MessageDataLegacy, SatXMPPEntity
|
||||
from libervia.backend.core.i18n import _
|
||||
from libervia.backend.core.log import getLogger
|
||||
from libervia.backend.memory import persistent
|
||||
|
|
@ -159,7 +159,7 @@ class Autocrypt:
|
|||
client._autocrypt_gpg_provider = get_gpg_provider(self.host, client)
|
||||
|
||||
async def handle_autocrypt_data(
|
||||
self, client: SatXMPPEntity, mess_data: MessageData, autocrypt_data_raw: str
|
||||
self, client: SatXMPPEntity, mess_data: MessageDataLegacy, autocrypt_data_raw: str
|
||||
) -> None:
|
||||
"""Process Autocrypt header from XMPP email gateway
|
||||
|
||||
|
|
@ -211,8 +211,8 @@ class Autocrypt:
|
|||
client._autocrypt_seen.add(sender_email)
|
||||
|
||||
def _check_headers(
|
||||
self, client: SatXMPPEntity, mess_data: MessageData
|
||||
) -> MessageData:
|
||||
self, client: SatXMPPEntity, mess_data: MessageDataLegacy
|
||||
) -> MessageDataLegacy:
|
||||
try:
|
||||
autocrypt_data = mess_data["extra"]["headers"]["autocrypt"]
|
||||
except KeyError:
|
||||
|
|
@ -232,7 +232,7 @@ class Autocrypt:
|
|||
post_treat.addCallback(partial(self._check_headers, client))
|
||||
return True
|
||||
|
||||
async def add_autocrypt_header(self, client, mess_data: MessageData) -> MessageData:
|
||||
async def add_autocrypt_header(self, client, mess_data: MessageDataLegacy) -> MessageDataLegacy:
|
||||
to_jid = mess_data["to"]
|
||||
if await self.host.memory.disco.has_identity(
|
||||
client, "gateway", "smtp", jid.JID(to_jid.host)
|
||||
|
|
@ -265,7 +265,7 @@ class Autocrypt:
|
|||
) -> Literal[True]:
|
||||
"""Process the XEP-0131 related data to be sent"""
|
||||
|
||||
def add_headers(mess_data: MessageData) -> MessageData:
|
||||
def add_headers(mess_data: MessageDataLegacy) -> MessageDataLegacy:
|
||||
extra = mess_data["extra"]
|
||||
self.move_keywords_to_headers(extra)
|
||||
# Now we parse headers, if any.
|
||||
|
|
|
|||
Loading…
Reference in a new issue