Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dax/jmc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/jmc/jabber/component.py')
-rw-r--r--src/jmc/jabber/component.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/jmc/jabber/component.py b/src/jmc/jabber/component.py
index 678dbdf..d5a33da 100644
--- a/src/jmc/jabber/component.py
+++ b/src/jmc/jabber/component.py
@@ -244,12 +244,15 @@ class RootSendMailMessageHandler(SendMailMessageHandler):
def filter(self, message, lang_class):
name = message.get_to().node
bare_from_jid = unicode(message.get_from().bare())
- accounts = Account.select(\
- AND(Account.q.name == name,
- Account.q.user_jid == bare_from_jid))
+ accounts = SMTPAccount.select(\
+ AND(SMTPAccount.q.default_account == True,
+ SMTPAccount.q.user_jid == bare_from_jid))
if accounts.count() != 1:
- self.__logger.error("Account " + name + " for user " + \
- bare_from_jid + " must be uniq")
+ self.__logger.error("No default account found for user " +
+ str(bare_from_jid))
+ if accounts.count() == 0:
+ accounts = SMTPAccount.select(\
+ SMTPAccount.q.user_jid == bare_from_jid)
return accounts
def handle(self, message, lang_class, accounts):