/usr/share/doc/python-twisted-words/examples/jabber_client.py is in python-twisted-words 13.2.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 33 34 35 36 37 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A very simple Twisted Jabber client
To run the script:
$ python jabber_client.py
"""
# Originally written by Darryl Vandorp
# http://randomthoughts.vandorp.ca/
from twisted.words.protocols.jabber import client, jid
from twisted.words.xish import domish
from twisted.internet import reactor
def authd(xmlstream):
print "authenticated"
presence = domish.Element(('jabber:client','presence'))
xmlstream.send(presence)
xmlstream.addObserver('/message', debug)
xmlstream.addObserver('/presence', debug)
xmlstream.addObserver('/iq', debug)
def debug(elem):
print elem.toXml().encode('utf-8')
print "="*20
myJid = jid.JID('username@server.jabber/twisted_words')
factory = client.basicClientFactory(myJid, 'password')
factory.addBootstrap('//event/stream/authd',authd)
reactor.connectTCP('server.jabber',5222,factory)
reactor.run()
|