diff options
author | Lance Stout <lancestout@gmail.com> | 2011-03-24 13:15:09 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-03-24 13:15:09 -0400 |
commit | f125c11a810cf308473394262879f94166c3f564 (patch) | |
tree | 313a8b6c84bc637640efd8545ae6f4d09c19637c /examples | |
parent | bf2f2782b7b64be97948f56e21d55b969072c4dc (diff) | |
parent | d94811d81d68d948155d42ff9096c23ccb90a73c (diff) | |
download | slixmpp-f125c11a810cf308473394262879f94166c3f564.tar.gz slixmpp-f125c11a810cf308473394262879f94166c3f564.tar.bz2 slixmpp-f125c11a810cf308473394262879f94166c3f564.tar.xz slixmpp-f125c11a810cf308473394262879f94166c3f564.zip |
Merge branch 'develop' into stream_features
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/adhoc_user.py | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/examples/adhoc_user.py b/examples/adhoc_user.py index 30e83f9b..738b22cd 100755 --- a/examples/adhoc_user.py +++ b/examples/adhoc_user.py @@ -137,74 +137,6 @@ class CommandUserBot(sleekxmpp.ClientXMPP): # handler is provided. self['xep_0050'].terminate_command(session) - def _handle_command(self, iq, session): - """ - Respond to the intial request for a command. - - Arguments: - iq -- The iq stanza containing the command request. - session -- A dictionary of data relevant to the command - session. Additional, custom data may be saved - here to persist across handler callbacks. - """ - form = self['xep_0004'].makeForm('form', 'Greeting') - form.addField(var='greeting', - ftype='text-single', - label='Your greeting') - - session['payload'] = form - session['next'] = self._handle_command_complete - session['has_next'] = False - - # Other useful session values: - # session['to'] -- The JID that received the - # command request. - # session['from'] -- The JID that sent the - # command request. - # session['has_next'] = True -- There are more steps to complete - # session['allow_complete'] = True -- Allow user to finish immediately - # and possibly skip steps - # session['cancel'] = handler -- Assign a handler for if the user - # cancels the command. - # session['notes'] = [ -- Add informative notes about the - # ('info', 'Info message'), command's results. - # ('warning', 'Warning message'), - # ('error', 'Error message')] - - return session - - def _handle_command_complete(self, payload, session): - """ - Process a command result from the user. - - Arguments: - payload -- Either a single item, such as a form, or a list - of items or forms if more than one form was - provided to the user. The payload may be any - stanza, such as jabber:x:oob for out of band - data, or jabber:x:data for typical data forms. - session -- A dictionary of data relevant to the command - session. Additional, custom data may be saved - here to persist across handler callbacks. - """ - - # In this case (as is typical), the payload is a form - form = payload - - greeting = form['values']['greeting'] - self.send_message(mto=session['from'], - mbody="%s, World!" % greeting) - - # Having no return statement is the same as unsetting the 'payload' - # and 'next' session values and returning the session. - - # Unless it is the final step, always return the session dictionary. - - session['payload'] = None - session['next'] = None - - return session - if __name__ == '__main__': # Setup the command line arguments. |