@@ 2,6 2,7 @@ package main
import (
"encoding/json"
+ "flag"
"fmt"
"io/ioutil"
"os"
@@ 22,7 23,15 @@ import (
"tallyard.xyz/ui"
)
+var noRedact bool
+
+func init() {
+ flag.BoolVar(&noRedact, "no-redact", false, "don't redact any messages once election is over (useful for debugging)")
+}
+
func main() {
+ flag.Parse()
+
os.MkdirAll(xdg.DataHome() + "/tallyard", 0700)
file, err := os.OpenFile(xdg.DataHome() + "/tallyard/tallyard.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
@@ 170,7 179,9 @@ func main() {
el.PrintResults()
- el.Finish(client)
+ if !noRedact {
+ el.RedactEvents(client)
+ }
}
var electionFilter = &mautrix.Filter{
@@ 419,7 419,7 @@ func (el *Election) SendSum(client *mautrix.Client, eventStore *EventStore) erro
return nil
}
-func (el *Election) Finish(client *mautrix.Client) {
+func (el *Election) RedactEvents(client *mautrix.Client) {
el.Lock()
defer el.Save()
defer el.Unlock()