Commit graph

39 commits

Author SHA1 Message Date
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
83a73ac9b7 Merge branch 'develop' into stream_features
Conflicts:
	sleekxmpp/clientxmpp.py
2011-05-31 11:05:54 -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
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
Lance Stout
9f1648328f Resolve timeout errors for get_roster.
See issue #89

Using get_roster will now return the same types of values as
Iq.send. If a timeout occurs, then the event 'roster_timeout'
will be fired. A successful call to get_roster will also
raise the 'roster_received' event.

To ensure that the get_roster call was successful, here
is a pattern to follow:

    def __init__(self, ...):
        ...
        self.add_event_handler('session_start', self.session_start)
        self.add_event_handler('roster_timeout', self.roster_timeout)
        self.add_event_handler('roster_received', self.roster_received)

    def session_start(self, e):
        self.send_presence()
        self.get_roster()

    def roster_timeout(self, e):
        # Optionally increase the timeout period
        self.get_roster(timeout=self.response_timeout * 2)

    def roster_received(self, iq):
        # Do stuff, roster has been initialized.
        ...
2011-05-20 12:56:00 -04:00
Lance Stout
a9685a00b3 Merge branch 'develop' into stream_features
Conflicts:
	sleekxmpp/clientxmpp.py
2011-03-22 12:08:27 -04:00
Lance Stout
86a6b40fd8 Updated doc for connect() 2011-03-22 11:59:27 -04:00
Lance Stout
7ef6abb2a3 May pass use_tls=False to connect().
Will disable the use of TLS for the session.
2011-03-22 11:56:55 -04:00
Lance Stout
d5b3a52827 Merge branch 'develop' into stream_features
Conflicts:
	sleekxmpp/xmlstream/stanzabase.py
2011-02-14 16:26:23 -05:00
Lance Stout
75584d7ad7 Remap old method names in a better way.
This should prevent some reference cycles that will cause garbage
collection issues.
2011-02-14 13:49:43 -05:00
Lance Stout
1a270dc05c First pass at re-worked stream features.
Stream features now use stanza objects!

Features are given a ranking that expresses the dependency
relationships (since only one feature is negotiated at a time, the
dependency graph can be replaced by a line).

>>> xmpp.register_feature('my_feature', _my_handler,
>>>                       restart=True,   # Requires stream restart
>>>                       order=600)      # Ranking (out of ~ 10,000,
>>>                                       # lower #'s executed first)

SASL mechanisms may now be added or disabled as needed. Each mechanism
is given a priority value indicating the order in which the client
wishes for mechanisms to be tried. Higher priority numbers are executed
first.

>>> xmpp.register_sasl_mechanism('SASL-MECH', _mech_handler,
>>>                              priority=0)

Disabling a SASL mechanism:

>>> xmpp.remove_sasl_mechanism('ANONYMOUS')
2011-01-28 00:49:37 -05:00
Stefan de Konink
c3be6ea0b2 My hunch is that these should also be updated. 2011-01-23 02:08:29 +08:00
Florent Le Coz
897a9ac333 Do not traceback when DNS resolution time out.
Just log that the resolution timed out, and fall back
to the hostname from the JID in this case
2011-01-20 06:34:08 +08:00
Lance Stout
13a2f719f4 Add reattempt to ClientXMPP.connect 2011-01-07 16:41:31 -05:00
Lance Stout
7ba6d5e02d Fix Node set to None error. 2010-11-17 16:01:27 -05: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
04cc48775d Fixed error in client roster handling.
The roster result iq was not being passed to the roster update
handler.
2010-10-24 12:08:59 -04:00
Nathan Fritz
d88999691c misc small tweaks 2010-10-20 20:14:26 -07:00
Nathan Fritz
c4699b92e6 pep8 fixes on core library 2010-10-20 19:43:53 -07:00
Nathan Fritz
77eab6544f reconnect if session isn't established within 15 seconds 2010-10-20 19:18:27 -07:00
Lance Stout
4375ac7d8b Underscore names by default.
Stanza objects now accept the use of underscored names.

The CamelCase versions are still available for backwards compatibility,
but are discouraged.

The property stanza.values now maps to the old getStanzaValues and
setStanzaValues, in addition to _set_stanza_values and
_get_stanza_values.
2010-10-17 22:04:42 -04:00
Lance Stout
505a63da3a Cleanup, restore PEP8. 2010-10-16 21:15:31 -04:00
Florent Le Coz
2755d732a4 Remove deprecation warnings
Remove all the deprecation warnings by using only boundjid.
And also fix a indentation error.
2010-10-17 08:55:30 +08:00
Florent Le Coz
2d18d905a5 Anonymous authentication
Implemented ANONYMOUS authentication on the ClientXMPP class.
To use it, you just need to provide a domain (e.g 'anon.example.com')
with an optional resource (e.g 'anon.example.com/resource') as the JID,
with no password. The JID class has been improved to accept
domains as fulljid.

You can test this with echo_client.py
python echo_client.py -j anon.louiz.org/  # anonymous with a resource
                                          # defined by the server
python echo_client.py -j anon.louiz.org/resource  # anonymous with given
                                                  # resource

The "normal" authentication method still works exactly like before.
2010-10-17 08:55:30 +08:00
Nathan Fritz
95ad8a1878 fixed stream test not disconnecting cleanly 2010-10-14 16:27:44 -07:00
Nathan Fritz
dc001bb201 deprecated jid, fulljid, server, user, resource properties and added boundjid JID 2010-10-14 15:50:54 -07:00
Nathan Fritz
0d0b963fe5 fixed socket name collision in xmlstream.py and fixed python 3.x compatibility 2010-10-14 10:58:07 -07:00
Nathan Fritz
7ad7a29a8f new state machine in place 2010-10-13 18:15:21 -07:00
Lance Stout
799645f13f Updated method names.
Using underscored names where possible.
2010-10-06 18:45:11 -04:00
Lance Stout
77b8f0f4bb Fixed whitespace issue. 2010-10-06 14:31:33 -04:00
Lance Stout
ed366b338d Moved ClientXMPP to clientxmpp.py.
Cleaned up the __init__.py files.
2010-10-06 14:20:32 -04:00