summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/stanzabase.py
AgeCommit message (Collapse)Author
2012-10-18Recognize plugin stanzas when they're appended.Lance Stout
2012-10-10Correct handling deleting plugins when xml:lang is active.Lance Stout
2012-09-25Add support for XEP-0280 Message CarbonsLance Stout
2012-09-24Fix deleting non-existent stanza plugins.Lance Stout
2012-09-24Simplify stringifying XMLLance Stout
2012-07-25Fix initializing plugins in stanzas with a language set.Lance Stout
2012-06-22Resolve xml:lang issue with duplicated elements depending on ordering.Lance Stout
2012-06-20Fix issue with setting subelements values with default langs.Lance Stout
2012-06-19Allow message and presence stanzas to be embedded as substanzas.Lance Stout
2012-06-19Remove usage of deprecated getchildren() method.Lance Stout
2012-06-19PEP8 formatting updates.Lance Stout
2012-06-18Enable using xml:lang with normal interfaces.Lance Stout
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.
2012-06-18Add initial support for xml:lang for streams and stanza plugins.Lance Stout
Remaining items are suitable default actions for language supporting interfaces.
2012-05-05Tidy up and add tests for multi_attrib plugins.Lance Stout
2012-04-30added multifactory and support for it to register_stanza_pluginErik Larsson
2012-04-25Use provided stanza ID.Lance Stout
2012-04-14Handle using provided weakrefs as stanza parent references.Lance Stout
Fixes issue #159
2012-03-27Add support for a new type of stanza interface: boolLance Stout
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.
2012-02-19Fix incompatibility with clearing an element between ElementTree and ↵Lance Stout
cElementTree
2012-02-18More pyflakes cleanup.Lance Stout
2012-02-17Make last_xml usage a little more explict.Lance Stout
2012-01-17Pre-parse StanzaPath paths to speed up matching.Lance Stout
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.
2011-12-31Merge branch 'develop' into develop-1.1Lance Stout
2011-12-31Add docs on using Iq stanzas.Lance Stout
2011-12-28Ensure that stanza plugins work as expected if the XML is appended.Lance Stout
2011-12-12Add support for incoming/outgoing filters.Lance Stout
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)
2011-12-11Fix iterable substanzas when added as normal plugin.Lance Stout
If an iterable plugin was an enabled, it wasn't added to the iterables list.
2011-11-22Update docs for tostringLance Stout
2011-11-21Add more stanzabase docsLance Stout
2011-11-21Update stanzabase docsLance Stout
2011-11-19Tidy up logging calls.Lance Stout
2011-09-01Fix memory reference bugs.Lance Stout
2011-08-04Cosmetic PEP8 fixes.Lance Stout
2011-05-31Merge branch 'develop' into stream_featuresLance Stout
Conflicts: sleekxmpp/clientxmpp.py
2011-05-27Don't use the send queue for stream initialization.Lance Stout
Use the parameter now=True to skip the queue when sending Iq stanzas, or using xmpp.send().
2011-03-24Merge branch 'develop' into stream_featuresLance Stout
2011-03-24Allow a stanza plugin to override a parent's interfaces.Lance Stout
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'
2011-03-22Merge branch 'develop' into stream_featuresLance Stout
2011-03-22Updated XEP-0128 plugin to work with the new XEP-0030 plugin.Lance Stout
Required fixing a few bugs in StanzaBase related to iterable substanzas.
2011-03-18Merge branch 'develop' into stream_featuresLance Stout
Conflicts: sleekxmpp/xmlstream/stanzabase.py
2011-03-18Change namespace inclusion in strings.Lance Stout
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.
2011-02-14Merge branch 'develop' into stream_featuresLance Stout
Conflicts: sleekxmpp/xmlstream/stanzabase.py
2011-02-14Remap old method names in a better way.Lance Stout
This should prevent some reference cycles that will cause garbage collection issues.
2011-02-11XMPPError exceptions can keep a stanza's contents.Lance Stout
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.
2011-01-27Update tostring methods.Lance Stout
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'.
2011-01-27Make stanza.plugins an OrderedDict.Lance Stout
This allows you to determine the order in which substanzas were added in the original XML.
2011-01-26Cleanup for stanzabase.Lance Stout
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.
2011-01-26Upgraded how subitem works.Lance Stout
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.
2011-01-19Make extending stanza objects nicer.Lance Stout
A stanza object may add is_extension = True to its class definition to provide a single new interface to a parent stanza. For example: import sleekxmpp from sleekxmpp import Iq from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin, ET class Foo(ElementBase): """ Test adding just an attribute to a parent stanza. Adding subelements works as expected. """ is_extension = True interfaces = set(('foo',)) plugin_attrib = '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, val): self.parent()._set_attr('foo', val) def get_foo(self): return self.parent()._get_attr('foo') def del_foo(self): self.parent()._del_attr('foo') register_stanza_plugin(Iq, Foo) i1 = Iq() i2 = Iq(xml=ET.fromstring("<iq xmlns='jabber:client' foo='bar' />")) >>> i1['foo'] = '3' >>> i1 '3' >>> i1 '<iq id="0" foo="3" />' >>> i2 '<iq id="0" foo="bar" />' >>> i2['foo'] 'bar' >>> del i2['foo'] >>> i2 '<iq id="0" />'
2010-12-07Add support for using xml:lang values.Lance Stout
Support is only for adding literal XML content to stanzas. Full support for things like multiple message bodies with different xml:lang values is still in the works.