diff options
| author | Jeff Carr <[email protected]> | 2025-08-30 15:24:54 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-30 15:24:54 -0500 |
| commit | bbb12d79e2ab03d5dd5a781a5e3b1192c548721e (patch) | |
| tree | 4f7a152f1e14f9d181c9e9614925a5184381f187 /doPlayback.go | |
| parent | c7896e47f9c91e330b023bdb34a7540f193a5422 (diff) | |
more code cleanups
Diffstat (limited to 'doPlayback.go')
| -rw-r--r-- | doPlayback.go | 27 |
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("-------------------------------------------------") |
