From 01356d23e5468ca8cc6f3edf37f847f04f35a70d Mon Sep 17 00:00:00 2001 From: Anton Ryzhov Date: Thu, 28 Mar 2013 20:44:37 +0400 Subject: Log events triggering --- sleekxmpp/xmlstream/xmlstream.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sleekxmpp') diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 289e3a21..e55e78e7 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -1130,6 +1130,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, -- cgit v1.2.3 From c0d02d99354780dfd0ca1cfa96222c626eb3be48 Mon Sep 17 00:00:00 2001 From: Anton Ryzhov Date: Thu, 28 Mar 2013 21:05:37 +0400 Subject: Remove `roster_received` event --- sleekxmpp/clientxmpp.py | 1 - 1 file changed, 1 deletion(-) (limited to 'sleekxmpp') 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) -- cgit v1.2.3 From 620ee9719f06043a8865dd74f7ce1231ae16ba53 Mon Sep 17 00:00:00 2001 From: Anton Ryzhov Date: Thu, 28 Mar 2013 21:42:37 +0400 Subject: Changed `failed_auth` event according to manual --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index 81b997eb..eb161be8 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -234,6 +234,6 @@ class FeatureMechanisms(BasePlugin): """SASL authentication failed. Disconnect and shutdown.""" self.attempted_mechs.add(self.mech.name) log.info("Authentication failed: %s", stanza['condition']) - self.xmpp.event("failed_auth", stanza, direct=True) + self.xmpp.event("failed_auth", direct=True) self._send_auth() return True -- cgit v1.2.3 From a0c77c04a5d7185fe01729961d05eccdba4d37e7 Mon Sep 17 00:00:00 2001 From: Anton Ryzhov Date: Thu, 28 Mar 2013 21:52:18 +0400 Subject: XMLStream `proxy_error` event duplicated with `connection_failed` SASL `no_auth` event duplicated with `failed_auth` --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 1 + sleekxmpp/xmlstream/xmlstream.py | 1 + 2 files changed, 2 insertions(+) (limited to 'sleekxmpp') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index eb161be8..2ed3e00b 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/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index e55e78e7..f9a9c5a5 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -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 -- cgit v1.2.3 From 020197718f81937a755f1ca1f1126fc1e15dbd72 Mon Sep 17 00:00:00 2001 From: Anton Ryzhov Date: Thu, 28 Mar 2013 22:09:02 +0400 Subject: Event index documentation updated --- sleekxmpp/componentxmpp.py | 4 ++-- sleekxmpp/features/feature_bind/bind.py | 2 +- sleekxmpp/features/feature_session/session.py | 2 +- sleekxmpp/xmlstream/xmlstream.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sleekxmpp') 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_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 f9a9c5a5..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" @@ -718,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): -- cgit v1.2.3 From 481971928c972a96a114b6dcf6480e48b530d95b Mon Sep 17 00:00:00 2001 From: Anton Ryzhov Date: Thu, 28 Mar 2013 22:41:00 +0400 Subject: `failed_auth` data returned Manual updated --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index 2ed3e00b..58ed9b91 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -235,6 +235,6 @@ class FeatureMechanisms(BasePlugin): """SASL authentication failed. Disconnect and shutdown.""" self.attempted_mechs.add(self.mech.name) log.info("Authentication failed: %s", stanza['condition']) - self.xmpp.event("failed_auth", direct=True) + self.xmpp.event("failed_auth", stanza, direct=True) self._send_auth() return True -- cgit v1.2.3