Fix prority between mailboxes and aliases, related to #38
parent
ede346fd84
commit
1e9a8607b0
@ -1,18 +1,21 @@
|
|||||||
dbpath = /data/freeposte.db
|
dbpath = /data/freeposte.db
|
||||||
query =
|
query =
|
||||||
SELECT destination
|
SELECT destination
|
||||||
FROM alias
|
FROM
|
||||||
|
(SELECT destination, email, wildcard, localpart FROM alias
|
||||||
|
UNION
|
||||||
|
SELECT email AS destination, email, 0 as wildcard, localpart FROM user)
|
||||||
WHERE
|
WHERE
|
||||||
(
|
(
|
||||||
alias.wildcard = 0
|
wildcard = 0
|
||||||
AND
|
AND
|
||||||
alias.email = '%s'
|
email = '%s'
|
||||||
) OR (
|
) OR (
|
||||||
alias.wildcard = 1
|
wildcard = 1
|
||||||
AND
|
AND
|
||||||
'%s' LIKE alias.email
|
'%s' LIKE email
|
||||||
)
|
)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
alias.wildcard ASC,
|
wildcard ASC,
|
||||||
length(alias.localpart) DESC
|
length(localpart) DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
Loading…
Reference in New Issue