Age | Commit message (Collapse) | Author |
|
Tests now run successfully. Occasionally get single error related to
duplicated payload data in pubsub items when copying stanza values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Using the special language value '*' will return a dictionary of all
such elements keyed by language.
>>> msg = Message()
>>> msg['body'] = 'Hi!'
>>> msg['body|sv'] = 'Hej!'
>>> print(msg)
'<message xmlns="jabber:client">
<body>Hi!</body>
<body xml:lang="sv">Hej!</body>
</message>'
>>> print(msg['body|*'])
OrderedDict(
('', 'Hi!'),
('sv', 'Hej!'))
Remaining items:
- Stanza path matching does not support language specifiers for normal
interfaces, only for plugins.
|
|
Remaining items are suitable default actions for language supporting
interfaces.
|
|
|
|
|
|
|
|
Fixes issue #159
|
|
The set of bool_interfaces provides default behaviour for
checking/setting the presence of empty subelements.
The prime example of this would be:
bool_interfaces = set(['required'])
This would mean that ``stanza['required']`` would return ``True`` for:
<stanza>
<required />
</stanza>
and ``False`` for:
<stanza />
Likewise, assigning ``stanza['required'] = True`` would add an empty
``<required />`` element, and setting it to ``False`` would remove
such an element if it exists.
|
|
cElementTree
|
|
|
|
|
|
The parsing and namespace cleaning isn't terribly expensive, but it does
add up. It was adding an extra 5sec when processing 100,000 basic
message stanzas.
|
|
|
|
|
|
|
|
A filter accepts and returns a stanza, but potentially modified.
To prevent sending/receiving a stanza, a filter may return None.
Incoming:
self.add_filter('in', in_filter)
Outgoing:
self.add_filter('out', out_filter)
Filters are applied in the order thay are added. However, you may
add an order parameter, which is the place in the list to insert the
filter:
self.add_filter('in', in_filter, order=0)
|
|
If an iterable plugin was an enabled, it wasn't added to
the iterables list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Conflicts:
sleekxmpp/clientxmpp.py
|
|
Use the parameter now=True to skip the queue when
sending Iq stanzas, or using xmpp.send().
|
|
|
|
Each interface, say foo, may be overridden in three ways:
set_foo
get_foo
del_foo
To declare an override in a plugin, add the class field
overrides as so:
overrides = ['set_foo', 'del_foo']
Each override must have a matching set_foo(), etc method
for implementing the new behaviour.
To enable the overrides for a particular parent stanza,
pass the option overrides=True to register_stanza_plugin.
register_stanza_plugin(Stanza, Plugin, overrides=True)
Example code:
class Test(ElementBase):
name = 'test'
namespace = 'testing'
interfaces = set(('foo', 'bar'))
sub_interfaces = set(('bar',))
class TestOverride(ElementBase):
name = 'test-override'
namespace = 'testing'
plugin_attrib = 'override'
interfaces = set(('foo',))
overrides = ['set_foo']
def setup(self, xml):
# Don't include an XML element in the parent stanza
# since we're adding just an attribute.
# If adding a regular subelement, no need to do this.
self.xml = ET.Element('')
def set_foo(self, value):
print("overrides!")
self.parent()._set_attr('foo', 'override-%s' % value)
register_stanza_plugin(Test, TestOverride, overrides=True)
Example usage:
>>> t = TestStanza()
>>> t['foo'] = 'bar'
>>> t['foo']
'override-bar'
|
|
|
|
Required fixing a few bugs in StanzaBase related to iterable
substanzas.
|
|
Conflicts:
sleekxmpp/xmlstream/stanzabase.py
|
|
ElementBase instances will display the top-most namespace by default.
StanzaBase instances will NOT display the top-most namespace by default.
May pass True or False to __str__ to override.
|
|
Conflicts:
sleekxmpp/xmlstream/stanzabase.py
|
|
This should prevent some reference cycles that will cause garbage
collection issues.
|
|
This allows exceptions to include the original
content of a stanza in the error response by including
the parameter clear=False when raising the exception.
|
|
Will now always show top-level namespace, unless it is the same
as the stream's default namespace. Also added the XMPP stream
namespace to the namespace map as 'stream'.
|
|
This allows you to determine the order in which substanzas
were added in the original XML.
|
|
Use stanza.values instead of _get/set_stanza_values where used.
ElementBase stanzas can now use .tag
May use class method tag_name() for stanza classes.
ElementBase now has .clear() method.
|
|
May now use register_stanza_plugin(Foo, Bar, iterable=True)
to add to the set of stanza classes used for iterable
substanzas. It is no longer necessary to manually specify
the contents of subitem if the new method is used.
|