Commit graph

86 commits

Author SHA1 Message Date
Lance Stout
7391288668 Tidy up roster_received event and callbacks. 2012-04-07 17:30:25 -04:00
Lance Stout
7734aee7ad Prevent roster_update from firing twice after retrieving the roster. 2012-04-07 17:22:29 -04:00
Lance Stout
c1d36cad46 Add better DNS resolver wrapper. 2012-03-30 10:12:43 -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
9d5eb864d1 More import cleanups based on pyflakes results. 2012-02-17 14:41:31 -08:00
Lance Stout
1a272fd276 Add support for querying and connecting to IPv6 addresses.
Tested using servers provided by Florian Jensen (flosoft.biz)
during the 2012 FOSDEM XMPP Summit.

Fixes issue #94.
2012-02-09 21:28:28 -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
e8b2dd6698 Update Roster stanza to use RosterItem substanzas.
get_roster() now returns the Iq result stanza instead of True (stanzas
also evaluate to True).
2012-01-12 17:21:43 -08:00
Lance Stout
a86935a42f Make get_roster(block=False) work properly.
Fixes issue #136
2012-01-10 19:57:38 -08: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
a720c3348b Updated last bit of core files to use new API format. 2011-12-05 20:37:47 -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
Lance Stout
5a6a65fd9f Fix typo 2011-11-14 11:20:53 -08:00
Lance Stout
9f9e8db814 Add use_ssl parameter to ClientXMPP.connect 2011-11-11 01:52:18 -08:00
Lance Stout
e37adace62 Allow SASL mechanism to be set when creating a ClientXMPP instance.
Instead of using:

    ClientXMPP(jid, password, plugin_config={
        'feature_mechanisms': {'use_mech': 'SOME-MECH'}})

You can use:

    ClientXMPP(jid, password, sasl_mech='SOME-MECH')

If you need to change the mechanism after instantiation, use:

    xmpp['feature_mechanisms'].sasl.mech = 'SCRAM-MD5'
2011-09-28 22:48:30 -04:00
Lance Stout
2162d6042e Session timeout now defaults to 45sec, but can be adjusted.
e.g.

    self.session_timeout = 15

It is also managed by XMLStream instead of ClientXMPP now.
2011-08-25 15:40:13 -07:00
Lance Stout
3e51126e18 PEP8 edits 2011-08-18 02:46:48 -07:00
Nathan Fritz
f75b6bf955 added inline documentation for new dns methods 2011-08-18 01:04:01 -07:00
Nathan Fritz
fb78bf0996 fixed manual address definition 2011-08-18 00:59:27 -07:00
Lance Stout
cd7cd30b4c Fix exceptions for Python3 2011-08-18 00:47:07 -07:00
Nathan Fritz
3853898ab3 DNS is now properly checked and different answers are tried for each reconnect until exhausted 2011-08-18 00:35:18 -07:00
Lance Stout
484efff156 Merge branch 'develop' into roster
Conflicts:
	setup.py
	sleekxmpp/clientxmpp.py
2011-08-12 16:47:58 -07:00
Nathan Fritz
bd8c110f00 Merge branch 'exceptions' into develop 2011-08-12 16:35:15 -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
Lance Stout
89cffd43f4 Merge branch 'develop' into roster
Conflicts:
	setup.py
2011-08-04 11:52:17 -07:00
Lance Stout
d94517d9ca Merge branch 'develop' into stream_features 2011-08-03 17:37: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
d7fe724145 Merge branch 'develop' into exceptions 2011-07-27 19:36:04 -07:00
Lance Stout
ad978700fc Merge branch 'develop' into roster 2011-07-27 19:35:42 -07:00
Lance Stout
ad032e5ed7 Fix error with DNS selection.
Missed a renaming of 'priority' to 'item'
2011-07-27 18:40:57 -07:00
Kim Alvefur
45412fd404 Do a weighted choice among the highest prioritized items based on weight instead of a weighted choice based on priorities. 2011-07-16 11:00:59 +08: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
Lance Stout
9ed972ffeb Fix SASL mechanism selection bug.
ANONYMOUS was being treated as PLAIN, mechanism was being chosen
purely from supported mechanisms, not those provided by the server.

Broke nested handler methods into top-level methods.
2011-06-29 14:05:27 -07:00
Lance Stout
3b1f3fddf0 Reorganized stream level stanzas. 2011-06-28 11:06:44 -07:00
Lance Stout
ce145b04ac Integrate roster with ClientXMPP.
Roster updates are now passed through to the roster when using
self.update_roster, etc.
2011-06-16 16:09:15 -07:00
Lance Stout
8aa4396e44 Begin experimental use of exceptions.
Provides IqTimeout and IqError which are raised when an Iq response
does not arrive in time, or it arrives with type='error'.
2011-06-01 15:17:22 -07:00
Lance Stout
83a73ac9b7 Merge branch 'develop' into stream_features
Conflicts:
	sleekxmpp/clientxmpp.py
2011-05-31 11:05:54 -07:00
Lance Stout
5ed27bf5f6 Merge branch 'develop' into roster 2011-05-31 10:59:14 -07:00
Lance Stout
1735c194cd Don't use the send queue for stream initialization.
Use the parameter now=True to skip the queue when
sending Iq stanzas, or using xmpp.send().
2011-05-27 17:00:57 -07:00
Lance Stout
a269be485f Merge branch 'develop' into stream_features 2011-05-20 13:46:46 -04:00
Lance Stout
d3bd9cd31d Merge branch 'develop' into roster 2011-05-20 13:46:36 -04:00
Lance Stout
6a07e7cbe3 Handle callback return value case. 2011-05-20 13:46:12 -04:00
Lance Stout
e2de82ac8d Merge branch 'develop' into stream_features
Conflicts:
	sleekxmpp/clientxmpp.py
2011-05-20 13:26:21 -04:00