From cbcfa156c4e01144dc92cc2901d1f37af2cd4b4c Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Sat, 31 Dec 2011 19:48:03 -0200 Subject: [PATCH 1/4] Add missing import. --- examples/echo_component.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/echo_component.py b/examples/echo_component.py index d8bcd752..9adfd1e7 100755 --- a/examples/echo_component.py +++ b/examples/echo_component.py @@ -12,6 +12,7 @@ import sys import logging import time +import getpass from optparse import OptionParser import sleekxmpp From cc63bef17988e219ee2b57e845fe6fbc033c110f Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Sat, 31 Dec 2011 19:50:53 -0200 Subject: [PATCH 2/4] Remove unused imports in the examples. --- examples/adhoc_provider.py | 1 - examples/adhoc_user.py | 1 - examples/disco_browser.py | 1 - examples/echo_client.py | 1 - examples/muc.py | 1 - examples/ping.py | 1 - examples/proxy_echo_client.py | 1 - examples/roster_browser.py | 1 - examples/send_client.py | 1 - 9 files changed, 9 deletions(-) diff --git a/examples/adhoc_provider.py b/examples/adhoc_provider.py index 4d4c3610..cfe72755 100755 --- a/examples/adhoc_provider.py +++ b/examples/adhoc_provider.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser diff --git a/examples/adhoc_user.py b/examples/adhoc_user.py index 0bc03c15..c155d4b8 100755 --- a/examples/adhoc_user.py +++ b/examples/adhoc_user.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser diff --git a/examples/disco_browser.py b/examples/disco_browser.py index 6023dd7e..20d012bc 100755 --- a/examples/disco_browser.py +++ b/examples/disco_browser.py @@ -10,7 +10,6 @@ """ import sys -import time import logging import getpass from optparse import OptionParser diff --git a/examples/echo_client.py b/examples/echo_client.py index cbb04683..db0064f9 100755 --- a/examples/echo_client.py +++ b/examples/echo_client.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser diff --git a/examples/muc.py b/examples/muc.py index 7af37449..ed54387a 100755 --- a/examples/muc.py +++ b/examples/muc.py @@ -11,7 +11,6 @@ import sys import logging -import time from optparse import OptionParser import sleekxmpp diff --git a/examples/ping.py b/examples/ping.py index d5622ffd..fa396907 100755 --- a/examples/ping.py +++ b/examples/ping.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser diff --git a/examples/proxy_echo_client.py b/examples/proxy_echo_client.py index 1f4ba9d3..6655ec59 100755 --- a/examples/proxy_echo_client.py +++ b/examples/proxy_echo_client.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser diff --git a/examples/roster_browser.py b/examples/roster_browser.py index 7926b096..7e7ec816 100644 --- a/examples/roster_browser.py +++ b/examples/roster_browser.py @@ -10,7 +10,6 @@ """ import sys -import time import logging import getpass import threading diff --git a/examples/send_client.py b/examples/send_client.py index 94bb584d..adf5fcc6 100755 --- a/examples/send_client.py +++ b/examples/send_client.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser From cbc6a0296bfdb44a09932d30cfb3aade8f23e156 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Sat, 31 Dec 2011 19:54:14 -0200 Subject: [PATCH 3/4] Ask interactively for missing command line arguments. Instead of complaining that the arguments were not given, ask interactively for input. This example was the only one to behave differently from the others. --- examples/muc.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/muc.py b/examples/muc.py index ed54387a..7586c61c 100755 --- a/examples/muc.py +++ b/examples/muc.py @@ -11,6 +11,7 @@ import sys import logging +import getpass from optparse import OptionParser import sleekxmpp @@ -160,9 +161,14 @@ if __name__ == '__main__': logging.basicConfig(level=opts.loglevel, format='%(levelname)-8s %(message)s') - if None in [opts.jid, opts.password, opts.room, opts.nick]: - 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: ") + if opts.room is None: + opts.room = raw_input("MUC room: ") + if opts.nick is None: + opts.nick = raw_input("MUC nickname: ") # Setup the MUCBot and register plugins. Note that while plugins may # have interdependencies, the order in which you register them does From 46e93bea09c05ab1183fd94981dcaa2654e5d0fd Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Sat, 31 Dec 2011 20:14:24 -0200 Subject: [PATCH 4/4] Remove unused import. I forgot about this one before! --- examples/echo_component.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/echo_component.py b/examples/echo_component.py index 9adfd1e7..82f6eb9f 100755 --- a/examples/echo_component.py +++ b/examples/echo_component.py @@ -11,7 +11,6 @@ import sys import logging -import time import getpass from optparse import OptionParser