File: pinger_client.tac

package info (click to toggle)
python-tx-xmpp 0.10.1.post1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,468 kB
  • sloc: python: 12,915; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
An XMPP Ping client as an XMPP client.

This pinger client logs in as C{pinger@example.org}.
"""

from twisted.application import service
from twisted.words.protocols.jabber.jid import JID
from tx_xmpp import client
from pinger import Pinger

# Configuration parameters

THIS_JID = JID('pinger@example.org')
OTHER_JID = JID('ping.example.com')
SECRET = 'secret'
LOG_TRAFFIC = True


# Set up the Twisted application

application = service.Application("Pinger Component")

pingerClient = client.XMPPClient(THIS_JID, SECRET)
pingerClient.logTraffic = LOG_TRAFFIC
pingerClient.setServiceParent(application)
pingerClient.send('<presence/>') # Hello, OpenFire!

pingerHandler = Pinger(OTHER_JID)
pingerHandler.setHandlerParent(pingerClient)