summaryrefslogtreecommitdiff
path: root/examples/ping.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-03-23 22:59:21 -0400
committerLance Stout <lancestout@gmail.com>2011-03-23 22:59:21 -0400
commit4916a12b6f2515b22b504c650bd97dd4c30c4471 (patch)
treedddbf8e3bacb9a242aec4ab8baefa499a981a48a /examples/ping.py
parentd6f2e51b05b94934680c579804b6af3fe404d852 (diff)
downloadslixmpp-4916a12b6f2515b22b504c650bd97dd4c30c4471.tar.gz
slixmpp-4916a12b6f2515b22b504c650bd97dd4c30c4471.tar.bz2
slixmpp-4916a12b6f2515b22b504c650bd97dd4c30c4471.tar.xz
slixmpp-4916a12b6f2515b22b504c650bd97dd4c30c4471.zip
Tidy up the examples.
Diffstat (limited to 'examples/ping.py')
-rwxr-xr-xexamples/ping.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/ping.py b/examples/ping.py
index 70066e3c..ae030c0f 100755
--- a/examples/ping.py
+++ b/examples/ping.py
@@ -12,6 +12,7 @@
import sys
import logging
import time
+import getpass
from optparse import OptionParser
import sleekxmpp
@@ -58,7 +59,8 @@ class PingTest(sleekxmpp.ClientXMPP):
event does not provide any additional
data.
"""
- self.sendPresence()
+ self.send_presence()
+ self.get_roster()
result = self['xep_0199'].send_ping(self.pingjid,
timeout=10,
errorfalse=True)
@@ -102,9 +104,10 @@ 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 PingTest and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does