summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README50
-rw-r--r--README.rst91
-rwxr-xr-xexamples/adhoc_provider.py25
-rwxr-xr-xexamples/adhoc_user.py2
-rwxr-xr-xexamples/config_component.py2
-rwxr-xr-xexamples/disco_browser.py2
-rwxr-xr-xexamples/echo_client.py4
-rwxr-xr-xexamples/muc.py16
-rwxr-xr-xexamples/ping.py2
-rwxr-xr-xexamples/proxy_echo_client.py2
-rw-r--r--examples/roster_browser.py2
-rwxr-xr-xexamples/send_client.py2
-rw-r--r--setup.py2
13 files changed, 141 insertions, 61 deletions
diff --git a/README b/README
deleted file mode 100644
index 8a85365c..00000000
--- a/README
+++ /dev/null
@@ -1,50 +0,0 @@
-SleekXMPP is an XMPP library written for Python 3.1+ (with 2.6 compatibility).
-Hosted at http://wiki.github.com/fritzy/SleekXMPP/
-
-Featured in examples in XMPP: The Definitive Guide by Kevin Smith, Remko Tronçon, and Peter Saint-Andre
-If you're coming here from The Definitive Guide, please read http://wiki.github.com/fritzy/SleekXMPP/xmpp-the-definitive-guide
-
-Requirements:
-We try to keep requirements to a minimum, but we suggest that you install http://dnspython.org although it isn't strictly required.
-If you do not install this library, you may need to specify the server/port for services that use SRV records (like GTalk).
-"sudo pip install dnspython" on a *nix system with pip installed.
-
-SleekXMPP has several design goals/philosophies:
-- Low number of dependencies.
-- Every XEP as a plugin.
-- Rewarding to work with.
-
-The goals for 1.0 include (and we're getting close):
-- Nearly Full test coverage of stanzas.
-- Wide range of functional tests.
-- Stanza objects for all interaction with the stream
-- Documentation on using and extending SleekXMPP.
-- Complete documentation on all implemented stanza objects
-- Documentation on all examples used in XMPP: The Definitive Guide
-
-1.1 will include:
-- More functional and unit tests
-- PEP-8 compliance
-- XEP-225 support
-
-Since 0.2, here's the Changelog:
-- MANY bugfixes
-- Re-implementation of handlers/threading to greatly simplify and remove bugs (no more spawning threads in handlers)
-- Stanza objects for jabber:client and all implemented XEPs
-- Raising XMPPError for jabber:client and extended errors in handlers
-- Robust error handling and better insurance of iq responses
-- Stanza objects have made life a lot easier!
-- Massive audit/cleanup.
-
-Credits
-----------------
-Main Author: Nathan Fritz fritz@netflint.net
-Contributors: Kevin Smith & Lance Stout
-Patches: Remko Tronçon
-
-Dave Cridland, for his Suelta SASL library.
-
-
-Feel free to add fritzy@netflint.net to your roster for direct support and comments.
-Join sleekxmpp-discussion@googlegroups.com / http://groups.google.com/group/sleekxmpp-discussion for email discussion.
-Join sleek@conference.jabber.org for groupchat discussion.
diff --git a/README.rst b/README.rst
new file mode 100644
index 00000000..dc29b639
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,91 @@
+SleekXMPP
+#########
+
+SleekXMPP is an MIT licensed XMPP library for Python 2.6/3.1+,
+and is featured in examples in
+`XMPP: The Definitive Guide <http://oreilly.com/catalog/9780596521271>`_
+by Kevin Smith, Remko Tronçon, and Peter Saint-Andre. If you've arrived
+here from reading the Definitive Guide, please see the notes on updating
+the examples to the latest version of SleekXMPP.
+
+SleekXMPP's design goals and philosphy are:
+
+**Low number of dependencies**
+ Installing and using SleekXMPP should be as simple as possible, without
+ having to deal with long dependency chains.
+
+ As part of reducing the number of dependencies, some third party
+ modules are included with SleekXMPP in the ``thirdparty`` directory.
+ Imports from this module first try to import an existing installed
+ version before loading the packaged version, when possible.
+
+**Every XEP as a plugin**
+ Following Python's "batteries included" approach, the goal is to
+ provide support for all currently active XEPs (final and draft). Since
+ adding XEP support is done through easy to create plugins, the hope is
+ to also provide a solid base for implementing and creating experimental
+ XEPs.
+
+**Rewarding to work with**
+ As much as possible, SleekXMPP should allow things to "just work" using
+ sensible defaults and appropriate abstractions. XML can be ugly to work
+ with, but it doesn't have to be that way.
+
+
+Get the Code
+------------
+.. code-block:: sh
+
+ pip install sleekxmpp
+
+The latest source code for SleekXMPP may be found on `Github
+<http://github.com/fritzy/SleekXMPP>`_. Releases can be found in the
+``master`` branch, while the latest development version is in the
+``develop`` branch.
+
+**Stable Releases**
+ - `1.0 Beta6.1 <http://github.com/fritzy/SleekXMPP/zipball/1.0-Beta6.1>`_
+ - `1.0 Beta5 <http://github.com/fritzy/SleekXMPP/zipball/1.0-Beta5>`_
+ - `1.0 Beta4 <http://github.com/fritzy/SleekXMPP/zipball/1.0-Beta4>`_
+ - `1.0 Beta3 <http://github.com/fritzy/SleekXMPP/zipball/1.0-Beta3>`_
+ - `1.0 Beta2 <http://github.com/fritzy/SleekXMPP/zipball/1.0-Beta2>`_
+ - `1.0 Beta1 <http://github.com/fritzy/SleekXMPP/zipball/1.0-Beta1>`_
+
+**Develop Releases**
+ - `Latest Develop Version <http://github.com/fritzy/SleekXMPP/zipball/develop>`_
+
+
+Discussion
+----------
+A mailing list and XMPP chat room are available for discussing and getting
+help with SleekXMPP.
+
+**Mailing List**
+ `SleekXMPP Discussion on Google Groups <http://groups.google.com/group/sleekxmpp-discussion>`_
+
+**Chat**
+ `sleek@conference.jabber.org <xmpp:sleek@conference.jabber.org?join>`_
+
+
+Credits
+-------
+**Main Author:** Nathan Fritz
+ `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 member of the XMPP
+ Council.
+
+**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>`_)
+ - Dann Martens (`dannmartens <http://github.com/dannmartens>`_)
+ - Florent Le Coz (`louiz <http://github.com/louiz>`_)
+ - Kevin Smith (`Kev <http://github.com/Kev>`_, http://kismith.co.uk)
+ - Remko Tronçon (`remko <http://github.com/remko>`_, http://el-tramo.be)
+ - Te-jé Rogers (`te-je <http://github.com/te-je>`_)
+ - Thom Nichols (`tomstrummer <http://github.com/tomstrummer>`_)
diff --git a/examples/adhoc_provider.py b/examples/adhoc_provider.py
index 3316a0c6..5fa26334 100755
--- a/examples/adhoc_provider.py
+++ b/examples/adhoc_provider.py
@@ -24,6 +24,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class CommandBot(sleekxmpp.ClientXMPP):
@@ -79,9 +81,21 @@ class CommandBot(sleekxmpp.ClientXMPP):
here to persist across handler callbacks.
"""
form = self['xep_0004'].makeForm('form', 'Greeting')
+ form['instructions'] = 'Send a custom greeting to a JID'
form.addField(var='greeting',
ftype='text-single',
label='Your greeting')
+ form.addField(var='recipient',
+ ftype='jid-single',
+ label='Who to greet')
+ form.addField(var='message',
+ ftype='text-multi',
+ label='Your message')
+ form.addField(var='demobool',
+ ftype='boolean',
+ label='Test booleans',
+ desc='Test default values too',
+ value=True)
session['payload'] = form
session['next'] = self._handle_command_complete
@@ -123,8 +137,14 @@ class CommandBot(sleekxmpp.ClientXMPP):
form = payload
greeting = form['values']['greeting']
- self.send_message(mto=session['from'],
- mbody="%s, World!" % greeting)
+ recipient = form['values']['recipient']
+ message = '\n'.join(form['values']['message'])
+
+ if recipient is None:
+ recipient = session['from']
+ self.send_message(mto=recipient,
+ mbody="%s, %s!\n%s" % (greeting, recipient, message),
+ mtype='chat')
# Having no return statement is the same as unsetting the 'payload'
# and 'next' session values and returning the session.
@@ -176,6 +196,7 @@ if __name__ == '__main__':
xmpp.register_plugin('xep_0030') # Service Discovery
xmpp.register_plugin('xep_0004') # Data Forms
xmpp.register_plugin('xep_0050') # Adhoc Commands
+ xmpp.register_plugin('xep_0199', {'keepalive': True, 'frequency':15})
# If you are working with an OpenFire server, you may need
# to adjust the SSL version used:
diff --git a/examples/adhoc_user.py b/examples/adhoc_user.py
index 5fba78d2..ac157edd 100755
--- a/examples/adhoc_user.py
+++ b/examples/adhoc_user.py
@@ -24,6 +24,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class CommandUserBot(sleekxmpp.ClientXMPP):
diff --git a/examples/config_component.py b/examples/config_component.py
index cbb8e628..7a28739f 100755
--- a/examples/config_component.py
+++ b/examples/config_component.py
@@ -27,6 +27,8 @@ from sleekxmpp.xmlstream.stanzabase import ET, registerStanzaPlugin
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class Config(ElementBase):
diff --git a/examples/disco_browser.py b/examples/disco_browser.py
index b2b96f95..0526bfc4 100755
--- a/examples/disco_browser.py
+++ b/examples/disco_browser.py
@@ -25,6 +25,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class Disco(sleekxmpp.ClientXMPP):
diff --git a/examples/echo_client.py b/examples/echo_client.py
index cd1b1d02..122b20f0 100755
--- a/examples/echo_client.py
+++ b/examples/echo_client.py
@@ -24,6 +24,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class EchoBot(sleekxmpp.ClientXMPP):
@@ -34,7 +36,7 @@ class EchoBot(sleekxmpp.ClientXMPP):
"""
def __init__(self, jid, password):
- sleekxmpp.ClientXMPP.__init__(self, jid, password)
+ sleekxmpp.ClientXMPP.__init__(self, jid, password, plugin_config={'feature_mechanisms': {'use_mech': 'PLAIN'}})
# The session_start event will be triggered when
# the bot establishes its connection with the server
diff --git a/examples/muc.py b/examples/muc.py
index 8296cb6d..96b5fb83 100755
--- a/examples/muc.py
+++ b/examples/muc.py
@@ -23,6 +23,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class MUCBot(sleekxmpp.ClientXMPP):
@@ -59,7 +61,7 @@ class MUCBot(sleekxmpp.ClientXMPP):
# muc::room@server::got_online, or muc::room@server::got_offline.
self.add_event_handler("muc::%s::got_online" % self.room,
self.muc_online)
-
+
def start(self, event):
"""
@@ -76,15 +78,15 @@ class MUCBot(sleekxmpp.ClientXMPP):
"""
self.getRoster()
self.sendPresence()
- self.plugin['xep_0045'].joinMUC(self.room,
- self.nick,
+ self.plugin['xep_0045'].joinMUC(self.room,
+ self.nick,
# If a room password is needed, use:
# password=the_room_password,
wait=True)
def muc_message(self, msg):
"""
- Process incoming message stanzas from any chat room. Be aware
+ Process incoming message stanzas from any chat room. Be aware
that if you also have any handlers for the 'message' event,
message stanzas may be processed by both handlers, so check
the 'type' attribute when using a 'message' event handler.
@@ -96,7 +98,7 @@ class MUCBot(sleekxmpp.ClientXMPP):
otherwise you will create an infinite loop responding
to your own messages.
- This handler will reply to messages that mention
+ This handler will reply to messages that mention
the bot's nickname.
Arguments:
@@ -112,12 +114,12 @@ class MUCBot(sleekxmpp.ClientXMPP):
def muc_online(self, presence):
"""
Process a presence stanza from a chat room. In this case,
- presences from users that have just come online are
+ presences from users that have just come online are
handled by sending a welcome message that includes
the user's nickname and role in the room.
Arguments:
- presence -- The received presence stanza. See the
+ presence -- The received presence stanza. See the
documentation for the Presence stanza
to see how else it may be used.
"""
diff --git a/examples/ping.py b/examples/ping.py
index ae030c0f..68772e6b 100755
--- a/examples/ping.py
+++ b/examples/ping.py
@@ -24,6 +24,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class PingTest(sleekxmpp.ClientXMPP):
diff --git a/examples/proxy_echo_client.py b/examples/proxy_echo_client.py
index 4db9a552..3466dc9b 100755
--- a/examples/proxy_echo_client.py
+++ b/examples/proxy_echo_client.py
@@ -24,6 +24,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class EchoBot(sleekxmpp.ClientXMPP):
diff --git a/examples/roster_browser.py b/examples/roster_browser.py
index a428324e..4a58cc1c 100644
--- a/examples/roster_browser.py
+++ b/examples/roster_browser.py
@@ -27,6 +27,8 @@ from sleekxmpp.exceptions import IqError, IqTimeout
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class RosterBrowser(sleekxmpp.ClientXMPP):
diff --git a/examples/send_client.py b/examples/send_client.py
index b3673512..d1dafee6 100755
--- a/examples/send_client.py
+++ b/examples/send_client.py
@@ -24,6 +24,8 @@ import sleekxmpp
if sys.version_info < (3, 0):
reload(sys)
sys.setdefaultencoding('utf8')
+else:
+ raw_input = input
class SendMsgBot(sleekxmpp.ClientXMPP):
diff --git a/setup.py b/setup.py
index adfa1b62..877991a8 100644
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ import sleekxmpp
VERSION = sleekxmpp.__version__
DESCRIPTION = 'SleekXMPP is an elegant Python library for XMPP (aka Jabber, Google Talk, etc).'
-with open('README') as readme:
+with open('README.rst') as readme:
LONG_DESCRIPTION = '\n'.join(readme)
CLASSIFIERS = [ 'Intended Audience :: Developers',