Commit graph

26 commits

Author SHA1 Message Date
Lance Stout
d7ba7cc72a Use underscore method name.
Since camelcase names are aliased to the underscored name at startup,
if the underscored version is replaced later, the camelCase name does
not reflect the change.
2011-04-08 16:14:22 -04:00
Lance Stout
75584d7ad7 Remap old method names in a better way.
This should prevent some reference cycles that will cause garbage
collection issues.
2011-02-14 13:49:43 -05:00
Lance Stout
34f6195ca5 Return the name of the registered callback.
Instead of the actual callback object, return just the name of
the callback object created when using iq.send(callback=..).

This will help prevent memory leaks by not keeping an additional
reference to the object, but still allows for the callback to be
canceled by using self.remove_handler("handler_name").
2011-02-13 16:30:57 -05:00
Lance Stout
ca2b4a188a Return the registered callback when using iq.send(callback=foo).
Allows for a callback to be canceled by unregistering the
returned handler.
2011-02-12 11:01:43 -05:00
Lance Stout
0d32638379 XMPPError exceptions can keep a stanza's contents.
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-02-11 15:20:26 -05:00
Lance Stout
2004ddd678 Add StreamError stanza and a stream_error event.
Note that the stream may automatically attempt to
reconnect when a stream error is received.
2011-01-16 13:22:52 -05:00
Lance Stout
ba0d699d83 Fix ordering error in Iq._set_stanza_values.
If iq['query'] was set before a plugin that used the query
element was set, then the query element was duplicated.
2011-01-12 08:55:33 -05:00
Lance Stout
19bd1e0485 Actually make the Iq callbacks work for real. 2010-12-07 23:04:04 -05:00
Lance Stout
5f2fc67c40 Added option for iq.send to accept a callhandler.
The callback will be a stream level handler, and will not
execute in its own thread. If you must have a thread, have the
callback function raise a custom event, which can be processed
by another event handler, which may run in an individual thread,
like so:

def handle_reply(self, iq):
    self.event('custom_event', iq)

def do_long_operation_in_thread(self, iq):
    ...

self.add_event_handler('custom_event', self.do_long_operation_in_thread)

...take out already prepared iq stanza...
iq.send(callback=self.handle_reply)
2010-12-07 17:19:39 -05:00
Lance Stout
6ee8a2980c Fix RESPONSE_TIMEOUT dependency loops. 2010-11-17 15:13:09 -05:00
Lance Stout
4375ac7d8b Underscore names by default.
Stanza objects now accept the use of underscored names.

The CamelCase versions are still available for backwards compatibility,
but are discouraged.

The property stanza.values now maps to the old getStanzaValues and
setStanzaValues, in addition to _set_stanza_values and
_get_stanza_values.
2010-10-17 22:04:42 -04:00
Lance Stout
1cedea2804 Added optional default value to _getAttr. 2010-07-30 14:11:24 -04:00
Lance Stout
cbed8029ba Updated, cleaned, and documented Iq stanza class. Also added unit tests. 2010-07-29 23:58:25 -04:00
Lance Stout
690eaf8d3c Updated license notices to use the correct MIT format. Also corrected references to nonexistant license.txt to LICENSE. 2010-07-20 11:19:49 -04:00
Lance Stout
35f4ef3452 Modified the return values for several methods so that they can be chained.
For example:

    iq.reply().error().setPayload(something.xml).send()
2010-05-25 07:28:43 +08:00
Nathan Fritz
80e7e0d0ee adding tests, fixed stanzapath matching to match keys, fixed pubsub#owner stanzas 2010-04-14 01:23:17 -07:00
Nathan Fritz
935ee4d14e changed license to MIT 2010-03-26 14:32:16 -07:00
Nathan Fritz
0dcbe92d1e got rid of stupid iq set/get/error/result methods 2010-02-15 21:42:27 -08:00
Nathan Fritz
6b130eb947 unhandled iq's should only respond to errors when type=get/set 2010-01-20 01:42:53 -08:00
Nathan Fritz
8e3168e145 * added first stanza tests
* added stanza.keys()
* stanza.getValues() now return substanzas and plugins
* stanza.setValues() now can read substanzas and plugins
* stanzas can now be iterable if stanza.subitem is set to a class
2010-01-08 01:45:11 +00:00
Nathan Fritz
093644ffbd * major stanza improvements
* raise XMPPError in handler to reply with error stanza
* started work on pubsub stanzas
2010-01-05 21:56:48 +00:00
Nathan Fritz
805afa4bc1 * fixed unhandled iqs 2009-12-22 10:05:53 +00:00
Nathan Fritz
07018c0afa * fixed many stanza bugs
* added stanza unhandled (unhandled iqs now reply with feature-not-implemented)
* added stanza exceptions (stanzas may now reply with exceptions when their handler raises an exception)
2009-12-17 01:54:22 +00:00
Nathan Fritz
8854509ccd * started converstion to stanza objects 2009-12-11 01:29:46 +00:00
Nathan Fritz
007b04dd30 * added proper message and iq stanzas. presence left to do 2009-12-10 01:23:03 +00:00
Nathan Fritz
96b103b275 moved seesmic branch to trunk 2009-06-03 22:56:51 +00:00