summaryrefslogtreecommitdiff
path: root/examples/echo_client.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-03-24 09:36:35 -0400
committerLance Stout <lancestout@gmail.com>2011-03-24 09:36:35 -0400
commitbf2f2782b7b64be97948f56e21d55b969072c4dc (patch)
tree45001e4822e5dc654de2658ee88c73966e907ef1 /examples/echo_client.py
parent694673b9bdc108ae109efd4dafa8893a22952b94 (diff)
parenta3d111be12144d9dea80165d84cd8168714d3d54 (diff)
downloadslixmpp-bf2f2782b7b64be97948f56e21d55b969072c4dc.tar.gz
slixmpp-bf2f2782b7b64be97948f56e21d55b969072c4dc.tar.bz2
slixmpp-bf2f2782b7b64be97948f56e21d55b969072c4dc.tar.xz
slixmpp-bf2f2782b7b64be97948f56e21d55b969072c4dc.zip
Merge branch 'develop' into stream_features
Diffstat (limited to 'examples/echo_client.py')
-rwxr-xr-xexamples/echo_client.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/echo_client.py b/examples/echo_client.py
index 099f8eea..dadf3b4e 100755
--- a/examples/echo_client.py
+++ b/examples/echo_client.py
@@ -12,6 +12,7 @@
import sys
import logging
import time
+import getpass
from optparse import OptionParser
import sleekxmpp
@@ -60,8 +61,8 @@ class EchoBot(sleekxmpp.ClientXMPP):
event does not provide any additional
data.
"""
- self.getRoster()
- self.sendPresence()
+ self.send_presence()
+ self.get_roster()
def message(self, msg):
"""
@@ -105,18 +106,19 @@ if __name__ == '__main__':
logging.basicConfig(level=opts.loglevel,
format='%(levelname)-8s %(message)s')
- if None in [opts.jid, opts.password]:
- optp.print_help()
- sys.exit(1)
+ if opts.jid is None:
+ opts.jid = raw_input("Username: ")
+ if opts.password is None:
+ opts.password = getpass.getpass("Password: ")
# Setup the EchoBot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does
# not matter.
xmpp = EchoBot(opts.jid, opts.password)
- xmpp.registerPlugin('xep_0030') # Service Discovery
- xmpp.registerPlugin('xep_0004') # Data Forms
- xmpp.registerPlugin('xep_0060') # PubSub
- xmpp.registerPlugin('xep_0199') # XMPP Ping
+ xmpp.register_plugin('xep_0030') # Service Discovery
+ xmpp.register_plugin('xep_0004') # Data Forms
+ xmpp.register_plugin('xep_0060') # PubSub
+ xmpp.register_plugin('xep_0199') # XMPP Ping
# If you are working with an OpenFire server, you may need
# to adjust the SSL version used: