Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
3d000af4 by Philipp Hörist at 2023-06-20T20:08:51+02:00
imprv: CommonError: Add 'by' attribute
- - - - -
77c9a119 by Philipp Hörist at 2023-06-21T00:49:27+02:00
feat: SecurityLabels: Add get_label_hash()
- - - - -
2 changed files:
- nbxmpp/modules/security_labels.py
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/modules/security_labels.py
=====================================
@@ -18,6 +18,7 @@
from typing import Dict
from dataclasses import dataclass
+import hashlib
from nbxmpp.protocol import Iq
from nbxmpp.simplexml import Node
@@ -150,6 +151,10 @@ class SecurityLabel:
return cls(displaymarking=displaymarking, label=label)
+ def get_label_hash(self) -> str:
+ sha = hashlib.sha512()
+ sha.update(str(self.label).encode())
+ return sha.hexdigest()
@dataclass
class Catalog:
=====================================
nbxmpp/structs.py
=====================================
@@ -773,10 +773,18 @@ class CommonError:
self.condition_data = self._error_node.getTagData(self.condition)
self.app_condition = stanza.getAppError()
self.type = stanza.getErrorType()
+ self.by = None
self.jid = stanza.getFrom()
self.id = stanza.getID()
self._text = {}
+ by = self._error_node.getAttr('by')
+ if by is not None:
+ try:
+ self.by = JID.from_string(by)
+ except Exception:
+ pass
+
text_elements = self._error_node.getTags('text',
namespace=Namespace.STANZAS)
for element in text_elements:
lang = element.getXmlLang()
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/624ab71cf3cd46e2e43f22e64f2546c95a913a0b...77c9a1197e39b09fab727bd125d5766ad51d8b61
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/624ab71cf3cd46e2e43f22e64f2546c95a913a0b...77c9a1197e39b09fab727bd125d5766ad51d8b61
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]