fix build
This commit is contained in:
parent
95448d82f0
commit
5b8326745c
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user