comparison libervia/backend/core/xmpp.py @ 4306:94e0968987cd

plugin XEP-0033: code modernisation, improve delivery, data validation: - Code has been rewritten using Pydantic models and `async` coroutines for data validation and cleaner element parsing/generation. - Delivery has been completely rewritten. It now works even if server doesn't support multicast, and send to local multicast service first. Delivering to local multicast service first is due to bad support of XEP-0033 in server (notably Prosody which has an incomplete implementation), and the current impossibility to detect if a sub-domain service handles fully multicast or only for local domains. This is a workaround to have a good balance between backward compatilibity and use of bandwith, and to make it work with the incoming email gateway implementation (the gateway will only deliver to entities of its own domain). - disco feature checking now uses `async` corountines. `host` implementation still use Deferred return values for compatibility with legacy code. rel 450
author Goffi <goffi@goffi.org>
date Thu, 26 Sep 2024 16:12:01 +0200
parents 0f953ce5f0a8
children
comparison
equal deleted inserted replaced
4305:4cd4922de876 4306:94e0968987cd
715 don't handle full stanza encryption 715 don't handle full stanza encryption
716 This trigger can return a Deferred (it's an async_point) 716 This trigger can return a Deferred (it's an async_point)
717 @param mess_data(dict): message data as constructed by onMessage workflow 717 @param mess_data(dict): message data as constructed by onMessage workflow
718 @return (dict): mess_data (so it can be used in a deferred chain) 718 @return (dict): mess_data (so it can be used in a deferred chain)
719 """ 719 """
720 # XXX: This is the last trigger before u"send" (last but one globally) 720 # XXX: This is the last trigger before "send" (last but one globally)
721 # for sending message. 721 # for sending message.
722 # This is intented for e2e encryption which doesn't do full stanza 722 # This is intented for e2e encryption which doesn't do full stanza
723 # encryption (e.g. OTR) 723 # encryption (e.g. OTR)
724 # This trigger point can't cancel the method 724 # This trigger point can't cancel the method
725 await self.host_app.trigger.async_point( 725 await self.host_app.trigger.async_point(
892 892
893 def message_send_to_bridge(self, data): 893 def message_send_to_bridge(self, data):
894 """Send message to bridge, so frontends can display it 894 """Send message to bridge, so frontends can display it
895 895
896 @param data: message data dictionnary 896 @param data: message data dictionnary
897 @param client: profile's client
898 """ 897 """
899 if data["type"] != C.MESS_TYPE_GROUPCHAT: 898 if data["type"] != C.MESS_TYPE_GROUPCHAT:
900 # we don't send groupchat message to bridge, as we get them back 899 # we don't send groupchat message to bridge, as we get them back
901 # and they will be added the 900 # and they will be added the
902 901