Commit graph

137 commits

Author SHA1 Message Date
Robin Gloster
3dd379cdf1 Revert "cleanup semicolons, whitespace and mutable default arguments"
This reverts commit 7265682a4d.
2014-08-18 15:15:14 +02:00
Robin Gloster
7265682a4d cleanup semicolons, whitespace and mutable default arguments 2014-08-18 00:52:24 +02:00
Lance Stout
648b03f811 Make send_message(mhtml='..') work as expected without loading plugin
71.
2013-08-07 08:48:15 -07:00
Lance Stout
e57e321d33 Try re-ordering initial imports to avoid import bugs 2013-08-06 15:54:02 -07:00
Jean-Philippe Caruana
2c26fb0d76 optimize imports 2013-07-26 17:48:33 +02:00
Lance Stout
79a8c5ceae Add proper XEP-0071 plugin. 2013-01-26 14:33:52 -08:00
Paul Molodowitch
52feabbe76 added setdefaultencoding method so reload(sys) not needed
reload(sys) could cause problem in user code - ie, sys.stdout, excepthook, and displayhook would be reset, etc
2012-10-24 13:06:36 -07:00
Lance Stout
a22ca228cc Lock the bound JID in the JID cache. 2012-10-24 12:56:54 -07:00
Lance Stout
747a6e94e6 Auto-subscribe to whitelisted JIDs if auto_subscribe is true 2012-10-15 22:19:47 -07:00
Lance Stout
657102e938 Update legacy auth to be used outside of stream features.
Also, add detection of legacy XMPP version.
2012-10-01 16:27:55 -07:00
Lance Stout
b5c669bdff Add options to auto add ID values to message and presence stanzas. 2012-09-25 12:26:56 -07:00
Lance Stout
1ca0c46333 Special plugin loading case for xep_0115 no longer needed. 2012-08-23 00:23:32 -07:00
Lance Stout
8a03bd72ae Ensure that auth is done based on the original, requested JID and not on the bound JID. 2012-08-17 10:17:35 -07:00
Lance Stout
6680c244f5 Fix deprecation warning for setting self.resource 2012-07-20 22:04:36 -07:00
Lance Stout
32e798967e Fix see-other-host handling if no host is actually given. Also, limit number of consecutive redirection attempts. 2012-07-20 15:28:18 -07:00
Lance Stout
917faecdcb Fix issue of roster data being split across multiple rosters.
Resolved by always normalizing JIDs to bare form, regardless of if they
are JID objects or strings.

Also simplified related code to prefer use of JID objects instead of
strings so they don't need to be parsed multiple times.
2012-07-19 23:54:18 -07:00
Lance Stout
a347cf625a Add session_bind_event threading event. 2012-07-10 01:35:57 -07:00
Lance Stout
85ef2d8d0b Add support for reconnecting based on see-other-host stream errors. 2012-06-22 23:13:16 -07:00
Lance Stout
d92aa05b5c PEP8 formatting updates. 2012-06-19 01:29:48 -07:00
Lance Stout
f7a74d960e Simplify send_presence_subscription() 2012-06-19 00:06:31 -07:00
Lance Stout
ff6fc44215 Simplify tracking last sent presence using outgoing filters. 2012-06-18 22:15:21 -07:00
Lance Stout
181aea737d Add initial support for xml:lang for streams and stanza plugins.
Remaining items are suitable default actions for language supporting
interfaces.
2012-06-18 22:00:33 -07:00
Lance Stout
f5652a667b Add 'presence' event, raised for all incoming presence stanzas. 2012-06-06 16:10:25 -07:00
Lance Stout
f49311ef9e Add better certificate handling.
Certificate host names are now matched (using DNS, SRV, XMPPAddr, and
Common Name), along with expiration check.

Scheduled event to reset the stream once the server's cert expires.

