Debian Codegraph @

doc/examples/pinger_client.tac

raw
1 """
2 An XMPP Ping client as an XMPP client.
3
4 This pinger client logs in as C{[email protected]}.
5 """
6
7 from twisted.application import service
8 from twisted.words.protocols.jabber.jid import JID
9 from tx_xmpp import client
10 from pinger import Pinger
11
12 # Configuration parameters
13
14 THIS_JID = JID('[email protected]')
15 OTHER_JID = JID('ping.example.com')
16 SECRET = 'secret'
17 LOG_TRAFFIC = True
18
19
20 # Set up the Twisted application
21
22 application = service.Application("Pinger Component")
23
24 pingerClient = client.XMPPClient(THIS_JID, SECRET)
25 pingerClient.logTraffic = LOG_TRAFFIC
26 pingerClient.setServiceParent(application)
27 pingerClient.send('<presence/>') # Hello, OpenFire!
28
29 pingerHandler = Pinger(OTHER_JID)
30 pingerHandler.setHandlerParent(pingerClient)