Commit graph

2557 commits

Author SHA1 Message Date
mathieui
8fd0d7c993
Add a coroutine_wrapper decorator
This decorator checks for the coroutine=True keyword arg and wraps the
result of the function call in a coroutine if it isn’t.

This allows to have constructs like:

@coroutine_wrapper
def toto(xmpp, *, coroutine=False):
    if xmpp.cached:
        return xmpp.cached
    else:
        return xmpp.make_iq_get().send(coroutine=coroutine)

@asyncio.coroutine
def main(xmpp):
    result = yield from toto(xmpp, coroutine=True)
    xmpp.cached = result
    result2 = yield from toto(xmpp, coroutine=True)

If the wrapper wasn’t there, the second fetch would fail. This decorator
does not do anything if the coroutine argument is False.
2015-02-23 17:32:31 +01:00
mathieui
1450d36377
Add a coroutine parameter to iq.send() to return a coroutine
(instead of exposing a different send_coroutine method)
2015-02-23 17:20:47 +01:00
mathieui
06358d0665
Use CallbackCoroutine with Iq callbacks too 2015-02-22 20:13:48 +01:00
mathieui
2b3b86e281
Allow event handlers to be coroutine functions
And do not copy data when running events with XMLStream.event()
2015-02-22 14:17:17 +01:00
mathieui
92e4bc752a
Add a “blocking” send_coroutine method to the Iq class 2015-02-21 23:45:30 +01:00
mathieui
ffb2e05f21
Check that ciphers have been initialized
(if not, python will use the system default)
2015-02-17 04:27:03 +01:00
mathieui
1e2665df19
Update the test suite.
- monkey-patch our own monkey-patched idle_call to run events immediatly
  rather than adding them to the event queue, and add a fake transport
  with a fake socket.
- remove the test file related to xep_0059 as it relies on blocking
  behavior, and comment out one xep_0030 test uses xep_0059
- remove many instances of threading and sleep()s because they do
  nothing except waste time and introduce race conditions.
