diff options
author | Lance Stout <lancestout@gmail.com> | 2013-03-28 12:20:38 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-03-28 12:20:38 -0700 |
commit | 0a2737dc77709daa0196340368b7ffbfaf71f641 (patch) | |
tree | 087efc13f84b19e4c0b6820f7956eeac0fd3784c /sleekxmpp/xmlstream | |
parent | 8b73c2bcff14fbda4b2549f167047a7ca1187fa8 (diff) | |
parent | 481971928c972a96a114b6dcf6480e48b530d95b (diff) | |
download | slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.tar.gz slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.tar.bz2 slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.tar.xz slixmpp-0a2737dc77709daa0196340368b7ffbfaf71f641.zip |
Merge pull request #228 from anton-ryzhov/events
Some events refactoring
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 289e3a21..1c0b84b9 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -559,7 +559,7 @@ class XMLStream(object): self.set_socket(self.socket, ignore=True) #this event is where you should set your application state - self.event("connected", direct=True) + self.event('connected', direct=True) return True except (Socket.error, ssl.SSLError) as serr: error_msg = "Could not connect to %s:%s. Socket Error #%s: %s" @@ -610,6 +610,7 @@ class XMLStream(object): lines = resp.split('\r\n') if '200' not in lines[0]: self.event('proxy_error', resp) + self.event('connection_failed', direct=True) log.error('Proxy Error: %s', lines[0]) return False @@ -717,7 +718,7 @@ class XMLStream(object): self.event('socket_error', serr, direct=True) finally: #clear your application state - self.event("disconnected", direct=True) + self.event('disconnected', direct=True) return True def abort(self): @@ -1130,6 +1131,8 @@ class XMLStream(object): event queue. All event handlers will run in the same thread. """ + log.debug("Event triggered: " + name) + handlers = self.__event_handlers.get(name, []) for handler in handlers: #TODO: Data should not be copied, but should be read only, |