Esempio n. 1
0
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)
    s2sFactory.logTraffic = config['verbose']
    s2sService = strports.service(config['server-port'], s2sFactory)
    s2sService.setServiceParent(s)

    # Hook up XMPP external server-side component service
    cFactory = component.XMPPComponentServerFactory(router,
                                                    config['component-secret'])

    cFactory.logTraffic = config['verbose']
    cServer = strports.service(config['component-port'], cFactory)
    cServer.setServiceParent(s)

    return s
def makeService(config):
    router = component.Router()
    factory = component.XMPPComponentServerFactory(router, config['secret'])

    if config['verbose']:
        factory.logTraffic = True

    return strports.service(config['port'], factory)
Esempio n. 3
0
 def setUp(self):
     self.router = component.Router()
     self.factory = component.XMPPComponentServerFactory(
         self.router, 'secret')
     self.xmlstream = self.factory.buildProtocol(None)
     self.xmlstream.thisEntity = JID('component.example.org')