- keep exactly two sleep() in IoT xeps because they rely on timeouts
2015-02-12 12:23:47 +01:00
mathieui
4d063e287e
Remove more threaded= and block= options from the plugins
(also, correct a typo)
2015-02-12 12:21:20 +01:00
mathieui
44f02fb3ab
Do the plugins post_init() upload loading
(the top_level boolean used to load them at this point wasn’t ever set
to true)
2015-02-12 12:18:32 +01:00
mathieui
f6b3a0c6cf
Fix the uses of stanza.reply()
This is relying on the stanzas being copied for each handler. We no
longer do that for performance reasons, so instead of editing the copy
in-place, stanza.reply() now returns a new stanza.
2015-02-12 12:17:01 +01:00
mathieui
8b36e918e8
Fix the componentxmpp interface 2015-02-12 12:11:50 +01:00
Sangeeth Saravanaraj
9044807121 Added help for running example.. 2015-02-05 18:11:41 +05:30
Sangeeth Saravanaraj
24264d3a07 Updated Example.. 2015-02-05 18:10:10 +05:30
Sangeeth Saravanaraj
8bc70264ef misc updates.. 2015-02-05 17:35:04 +05:30
Florent Le Coz
957c635fb7 XMLStream must provide the BaseProtocol interface 2015-02-04 17:49:30 +01:00
mathieui
4027927c6e
Don’t set the msg['from'] and msg['id'] in receipt.ack()
setting msg['id'] is wrong, and setting msg['from'] might lead to
echoing back wrong input.
2015-02-04 16:49:39 +01:00
Sangeeth Saravanaraj
c16b862200 Raise http_request and http_response events. 2015-02-03 12:33:25 +05:30
Sangeeth Saravanaraj
a96f608469 Composing request and response. 2015-01-29 08:33:40 +05:30
Sangeeth Saravanaraj
e1f25604ec Added callbacks, registered stanzas, added features, etc. 2015-01-28 14:52:15 +05:30
Sangeeth Saravanaraj
0fe057b5c3 Boilerplate for Stanzas - request and response 2015-01-27 15:13:57 +05:30
Sangeeth Saravanaraj
be76dda21d Added xep_0332 to setup 2015-01-23 10:29:21 +05:30
Sangeeth Saravanaraj
ecd124dd06 Boilerplate for xep_0332 2015-01-22 16:40:03 +05:30
Sangeeth Saravanaraj
4a8951c4ee added xep_0332 to plugins 2015-01-22 16:39:27 +05:30
Sangeeth Saravanaraj
8afba7de85 renamed example for convenience. 2015-01-22 16:38:16 +05:30
Sangeeth Saravanaraj
1ce42d3a2f Boilerplate example. 2015-01-22 11:30:38 +05:30
Sangeeth Saravanaraj
2f4d811db4 Fixed a typo in docs/guide_xep_0030.rst 2015-01-22 11:13:03 +05:30
Sangeeth Saravanaraj
61127f521d Added PyCharm's .idea folder to .gitignore 2015-01-22 11:09:47 +05:30
mathieui
62eefdbd6a
Expose MUC support in disco#info
http://xmpp.org/extensions/xep-0045.html#disco-client
2015-01-15 22:50:49 +01:00
Florent Le Coz
225e07eb64 Fix the call of iscoroutinefunction() 2015-01-05 11:36:24 +01:00
Florent Le Coz
1207c81ab5 Do not copy the stanza before calling each handler 2015-01-03 18:42:57 +01:00
Florent Le Coz
565da65ccd Use a deque for the idle list 2015-01-03 16:13:39 +01:00
Florent Le Coz
47fbd4cead Delay the handling of stanza for when the process is not busy
We use some dirty monkey-patching to add a idle_call() function to the
asyncio module. We then use that method to handle each received stanza only
when the event loop is not busy with some other IO (mainly, the standard
input)
2015-01-03 06:08:03 +01:00
mathieui
1b9b4199e8
Make the ca_certs option useful again (CA-based cert validation)
It was broken since the fork.
2014-12-17 19:03:49 +01:00
mathieui
b5930ca958
Bring back authentication through SASL EXTERNAL
(and only update the ssl context before it gets used)
2014-12-11 19:27:13 +01:00
mathieui
063e73c0d2
Fix the element name for retrieving certs in XEP-0257
And s/258/257/ in the XEP description
2014-12-11 18:32:50 +01:00
mathieui
423974f90d
Fix xep-0257 for slixmpp, and fix an element name 2014-12-11 14:46:52 +01:00
Oleg Antonyan
d261318e1a In queues added option to remove first element on addind new if queue is
full
2014-11-27 07:11:06 +02:00
Oleg Antonyan
d33cc00fe9 On initial connect use delay if connection failed 2014-11-23 16:46:01 +02:00
Florent Le Coz
5fcf08a415 Lower the timeout for each DNS resolution attempt 2014-11-14 01:13:52 +01:00
mathieui
3c06568ed5
Let loop.create_connection do its getaddrinfo coroutine if there are no dns records left/available 2014-11-12 22:22:20 +01:00
Lance Stout
27582f6fd2 Merge pull request #326 from s-m-b/patch-1
Typo fix of parameter name 'data' it is now 'iq'
2014-11-10 09:07:32 -08:00
s-m-b
e328ff4833 Typo fix of parameter name 'data' it is now 'iq'
Code was broken during refactoring
2014-11-09 04:36:38 +03:00
Florent Le Coz
68e35e631a Also work without SRV records 2014-11-05 01:11:44 +01:00
mathieui
ad8c76602b
Depend on aiodns and not dnspython in the setup.py 2014-11-03 16:55:43 +01:00
Florent Le Coz
b5c98ba99e Fix default value of dns_answers to None (instead of []) 2014-11-02 17:44:41 +01:00
mathieui
711f8dc6af Use aiodns instead of dnspython to query DNS records 2014-11-02 17:26:29 +01:00
mathieui
5b41fb98de Add the ssl_cert and ssl_invalid_chain back
- hack the stdlib to get the peercert, remove that hack when http://bugs.python.org/issue22768 gets fixed
2014-10-30 19:51:30 +01:00
mathieui
6da625dbdb Make the "ciphers" option work again 2014-10-30 19:51:00 +01:00
mathieui
e862c47b8b Remove the ssl_version option, as the defaults in python3.4 are sane 2014-10-30 19:49:26 +01:00
Florent Le Coz
4a8fe56470 Something something get_stanza_values
Fix something that was broken by Link Mauve
2014-10-11 21:04:28 +02:00