How to use the slixmpp.xmlstream.StanzaBase function in slixmpp

To help you get started, we’ve selected a few slixmpp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poezio / slixmpp / slixmpp / stanza / iq.py View on Github external
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
github poezio / slixmpp / slixmpp / features / feature_mechanisms / stanza / challenge.py View on Github external
"""
    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))
github poezio / slixmpp / slixmpp / features / feature_starttls / stanza.py View on Github external
"""
        """
        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()
github poezio / slixmpp / slixmpp / plugins / xep_0138.py View on Github external
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):
github poezio / slixmpp / slixmpp / stanza / stream_error.py View on Github external
"""
    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.
github poezio / slixmpp / slixmpp / plugins / xep_0198 / stanza.py View on Github external
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))
github poezio / slixmpp / slixmpp / features / feature_mechanisms / stanza / success.py View on Github external
def setup(self, xml):
        StanzaBase.setup(self, xml)
        self.xml.tag = self.tag_name()
github poezio / slixmpp / slixmpp / features / feature_mechanisms / stanza / auth.py View on Github external
"""
    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()
github poezio / slixmpp / slixmpp / features / feature_mechanisms / stanza / auth.py View on Github external
def setup(self, xml):
        StanzaBase.setup(self, xml)
        self.xml.tag = self.tag_name()
github poezio / slixmpp / slixmpp / plugins / xep_0198 / stanza.py View on Github external
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)