Example #1
0
 def test_DiscoInfo(self):
     factory = XmlStreamFactory()
     sm = StreamManager(factory)
     disco.DiscoHandler().setHandlerParent(sm)
     DiscoResponder().setHandlerParent(sm)
     xs = factory.buildProtocol(None)
     output = []
     xs.send = output.append
     xs.connectionMade()
     xs.dispatch(xs, "//event/stream/authd")
     xs.dataReceived("<stream>")
     xs.dataReceived("""<iq from='*****@*****.**' to='example.com'
                            type='get'>
                          <query xmlns='%s'/>
                        </iq>""" % NS_DISCO_INFO)
     reply = output[0]
     self.assertEqual(NS_DISCO_INFO, reply.query.uri)
     self.assertEqual(NS_DISCO_INFO, reply.query.identity.uri)
     self.assertEqual('dummy', reply.query.identity['category'])
     self.assertEqual('generic', reply.query.identity['type'])
     self.assertEqual('Generic Dummy Entity', reply.query.identity['name'])
     self.assertEqual(NS_DISCO_INFO, reply.query.feature.uri)
     self.assertEqual('jabber:iq:version', reply.query.feature['var'])
Example #2
0
File: xmpp.py Project: monoid/w4
def buildXMPPApp(domain, port, secret, groupset, application):
    router = component.Router()
    serverService = server.ServerService(router, domain=domain, secret=secret)
    serverService.logTraffic = LOG

    s2sFactory = server.XMPPS2SServerFactory(serverService)
    s2sFactory.logTraffic = LOG
    s2sService = strports.service(port, s2sFactory)
    s2sService.setServiceParent(application)

    w4Comp = component.InternalComponent(router, domain)
    w4Comp.logTraffic = LOG
    w4Comp.setServiceParent(application)

    presenceHandler = PresenceHandler(groupset)
    presenceHandler.setHandlerParent(w4Comp)

    chatHandler = ChatHandler(groupset)
    chatHandler.setHandlerParent(w4Comp)

    discoHandler = disco.DiscoHandler()
    discoHandler.setHandlerParent(w4Comp)

    return application
Example #3
0
# start xmpp component
xmpp = Component(conf.jabberHost, conf.jabberPort, conf.jabberComponentName,
                 conf.jabberPassword)
xmpp.logTraffic = False
handler = XMPPComponent()
handler.setHandlerParent(xmpp)

# fallback handling
generic.FallbackHandler().setHandlerParent(xmpp)

# version handling
generic.VersionHandler("SMS.de Gateway", "1.0").setHandlerParent(xmpp)

# allow disco handling
disco.DiscoHandler().setHandlerParent(xmpp)
DiscoResponder().setHandlerParent(xmpp)

# add handler for gateway requests
GatewayHandler().setHandlerParent(xmpp)

# add handler for vcards
VCardHandler().setHandlerParent(xmpp)

# add handler for registering
RegisterHandler().setHandlerParent(xmpp)

# PresenceHandler
PresenceHandler().setHandlerParent(xmpp)

xmpp.setServiceParent(sc)
Example #4
0
 def setUp(self):
     self.service = disco.DiscoHandler()