Commit graph

553 commits

Author SHA1 Message Date
Nathan Fritz
8a22597180 added has_jid to roster 2011-04-15 17:43:12 -07:00
Nathan Fritz
e919906c8c Pubsub/Unsubscribe was not getting registered 2011-04-14 17:34:33 -07:00
Nathan Fritz
46dc6eac88 remove roster item state responsibility from clients 2011-04-14 16:27:27 -07:00
Lance Stout
b9bf30e095 Merge branch 'develop' into roster 2011-04-11 14:23:39 -04:00
Lance Stout
1d891858b6 Mark scheduler thread as a daemon. 2011-04-11 14:22:32 -04:00
Lance Stout
b60c51ef13 Merge branch 'develop' into roster 2011-04-08 16:52:20 -04:00
Lance Stout
f02b0564e0 Update tests to reflect XEP-0086 correcting error codes. 2011-04-08 16:51:24 -04:00
Lance Stout
6b05938573 Merge branch 'develop' into roster 2011-04-08 16:41:45 -04:00
Lance Stout
2e1befc8c6 Make setup.py use sleekxmpp.__version__ 2011-04-08 16:41:18 -04:00
Lance Stout
87ccd804ff Add version info.
May now use sleekxmpp.__version__ and sleekxmpp.__version_info__.
2011-04-08 16:39:39 -04:00
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
77601f7262 Merge branch 'develop' into roster 2011-03-24 13:15:00 -04:00
Lance Stout
d94811d81d Added new implementation for XEP-0086. 2011-03-24 13:14:26 -04:00
Lance Stout
6d45971411 Allow a stanza plugin to override a parent's interfaces.
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-24 12:25:17 -04:00
Lance Stout
84e2589f22 Left too much unlrelated code in example. 2011-03-24 09:42:54 -04:00
Lance Stout
d9be51b2ef Merge branch 'develop' into roster 2011-03-24 09:36:26 -04:00
Lance Stout
a3d111be12 Added new XEP-0050 implementation.
Backward incompatibility alert!

Please see examples/adhoc_provider.py for how to use the new
plugin implementation, or the test examples in the files
tests/test_stream_xep_0050.py and tests/test_stanza_xep_0050.py.

Major changes:
    - May now have zero-step commands. Useful if a command is
      intended to be a dynamic status report that doesn't
      require any user input.
    - May use payloads other than data forms, such as a
      completely custom stanza type.
    - May include multiple payload items, such as multiple
      data forms, or a form and a custom stanza type.
    - Includes a command user API for calling adhoc commands
      on remote agents and managing the workflow.
    - Added support for note elements.

Todo:
    - Add prev action support.

You may use register_plugin('old_0050') to continue using the
previous XEP-0050 implementation.
2011-03-24 09:35:36 -04:00
Lance Stout
4916a12b6f Tidy up the examples. 2011-03-23 22:59:21 -04:00
Lance Stout
d6f2e51b05 Allow SleekTest to wait longer when checking for sent stanzas.
Now timeouts at 0.5sec instead of 0.1sec, which should prevent test
failures from stanzas being delayed longer than usual.
2011-03-23 20:23:49 -04:00
Lance Stout
feb7f892ea Fix typo. 2011-03-23 19:00:20 -04:00
Lance Stout
a420771665 Updated todo file again.
Only 11 plugins left to tidy before 1.0!
2011-03-23 10:10:54 -04:00
Lance Stout
393259c24b Merge branch 'develop' into roster 2011-03-23 10:01:10 -04:00
Lance Stout
f2449009d1 Updated todo file. 2011-03-23 10:00:48 -04:00
Lance Stout
833f95b53a Cleaned XEP-0249 plugin, added tests. 2011-03-23 10:00:32 -04:00
Lance Stout
756c4c032f Merge branch 'develop' into roster 2011-03-22 20:48:09 -04:00
Lance Stout
4b1fadde4b Updated XEP-0128 plugin to work with the new XEP-0030 plugin.
Required fixing a few bugs in StanzaBase related to iterable
substanzas.
2011-03-22 20:42:43 -04:00
Lance Stout
e1360ae049 Merge branch 'develop' into roster 2011-03-22 12:00:01 -04:00
Lance Stout
86a6b40fd8 Updated doc for connect() 2011-03-22 11:59:27 -04:00
Lance Stout
7ef6abb2a3 May pass use_tls=False to connect().
Will disable the use of TLS for the session.
2011-03-22 11:56:55 -04:00
Lance Stout
b048f8d733 Merge branch 'develop' into roster 2011-03-18 17:36:35 -04:00
Lance Stout
dbf6780345 Change namespace inclusion in strings.
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-18 17:34:07 -04:00
Lance Stout
450c313340 Fix error in stanza handler registration in XEP-0092. 2011-03-18 17:30:29 -04:00
Lance Stout
f65f88325b Merge branch 'develop' into roster 2011-03-18 15:51:27 -04:00
Lance Stout
996ca52471 Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop 2011-03-18 15:48:38 -04:00
Lance Stout
6244857746 Fix self.disconnect(reconnect=True) not working. 2011-03-18 15:47:21 -04:00
Florent Le Coz
5635265203 Avoid infinite loop on version result
We need to check if type="get". otherwise we will send our version
when we will receive the version of the remote entity, and thus
going in an infinite loop.
2011-03-16 06:45:06 +08:00
Lance Stout
42c8f6ae87 Merge branch 'develop' into roster 2011-02-24 16:19:45 -05:00
Lance Stout
45ccb31356 Remove the occasional warning about XEP-0059 not loaded. 2011-02-24 16:13:44 -05:00
Lance Stout
1a81b2f464 Add tests for XEP-0085, fix some bugs. 2011-02-24 14:15:02 -05:00
Lance Stout
77251452c1 Updated the XEP-0085 plugin.
Can now be used as so:

>>> msg['chat_state']
''
>>> msg
<message />

>>> msg['chat_state'] = 'paused'
>>> msg
<message>
  <paused xmlns="http://jabber.org/protocol/chatstates" />
</message>

>>> msg['chat_state']
'paused'

>>> del msg['chat_state']
>>> msg
<message />
2011-02-24 12:10:29 -05:00
Lance Stout
4df3aa569b Bring back the signal handlers (and the "killed" event).
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-23 10:20:04 -05:00
Nathan Fritz
2e2e16e281 fixes to ping: auto-ping off by default, fixed ping-time of zero bug, fixed class name mismatch 2011-02-15 15:24:58 -08:00
Lance Stout
e4f3b777f9 Reset the roster on disconnect instead of replacing it. 2011-02-14 16:24:49 -05:00
Lance Stout
a278f79bdb Merge branch 'develop' into roster
Conflicts:
	sleekxmpp/clientxmpp.py
2011-02-14 16:18:44 -05:00
Lance Stout
d709f8db65 Use the _build_stanza method. 2011-02-14 13:50:59 -05: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
e0f9025e7c More attempts at fixing garbage collection.
Don't keep a reference to stanzas in Callback objects.
2011-02-14 11:30:04 -05:00
Lance Stout
9004e8bbf2 Break references that can prevent garbage collection. 2011-02-14 11:13:41 -05:00
Lance Stout
8b5511c7ec Simplification when removing a deletable handler. 2011-02-13 16:40:04 -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