plugin XEP-0384: Implementation of Automatic Trust Management:
- Implementation of Trust Messages (XEP-0434) - Implementation of Automatic Trust Management (XEP-0450) - Implementations directly as part of the OMEMO plugin, since omemo:2 is the only protocol supported by ATM at the moment - Trust system selection updated to allow choice between manual trust with ATM and BTBV - dev-requirements.txt updated to include additional requirements for the e2e tests fix 376
This commit is contained in:
parent
289855c9d1
commit
e062c2f0e5
6 changed files with 818 additions and 161 deletions
|
|
@ -6,3 +6,7 @@ mypy
|
||||||
pylint
|
pylint
|
||||||
pytest
|
pytest
|
||||||
pytest_twisted
|
pytest_twisted
|
||||||
|
|
||||||
|
sh
|
||||||
|
libervia-templates @ hg+https://repos.goffi.org/sat_templates
|
||||||
|
libervia-web @ hg+https://repos.goffi.org/libervia-web
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ html2text==2020.1.16
|
||||||
hyperlink==21.0.0
|
hyperlink==21.0.0
|
||||||
idna==3.3
|
idna==3.3
|
||||||
incremental==21.3.0
|
incremental==21.3.0
|
||||||
Jinja2==3.1.2
|
Jinja2==3.0.3
|
||||||
langid==1.1.6
|
langid==1.1.6
|
||||||
lxml==4.8.0
|
lxml==4.8.0
|
||||||
Mako==1.2.0
|
Mako==1.2.0
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,6 @@ class XEP_0374:
|
||||||
else:
|
else:
|
||||||
# I'm not sure why this check is required, this code is copied from XEP-0384
|
# I'm not sure why this check is required, this code is copied from XEP-0384
|
||||||
if sender_jid.userhostJID() == client.jid.userhostJID():
|
if sender_jid.userhostJID() == client.jid.userhostJID():
|
||||||
# TODO: I've seen this cause an exception "builtins.KeyError: 'to'", seems
|
|
||||||
# like "to" isn't always set.
|
|
||||||
try:
|
try:
|
||||||
feedback_jid = jid.JID(message_elt["to"])
|
feedback_jid = jid.JID(message_elt["to"])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -20,7 +20,7 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import html.entities
|
import html.entities
|
||||||
import re
|
import re
|
||||||
from typing import Optional, Tuple, Union, Literal, overload
|
from typing import Dict, Optional, Tuple, Union, Literal, overload
|
||||||
from xml.dom import NotFoundErr, minidom
|
from xml.dom import NotFoundErr, minidom
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
@ -2030,3 +2030,37 @@ def domish_elt_2_et_elt(elt, lxml = False):
|
||||||
for child in elt.elements():
|
for child in elt.elements():
|
||||||
et_elt.append(domish_elt_2_et_elt(child, lxml=lxml))
|
et_elt.append(domish_elt_2_et_elt(child, lxml=lxml))
|
||||||
return et_elt
|
return et_elt
|
||||||
|
|
||||||
|
|
||||||
|
def domish_elt_2_et_elt2(element: domish.Element) -> ET.Element:
|
||||||
|
"""
|
||||||
|
WIP, originally from the OMEMO plugin
|
||||||
|
"""
|
||||||
|
|
||||||
|
element_name = element.name
|
||||||
|
if element.uri is not None:
|
||||||
|
element_name = "{" + element.uri + "}" + element_name
|
||||||
|
|
||||||
|
attrib: Dict[str, str] = {}
|
||||||
|
for qname, value in element.attributes.items():
|
||||||
|
attribute_name = qname[1] if isinstance(qname, tuple) else qname
|
||||||
|
attribute_namespace = qname[0] if isinstance(qname, tuple) else None
|
||||||
|
if attribute_namespace is not None:
|
||||||
|
attribute_name = "{" + attribute_namespace + "}" + attribute_name
|
||||||
|
|
||||||
|
attrib[attribute_name] = value
|
||||||
|
|
||||||
|
result = ET.Element(element_name, attrib)
|
||||||
|
|
||||||
|
last_child: Optional[ET.Element] = None
|
||||||
|
for child in element.children:
|
||||||
|
if isinstance(child, str):
|
||||||
|
if last_child is None:
|
||||||
|
result.text = child
|
||||||
|
else:
|
||||||
|
last_child.tail = child
|
||||||
|
else:
|
||||||
|
last_child = domish_elt_2_et_elt2(child)
|
||||||
|
result.append(last_child)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
|
||||||
4
setup.py
4
setup.py
|
|
@ -52,8 +52,8 @@ install_requires = [
|
||||||
'urwid-satext == 0.9.*',
|
'urwid-satext == 0.9.*',
|
||||||
'wokkel >= 18.0.0, < 19.0.0',
|
'wokkel >= 18.0.0, < 19.0.0',
|
||||||
'omemo >= 1.0.0, < 2',
|
'omemo >= 1.0.0, < 2',
|
||||||
'twomemo[xml] >= 1.0.0, < 2',
|
'twomemo >= 1.0.0, < 2',
|
||||||
'oldmemo[xml] >= 1.0.0, < 2',
|
'oldmemo >= 1.0.0, < 2',
|
||||||
'pyyaml < 7.0.0',
|
'pyyaml < 7.0.0',
|
||||||
'sqlalchemy >= 1.4',
|
'sqlalchemy >= 1.4',
|
||||||
'alembic',
|
'alembic',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue