# Path: wokkel/iwokkel.py
# class IDisco(Interface):
#     """
#     Interface for XMPP service discovery.
#     """
# 
#     def getDiscoInfo(requestor, target, nodeIdentifier=''):
#         """
#         Get identity and features from this entity, node.
# 
#         @param requestor: The entity the request originated from.
#         @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param target: The target entity to which the request is made.
#         @type target: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param nodeIdentifier: The optional identifier of the node at this
#             entity to retrieve the identify and features of.  The default is
#             C{''}, meaning the root node.
#         @type nodeIdentifier: C{unicode}
#         """
# 
#     def getDiscoItems(requestor, target, nodeIdentifier=''):
#         """
#         Get contained items for this entity, node.
# 
#         @param requestor: The entity the request originated from.
#         @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param target: The target entity to which the request is made.
#         @type target: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param nodeIdentifier: The optional identifier of the node at this
#                                entity to retrieve the identify and features of.
#                                The default is C{''}, meaning the root node.
#         @type nodeIdentifier: C{unicode}
#         """
# 
# Path: wokkel/subprotocols.py
# class XMPPHandler(object):
#     """
#     XMPP protocol handler.
# 
#     Classes derived from this class implement (part of) one or more XMPP
#     extension protocols, and are referred to as a subprotocol implementation.
#     """
# 
#     def __init__(self):
#         self.parent = None
#         self.xmlstream = None
# 
# 
#     def setHandlerParent(self, parent):
#         self.parent = parent
#         self.parent.addHandler(self)
# 
# 
#     def disownHandlerParent(self, parent):
#         self.parent.removeHandler(self)
#         self.parent = None
# 
# 
#     def makeConnection(self, xs):
#         self.xmlstream = xs
#         self.connectionMade()
# 
# 
#     def connectionMade(self):
#         """
#         Called after a connection has been established.
# 
#         Can be overridden to perform work before stream initialization.
#         """
# 
# 
#     def connectionInitialized(self):
#         """
#         The XML stream has been initialized.
# 
#         Can be overridden to perform work after stream initialization, e.g. to
#         set up observers and start exchanging XML stanzas.
#         """
# 
# 
#     def connectionLost(self, reason):
#         """
#         The XML stream has been closed.
# 
#         This method can be extended to inspect the C{reason} argument and
#         act on it.
#         """
#         self.xmlstream = None
# 
# 
#     def send(self, obj):
#         """
#         Send data over the managed XML stream.
# 
#         @note: The stream manager maintains a queue for data sent using this
#                method when there is no current initialized XML stream. This
#                data is then sent as soon as a new stream has been established
#                and initialized. Subsequently, L{connectionInitialized} will be
#                called again. If this queueing is not desired, use C{send} on
#                C{self.xmlstream}.
# 
#         @param obj: data to be sent over the XML stream. This is usually an
#                     object providing L{domish.IElement}, or serialized XML. See
#                     L{xmlstream.XmlStream} for details.
#         """
#         self.parent.send(obj)
# 
# 
#     def request(self, request):
#         """
#         Send an IQ request and track the response.
# 
#         This passes the request to the parent for sending and response
#         tracking.
# 
#         @see: L{StreamManager.request}.
#         """
#         return self.parent.request(request)


from zope.interface import implementer
from twisted.internet import defer, protocol
from twisted.python import reflect
from twisted.python.deprecate import deprecated
from twisted.words.protocols.jabber import error, jid, xmlstream
from twisted.words.protocols.jabber.xmlstream import toResponse
from twisted.words.xish import domish, utility
from twisted.words.xish.xmlstream import BootstrapMixin
from incremental import Version
from wokkel.iwokkel import IDisco
from wokkel.subprotocols import XMPPHandler
            from wokkel import disco

    if namespace is not None:
        strip(rootElement)

    return rootElement



class FallbackHandler(XMPPHandler):
    """
    XMPP subprotocol handler that catches unhandled iq requests.

    Unhandled iq requests are replied to with a service-unavailable stanza
    error.
    """

    def connectionInitialized(self):
        self.xmlstream.addObserver(IQ_SET, self.iqFallback, -1)
        self.xmlstream.addObserver(IQ_GET, self.iqFallback, -1)

    def iqFallback(self, iq):
        if iq.handled == True:
            return

        reply = error.StanzaError('service-unavailable')
        self.xmlstream.send(reply.toResponse(iq))



@implementer(IDisco)

# Path: wokkel/iwokkel.py
# class IDisco(Interface):
#     """
#     Interface for XMPP service discovery.
#     """
# 
#     def getDiscoInfo(requestor, target, nodeIdentifier=''):
#         """
#         Get identity and features from this entity, node.
# 
#         @param requestor: The entity the request originated from.
#         @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param target: The target entity to which the request is made.
#         @type target: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param nodeIdentifier: The optional identifier of the node at this
#             entity to retrieve the identify and features of.  The default is
#             C{''}, meaning the root node.
#         @type nodeIdentifier: C{unicode}
#         """
# 
#     def getDiscoItems(requestor, target, nodeIdentifier=''):
#         """
#         Get contained items for this entity, node.
# 
#         @param requestor: The entity the request originated from.
#         @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param target: The target entity to which the request is made.
#         @type target: L{JID<twisted.words.protocols.jabber.jid.JID>}
#         @param nodeIdentifier: The optional identifier of the node at this
#                                entity to retrieve the identify and features of.
#                                The default is C{''}, meaning the root node.
#         @type nodeIdentifier: C{unicode}
#         """
# 
# Path: wokkel/subprotocols.py
# class XMPPHandler(object):
#     """
#     XMPP protocol handler.
# 
#     Classes derived from this class implement (part of) one or more XMPP
#     extension protocols, and are referred to as a subprotocol implementation.
#     """
# 
#     def __init__(self):
#         self.parent = None
#         self.xmlstream = None
# 
# 
#     def setHandlerParent(self, parent):
#         self.parent = parent
#         self.parent.addHandler(self)
# 
# 
#     def disownHandlerParent(self, parent):
#         self.parent.removeHandler(self)
#         self.parent = None
# 
# 
#     def makeConnection(self, xs):
#         self.xmlstream = xs
#         self.connectionMade()
# 
# 
#     def connectionMade(self):
#         """
#         Called after a connection has been established.
# 
#         Can be overridden to perform work before stream initialization.
#         """
# 
# 
#     def connectionInitialized(self):
#         """
#         The XML stream has been initialized.
# 
#         Can be overridden to perform work after stream initialization, e.g. to
#         set up observers and start exchanging XML stanzas.
#         """
# 
# 
#     def connectionLost(self, reason):
#         """
#         The XML stream has been closed.
# 
#         This method can be extended to inspect the C{reason} argument and
#         act on it.
#         """
#         self.xmlstream = None
# 
# 
#     def send(self, obj):
#         """
#         Send data over the managed XML stream.
# 
#         @note: The stream manager maintains a queue for data sent using this
#                method when there is no current initialized XML stream. This
#                data is then sent as soon as a new stream has been established
#                and initialized. Subsequently, L{connectionInitialized} will be
#                called again. If this queueing is not desired, use C{send} on
#                C{self.xmlstream}.
# 
#         @param obj: data to be sent over the XML stream. This is usually an
#                     object providing L{domish.IElement}, or serialized XML. See
#                     L{xmlstream.XmlStream} for details.
#         """
#         self.parent.send(obj)
# 
# 
#     def request(self, request):
#         """
#         Send an IQ request and track the response.
# 
#         This passes the request to the parent for sending and response
#         tracking.
# 
#         @see: L{StreamManager.request}.
#         """
#         return self.parent.request(request)


# Path: wokkel/generic.py
from zope.interface import implementer
from twisted.internet import defer, protocol
from twisted.python import reflect
from twisted.python.deprecate import deprecated
from twisted.words.protocols.jabber import error, jid, xmlstream
from twisted.words.protocols.jabber.xmlstream import toResponse
from twisted.words.xish import domish, utility
from twisted.words.xish.xmlstream import BootstrapMixin
from incremental import Version
from wokkel.iwokkel import IDisco
from wokkel.subprotocols import XMPPHandler
            from wokkel import disco


    if namespace is not None:
        strip(rootElement)

    return rootElement



class FallbackHandler(XMPPHandler):
    """
    XMPP subprotocol handler that catches unhandled iq requests.

    Unhandled iq requests are replied to with a service-unavailable stanza
    error.
    """

    def connectionInitialized(self):
        self.xmlstream.addObserver(IQ_SET, self.iqFallback, -1)
        self.xmlstream.addObserver(IQ_GET, self.iqFallback, -1)

    def iqFallback(self, iq):
        if iq.handled == True:
            return

        reply = error.StanzaError('service-unavailable')
        self.xmlstream.send(reply.toResponse(iq))



@implementer(IDisco)

class VersionHandler(XMPPHandler):