Commit ab548c502b5ecba40003067a6bd6050479efe5ee
1 parent
2cff4b70cd
Exists in
master
added Valid() to filters
Showing
2 changed files
with
14 additions
and
6 deletions
Show diff stats
email.go
... | ... | @@ -134,12 +134,12 @@ func SendEmail(email *Email, conf *EmailConfig) error { |
134 | 134 | } |
135 | 135 | |
136 | 136 | type EmailConfig struct { |
137 | - ServerName string | |
138 | - Identity string | |
139 | - Username string | |
140 | - Password string | |
141 | - Host string | |
142 | - Port int | |
137 | + ServerName string `json:"-"` | |
138 | + Identity string `json:"-"` | |
139 | + Username string `json:"username"` | |
140 | + Password string `json:"password"` | |
141 | + Host string `json:"host"` | |
142 | + Port int `json:"port"` | |
143 | 143 | } |
144 | 144 | |
145 | 145 | func NewEmailConfig(ident, uname, pword, host string, port int) *EmailConfig { | ... | ... |
filtering.go
... | ... | @@ -8,6 +8,14 @@ import ( |
8 | 8 | |
9 | 9 | type Filter map[string]string |
10 | 10 | |
11 | +func (f *Filter) Size() int { | |
12 | + return len(*f) | |
13 | +} | |
14 | + | |
15 | +func (f *Filter) Valid() bool { | |
16 | + return len(*f) > 0 | |
17 | +} | |
18 | + | |
11 | 19 | func (fs Filter) validate(validFilters []string) (Filter, bool) { |
12 | 20 | goodFilters := make(map[string]string) |
13 | 21 | cnt := 0 | ... | ... |