From fb65e54100d9de68717371ed013f92a83a883ae8 Mon Sep 17 00:00:00 2001 From: David Rousselie Date: Tue, 5 Jun 2007 21:27:06 +0200 Subject: [PATCH] Do not apply password handler when no account found darcs-hash:20070605192706-86b55-874537dd6dbcd5215c55adb852ffb34186ef456c.gz --- src/jcl/jabber/component.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jcl/jabber/component.py b/src/jcl/jabber/component.py index 6b0639e..3cb7579 100644 --- a/src/jcl/jabber/component.py +++ b/src/jcl/jabber/component.py @@ -1220,10 +1220,13 @@ class PasswordMessageHandler(Handler): name = stanza.get_to().node bare_from_jid = unicode(stanza.get_from().bare()) accounts = Account.select(\ - AND(Account.q.name == name, \ - Account.q.user_jid == bare_from_jid)) - if accounts.count() != 1: - print >>sys.stderr, "Account " + name + " for user " + bare_from_jid + " must be uniq" + AND(Account.q.name == name, + Account.q.user_jid == bare_from_jid)) + if accounts.count() > 1: + print >>sys.stderr, "Account " + name + " for user " + \ + bare_from_jid + " must be uniq" + elif accounts.count() == 0: + return None _account = accounts[0] if hasattr(_account, 'password') \ and hasattr(_account, 'waiting_password_reply') \