func matchCriteria(m tat.Message, c tat.FilterCriteria) bool { /* bson:"label" json:"label,omitempty bson:"notLabel" json:"notLabel,omitempty bson:"andLabel" json:"andLabel,omitempty bson:"tag" json:"tag,omitempty bson:"notTag" json:"notTag,omitempty bson:"andTag" json:"andTag,omitempty bson:"username" json:"username,omitempty bson:"onlyMsgRoot" json:"onlyMsgRoot,omitempty */ if c.OnlyMsgRoot && m.InReplyOfID != "" { return false } if c.Label != "" { labels := strings.Split(c.Label, ",") ok := false for _, l := range labels { if m.ContainsLabel(l) { ok = true break } } if !ok { return false } } if c.NotLabel != "" { notLabels := strings.Split(c.NotLabel, ",") for _, l := range notLabels { if m.ContainsLabel(l) { return false } } } if c.AndLabel != "" { andLabels := strings.Split(c.AndLabel, ",") ok := 0 for _, l := range andLabels { if m.ContainsLabel(l) { ok++ } } if ok != len(andLabels) { return false } } if c.Tag != "" { tags := strings.Split(c.Tag, ",") ok := false for _, l := range tags { if m.ContainsTag(l) { ok = true break } } if !ok { return false } } if c.NotTag != "" { notTags := strings.Split(c.NotTag, ",") for _, l := range notTags { if m.ContainsTag(l) { return false } } } if c.AndTag != "" { andTags := strings.Split(c.AndTag, ",") ok := 0 for _, l := range andTags { if m.ContainsTag(l) { ok++ } } if ok != len(andTags) { return false } } if c.Username != "" && c.Username != m.Author.Username { return false } return true }