summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
AgeCommit message (Collapse)Author
2011-05-31Apply connection backoff to reconnect attempts.Lance Stout
Backoff was only being done for the initial connection attempt before. Now any reconnection will start with a minimum 1 sec delay which will approximately double between attempts.
2011-05-31Cleanup logging and exception handling.Lance Stout
The syntax and attribute errors raised during a disconnect/reconnect attempt are now caught and produce nicer log messages.
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-05-27Fix typo for SSL certificate use.Lance Stout
2011-05-27Add exponential backoff to connection attempts.Lance Stout
Delay will approximately double between attempts (random variation). See issue #67.
2011-05-27Added support for testind disconnect errors.Lance Stout
2011-05-20Fix double roster entry issue with Unicode.Lance Stout
JIDs with Unicode values were being encoded by the JID class instead of leaving them as just Unicode strings. It may still be a good idea to use from __future__ import unicode_literals pretty much everywhere though. Fixes issue #88.
2011-04-11Mark scheduler thread as a daemon.Lance 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-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-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-03-18Fix self.disconnect(reconnect=True) not working.Lance Stout
2011-02-23Bring back the signal handlers (and the "killed" event).Lance Stout
Now done more responsibly, saving any existing signal handlers and calling them when an interrupt occurs in addition to the one Sleek installs. NOTE: You may need to explicitly use "kill <process id>" in order to trigger the proper signal handler execution, and to raise the "killed" event.
2011-02-14Use the _build_stanza method.Lance Stout
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-14More attempts at fixing garbage collection.Lance Stout
Don't keep a reference to stanzas in Callback objects.
2011-02-14Break references that can prevent garbage collection.Lance Stout
2011-02-13Simplification when removing a deletable handler.Lance Stout
2011-02-13Make one-off Callbacks ready for deletion after the prerun step.Lance Stout
Waiting until the actual run step means that the handler is not marked for deletion when checked in the __spawn_event() thread, causing the callback to stay in the handler list.
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-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-27Recognize stanzas that don't use the default namespace.Lance Stout
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" />'
2011-01-16Raise the event 'socket_error' when a socket error occurs.Lance Stout
Will be most useful for debugging and responding to failed connection attempts.
2011-01-14Add a note for debug statement when running scheduled events.Lance Stout
Fixes the intermittent DEBUG ((),) messages that give no explanation. Will now show as: DEBUG Scheduled event: ((), )
2011-01-13Fix bug in JID class. Attribute .jid now works properly.Lance Stout
2011-01-05Allow JID objects to be compared with strings.Lance Stout
Two JIDs match if they have the same full JID value.
2010-12-17Make tests pass for catching exceptions.Lance Stout
May now use sys.excepthook to catch exceptions from threaded handlers.
2010-12-16Use daemon threads instead of signals.Lance Stout
Daemonized threads exit once the main program has quit, and the only threads left running are all daemon threads. Should fix hanging clients while not trampling over anyone else's signal handlers.
2010-12-16Added support for using SSL CA certificates.Lance Stout
Originally provided by Brian Beggs (macdiesel) and Thom Nichols (tomstrummer).
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.
2010-11-18Added __repr__ for JIDs.Lance Stout
2010-11-17Fix RESPONSE_TIMEOUT dependency loops.Lance Stout
2010-11-17Make live stream tests work better.Lance Stout
SleekTest can now use matchers when checking stanzas, using the method parameter for self.check(), self.recv(), and self.send(): method='exact' - Same behavior as before 'xpath' - Use xpath matcher 'id' - Use ID matcher 'mask' - Use XML mask matcher 'stanzapath' - Use StanzaPath matcher recv_feature and send_feature only accept 'exact' and 'mask' for now.
2010-11-16scheduler no longer waits for the next event before exitingsleek-1.0-Beta41.0-Beta4Nathan Fritz
2010-11-06Logging no longer uses root logger.Lance Stout
Each module should now log into its own logger.
2010-11-05Simplified SleekTest.Lance Stout
* check_stanza does not require stanza_class parameter. Introspection! * check_message, check_iq, and check_presence removed -- use check instead. * stream_send_stanza, stream_send_message, stream_send_iq, and stream_send_presence removed -- use send instead. * Use recv instead of recv_message, recv_presence, etc. * check_jid instead of check_JID * stream_start may accept multi=True to return a new SleekTest instance for testing multiple streams at once.
2010-11-04Fix bug introduced while fixing another bug.Lance Stout
Threaded event handlers now handle exceptions again.
2010-11-04fixed indent errorsNathan Fritz
2010-11-03Merge branch 'develop' of github.com:fritzy/SleekXMPP into developLance Stout
2010-11-03Catch exceptions for direct events.Lance Stout
Events triggered with direct=True will have exceptions caught. Note that all event handlers in a direct event will currently run in the same thread.
2010-10-31Fix bug in XEP-0030 plugin.Lance Stout
xep_0030 still referenced event_handlers. Added the method event_handled which will return the number of registered handlers for an event to resolve the issue.
2010-10-28Added try/except for setting signal handlers.Lance Stout
Setting signal handlers from inside a thread is not supported in Python, but some applications need to run Sleek from a child thread. SleekXMPP applications that run inside a child thread will NOT be able to detect SIGHUP or SIGTERM events. Those must be caught and managed by the main program.
2010-10-27SSL and signal fixes.Lance Stout
Made setting the SIG* handlers conditional on if the signal defined for the OS. Added the attribute ssl_version to XMLStream to set the version of SSL used during connection. It defaults to ssl.PROTOCOL_TLSv1, but OpenFire tends to require ssl.PROTOCOL_SSLv23.
2010-10-25Made exceptions work.sleek-1.0-Beta21.0-Beta2Lance Stout
Raising an XMPPError exception from an event handler now works, even if from a threaded handler. Added stream tests to verify. We should start using XMPPError, it really makes things simple!
2010-10-24More JID unit tests.Lance Stout
sleekxmpp.xmlstream.jid now has 100% coverage!
2010-10-24Fixed resource bug in JIDs.Lance Stout
JIDs without resources will return '' instead of the bare JID. Cleaned up JID tests, and added check_JID to SleekTest.
2010-10-21Fixed mixed text and elements bug in tostring.Lance Stout
XML of the form <a>foo <b>bar</b> baz</a> was outputted as <a>foo <b>bar</b> baz baz</a>. Includes unit test.