summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-11-14 12:00:21 -0800
committerLance Stout <lancestout@gmail.com>2011-11-14 12:00:21 -0800
commit9faecec2db94a234b23788e8fc7521826dafdac1 (patch)
tree89b7bbdb00f8caa3338f238b6dfb8838de82b41c /README.rst
parent5d7111fe3be75eaa5b4fe5c4e514c75c4c3db427 (diff)
downloadslixmpp-9faecec2db94a234b23788e8fc7521826dafdac1.tar.gz
slixmpp-9faecec2db94a234b23788e8fc7521826dafdac1.tar.bz2
slixmpp-9faecec2db94a234b23788e8fc7521826dafdac1.tar.xz
slixmpp-9faecec2db94a234b23788e8fc7521826dafdac1.zip
Simplify boilerplate example.
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst29
1 files changed, 13 insertions, 16 deletions
diff --git a/README.rst b/README.rst
index 21e32a6b..5e806ad5 100644
--- a/README.rst
+++ b/README.rst
@@ -112,13 +112,21 @@ SleekXMPP projects::
def __init__(self, jid, password):
ClientXMPP.__init__(self, jid, password)
- self.add_event_handler("session_start", self.start)
+ self.add_event_handler("session_start", self.session_start)
self.add_event_handler("message", self.message)
- def start(self, event):
+ self.register_plugin('xep_0030') # Service Discovery
+ self.register_plugin('xep_0199') # XMPP Ping
+
+ # If you are working with an OpenFire server, you will
+ # need to use a different SSL version:
+ # import ssl
+ # self.ssl_version = ssl.PROTOCOL_SSLv3
+
+ def session_start(self, event):
self.send_presence()
- # Most get_* methods from plugins use Iq stanzas, which
+ # Most get_*/set_* methods from plugins use Iq stanzas, which
# can generate IqError and IqTimeout exceptions
try:
self.get_roster()
@@ -143,19 +151,8 @@ SleekXMPP projects::
format='%(levelname)-8s %(message)s')
xmpp = EchoBot('somejid@example.com', 'use_getpass')
- xmpp.register_plugin('xep_0030') # Service Discovery
- xmpp.register_plugin('xep_0199') # XMPP Ping
-
- # If you are working with an OpenFire server, you will need
- # to use a different SSL version:
- #
- # import ssl
- # xmpp.ssl_version = ssl.PROTOCOL_SSLv3
-
- if xmpp.connect():
- xmpp.process(block=True)
- else:
- print("Unable to connect.")
+ xmpp.connect():
+ xmpp.process(block=True)
Credits