From c26b716164d123b177fd069b9e04cb07eab79b56 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 13 Aug 2011 00:00:34 -0700 Subject: Update XEP-0050 to use new IQ exceptions. IqError is now caught and forwarded to the command error handler referenced in the session. Errors are now caught and processed by the session's error handler whether or not the results Iq stanza includes the substanza. Added the option for blocking command calls. The blocking option is set during start_command with block=True. Subsequent command flow methods use session['block'] to determine their blocking behaviour. If you use blocking commands, then you will need to wrap your command calls in a try/except block for IqTimeout exceptions. --- examples/adhoc_user.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/adhoc_user.py') diff --git a/examples/adhoc_user.py b/examples/adhoc_user.py index 738b22cd..5fba78d2 100755 --- a/examples/adhoc_user.py +++ b/examples/adhoc_user.py @@ -136,6 +136,7 @@ class CommandUserBot(sleekxmpp.ClientXMPP): # The session will automatically be cleared if no error # handler is provided. self['xep_0050'].terminate_command(session) + self.disconnect() if __name__ == '__main__': @@ -176,7 +177,7 @@ if __name__ == '__main__': if opts.other is None: opts.other = raw_input("JID Providing Commands: ") if opts.greeting is None: - opts.other = raw_input("Greeting: ") + opts.greeting = raw_input("Greeting: ") # Setup the CommandBot and register plugins. Note that while plugins may # have interdependencies, the order in which you register them does -- cgit v1.2.3