Handle invalid cert trust chains gracefully now.
2012-05-22 03:56:06 -07:00
Lance Stout
8b47159788 Populate the to attribute for message and presence stanzas if the server leaves it blank. 2012-04-26 15:46:18 -07:00
Lance Stout
488f7ed886 Begin experiment with a centralized API callback registry.
The API registry generalizes the node handler system from the xep_0030
plugin so that other plugins can use it.
2012-04-06 15:09:25 -04:00
Lance Stout
f8f2b541db Handle loading plugins on demand.
Plugins that are referenced as dependencies, but have not been
registered now will be imported. Newer plugins should register
themselves automatically, but older style plugins will be
explicitly registered after import.
2012-03-12 19:32:20 -07:00
Lance Stout
01b2499915 Introduce new plugin system.
The new system is backward compatible and will load older style plugins.

The new plugin framework allows plugins to track their dependencies, and
will auto-enable plugins as needed.

Dependencies are tracked via a class-level set named `dependencies` in
each plugin.

Plugin names are no longer tightly coupled with the plugin class name,
Pso EP8 style class names may be used.

Disabling plugins is now allowed, but ensuring proper cleanup is left to
the plugin implementation.

The use of a `post_init()` method is no longer needed for new style
plugins, but plugins following the old style will still require a
`post_init()` method.
2012-03-12 16:24:18 -07:00
Lance Stout
91155444c0 Resolve plugin dependency chains with XEP-0115.
The post_init() system can only reliably handle a single layer
of dependencies between plugins, but PEP plugins with XEP-0115
exceed that limit and plugins can be post_init'ed out of order. To
resolve this, we will special case XEP-0115 to be post_init'ed
first until the new plugin system with dependency tracking is
stable.
2012-03-10 12:48:35 -08:00
Lance Stout
d41ada6b66 Cleanup logging when loading a custom plugin. 2012-03-05 11:30:36 -08:00
Lance Stout
830db11b41 Ensure that roster nodes aren't empty strings.
This would happen when receiving presence without a 'to' field, which
happens when receiving presence from other resources for the same account.
2012-03-05 11:08:57 -08:00
Lance Stout
7d74a7b027 More extraneous import cleanup. 2012-02-17 14:59:56 -08:00
Lance Stout
9d5eb864d1 More import cleanups based on pyflakes results. 2012-02-17 14:41:31 -08:00
Lance Stout
1ae219025a Don't dump exception logs for XML stream parsing errors.
The exceptions are handled, so we don't need to clutter the output logs.
2012-01-12 22:26:15 -08:00
Lance Stout
65dbddb6b6 Fix logging when loading plugins. 2011-12-09 20:57:08 -08:00
Lance Stout
e01c2d222a More doc updates 2011-12-05 08:55:05 -08:00
Lance Stout
b54cc97e4c Merge remote-tracking branch 'vijayp/master' into HEAD
Conflicts:
	examples/ping.py
	sleekxmpp/basexmpp.py
	sleekxmpp/clientxmpp.py
	sleekxmpp/features/feature_bind/bind.py
	sleekxmpp/features/feature_mechanisms/mechanisms.py
	sleekxmpp/plugins/gmail_notify.py
	sleekxmpp/plugins/jobs.py
	sleekxmpp/plugins/xep_0009/remote.py
	sleekxmpp/plugins/xep_0009/rpc.py
	sleekxmpp/plugins/xep_0012.py
	sleekxmpp/plugins/xep_0045.py
	sleekxmpp/plugins/xep_0050/adhoc.py
	sleekxmpp/plugins/xep_0078/legacyauth.py
	sleekxmpp/plugins/xep_0085/chat_states.py
	sleekxmpp/plugins/xep_0199/ping.py
	sleekxmpp/plugins/xep_0224/attention.py
	sleekxmpp/xmlstream/handler/waiter.py
	sleekxmpp/xmlstream/matcher/xmlmask.py
	sleekxmpp/xmlstream/xmlstream.py

Conflicts:
	examples/ping.py
	sleekxmpp/basexmpp.py
	sleekxmpp/clientxmpp.py
	sleekxmpp/features/feature_bind/bind.py
	sleekxmpp/features/feature_mechanisms/mechanisms.py
	sleekxmpp/plugins/gmail_notify.py
	sleekxmpp/plugins/jobs.py
	sleekxmpp/plugins/xep_0009/remote.py
	sleekxmpp/plugins/xep_0009/rpc.py
	sleekxmpp/plugins/xep_0012.py
	sleekxmpp/plugins/xep_0045.py
	sleekxmpp/plugins/xep_0050/adhoc.py
	sleekxmpp/plugins/xep_0078/legacyauth.py
	sleekxmpp/plugins/xep_0085/chat_states.py
	sleekxmpp/plugins/xep_0199/ping.py
	sleekxmpp/plugins/xep_0224/attention.py
	sleekxmpp/xmlstream/handler/waiter.py
	sleekxmpp/xmlstream/matcher/xmlmask.py
	sleekxmpp/xmlstream/xmlstream.py
