# Path: xmpp/plugins/amp.py
# class AmpStanza(ElementBase):
# class feature_amp(BasePlugin):
#     def plugin_init(self):
#     def _handle_amp(self, features):
# 
# Path: xmpp/plugins/auth.py
# class AuthStanza(ElementBase):
# class feature_auth(BasePlugin):
#     def plugin_init(self):
#     def _handle_auth(self, features):
# 
# Path: xmpp/plugins/bind.py
# class AmpStanza(ElementBase):
# class feature_bind(BasePlugin):
#     def plugin_init(self):
#     def _handle_bind(self, features):
# 
# Path: xmpp/plugins/caps.py
# class CapsStanza(ElementBase):
# class feature_caps(BasePlugin):
#     def plugin_init(self):
#     def _handle_caps(self, features):
# 
# Path: xmpp/plugins/compression.py
# class CompressionStanza(ElementBase):
# class feature_compression(BasePlugin):
#     def plugin_init(self):
#     def _handle_compression(self, features):
# 
# Path: xmpp/plugins/dialback.py
# class DialbackStanza(ElementBase):
# class feature_dialback(BasePlugin):
#     def plugin_init(self):
#     def _handle_dialback(self, features):
# 
# Path: xmpp/plugins/register.py
# class RegisterStanza(ElementBase):
# class feature_register(BasePlugin):
#     def plugin_init(self):
#     def _handle_register(self, features):
# 
# Path: xmpp/plugins/rosterver.py
# class RosterVerStanza(ElementBase):
# class feature_rosterver(BasePlugin):
#     def plugin_init(self):
#     def _handle_rosterver(self, features):
# 
# Path: xmpp/plugins/session.py
# class SessionStanza(ElementBase):
# class feature_session(BasePlugin):
#     def plugin_init(self):
#     def _handle_session(self, features):
# 
# Path: xmpp/plugins/sm.py
# class SMStanza2(ElementBase):
# class SMStanza3(ElementBase):
# class feature_sm(BasePlugin):
#     def plugin_init(self):
#     def _handle_sm(self, features):


import logging
import re
from sleekxmpp import ClientXMPP
from sleekxmpp.basexmpp import BaseXMPP
from sleekxmpp.stanza import StreamFeatures
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import MatchXPath
from django.conf import settings
from xmpp.plugins import amp
from xmpp.plugins import auth
from xmpp.plugins import bind
from xmpp.plugins import caps
from xmpp.plugins import compression
from xmpp.plugins import dialback
from xmpp.plugins import register
from xmpp.plugins import rosterver
from xmpp.plugins import session
from xmpp.plugins import sm
    :param server: The server to connect to.
    :type  server: :py:class:`~server.models.Server`
    :param callback: Callback to call with stream features.
    :param cert: Certificate
    """

    def __init__(self, server, callback, lang='en', ns='jabber:client', get_ca=False):
        super(StreamFeatureClient, self).__init__(server.domain, default_ns=ns)
        self._listed_server = server

        self.use_ipv6 = settings.USE_IP6
        self.auto_reconnect = False
        self.callback = callback
        self.ca_certs = '/etc/ssl/certs/ca-certificates.crt'

        # copied from ClientXMPP
        self.default_lang = lang
        self.stream_header = "<stream:stream to='%s' %s %s %s %s>" % (
            self.boundjid.host,
            "xmlns:stream='%s'" % self.stream_ns,
            "xmlns='%s'" % self.default_ns,
            "xml:lang='%s'" % self.default_lang,
            "version='1.0'")
        self.stream_footer = "</stream:stream>"
        self.features = set()
        self._stream_feature_handlers = {}
        self._stream_feature_order = []

        # register known features:
        self.register_plugin('feature_amp', module=amp)

# Path: xmpp/plugins/amp.py
# class AmpStanza(ElementBase):
# class feature_amp(BasePlugin):
#     def plugin_init(self):
#     def _handle_amp(self, features):
# 
# Path: xmpp/plugins/auth.py
# class AuthStanza(ElementBase):
# class feature_auth(BasePlugin):
#     def plugin_init(self):
#     def _handle_auth(self, features):
# 
# Path: xmpp/plugins/bind.py
# class AmpStanza(ElementBase):
# class feature_bind(BasePlugin):
#     def plugin_init(self):
#     def _handle_bind(self, features):
# 
# Path: xmpp/plugins/caps.py
# class CapsStanza(ElementBase):
# class feature_caps(BasePlugin):
#     def plugin_init(self):
#     def _handle_caps(self, features):
# 
# Path: xmpp/plugins/compression.py
# class CompressionStanza(ElementBase):
# class feature_compression(BasePlugin):
#     def plugin_init(self):
#     def _handle_compression(self, features):
# 
# Path: xmpp/plugins/dialback.py
# class DialbackStanza(ElementBase):
# class feature_dialback(BasePlugin):
#     def plugin_init(self):
#     def _handle_dialback(self, features):
# 
# Path: xmpp/plugins/register.py
# class RegisterStanza(ElementBase):
# class feature_register(BasePlugin):
#     def plugin_init(self):
#     def _handle_register(self, features):
# 
# Path: xmpp/plugins/rosterver.py
# class RosterVerStanza(ElementBase):
# class feature_rosterver(BasePlugin):
#     def plugin_init(self):
#     def _handle_rosterver(self, features):
# 
# Path: xmpp/plugins/session.py
# class SessionStanza(ElementBase):
# class feature_session(BasePlugin):
#     def plugin_init(self):
#     def _handle_session(self, features):
# 
# Path: xmpp/plugins/sm.py
# class SMStanza2(ElementBase):
# class SMStanza3(ElementBase):
# class feature_sm(BasePlugin):
#     def plugin_init(self):
#     def _handle_sm(self, features):


# Path: xmpp/clients.py
import logging
import re
from sleekxmpp import ClientXMPP
from sleekxmpp.basexmpp import BaseXMPP
from sleekxmpp.stanza import StreamFeatures
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import MatchXPath
from django.conf import settings
from xmpp.plugins import amp
from xmpp.plugins import auth
from xmpp.plugins import bind
from xmpp.plugins import caps
from xmpp.plugins import compression
from xmpp.plugins import dialback
from xmpp.plugins import register
from xmpp.plugins import rosterver
from xmpp.plugins import session
from xmpp.plugins import sm

    :param server: The server to connect to.
    :type  server: :py:class:`~server.models.Server`
    :param callback: Callback to call with stream features.
    :param cert: Certificate
    """

    def __init__(self, server, callback, lang='en', ns='jabber:client', get_ca=False):
        super(StreamFeatureClient, self).__init__(server.domain, default_ns=ns)
        self._listed_server = server

        self.use_ipv6 = settings.USE_IP6
        self.auto_reconnect = False
        self.callback = callback
        self.ca_certs = '/etc/ssl/certs/ca-certificates.crt'

        # copied from ClientXMPP
        self.default_lang = lang
        self.stream_header = "<stream:stream to='%s' %s %s %s %s>" % (
            self.boundjid.host,
            "xmlns:stream='%s'" % self.stream_ns,
            "xmlns='%s'" % self.default_ns,
            "xml:lang='%s'" % self.default_lang,
            "version='1.0'")
        self.stream_footer = "</stream:stream>"
        self.features = set()
        self._stream_feature_handlers = {}
        self._stream_feature_order = []

        # register known features:
        self.register_plugin('feature_amp', module=amp)

        self.register_plugin('feature_auth', module=auth)