Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def reply(self, clear=True):
"""
Create a new stanza replying to ``self``.
Overrides StanzaBase.reply
Sets the 'type' to 'result' in addition to the default
StanzaBase.reply behavior.
:param bool clear: Indicates if existing content should be
removed before replying. Defaults to True.
"""
new_iq = StanzaBase.reply(self, clear=clear)
new_iq['type'] = 'result'
return new_iq
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
import base64
from slixmpp.util import bytes
from slixmpp.xmlstream import StanzaBase
class Challenge(StanzaBase):
"""
"""
name = 'challenge'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = {'value'}
plugin_attrib = name
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
def get_value(self):
return base64.b64decode(bytes(self.xml.text))
"""
"""
return True
class Proceed(StanzaBase):
"""
"""
name = 'proceed'
namespace = 'urn:ietf:params:xml:ns:xmpp-tls'
interfaces = set()
class Failure(StanzaBase):
"""
"""
name = 'failure'
namespace = 'urn:ietf:params:xml:ns:xmpp-tls'
interfaces = set()
class Compress(StanzaBase):
name = 'compress'
namespace = 'http://jabber.org/protocol/compress'
interfaces = set(('method',))
sub_interfaces = interfaces
plugin_attrib = 'compress'
plugin_tag_map = {}
plugin_attrib_map = {}
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
class Compressed(StanzaBase):
name = 'compressed'
namespace = 'http://jabber.org/protocol/compress'
interfaces = set()
plugin_tag_map = {}
plugin_attrib_map = {}
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
class ZlibSocket(object):
def __init__(self, socketobj):
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
from slixmpp.stanza.error import Error
from slixmpp.xmlstream import StanzaBase
class StreamError(Error, StanzaBase):
"""
XMPP stanzas of type 'error' should include an stanza that
describes the nature of the error and how it should be handled.
Use the 'XEP-0086: Error Condition Mappings' plugin to include error
codes used in older XMPP versions.
The stream:error stanza is used to provide more information for
error that occur with the underlying XML stream itself, and not
a particular stanza.
Note: The StreamError stanza is mostly the same as the normal
Error stanza, but with different namespaces and
condition names.
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
def get_h(self):
h = self._get_attr('h', None)
if h:
return int(h)
return None
def set_h(self, val):
self._set_attr('h', str(val))
class Resumed(StanzaBase):
name = 'resumed'
namespace = 'urn:xmpp:sm:3'
interfaces = {'h', 'previd'}
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
def get_h(self):
h = self._get_attr('h', None)
if h:
return int(h)
return None
def set_h(self, val):
self._set_attr('h', str(val))
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
import base64
from slixmpp.util import bytes
from slixmpp.xmlstream import StanzaBase
class Auth(StanzaBase):
"""
"""
name = 'auth'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('mechanism', 'value'))
plugin_attrib = name
#: Some SASL mechs require sending values as is,
#: without converting base64.
plain_mechs = set(['X-MESSENGER-OAUTH2'])
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
def del_required(self):
self._del_sub('required')
def get_optional(self):
return self.xml.find('{%s}optional' % self.namespace) is not None
def set_optional(self, val):
self.del_optional()
if val:
self._set_sub_text('optional', '', keep=True)
def del_optional(self):
self._del_sub('optional')
class RequestAck(StanzaBase):
name = 'r'
namespace = 'urn:xmpp:sm:3'
interfaces = set()
def setup(self, xml):
StanzaBase.setup(self, xml)
self.xml.tag = self.tag_name()
class Ack(StanzaBase):
name = 'a'
namespace = 'urn:xmpp:sm:3'
interfaces = {'h'}
def setup(self, xml):
StanzaBase.setup(self, xml)