File: pinger_component.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 (32 lines) | stat: -rw-r--r-- 793 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
31
32
"""
An XMPP Ping client as an external server-side component.

This pinger client assumes the domain C{pinger}.
"""

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

# Configuration parameters

EXT_HOST = 'localhost'
EXT_PORT = 5347
SECRET = 'secret'
DOMAIN = 'pinger'
OTHER_DOMAIN = 'ping'
LOG_TRAFFIC = True


# Set up the Twisted application

application = service.Application("Pinger Component")

router = component.Router()
pingerComponent = component.Component(EXT_HOST, EXT_PORT, DOMAIN, SECRET)
pingerComponent.logTraffic = LOG_TRAFFIC
pingerComponent.setServiceParent(application)

pingerHandler = Pinger(JID(OTHER_DOMAIN), JID(DOMAIN))
pingerHandler.setHandlerParent(pingerComponent)