1
0
Fork 0
mirror of https://github.com/Luzifer/automail.git synced 2024-12-20 13:01:20 +00:00

Simplify header matcher

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-06-27 15:29:01 +02:00
parent b6b825e29c
commit 5c0da4c04c
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -120,23 +120,7 @@ func (m matcher) Match(msg *enmime.Envelope) bool {
return true
}
switch strings.ToLower(m.Header) {
case "cc":
return m.matchString(msg.GetHeader("cc"))
case "from":
return m.matchString(msg.GetHeader("from"))
case "subject":
return m.matchString(msg.GetHeader("subject"))
case "to":
return m.matchString(msg.GetHeader("to"))
}
return false
return m.matchString(msg.GetHeader(strings.ToLower(m.Header)))
}
func (m matcher) matchString(s string) bool {