# Path: wokkel/server.py
# NS_DIALBACK = 'jabber:server:dialback'
# def generateKey(secret, receivingServer, originatingServer, streamID):
# def trapStreamError(xs, observer):
#     def wrappedObserver(element):
#     def __init__(self, reactor, domain, factory):
#     def pickServer(self):
#     def __init__(self, xs, thisHost, otherHost, secret):
#     def initialize(self):
#     def onResult(self, result):
#     def onStreamError(self, failure):
#     def __init__(self, xs, thisHost, otherHost, originalStreamID, key):
#     def initialize(self):
#     def onVerify(self, verify):
#     def onStreamError(self, failure):
#     def __init__(self, thisHost, otherHost, secret):
#     def connectionMade(self):
#     def associateWithStream(self, xs):
#     def __init__(self, thisHost, otherHost, originalStreamID, key):
#     def connectionMade(self):
#     def associateWithStream(self, xs):
#     def __init__(self, service):
#     def streamStarted(self, rootElement):
#         def prepareStream(domain):
#     def onVerify(self, verify):
#     def onResult(self, result):
#         def reply(validity):
#         def valid(xs):
#         def invalid(failure):
#     def __init__(self, authenticator):
#     def onConnectionMade(self, xs):
#         def logDataIn(buf):
#         def logDataOut(buf):
# def initiateS2S(factory):
#     def __init__(self, service):
#         def authenticatorFactory():
#     def onConnectionMade(self, xs):
#         def logDataIn(buf):
#         def logDataOut(buf):
#     def onAuthenticated(self, xs):
#     def onConnectionLost(self, xs, reason):
#     def onError(self, reason):
#     def onElement(self, xs, element):
#     def __init__(self, router, domain=None, secret=None):
#     def outgoingInitialized(self, xs):
#     def outgoingDisconnected(self, xs):
#     def initiateOutgoingStream(self, thisHost, otherHost):
#         def resetConnecting(_):
#     def validateConnection(self, thisHost, otherHost, sid, key):
#         def connected(xs):
#             def disconnect(_):
#     def send(self, stanza):
#     def dispatch(self, xs, stanza):
# class XMPPServerConnector(SRVConnector):
# class DialbackFailed(Exception):
# class OriginatingDialbackInitializer(object):
# class ReceivingDialbackInitializer(object):
# class XMPPServerConnectAuthenticator(xmlstream.ConnectAuthenticator):
# class XMPPServerVerifyAuthenticator(xmlstream.ConnectAuthenticator):
# class XMPPServerListenAuthenticator(xmlstream.ListenAuthenticator):
# class DeferredS2SClientFactory(DeferredXmlStreamFactory):
# class XMPPS2SServerFactory(xmlstream.XmlStreamServerFactory):
# class ServerService(object):


from twisted.application import service, strports
from twisted.python import usage
from twisted.words.protocols.jabber import component
from wokkel import server
    def __init__(self):
        usage.Options.__init__(self)
        self['domains'] = set()


    def opt_domain(self, domain):
        """
        Domain to accept server connections for. Repeat for more domains.
        """
        self['domains'].add(domain)


    def postOptions(self):
        if not self['domains']:
            raise usage.UsageError('Need at least one domain')



def makeService(config):
    s = service.MultiService()

    router = component.Router()

    # Set up the XMPP server service

    serverService = server.ServerService(router, secret=config['server-secret'])
    serverService.domains = config['domains']
    serverService.logTraffic = config['verbose']

    # Hook up XMPP server-to-server service

# Path: wokkel/server.py
# NS_DIALBACK = 'jabber:server:dialback'
# def generateKey(secret, receivingServer, originatingServer, streamID):
# def trapStreamError(xs, observer):
#     def wrappedObserver(element):
#     def __init__(self, reactor, domain, factory):
#     def pickServer(self):
#     def __init__(self, xs, thisHost, otherHost, secret):
#     def initialize(self):
#     def onResult(self, result):
#     def onStreamError(self, failure):
#     def __init__(self, xs, thisHost, otherHost, originalStreamID, key):
#     def initialize(self):
#     def onVerify(self, verify):
#     def onStreamError(self, failure):
#     def __init__(self, thisHost, otherHost, secret):
#     def connectionMade(self):
#     def associateWithStream(self, xs):
#     def __init__(self, thisHost, otherHost, originalStreamID, key):
#     def connectionMade(self):
#     def associateWithStream(self, xs):
#     def __init__(self, service):
#     def streamStarted(self, rootElement):
#         def prepareStream(domain):
#     def onVerify(self, verify):
#     def onResult(self, result):
#         def reply(validity):
#         def valid(xs):
#         def invalid(failure):
#     def __init__(self, authenticator):
#     def onConnectionMade(self, xs):
#         def logDataIn(buf):
#         def logDataOut(buf):
# def initiateS2S(factory):
#     def __init__(self, service):
#         def authenticatorFactory():
#     def onConnectionMade(self, xs):
#         def logDataIn(buf):
#         def logDataOut(buf):
#     def onAuthenticated(self, xs):
#     def onConnectionLost(self, xs, reason):
#     def onError(self, reason):
#     def onElement(self, xs, element):
#     def __init__(self, router, domain=None, secret=None):
#     def outgoingInitialized(self, xs):
#     def outgoingDisconnected(self, xs):
#     def initiateOutgoingStream(self, thisHost, otherHost):
#         def resetConnecting(_):
#     def validateConnection(self, thisHost, otherHost, sid, key):
#         def connected(xs):
#             def disconnect(_):
#     def send(self, stanza):
#     def dispatch(self, xs, stanza):
# class XMPPServerConnector(SRVConnector):
# class DialbackFailed(Exception):
# class OriginatingDialbackInitializer(object):
# class ReceivingDialbackInitializer(object):
# class XMPPServerConnectAuthenticator(xmlstream.ConnectAuthenticator):
# class XMPPServerVerifyAuthenticator(xmlstream.ConnectAuthenticator):
# class XMPPServerListenAuthenticator(xmlstream.ListenAuthenticator):
# class DeferredS2SClientFactory(DeferredXmlStreamFactory):
# class XMPPS2SServerFactory(xmlstream.XmlStreamServerFactory):
# class ServerService(object):


# Path: wokkel/componentservertap.py
from twisted.application import service, strports
from twisted.python import usage
from twisted.words.protocols.jabber import component
from wokkel import server

    def __init__(self):
        usage.Options.__init__(self)
        self['domains'] = set()


    def opt_domain(self, domain):
        """
        Domain to accept server connections for. Repeat for more domains.
        """
        self['domains'].add(domain)


    def postOptions(self):
        if not self['domains']:
            raise usage.UsageError('Need at least one domain')



def makeService(config):
    s = service.MultiService()

    router = component.Router()

    # Set up the XMPP server service

    serverService = server.ServerService(router, secret=config['server-secret'])
    serverService.domains = config['domains']
    serverService.logTraffic = config['verbose']

    # Hook up XMPP server-to-server service

    s2sFactory = server.XMPPS2SServerFactory(serverService)