diff --git a/contrib/backends/srndv2/src/srnd/daemon.go b/contrib/backends/srndv2/src/srnd/daemon.go index 69cd8c0..2a6b565 100644 --- a/contrib/backends/srndv2/src/srnd/daemon.go +++ b/contrib/backends/srndv2/src/srnd/daemon.go @@ -537,7 +537,9 @@ func (self *NNTPDaemon) ExpireAll() { func (self *NNTPDaemon) MarkSpam(msgid string) { if ValidMessageID(msgid) { - self.modEngine.MarkSpam(msgid) + if self.mod != nil { + self.mod.MarkSpam(msgid) + } } } diff --git a/contrib/backends/srndv2/src/srnd/mod.go b/contrib/backends/srndv2/src/srnd/mod.go index 19a387d..8223b05 100644 --- a/contrib/backends/srndv2/src/srnd/mod.go +++ b/contrib/backends/srndv2/src/srnd/mod.go @@ -215,6 +215,7 @@ func (self *modEngine) MarkSpam(msgid string) (err error) { if self.spam == nil { err = self.store.MarkSpam(msgid) } else { + var f io.ReadCloser f, err = self.store.OpenMessage(msgid) if err == nil { err = self.spam.MarkSpam(f) diff --git a/contrib/backends/srndv2/src/srnd/mod_http.go b/contrib/backends/srndv2/src/srnd/mod_http.go index 475cd5b..ea81baf 100644 --- a/contrib/backends/srndv2/src/srnd/mod_http.go +++ b/contrib/backends/srndv2/src/srnd/mod_http.go @@ -531,7 +531,8 @@ func (self httpModUI) HandlePostSpam(wr http.ResponseWriter, r *http.Request) { resp := make(map[string]interface{}) self.asAuthed("spam", func(path string) { var mm ModMessage - keys := string.Split(r.FormValue("spam"), ",") + var err error + keys := strings.Split(r.FormValue("spam"), ",") for _, k := range keys { k = strings.TrimSpace(k) go self.daemon.MarkSpam(k) @@ -552,7 +553,7 @@ func (self httpModUI) HandlePostSpam(wr http.ResponseWriter, r *http.Request) { } resp["error"] = err } - }) + }, wr, r) json.NewEncoder(wr).Encode(resp) } diff --git a/contrib/backends/srndv2/src/srnd/spam.go b/contrib/backends/srndv2/src/srnd/spam.go index 094a38e..70eab0f 100644 --- a/contrib/backends/srndv2/src/srnd/spam.go +++ b/contrib/backends/srndv2/src/srnd/spam.go @@ -36,7 +36,7 @@ type SpamResult struct { // feed spam subsystem a spam post func (sp *SpamFilter) MarkSpam(msg io.Reader) (err error) { - var buff [65636]byte + var buf [65636]byte var u *user.User u, err = user.Current() @@ -50,9 +50,11 @@ func (sp *SpamFilter) MarkSpam(msg io.Reader) (err error) { } defer conn.Close() fmt.Fprintf(conn, "TELL SPAMC/1.5\r\nUser: %s\r\nMessage-class: spam\r\nSet: local\r\n", u.Username) - io.CopyBuffer(conn, buf[:], msg) + io.CopyBuffer(conn, msg, buf[:]) conn.CloseWrite() r := bufio.NewReader(conn) + io.Copy(Discard, r) + return } func (sp *SpamFilter) openConn() (*net.TCPConn, error) { diff --git a/contrib/backends/srndv2/src/srnd/store.go b/contrib/backends/srndv2/src/srnd/store.go index 1adbe7b..d421e6c 100644 --- a/contrib/backends/srndv2/src/srnd/store.go +++ b/contrib/backends/srndv2/src/srnd/store.go @@ -95,12 +95,6 @@ type ArticleStore interface { // get filepath for spam file via msgid SpamFile(msgid string) string - MarkHam(msgid string) error - UnmarkHam(msgid string) error - - // get filepath for ham - HamFile(msgid string) string - // iterate over all spam messages IterSpam(func(string) error) error