From 3bb01de1201501d759c6aadb08ecd9ccf0bdc47c Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 18 Apr 2021 21:15:22 +0200 Subject: stanza: add a Handshake class and use it in componentxmpp --- slixmpp/stanza/__init__.py | 7 ++++++- slixmpp/stanza/handshake.py | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 slixmpp/stanza/handshake.py (limited to 'slixmpp/stanza') diff --git a/slixmpp/stanza/__init__.py b/slixmpp/stanza/__init__.py index 6e2e9718..1371fad2 100644 --- a/slixmpp/stanza/__init__.py +++ b/slixmpp/stanza/__init__.py @@ -1,4 +1,3 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2010 Nathanael C. Fritz # This file is part of Slixmpp. @@ -10,3 +9,9 @@ from slixmpp.stanza.message import Message from slixmpp.stanza.presence import Presence from slixmpp.stanza.stream_features import StreamFeatures from slixmpp.stanza.stream_error import StreamError +from slixmpp.stanza.handshake import Handshake + +__all__ = [ + 'Error', 'Iq', 'Message', 'Presence', 'StreamFeatures', 'StreamError', + 'Handshake' +] diff --git a/slixmpp/stanza/handshake.py b/slixmpp/stanza/handshake.py new file mode 100644 index 00000000..c58f69aa --- /dev/null +++ b/slixmpp/stanza/handshake.py @@ -0,0 +1,25 @@ +# Slixmpp: The Slick XMPP Library +# Copyright (C) 2021 Mathieu Pasquet +# This file is part of Slixmpp. +# See the file LICENSE for copying permission. + +from slixmpp.xmlstream import StanzaBase + + +class Handshake(StanzaBase): + + """ + Jabber Component protocol handshake + """ + namespace = 'jabber:component:accept' + name = 'handshake' + interfaces = {'value'} + + def set_value(self, value: str): + self.xml.text = value + + def get_value(self) -> str: + return self.xml.text + + def del_value(self): + self.xml.text = '' -- cgit v1.2.3