summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2013-03-28 12:20:38 -0700
committerLance Stout <lancestout@gmail.com>2013-03-28 12:20:38 -0700
commit0a2737dc77709daa0196340368b7ffbfaf71f641 (patch)
tree087efc13f84b19e4c0b6820f7956eeac0fd3784c /sleekxmpp
parent8b73c2bcff14fbda4b2549f167047a7ca1187fa8 (diff)
parent481971928c972a96a114b6dcf6480e48b530d95b (diff)
downloadslixmpp-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')
-rw-r--r--sleekxmpp/clientxmpp.py1
-rw-r--r--sleekxmpp/componentxmpp.py4
-rw-r--r--sleekxmpp/features/feature_bind/bind.py2
-rw-r--r--sleekxmpp/features/feature_mechanisms/mechanisms.py1
-rw-r--r--sleekxmpp/features/feature_session/session.py2
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py7
6 files changed, 10 insertions, 7 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index ae3803ef..905e1944 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -248,7 +248,6 @@ class ClientXMPP(BaseXMPP):
callback = lambda resp: self._handle_roster(resp)
response = iq.send(block, timeout, callback)
- self.event('roster_received', response)
if block:
self._handle_roster(response)
diff --git a/sleekxmpp/componentxmpp.py b/sleekxmpp/componentxmpp.py
index 44f82e96..5284f9d4 100644
--- a/sleekxmpp/componentxmpp.py
+++ b/sleekxmpp/componentxmpp.py
@@ -158,8 +158,8 @@ class ComponentXMPP(BaseXMPP):
"""
self.session_bind_event.set()
self.session_started_event.set()
- self.event("session_bind", self.boundjid, direct=True)
- self.event("session_start")
+ self.event('session_bind', self.boundjid, direct=True)
+ self.event('session_start')
def _handle_probe(self, pres):
self.roster[pres['to']][pres['from']].handle_probe(pres)
diff --git a/sleekxmpp/features/feature_bind/bind.py b/sleekxmpp/features/feature_bind/bind.py
index d2adc27b..bc145620 100644
--- a/sleekxmpp/features/feature_bind/bind.py
+++ b/sleekxmpp/features/feature_bind/bind.py
@@ -62,4 +62,4 @@ class FeatureBind(BasePlugin):
log.debug("Established Session")
self.xmpp.sessionstarted = True
self.xmpp.session_started_event.set()
- self.xmpp.event("session_start")
+ self.xmpp.event('session_start')
diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py
index 81b997eb..58ed9b91 100644
--- a/sleekxmpp/features/feature_mechanisms/mechanisms.py
+++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py
@@ -171,6 +171,7 @@ class FeatureMechanisms(BasePlugin):
except sasl.SASLNoAppropriateMechanism:
log.error("No appropriate login method.")
self.xmpp.event("no_auth", direct=True)
+ self.xmpp.event("failed_auth", direct=True)
self.attempted_mechs = set()
return self.xmpp.disconnect()
except StringPrepError:
diff --git a/sleekxmpp/features/feature_session/session.py b/sleekxmpp/features/feature_session/session.py
index c799a763..ceadd5f3 100644
--- a/sleekxmpp/features/feature_session/session.py
+++ b/sleekxmpp/features/feature_session/session.py
@@ -51,4 +51,4 @@ class FeatureSession(BasePlugin):
log.debug("Established Session")
self.xmpp.sessionstarted = True
self.xmpp.session_started_event.set()
- self.xmpp.event("session_start")
+ self.xmpp.event('session_start')
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,