Commit graph

42 commits

Author SHA1 Message Date
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
7858d969d8 Remove usage of deprecated getchildren() method. 2012-06-19 09:47:31 -07:00
Lance Stout
d92aa05b5c PEP8 formatting updates. 2012-06-19 01:29:48 -07:00
Lance Stout
7842c55da3 Add auth_success event.
The auth_success event is triggered upon successful SASL negotiation.
2012-05-15 14:26:25 -07:00
Lance Stout
f5beac2afa Use SASLPrepFailure as the exception name instead of UnicodeError. 2012-05-14 23:12:54 -07:00
Lance Stout
8a23f28dfa Add an exception handler for SASLprep failures. 2012-05-14 22:26:06 -07:00
Lance Stout
4b2b2d16b8 Reset attempted SASL mech set after no suitable mechs are found. 2012-04-11 12:53:22 -04:00
Lance Stout
96ff2d43c0 Explicitly set the desired SASL mech to ANONYMOUS if no username is provided. 2012-03-13 12:24:41 -07:00
Lance Stout
1b00b7e8df Correct handling SASL auth failures when forcing the use of a specific mechanism. 2012-03-13 11:07:14 -07:00
Lance Stout
7284ceb90c Move feature_rosterver to new system. 2012-03-12 20:04:11 -07:00
Lance Stout
24ec448b7f Move feature_starttls to new system. 2012-03-12 19:57:20 -07:00
Lance Stout
ed5a2f400d Move feature_session to new system. 2012-03-12 19:52:20 -07:00
Lance Stout
9596616b42 Move feature_mechanisms to new system. 2012-03-12 19:52:01 -07:00
Lance Stout
8d38fb511b Move feature_bind to new system. 2012-03-12 19:49:43 -07:00
Lance Stout
9d645ad5cd Update the list of all stream feature plugins. 2012-03-12 19:32:20 -07:00
Lance Stout
a71823dc04 Add support for roster versioning.
This was XEP-0237, but is now part of RFC 6121.

Roster backends should now expose two additional methods:

version(jid):
    Return the version of the given JID's roster.
set_version(jid, version):
    Update the version of the given JID's roster.

A new state field will be passed to the backend if an item
has been marked for removal. This is 'removed' which will
be set to True.
2012-03-07 14:55:27 -08:00
Lance Stout
7d74a7b027 More extraneous import cleanup. 2012-02-17 14:59:56 -08:00
Lance Stout
c1357717d9 Use '=' as base64 value for empty string SASL results. 2012-02-09 22:01:11 -08:00
Lance Stout
f81fb6af44 Require explicitly setting access_token value.
Silently substituting the password field was nice, but for mechs
that can use either the password or an access token, it makes
things very difficult. This really only affects MSN clients since
Facebook clients should already be setting the api key.
2012-01-21 00:19:59 -08:00
Lance Stout
bb0a5186d6 Handle SASLCancelled and SASLError exceptions. 2012-01-21 00:19:08 -08:00
Lance Stout
baad907422 Add missing SASL <abort /> stanza 2012-01-21 00:17:49 -08:00
Lance Stout
3a22d798f8 Allow attempting multiple SASL mechs during a single stream.
Instead of disconnecting when the first chosen mech fails, we will
try all of them once.
2012-01-20 02:01:08 -08:00
Lance Stout
0d2125e737 Add an extra config dict to store SASL credentials.
We'll need extra things beyond just a password, such as api_key.
2012-01-20 01:08:25 -08:00
Lance Stout
1e01903072 Revert "Remove stream feature handlers on session_start."
This reverts commit 4274f49ada.

The SASL mech was choking on this, so let's send it back for some
more refining.
2012-01-18 11:51:00 -08:00
Lance Stout
4274f49ada Remove stream feature handlers on session_start.
Based on profiling, using around 35 stream handlers quarters the number
of basic message stanzas that can be processed in a second, in
comparison to only using the bare minimum of four handlers.

To help, we can drop handlers for stream features once the session
has started. So that we can re-enable these handlers when a stream
must restart, the 'stream_start' event has been added which fires
whenever a stream header is received.

The 'stream_start' event is a more generic replacement for the
existing start_stream_handler() method.
2012-01-17 22:14:24 -08:00
Lance Stout
6b9a55e62d Sync with Suelta. 2012-01-07 00:19:08 -05:00
Lance Stout
c578ddeb1a Add support for MSN with X-MESSENGER-OAUTH2 SASL support.
NOTE: This requires already having the access token. It does NOT
perform any OAuth requests.
2012-01-06 23:31:58 -05:00
Lance Stout
8ef7188dae Fix client_roster when the bare JID changes after binding.
Adds session_bind event.
2012-01-06 23:30:14 -05: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
Lance Stout
572becad44 Enable forcing a specififc SASL mech:
xmpp = ClientXMPP(jid, password, {
    'feature_mechanisms': {'use_mech':'PLAIN'}})
2011-08-09 00:51:49 -07:00
Lance Stout
47bc50d9fb Cosmetic PEP8 fixes. 2011-08-04 22:37:22 -07:00
Lance Stout
6c8a135612 Fix imports using __all__. 2011-08-04 21:49:15 -07:00
Lance Stout
d4091dbde6 Integrate a modified version of Dave Cridland's Suelta SASL library. 2011-08-03 17:00:51 -07:00
Lance Stout
0224d028e7 SASL failure event now includes the failure stanza.
Broke SASL stanzas into separate files.

Fixed typo in feature_bind.
2011-07-02 23:09:29 -07:00
Lance Stout
219df582da It isn't 2010 anymore.
I keep forgetting to update the copyright on new code.
2011-07-02 22:49:34 -07:00
Lance Stout
b898b14b77 Use a set to track negotiated features.
Added guards to prevent renegotiating STARTTLS or SASL in cases where
servers don't behave properly.
2011-07-02 22:30:55 -07:00
Lance Stout
fba235a801 Simplify SASL mech registration.
Moved SASL registration completely to the feature plugin, instead of
keeping a portion of it in ClientXMPP.
2011-07-02 21:57:50 -07:00
Lance Stout
b0297af38d Finish cleaning up stream feature organization.
Fixed missing references that weren't caught due to leftover pyc
file allowing tests to keep working when they shouldn't have.
2011-07-02 21:43:02 -07:00
Lance Stout
634f5d691b Continued reorganization and streamlining. 2011-07-01 14:45:55 -07:00
Lance Stout
754ac5092a Reorganize features into plugins. 2011-06-30 15:40:22 -07:00