plugin XEP-0004: New data form implementation using Pydantic:

This new model is easier to manipulate and serialize, and use the benefits from Pydantic's
data validation mechanisms. It has method to easily convert to/from Wokkel data form or
to/from a domish.Element.

rel 465
This commit is contained in:
Goffi 2025-10-01 17:57:47 +02:00
commit b882fb53ea
2 changed files with 350 additions and 6 deletions

View file

@ -25,7 +25,6 @@ from pathlib import Path
import shutil
from typing import Optional, List, Tuple, Dict, cast
from wokkel.data_form import Option
from libervia import backend
from libervia.backend.core.i18n import _, D_, language_switch
from libervia.backend.core import patches
@ -82,7 +81,6 @@ class LiberviaBackend(service.Service):
# map for short name to whole namespace,
# extended by plugins with register_namespace
self.ns_map = {
"x-data": xmpp.NS_X_DATA,
"disco#info": xmpp.NS_DISCO_INFO,
}

View file

@ -58,9 +58,7 @@ from libervia.backend.tools.common import data_format
log = getLogger(__name__)
NS_X_DATA = "jabber:x:data"
NS_DISCO_INFO = "http://jabber.org/protocol/disco#info"
NS_XML_ELEMENT = "urn:xmpp:xml-element"
NS_ROSTER_VER = "urn:xmpp:features:rosterver"
# we use 2 "@" which is illegal in a jid, to be sure we are not mixing keys
# with roster jids
@ -2067,8 +2065,6 @@ class SatDiscoProtocol(disco.DiscoClientProtocol):
# those features are implemented in Wokkel (or sat_tmp.wokkel)
# and thus are always available
return [
disco.DiscoFeature(NS_X_DATA),
disco.DiscoFeature(NS_XML_ELEMENT),
disco.DiscoFeature(NS_DISCO_INFO),
]