summaryrefslogtreecommitdiff
path: root/examples/component.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-09-01 18:18:30 -0400
committerLance Stout <lancestout@gmail.com>2010-09-01 18:18:30 -0400
commit0b4320a19610ab5c3f8d543a4a1ee7969c9e8db6 (patch)
treeff8b308a9b0d6f18d62401321cdd39ea3ed048ed /examples/component.py
parent9bef4b4d4d54768cb753e4bbfec049e97d063882 (diff)
downloadslixmpp-0b4320a19610ab5c3f8d543a4a1ee7969c9e8db6.tar.gz
slixmpp-0b4320a19610ab5c3f8d543a4a1ee7969c9e8db6.tar.bz2
slixmpp-0b4320a19610ab5c3f8d543a4a1ee7969c9e8db6.tar.xz
slixmpp-0b4320a19610ab5c3f8d543a4a1ee7969c9e8db6.zip
Updated the client and component examples.
The component example now actually uses a config.xml file for its connection information, and to initialize a roster.
Diffstat (limited to 'examples/component.py')
-rw-r--r--examples/component.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/examples/component.py b/examples/component.py
deleted file mode 100644
index f24216c2..00000000
--- a/examples/component.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import sleekxmpp.componentxmpp
-import logging
-from optparse import OptionParser
-import time
-
-class Example(sleekxmpp.componentxmpp.ComponentXMPP):
-
- def __init__(self, jid, password):
- sleekxmpp.componentxmpp.ComponentXMPP.__init__(self, jid, password, 'vm1', 5230)
- self.add_event_handler("session_start", self.start)
- self.add_event_handler("message", self.message)
-
- def start(self, event):
- #self.getRoster()
- #self.sendPresence(pto='admin@tigase.netflint.net/sarkozy')
- #self.sendPresence(pto='tigase.netflint.net')
- pass
-
- def message(self, event):
- self.sendMessage("%s/%s" % (event['jid'], event['resource']), "Thanks for sending me, \"%s\"." % event['message'], mtype=event['type'])
-
-if __name__ == '__main__':
- #parse command line arguements
- optp = OptionParser()
- optp.add_option('-q','--quiet', help='set logging to ERROR', action='store_const', dest='loglevel', const=logging.ERROR, default=logging.INFO)
- optp.add_option('-d','--debug', help='set logging to DEBUG', action='store_const', dest='loglevel', const=logging.DEBUG, default=logging.INFO)
- optp.add_option('-v','--verbose', help='set logging to COMM', action='store_const', dest='loglevel', const=5, default=logging.INFO)
- optp.add_option("-c","--config", dest="configfile", default="config.xml", help="set config file to use")
- opts,args = optp.parse_args()
-
- logging.basicConfig(level=opts.loglevel, format='%(levelname)-8s %(message)s')
- xmpp = Example('component.vm1', 'secreteating')
- xmpp.registerPlugin('xep_0004')
- xmpp.registerPlugin('xep_0030')
- xmpp.registerPlugin('xep_0060')
- xmpp.registerPlugin('xep_0199')
- if xmpp.connect():
- xmpp.process(threaded=False)
- print("done")
- else:
- print("Unable to connect.")