From 0e6e2093e4631d426a2b8eb266d12076572f7ccb Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 27 Nov 2018 10:45:21 -0500 Subject: [PATCH] add remove command for mod --- contrib/backends/srndv2/src/srnd/mod.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/mod.go b/contrib/backends/srndv2/src/srnd/mod.go index 8223b05..603145f 100644 --- a/contrib/backends/srndv2/src/srnd/mod.go +++ b/contrib/backends/srndv2/src/srnd/mod.go @@ -47,7 +47,6 @@ type ModUI interface { // handle mark a post as spam HandlePostSpam(wr http.ResponseWriter, r *http.Request) - // get outbound message channel MessageChan() chan NNTPMessage } @@ -56,6 +55,7 @@ type ModAction string const ModInetBan = ModAction("overchan-inet-ban") const ModDelete = ModAction("delete") +const ModRemove = ModAction("remove") const ModRemoveAttachment = ModAction("overchan-del-attachment") const ModStick = ModAction("overchan-stick") const ModLock = ModAction("overchan-lock") @@ -437,7 +437,19 @@ func (mod *modEngine) Do(ev ModEvent) { } else if action == ModSage { // TODO: implement } else if action == ModStick { - // TODO: implement + // TODP: implement + } else if action == ModRemove { + if ValidMessageID(target) { + err := mod.database.DeleteArticle(target) + if err == nil { + err = mod.store.Remove(target) + } + if err == nil { + log.Println("removed", target) + } else { + log.Println(action, target, "failed:", err) + } + } } else if action == ModRemoveAttachment { var delfiles []string atts := mod.database.GetPostAttachments(target)