summaryrefslogtreecommitdiff
path: root/examples/adhoc_user.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-03-24 13:15:00 -0400
committerLance Stout <lancestout@gmail.com>2011-03-24 13:15:00 -0400
commit77601f7262370ba172966352a94575ec02b4a776 (patch)
tree94d4db4e2718d6c919c3fbd6ad0bd4f5f1e53566 /examples/adhoc_user.py
parentd9be51b2efcdaaf6b62488700eb3ce859bb0958a (diff)
parentd94811d81d68d948155d42ff9096c23ccb90a73c (diff)
downloadslixmpp-77601f7262370ba172966352a94575ec02b4a776.tar.gz
slixmpp-77601f7262370ba172966352a94575ec02b4a776.tar.bz2
slixmpp-77601f7262370ba172966352a94575ec02b4a776.tar.xz
slixmpp-77601f7262370ba172966352a94575ec02b4a776.zip
Merge branch 'develop' into roster
Diffstat (limited to 'examples/adhoc_user.py')
-rwxr-xr-xexamples/adhoc_user.py68
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.