summaryrefslogtreecommitdiff
path: root/doPlayback.go
diff options
context:
space:
mode:
Diffstat (limited to 'doPlayback.go')
-rw-r--r--doPlayback.go27
1 files changed, 23 insertions, 4 deletions
diff --git a/doPlayback.go b/doPlayback.go
index 42dd95d..2302d12 100644
--- a/doPlayback.go
+++ b/doPlayback.go
@@ -7,13 +7,32 @@ import (
"go.wit.com/log"
)
-func doPlayback() {
+func doPlayback() error {
if argv.Uuid != "" {
showChat(argv.Uuid)
- return
+ return nil
+ }
+
+ if argv.Playback.Purge != nil {
+ doPurge()
+ return nil
}
listChats(me.chats)
+ return nil
+}
+
+func doPurge() {
+ changed := false
+ for _, chat := range me.chats.GetChats() {
+ if len(chat.GetEntries()) == 0 {
+ me.chats.Delete(chat)
+ changed = true
+ }
+ }
+ if changed {
+ me.chats.ConfigSave()
+ }
}
func showChat(uuid string) {
@@ -46,11 +65,11 @@ func listChats(chats *chatpb.Chats) {
formattedTime = "No Timestamp"
}
- log.Printf("Topic: %-25s | Entries: %-4d | Started: %s | UUID: %s\n",
- chat.GetChatName(),
+ log.Printf("Entries: %-4d | Started: %-25s | UUID: %s | %-25s\n",
entryCount,
formattedTime,
chat.GetUuid(),
+ chat.GetChatName(),
)
}
log.Println("-------------------------------------------------")