summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-18 15:31:45 -0800
committerLance Stout <lancestout@gmail.com>2012-01-18 15:31:45 -0800
commit79b71228c1659f4127f4c151859f8a8c22838147 (patch)
tree0a9caa7ff32a45a3d83b4a5463659e7bc00435b7 /docs
parent738ec92b8ea6175f20d81e356e5dc76bff1559c4 (diff)
downloadslixmpp-79b71228c1659f4127f4c151859f8a8c22838147.tar.gz
slixmpp-79b71228c1659f4127f4c151859f8a8c22838147.tar.bz2
slixmpp-79b71228c1659f4127f4c151859f8a8c22838147.tar.xz
slixmpp-79b71228c1659f4127f4c151859f8a8c22838147.zip
Fix some more merge conflicts.
Diffstat (limited to 'docs')
-rw-r--r--docs/_static/haiku.css1
-rw-r--r--docs/_static/header.pngbin98587 -> 16588 bytes
-rw-r--r--docs/index.rst93
3 files changed, 82 insertions, 12 deletions
diff --git a/docs/_static/haiku.css b/docs/_static/haiku.css
index 41e0eb45..3d8ee6a7 100644
--- a/docs/_static/haiku.css
+++ b/docs/_static/haiku.css
@@ -409,7 +409,6 @@ div.viewcode-block:target {
padding: 0 12px;
}
-
#from_andyet {
-webkit-box-shadow: #CCC 0px 0px 3px;
background: rgba(255, 255, 255, 1);
diff --git a/docs/_static/header.png b/docs/_static/header.png
index 19310618..2aaa53a1 100644
--- a/docs/_static/header.png
+++ b/docs/_static/header.png
Binary files differ
diff --git a/docs/index.rst b/docs/index.rst
index b8b19e81..9e3fc064 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -13,7 +13,7 @@ SleekXMPP
``develop`` branch.
**Latest Stable Release**
- - `1.0 <http://github.com/fritzy/SleekXMPP/zipball/1.0>`_
+ - `1.0 <http://github.com/fritzy/SleekXMPP/zipball/1.0>`_
**Develop Releases**
- `Latest Develop Version <http://github.com/fritzy/SleekXMPP/zipball/develop>`_
@@ -59,6 +59,72 @@ SleekXMPP's design goals and philosphy are:
sensible defaults and appropriate abstractions. XML can be ugly to work
with, but it doesn't have to be that way.
+Here's your first SleekXMPP Bot:
+--------------------------------
+
+.. code-block:: python
+
+ import logging
+
+ from sleekxmpp import ClientXMPP
+ from sleekxmpp.exceptions import IqError, IqTimeout
+
+
+ class EchoBot(ClientXMPP):
+
+ def __init__(self, jid, password):
+ ClientXMPP.__init__(self, jid, password)
+
+ self.add_event_handler("session_start", self.session_start)
+ self.add_event_handler("message", self.message)
+
+ # 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:
+ # import ssl
+ # self.ssl_version = ssl.PROTOCOL_SSLv3
+
+ 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()
+
+ def message(self, msg):
+ if msg['type'] in ('chat', 'normal'):
+ msg.reply("Thanks for sending\n%(body)s" % msg).send()
+
+
+ if __name__ == '__main__':
+ # Ideally use optparse or argparse to get JID,
+ # password, and log level.
+
+ logging.basicConfig(level=logging.DEBUG,
+ format='%(levelname)-8s %(message)s')
+
+ xmpp = EchoBot('somejid@example.com', 'use_getpass')
+ xmpp.connect()
+ xmpp.process(block=True)
+
+
+
Getting Started (with Examples)
-------------------------------
.. toctree::
@@ -156,23 +222,28 @@ Additional Info
Credits
-------
+
**Main Author:** `Nathan Fritz <http://andyet.net/team/fritzy>`_
- `fritzy@netflint.net <xmpp:fritzy@netflint.net?message>`_,
- `@fritzy <http://twitter.com/fritzy>`_
+ `fritzy@netflint.net <xmpp:fritzy@netflint.net?message>`_,
+ `@fritzy <http://twitter.com/fritzy>`_
- Nathan is also the author of XMPPHP and `Seesmic-AS3-XMPP
- <http://code.google.com/p/seesmic-as3-xmpp/>`_, and a former member of the XMPP
- Council.
+ Nathan is also the author of XMPPHP and `Seesmic-AS3-XMPP
+ <http://code.google.com/p/seesmic-as3-xmpp/>`_, and a former member of the XMPP
+ Council.
**Co-Author:** `Lance Stout <http://andyet.net/team/lance>`_
- `lancestout@gmail.com <xmpp:lancestout@gmail.com?message>`_,
- `@lancestout <http://twitter.com/lancestout>`_
+ `lancestout@gmail.com <xmpp:lancestout@gmail.com?message>`_,
+ `@lancestout <http://twitter.com/lancestout>`_
Both Fritzy and Lance work for `&yet <http://andyet.net>`_, which specializes in
-realtime web and XMPP applications.
+realtime web and XMPP applications.
-- `contact@andyet.net <mailto:contact@andyet.net>`_
-- `XMPP Consulting <http://xmppconsulting.com>`_
+ - `contact@andyet.net <mailto:contact@andyet.net>`_
+ - `XMPP Consulting <http://xmppconsulting.com>`_
+
+**Co-Author:** Lance Stout
+ `lancestout@gmail.com <xmpp:lancestout@gmail.com?message>`_,
+ `@lancestout <http://twitter.com/lancestout>`_
**Contributors:**
- Brian Beggs (`macdiesel <http://github.com/macdiesel>`_)