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:
parent
b6b825e29c
commit
5c0da4c04c
1 changed files with 1 additions and 17 deletions
18
handler.go
18
handler.go
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue