diff options
author | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-05 01:20:45 +0100 |
---|---|---|
committer | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-05 01:20:45 +0100 |
commit | aa5d422f38889edf2131d840ca50e3fb8a603420 (patch) | |
tree | 586ab1e09e9c368814a9a5a26313203af4f050a7 /slixmpp | |
parent | 05749c49690c00f2b1794212b2fb9281b6956a89 (diff) | |
parent | 684247b375cb629c6a63944e12a42dd9ae59ac7c (diff) | |
download | slixmpp-aa5d422f38889edf2131d840ca50e3fb8a603420.tar.gz slixmpp-aa5d422f38889edf2131d840ca50e3fb8a603420.tar.bz2 slixmpp-aa5d422f38889edf2131d840ca50e3fb8a603420.tar.xz slixmpp-aa5d422f38889edf2131d840ca50e3fb8a603420.zip |
Merge branch 'doap' into 'master'
DOAP di doap
See merge request poezio/slixmpp!76
Diffstat (limited to 'slixmpp')
-rw-r--r-- | slixmpp/plugins/__init__.py | 29 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0300/hash.py | 20 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0352/csi.py | 13 |
3 files changed, 37 insertions, 25 deletions
diff --git a/slixmpp/plugins/__init__.py b/slixmpp/plugins/__init__.py index 02ac3712..f37fdcfb 100644 --- a/slixmpp/plugins/__init__.py +++ b/slixmpp/plugins/__init__.py @@ -16,14 +16,14 @@ __all__ = [ 'xep_0009', # Jabber-RPC 'xep_0012', # Last Activity 'xep_0013', # Flexible Offline Message Retrieval - 'xep_0016', # Privacy Lists +# 'xep_0016', # Privacy Lists. Don’t automatically load 'xep_0020', # Feature Negotiation 'xep_0027', # Current Jabber OpenPGP Usage 'xep_0030', # Service Discovery 'xep_0033', # Extended Stanza Addresses 'xep_0045', # Multi-User Chat (Client) 'xep_0047', # In-Band Bytestreams - 'xep_0048', # Bookmarks +# 'xep_0048', # Legacy Bookmarks. Don’t automatically load 'xep_0049', # Private XML Storage 'xep_0050', # Ad-hoc Commands 'xep_0054', # vcard-temp @@ -31,17 +31,20 @@ __all__ = [ 'xep_0060', # Pubsub (Client) 'xep_0065', # SOCKS5 Bytestreams 'xep_0066', # Out of Band Data + 'xep_0070', # Verifying HTTP Requests via XMPP 'xep_0071', # XHTML-IM 'xep_0077', # In-Band Registration -# 'xep_0078', # Non-SASL auth. Don't automatically load +# 'xep_0078', # Non-SASL auth. Don’t automatically load 'xep_0079', # Advanced Message Processing 'xep_0080', # User Location 'xep_0082', # XMPP Date and Time Profiles 'xep_0084', # User Avatar 'xep_0085', # Chat State Notifications 'xep_0086', # Legacy Error Codes - 'xep_0091', # Legacy Delayed Delivery +# 'xep_0091', # Legacy Delayed Delivery. Don’t automatically load 'xep_0092', # Software Version +# 'xep_0095', # Legacy Stream Initiation. Don’t automatically load +# 'xep_0096', # Legacy SI File Transfer. Don’t automatically load 'xep_0106', # JID Escaping 'xep_0107', # User Mood 'xep_0108', # User Activity @@ -51,6 +54,7 @@ __all__ = [ 'xep_0128', # Extended Service Discovery 'xep_0131', # Standard Headers and Internet Metadata 'xep_0133', # Service Administration +# 'xep_0138', # Stream Compression. Broken atm 'xep_0152', # Reachability Addresses 'xep_0153', # vCard-Based Avatars 'xep_0163', # Personal Eventing Protocol @@ -69,27 +73,34 @@ __all__ = [ 'xep_0224', # Attention 'xep_0231', # Bits of Binary 'xep_0235', # OAuth Over XMPP - 'xep_0242', # XMPP Client Compliance 2009 +# 'xep_0242', # XMPP Client Compliance 2009. Don’t automatically load 'xep_0249', # Direct MUC Invitations 'xep_0256', # Last Activity in Presence 'xep_0257', # Client Certificate Management for SASL EXTERNAL 'xep_0258', # Security Labels in XMPP - 'xep_0270', # XMPP Compliance Suites 2010 +# 'xep_0270', # XMPP Compliance Suites 2010. Don’t automatically load 'xep_0279', # Server IP Check 'xep_0280', # Message Carbons 'xep_0297', # Stanza Forwarding - 'xep_0302', # XMPP Compliance Suites 2012 + 'xep_0300', # Use of Cryptographic Hash Functions in XMPP +# 'xep_0302', # XMPP Compliance Suites 2012. Don’t automatically load 'xep_0308', # Last Message Correction 'xep_0313', # Message Archive Management 'xep_0319', # Last User Interaction in Presence - 'xep_0323', # IoT Systems Sensor Data - 'xep_0325', # IoT Systems Control +# 'xep_0323', # IoT Systems Sensor Data. Don’t automatically load +# 'xep_0325', # IoT Systems Control. Don’t automatically load 'xep_0332', # HTTP Over XMPP Transport + 'xep_0333', # Chat Markers + 'xep_0334', # Message Processing Hints + 'xep_0335', # JSON Containers + 'xep_0352', # Client State Indication 'xep_0353', # Jingle Message Initiation 'xep_0359', # Unique and Stable Stanza IDs 'xep_0363', # HTTP File Upload 'xep_0369', # MIX-CORE 'xep_0377', # Spam reporting + 'xep_0380', # Explicit Message Encryption + 'xep_0394', # Message Markup 'xep_0403', # MIX-Presence 'xep_0404', # MIX-Anon 'xep_0405', # MIX-PAM diff --git a/slixmpp/plugins/xep_0300/hash.py b/slixmpp/plugins/xep_0300/hash.py index 6095671d..75252d0c 100644 --- a/slixmpp/plugins/xep_0300/hash.py +++ b/slixmpp/plugins/xep_0300/hash.py @@ -39,25 +39,22 @@ class XEP_0300(BasePlugin): 'sha-1': hashlib.sha1, 'sha-256': hashlib.sha256, 'sha-512': hashlib.sha512, - 'sha3-256': lambda: hashlib.sha3_256(), - 'sha3-512': lambda: hashlib.sha3_512(), + 'sha3-256': hashlib.sha3_256, + 'sha3-512': hashlib.sha3_512, 'BLAKE2b256': lambda: hashlib.blake2b(digest_size=32), 'BLAKE2b512': lambda: hashlib.blake2b(digest_size=64), } + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.enabled_hashes = [] + def plugin_init(self): namespace = 'urn:xmpp:hash-function-text-names:%s' - self.enabled_hashes = [] + self.enabled_hashes.clear() for algo in self._hashlib_function: if getattr(self, 'enable_' + algo, False): - # XXX: this is a hack for Python 3.5 or below, which - # don’t support sha3 or blake2b… - try: - self._hashlib_function[algo]() - except AttributeError: - log.warn('Algorithm %s unavailable, disabling.', algo) - else: - self.enabled_hashes.append(namespace % algo) + self.enabled_hashes.append(namespace % algo) def session_bind(self, jid): self.xmpp['xep_0030'].add_feature(Hash.namespace) @@ -68,6 +65,7 @@ class XEP_0300(BasePlugin): def plugin_end(self): for namespace in self.enabled_hashes: self.xmpp['xep_0030'].del_feature(namespace) + self.enabled_hashes.clear() self.xmpp['xep_0030'].del_feature(feature=Hash.namespace) diff --git a/slixmpp/plugins/xep_0352/csi.py b/slixmpp/plugins/xep_0352/csi.py index 93295b84..21bfe371 100644 --- a/slixmpp/plugins/xep_0352/csi.py +++ b/slixmpp/plugins/xep_0352/csi.py @@ -8,6 +8,7 @@ import logging +from slixmpp import ClientXMPP from slixmpp.stanza import StreamFeatures from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins.base import BasePlugin @@ -40,17 +41,19 @@ class XEP_0352(BasePlugin): self.xmpp.register_stanza(stanza.Active) self.xmpp.register_stanza(stanza.Inactive) - self.xmpp.register_feature('csi', - self._handle_csi_feature, - restart=False, - order=self.order) + if isinstance(self.xmpp, ClientXMPP): + self.xmpp.register_feature('csi', + self._handle_csi_feature, + restart=False, + order=self.order) def plugin_end(self): if self.xmpp.is_component: return - self.xmpp.unregister_feature('csi', self.order) + if isinstance(self.xmpp, ClientXMPP): + self.xmpp.unregister_feature('csi', self.order) self.xmpp.remove_stanza(stanza.Active) self.xmpp.remove_stanza(stanza.Inactive) |