2011-11-19 18:23:26 -08:00
Vijay Pandurangan
48af3d3322 remove unnecessary copies when only one handler matches. This was taking up ~ 15% of CPU on moderate load. 2011-11-19 15:59:38 -08:00
Lance Stout
429c94d6a9 Tidy up logging calls. 2011-11-19 12:07:57 -08:00
Vijay Pandurangan
deb52ad350 This change stops sleekxmpp from spending huge amounts of time unnecessarily computing logging data that may never be used. This is a HUGE performance improvement; in some of my test runs, unnecessary string creation was accounting for > 60% of all CPU time.
Note that using % in a string will _always_ perform the sting substitutions, because the strings are constructed before the function is called. So log.debug('%s' % expensiveoperation()) will take about the same CPU time whether or not the logging level is DEBUG or INFO. if you use , no substitutions are performed unless the string is actually logged
2011-11-20 03:39:05 +08:00
Vijay Pandurangan
6f3cc77bb5 This change stops sleekxmpp from spending huge amounts of time unnecessarily computing logging data that may never be used. This is a HUGE performance improvement; in some of my test runs, unnecessary string creation was accounting for > 60% of all CPU time.
Note that using % in a string will _always_ perform the sting substitutions, because the strings are constructed before the function is called. So log.debug('%s' % expensiveoperation()) will take about the same CPU time whether or not the logging level is DEBUG or INFO. if you use , no substitutions are performed unless the string is actually logged
2011-11-19 11:30:44 -08:00
Lance Stout
22868c3924 Fix changed_status event
Once again only fires when a resource's presence show value changes.
2011-11-18 13:39:02 -08:00
Lance Stout
a8d5da5091 Restore original behaviour for auto_authorize and auto_subscribe.
The change to using the new roster broke the original auto_* values
and used per-roster versions. The original auto_* values will now set
the behaviour globally. Use the per-roster values to override for a
specific JID.
2011-11-06 08:25:29 -08:00
Lance Stout
f92f96325a Make Iq exceptions more discoverable and simpler to use.
IqError and IqTimeout now extend XMPPError, so if you don't care
about the difference, you can use:

    try:
        self.do_something_with_iqs()
    except XMPPError:
        # Error? Timeout? I don't care!
        pass

If you do need to distinguish between timeouts and error replies,
you can still continue to use:

    try:
        self.do_somethin_with_iqs()
    except IqError as err:
        pass
    except IqTimeout:
        pass

If you don't catch any Iq errors and you're processing a stanza
then an error response will be sent, just like normal if you raise
XMPPError or any other exception, except that the error messages
will be generic to prevent leaking too much information.
2011-08-19 01:04:20 -07:00
Lance Stout
a714fa82b2 Remove extra, unhelpful presence debug log. 2011-08-18 02:46:08 -07:00
Lance Stout
484efff156 Merge branch 'develop' into roster
Conflicts:
	setup.py
	sleekxmpp/clientxmpp.py
2011-08-12 16:47:58 -07:00
Lance Stout
e83fae3a6f Save the stream ID when the stream starts. 2011-08-06 00:44:32 -07:00
Lance Stout
5be5b8c02b If no config for a plugin is given, try using self.plugin_config.
Sleek loads a few plugins by default, which made it difficult to
configure or even disable them.

Now, if a plugin is registered without any configuration, then
sleek will try finding a configuration in self.plugin_config.
2011-08-06 00:41:14 -07:00
Lance Stout
47bc50d9fb Cosmetic PEP8 fixes. 2011-08-04 22:37:22 -07:00
Nathan Fritz
7f90de887a added block as process option and updated documentation. added typical use example to ClientXMPP. 2011-08-04 21:49:32 -07:00