diff options
author | Lance Stout <lancestout@gmail.com> | 2011-03-24 09:42:54 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-03-24 09:42:54 -0400 |
commit | 84e2589f2205eb0b88fca92418c17950ab3a3f1b (patch) | |
tree | 9202527b4f21ecb45350ec2242ccc82119a613df /examples/adhoc_user.py | |
parent | a3d111be12144d9dea80165d84cd8168714d3d54 (diff) | |
download | slixmpp-84e2589f2205eb0b88fca92418c17950ab3a3f1b.tar.gz slixmpp-84e2589f2205eb0b88fca92418c17950ab3a3f1b.tar.bz2 slixmpp-84e2589f2205eb0b88fca92418c17950ab3a3f1b.tar.xz slixmpp-84e2589f2205eb0b88fca92418c17950ab3a3f1b.zip |
Left too much unlrelated code in example.
Diffstat (limited to 'examples/adhoc_user.py')
-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. |