Remove all trailing whitespaces.
This commit is contained in:

committed by
Florent Le Coz

parent
ed37174a2b
commit
17174016ec
@@ -5,7 +5,7 @@ Create and Run a Server Component
|
||||
=================================
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
If you have any issues working through this quickstart guide
|
||||
or the other tutorials here, please either send a message to the
|
||||
`mailing list <http://groups.google.com/group/slixmpp-discussion>`_
|
||||
@@ -21,8 +21,8 @@ or ``easy_install``.
|
||||
pip install slixmpp # Or: easy_install slixmpp
|
||||
|
||||
|
||||
Many XMPP applications eventually graduate to requiring to run as a server
|
||||
component in order to meet scalability requirements. To demonstrate how to
|
||||
Many XMPP applications eventually graduate to requiring to run as a server
|
||||
component in order to meet scalability requirements. To demonstrate how to
|
||||
turn an XMPP client bot into a component, we'll turn the echobot example
|
||||
(:ref:`echobot`) into a component version.
|
||||
|
||||
|
@@ -5,7 +5,7 @@ Slixmpp Quickstart - Echo Bot
|
||||
===============================
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
If you have any issues working through this quickstart guide
|
||||
or the other tutorials here, please either send a message to the
|
||||
`mailing list <http://groups.google.com/group/slixmpp-discussion>`_
|
||||
@@ -93,7 +93,7 @@ as well.
|
||||
.. code-block:: python
|
||||
|
||||
class EchoBot(slixmpp.ClientXMPP):
|
||||
|
||||
|
||||
def __init__(self, jid, password):
|
||||
super(EchoBot, self).__init__(jid, password)
|
||||
|
||||
@@ -102,7 +102,7 @@ Handling Session Start
|
||||
The XMPP spec requires clients to broadcast its presence and retrieve its roster (buddy list) once
|
||||
it connects and establishes a session with the XMPP server. Until these two tasks are completed,
|
||||
some servers may not deliver or send messages or presence notifications to the client. So we now
|
||||
need to be sure that we retrieve our roster and send an initial presence once the session has
|
||||
need to be sure that we retrieve our roster and send an initial presence once the session has
|
||||
started. To do that, we will register an event handler for the :term:`session_start` event.
|
||||
|
||||
.. code-block:: python
|
||||
@@ -198,7 +198,7 @@ or ``chat``. (Other potential types are ``error``, ``headline``, and ``groupchat
|
||||
|
||||
Let's take a closer look at the ``.reply()`` method used above. For message stanzas,
|
||||
``.reply()`` accepts the parameter ``body`` (also as the first positional argument),
|
||||
which is then used as the value of the ``<body />`` element of the message.
|
||||
which is then used as the value of the ``<body />`` element of the message.
|
||||
Setting the appropriate ``to`` JID is also handled by ``.reply()``.
|
||||
|
||||
Another way to have sent the reply message would be to use :meth:`send_message <slixmpp.basexmpp.BaseXMPP.send_message>`,
|
||||
@@ -242,7 +242,7 @@ the newer ``argparse`` module.
|
||||
|
||||
We want to accept three parameters: the JID for the echo bot, its password, and a flag for
|
||||
displaying the debugging logs. We also want these to be optional parameters, since passing
|
||||
a password directly through the command line can be a security risk.
|
||||
a password directly through the command line can be a security risk.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -303,21 +303,21 @@ the ``EchoBot.__init__`` method instead.
|
||||
|
||||
.. note::
|
||||
|
||||
If you are using the OpenFire server, you will need to include an additional
|
||||
If you are using the OpenFire server, you will need to include an additional
|
||||
configuration step. OpenFire supports a different version of SSL than what
|
||||
most servers and Slixmpp support.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
import ssl
|
||||
xmpp.ssl_version = ssl.PROTOCOL_SSLv3
|
||||
|
||||
Now we're ready to connect and begin echoing messages. If you have the package
|
||||
``dnspython`` installed, then the :meth:`slixmpp.clientxmpp.ClientXMPP` method
|
||||
will perform a DNS query to find the appropriate server to connect to for the
|
||||
given JID. If you do not have ``dnspython``, then Slixmpp will attempt to
|
||||
given JID. If you do not have ``dnspython``, then Slixmpp will attempt to
|
||||
connect to the hostname used by the JID, unless an address tuple is supplied
|
||||
to :meth:`slixmpp.clientxmpp.ClientXMPP`.
|
||||
to :meth:`slixmpp.clientxmpp.ClientXMPP`.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -349,12 +349,12 @@ to :meth:`slixmpp.clientxmpp.ClientXMPP`.
|
||||
To begin responding to messages, you'll see we called :meth:`slixmpp.basexmpp.BaseXMPP.process`
|
||||
which will start the event handling, send queue, and XML reader threads. It will also call
|
||||
the :meth:`slixmpp.plugins.base.base_plugin.post_init` method on all registered plugins. By
|
||||
passing ``block=True`` to :meth:`slixmpp.basexmpp.BaseXMPP.process` we are running the
|
||||
passing ``block=True`` to :meth:`slixmpp.basexmpp.BaseXMPP.process` we are running the
|
||||
main processing loop in the main thread of execution. The :meth:`slixmpp.basexmpp.BaseXMPP.process`
|
||||
call will not return until after Slixmpp disconnects. If you need to run the client in the background
|
||||
for another program, use ``block=False`` to spawn the processing loop in its own thread.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
|
||||
Before 1.0, controlling the blocking behaviour of :meth:`slixmpp.basexmpp.BaseXMPP.process` was
|
||||
done via the ``threaded`` argument. This arrangement was a source of confusion because some users
|
||||
|
@@ -36,7 +36,7 @@ stanzas this way. The relevant methods are:
|
||||
* :meth:`~slixmpp.basexmpp.BaseXMPP.make_iq_error`
|
||||
* :meth:`~slixmpp.basexmpp.BaseXMPP.make_iq_query`
|
||||
|
||||
These methods all follow the same pattern: create or modify an existing
|
||||
These methods all follow the same pattern: create or modify an existing
|
||||
:class:`~slixmpp.stanza.iq.Iq` stanza, set the ``'type'`` value based
|
||||
on the method name, and finally add a ``<query />`` element with the given
|
||||
namespace. For example, to produce the query above, you would use:
|
||||
@@ -74,7 +74,7 @@ These options are:
|
||||
To change the timeout for a single call, the ``timeout`` parameter works:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
iq.send(timeout=60)
|
||||
|
||||
* ``callback``: When not using a blocking call, using the ``callback``
|
||||
@@ -85,7 +85,7 @@ These options are:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
cb_name = iq.send(callback=self.a_callback)
|
||||
cb_name = iq.send(callback=self.a_callback)
|
||||
|
||||
# ... later if we need to cancel
|
||||
self.remove_handler(cb_name)
|
||||
@@ -133,7 +133,7 @@ interfacting with the :class:`~slixmpp.stanza.iq.Iq` payload.
|
||||
* :ref:`create-plugin`
|
||||
* :ref:`work-with-stanzas`
|
||||
* :ref:`using-handlers-matchers`
|
||||
|
||||
|
||||
|
||||
The typical way to respond to :class:`~slixmpp.stanza.iq.Iq` requests is
|
||||
to register stream handlers. As an example, suppose we create a stanza class
|
||||
|
@@ -5,7 +5,7 @@ Enable HTTP Proxy Support
|
||||
=========================
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
If you have any issues working through this quickstart guide
|
||||
or the other tutorials here, please either send a message to the
|
||||
`mailing list <http://groups.google.com/group/slixmpp-discussion>`_
|
||||
|
@@ -2,7 +2,7 @@ Sign in, Send a Message, and Disconnect
|
||||
=======================================
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
If you have any issues working through this quickstart guide
|
||||
or the other tutorials here, please either send a message to the
|
||||
`mailing list <http://groups.google.com/group/slixmpp-discussion>`_
|
||||
@@ -10,7 +10,7 @@ Sign in, Send a Message, and Disconnect
|
||||
<xmpp:sleek@conference.jabber.org?join>`_.
|
||||
|
||||
A common use case for Slixmpp is to send one-off messages from
|
||||
time to time. For example, one use case could be sending out a notice when
|
||||
time to time. For example, one use case could be sending out a notice when
|
||||
a shell script finishes a task.
|
||||
|
||||
We will create our one-shot bot based on the pattern explained in :ref:`echobot`. To
|
||||
@@ -24,7 +24,7 @@ for the JID that will receive our message, and the string content of the message
|
||||
|
||||
|
||||
class SendMsgBot(slixmpp.ClientXMPP):
|
||||
|
||||
|
||||
def __init__(self, jid, password, recipient, msg):
|
||||
super(SendMsgBot, self).__init__(jid, password)
|
||||
|
||||
@@ -52,7 +52,7 @@ Finally, we need to disconnect the client using :meth:`disconnect <slixmpp.xmlst
|
||||
Now, sent stanzas are placed in a queue to pass them to the send thread. If we were to call
|
||||
:meth:`disconnect <slixmpp.xmlstream.XMLStream.disconnect>` without any parameters, then it is possible
|
||||
for the client to disconnect before the send queue is processed and the message is actually
|
||||
sent on the wire. To ensure that our message is processed, we use
|
||||
sent on the wire. To ensure that our message is processed, we use
|
||||
:meth:`disconnect(wait=True) <slixmpp.xmlstream.XMLStream.disconnect>`.
|
||||
|
||||
.. code-block:: python
|
||||
|
Reference in New Issue
Block a user