From 9cecd94fc24033b85d17ce5bcea8e15a442825c4 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 27 Oct 2018 06:59:23 -0400 Subject: [PATCH 1/2] tell about banned articles when handling ARTICLE --- contrib/backends/srndv2/src/srnd/nntp.go | 29 ++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/nntp.go b/contrib/backends/srndv2/src/srnd/nntp.go index 8f90dbd..be13a7d 100644 --- a/contrib/backends/srndv2/src/srnd/nntp.go +++ b/contrib/backends/srndv2/src/srnd/nntp.go @@ -759,18 +759,23 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string } } } - if ValidMessageID(msgid) && daemon.store.HasArticle(msgid) { - // we have it yeh - f, err := daemon.store.OpenMessage(msgid) - if err == nil { - conn.PrintfLine("220 %s", msgid) - dw := conn.DotWriter() - _, err = io.Copy(dw, f) - dw.Close() - f.Close() - } else { - // wtf?! - conn.PrintfLine("503 idkwtf happened: %s", err.Error()) + if ValidMessageID(msgid) { + if daemon.database.IsBanned(msgid) { + // article banned + conn.PrintfLine("439 %s article banned from server", msgid) + } else if daemon.store.HasArticle(msgid) { + // we have it yeh + f, err := daemon.store.OpenMessage(msgid) + if err == nil { + conn.PrintfLine("220 %s", msgid) + dw := conn.DotWriter() + _, err = io.Copy(dw, f) + dw.Close() + f.Close() + } else { + // wtf?! + conn.PrintfLine("503 idkwtf happened: %s", err.Error()) + } } } else { // we dont got it From 142c40889bb8e7f53b726f889fb22a8e71fa2a50 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 27 Oct 2018 07:00:58 -0400 Subject: [PATCH 2/2] make it compile --- contrib/backends/srndv2/src/srnd/nntp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/backends/srndv2/src/srnd/nntp.go b/contrib/backends/srndv2/src/srnd/nntp.go index be13a7d..61f2e55 100644 --- a/contrib/backends/srndv2/src/srnd/nntp.go +++ b/contrib/backends/srndv2/src/srnd/nntp.go @@ -760,7 +760,7 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string } } if ValidMessageID(msgid) { - if daemon.database.IsBanned(msgid) { + if daemon.database.ArticleBanned(msgid) { // article banned conn.PrintfLine("439 %s article banned from server", msgid) } else if daemon.store.HasArticle(msgid) {