diff options
author | Lance Stout <lancestout@gmail.com> | 2012-03-30 23:02:48 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-04-06 15:09:25 -0400 |
commit | 488f7ed88691d9f7fa756a28702f6bee43d6a260 (patch) | |
tree | 62d59aef1051cd3ae0d068499e371efd5a6c6fdc /sleekxmpp/basexmpp.py | |
parent | 51e5aee8308e42a89b7c0ab83ec53e2abea9767f (diff) | |
download | slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.tar.gz slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.tar.bz2 slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.tar.xz slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.zip |
Begin experiment with a centralized API callback registry.
The API registry generalizes the node handler system from the xep_0030
plugin so that other plugins can use it.
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r-- | sleekxmpp/basexmpp.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index dc1f6b94..5fcfbf6d 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -19,6 +19,7 @@ import logging import sleekxmpp from sleekxmpp import plugins, features, roster +from sleekxmpp.api import APIRegistry from sleekxmpp.exceptions import IqError, IqTimeout from sleekxmpp.stanza import Message, Presence, Iq, StreamError @@ -97,6 +98,22 @@ class BaseXMPP(XMLStream): #: ``'to'`` and ``'from'`` JIDs of stanzas. self.is_component = False + #: The API registry is a way to process callbacks based on + #: JID+node combinations. Each callback in the registry is + #: marked with: + #: + #: - An API name, e.g. xep_0030 + #: - The name of an action, e.g. get_info + #: - The JID that will be affected + #: - The node that will be affected + #: + #: API handlers with no JID or node will act as global handlers, + #: while those with a JID and no node will service all nodes + #: for a JID, and handlers with both a JID and node will be + #: used only for that specific combination. The handler that + #: provides the most specificity will be used. + self.api = APIRegistry(self) + #: Flag indicating that the initial presence broadcast has #: been sent. Until this happens, some servers may not #: behave as expected when sending stanzas. |