summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-18 15:22:19 -0800
committerLance Stout <lancestout@gmail.com>2012-01-18 15:22:19 -0800
commitfd515d807c9af22b2df5cbe31825bf26aad596c1 (patch)
tree80d22018ea790b141078d0d9aeb3a7a6ce613b1e
parent4f4c121d9b64a02fa86438066fca6fd81e66032f (diff)
downloadslixmpp-fd515d807c9af22b2df5cbe31825bf26aad596c1.tar.gz
slixmpp-fd515d807c9af22b2df5cbe31825bf26aad596c1.tar.bz2
slixmpp-fd515d807c9af22b2df5cbe31825bf26aad596c1.tar.xz
slixmpp-fd515d807c9af22b2df5cbe31825bf26aad596c1.zip
Add example of accessing plugins to the README.
-rw-r--r--README.rst28
1 files changed, 17 insertions, 11 deletions
diff --git a/README.rst b/README.rst
index e2c289d9..a477a3de 100644
--- a/README.rst
+++ b/README.rst
@@ -118,8 +118,12 @@ SleekXMPP projects::
self.add_event_handler("session_start", self.session_start)
self.add_event_handler("message", self.message)
- self.register_plugin('xep_0030') # Service Discovery
- self.register_plugin('xep_0199') # XMPP Ping
+ # If you wanted more functionality, here's how to register plugins:
+ # self.register_plugin('xep_0030') # Service Discovery
+ # self.register_plugin('xep_0199') # XMPP Ping
+
+ # Here's how to access plugins once you've registered them:
+ # self['xep_0030'].add_feature('echo_demo')
# If you are working with an OpenFire server, you will
# need to use a different SSL version:
@@ -128,18 +132,20 @@ SleekXMPP projects::
def session_start(self, event):
self.send_presence()
+ self.get_roster()
# Most get_*/set_* methods from plugins use Iq stanzas, which
# can generate IqError and IqTimeout exceptions
- try:
- self.get_roster()
- except IqError as err:
- logging.error('There was an error getting the roster')
- logging.error(err.iq['error']['condition'])
- self.disconnect()
- except IqTimeout:
- logging.error('Server is taking too long to respond')
- self.disconnect()
+ #
+ # try:
+ # self.get_roster()
+ # except IqError as err:
+ # logging.error('There was an error getting the roster')
+ # logging.error(err.iq['error']['condition'])
+ # self.disconnect()
+ # except IqTimeout:
+ # logging.error('Server is taking too long to respond')
+ # self.disconnect()
def message(self, msg):
if msg['type'] in ('chat', 'normal'):