예제 #1
0
 def listen(self):
     """
     Start listening on XMPP and Shoutbox, relaying messages.
     """
     print "Creating AsyncClient..."
     c = AsyncClient(self.login, self.passwd, hostname=self.host, port=self.port)
     print "Registering xmppbridge with client..."
     c.register(self)
     print "Running client..."
     c.run()
예제 #2
0
        iq = Stanza.get_iq(self.client.jid, u"firehoser.superfeedr.com")
        E(u"query", namespace=XMPP_DISCO_ITEMS_NS, parent=iq,
          attributes={u'node': e.get_attribute_value('node')})
        self.client.send_stanza(iq)

    @headstock.xmpphandler('entry', ATOM10_NS)
    def entry(self, e):
        print e.get_child('title', ns=ATOM10_NS).xml_text

    @headstock.xmpphandler('message', XMPP_CLIENT_NS)
    def message(self, e):
        pass

if __name__ == '__main__':
    from headstock.lib.utils import parse_commandline
    
    options = parse_commandline()
    if not options.password:
        from getpass import getpass
        options.password = getpass()
    host, port = options.address.split(':')
    
    c = AsyncClient(unicode(options.jid), unicode(options.password),
                    hostname=host, port=int(port), tls=options.usetls)
    c.set_log(stdout=True)
    
    c.register(Basic())
    c.register(PubSub())

    c.run()
예제 #3
0
    @headstock.xmpphandler('entry', ATOM10_NS)
    def entry(self, e):
        print e.get_child('title', ns=ATOM10_NS).xml_text

    @headstock.xmpphandler('message', XMPP_CLIENT_NS)
    def message(self, e):
        pass


if __name__ == '__main__':
    from headstock.lib.utils import parse_commandline

    options = parse_commandline()
    if not options.password:
        from getpass import getpass
        options.password = getpass()
    host, port = options.address.split(':')

    c = AsyncClient(unicode(options.jid),
                    unicode(options.password),
                    hostname=host,
                    port=int(port),
                    tls=options.usetls)
    c.set_log(stdout=True)

    c.register(Basic())
    c.register(PubSub())

    c.run()
예제 #4
0
        self.client.send_stanza(m)


if __name__ == '__main__':
    from headstock.lib.utils import parse_commandline

    options = parse_commandline()
    if not options.password:
        from getpass import getpass
        options.password = getpass()
    host, port = options.address.split(':')

    registercls = None
    if options.register:
        from headstock.register import Register
        registercls = Register

    from headstock.client import AsyncClient  #, CircuitsClient, TornadoClient, KamaeliaClient
    c = AsyncClient(unicode(options.jid),
                    unicode(options.password),
                    hostname=host,
                    port=int(port),
                    tls=options.usetls,
                    registercls=registercls)
    c.set_log(stdout=True)

    c.register(Basic())

    c.run()