Commit Graph

447 Commits

Author SHA1 Message Date
Lance Stout b3353183f3 Added ordereddict implementation to thirdparty.
See http://pypi.python.org/pypi/ordereddict and
http://code.activestate.com/recipes/576693/.
2010-12-21 17:33:31 -05:00
Lance Stout f97f6e5985 More documentation for XEP-0030 plugin. 2010-12-21 11:33:03 -05:00
Lance Stout 34c374a1e1 Make tests pass for catching exceptions.
May now use sys.excepthook to catch exceptions
from threaded handlers.
2010-12-17 13:11:03 -05:00
Lance Stout 506eccf84d Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop 2010-12-17 10:44:32 -05:00
Florent Le Coz 982bf3b2ec RootStanza raises unexpected exceptions
We now raise the unexpected exceptions instead of sending
them on the network.
 - avoids flood (sending a traceback on a MUC, for example…) and
   maybe some security issues.
 - lets you handle the traceback (catch it to handle
   it properly, or with except_hook, etc)
 - an exception cannot be raised without you knowing
2010-12-17 23:43:48 +08:00
Lance Stout 53a5026301 Almost done with xep-30; added more docs. 2010-12-16 23:52:17 -05:00
Lance Stout 0aee445e69 Use daemon threads instead of signals.
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-16 22:21:50 -05:00
Lance Stout 0ea014fe41 Updated the list of plugins in sleekxmpp.plugins.__init__ 2010-12-16 18:29:56 -05:00
Lance Stout 62b190d0ff Fixed specifying 'from' values in XEP-0045 plugin.
Methods now accept either an ifrom or mfrom parameter
to specify a 'from' value. Client connections should not
need to use these, but component connections must use them.
2010-12-16 18:14:33 -05:00
Lance Stout 4b57b8131f Added support for using SSL CA certificates.
Originally provided by Brian Beggs (macdiesel)
and Thom Nichols (tomstrummer).
2010-12-16 17:30:08 -05:00
Lance Stout 988a90a176 Added MUC invite handler to XEP-0045 plugin.
Originally contributed by damium/romeira, with some
modifications.

Also, converted tabs to spaces to prepare for future cleanup.
2010-12-16 16:18:49 -05:00
Lance Stout 67775fb8bd Use boundjid in plugins instead of the deprecated accessors.
Originally contributed by skinkie, with a few modifications.
2010-12-16 15:38:00 -05:00
Lance Stout e81683beee Some Python 3.1+ compatibility fixes.
Originally contributed by filipegiusti.
2010-12-16 15:29:17 -05:00
Lance Stout d9c25ee65c Added more options to the make_iq_* methods.
May include a to and from JID in make_iq_* calls.

May pass an existing iq stanza to most of them instead of generating
a new stanza.

make_iq now accepts a 'to' value, 'type' value, and 'query' value to
simplify things a bit more.
2010-12-16 15:25:04 -05:00
Lance Stout 1ebc7f4d4b Implement a few more static node handlers. 2010-12-15 19:22:21 -05:00
Lance Stout 2c5b77ae2e And some more docs. 2010-12-15 18:57:45 -05:00
Lance Stout d8aae88526 The documentation effort continues.
Also, need to start working on a replacement for the XEP-30 page in the
wiki since the API has changed significantly.
2010-12-15 17:58:15 -05:00
Lance Stout 2f4bdfee1b Update some docs. 2010-12-13 15:58:59 -05:00
Lance Stout f4451fe6b7 First pass at a new XEP-0030 plugin.
Now with dynamic node handling goodness.

Some things are not quite working yet, in particular:
    set_items
    set_info
    set_identities
    set_features

And still need more unit tests to round things out.
2010-12-09 18:57:27 -05:00
Lance Stout f474d378ef Add support for using xml:lang values.
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-12-07 23:07:40 -05:00
Lance Stout defc252c7d Fix several errors in SleekTest.
Notably, not sending an expected stanza will not silently pass.
2010-12-07 23:04:37 -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 8ead33fc3b Fixed typo 2010-11-18 16:23:18 -05:00
Lance Stout ab25301953 Adding stream tests for XEP-0030.
Fixed some errors when responding to disco requests.
2010-11-18 15:50:45 -05:00
Lance Stout 291b118aca XEP-0030 bug fixes. 2010-11-18 11:22:11 -05:00
Lance Stout db7fb10e95 Add rename_node method to disco plugin. 2010-11-18 01:15:34 -05:00
Lance Stout 60d3afe6b6 Added __repr__ for JIDs. 2010-11-18 00:03:39 -05:00
Lance Stout e648f08bad Fix stream test errors. 2010-11-17 16:08:14 -05:00
Lance Stout 7ba6d5e02d Fix Node set to None error. 2010-11-17 16:01:27 -05:00
Lance Stout ea48bb5ac5 Fixed some live stream test errors.
Added test demonstrating using multiple stream clients
in a single test.
2010-11-17 15:45:16 -05:00
Lance Stout 6ee8a2980c Fix RESPONSE_TIMEOUT dependency loops. 2010-11-17 15:13:09 -05:00
Lance Stout b8114b25ed Make live stream tests work better.
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-17 13:43:15 -05:00
Nathan Fritz 45991e47ee scheduler no longer waits for the next event before exiting 2010-11-16 17:58:20 -08:00
Nathan Fritz b8f40eb843 xep_0199 ping now uses scheduler instead of dedicated thread 2010-11-16 17:43:05 -08:00
Florent Le Coz b73a859031 Add a groupchat_subject event
Use this event to get notified of the subject changes (or to get the
subject of the room when joining one)
2010-11-10 05:54:22 +08:00
Florent Le Coz 9dbf246f0b Doesn't fail if host has NO SRV record
Just catch an other exception type coming from the dns resolver that
could be raised with hosts like "anon.example.com" which just don't have
any SRV record.
2010-11-09 01:53:41 +08:00
Lance Stout 4fb77ac878 Logging no longer uses root logger.
Each module should now log into its own logger.
2010-11-06 01:28:59 -04:00
Lance Stout d0c506f930 Simplified SleekTest.
* 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-05 21:18:48 -04:00
Lance Stout 7351fe1a02 Fix bug introduced while fixing another bug.
Threaded event handlers now handle exceptions again.
2010-11-04 14:35:35 -04:00
Nathan Fritz 38c2f51f83 fixed indent errors 2010-11-04 11:39:41 -07:00
Lance Stout 1bf34caa5b Fixes for XEP-0199 plugin.
Quick fixes to get the XEP-0199 plugin working until a proper cleanup is
done.
2010-11-03 14:04:18 -04:00
Lance Stout 5769935720 Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop 2010-11-03 12:39:44 -04:00
Lance Stout 0214db7545 Catch exceptions for direct events.
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-11-03 12:38:13 -04:00
Lance Stout ffc6f031d9 Updated namespaced used in the XEP-0199 plugin. 2010-11-03 12:37:26 -04:00
Lance Stout 9e248bb852 Fix bug in XEP-0030 plugin.
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-31 18:27:52 -04:00
Lance Stout 973890e2c9 Added try/except for setting signal handlers.
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-28 10:42:23 -04:00
Lance Stout 9c08e56ed0 SSL and signal fixes.
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-27 19:27:47 -04:00
Lance Stout b888610525 Added XEP-202 Entity Time plugin.
Contributed by Cesar Alcalde.
2010-10-25 21:26:25 -04:00
Lance Stout 6d68706326 Added XEP-0012 Last Activity plugin.
Contributed by Cesar Alcalde.
2010-10-25 20:37:02 -04:00