summaryrefslogtreecommitdiff
path: root/helpers.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-08-22 02:26:40 -0500
committerJeff Carr <[email protected]>2025-08-22 02:26:40 -0500
commit185677e464c9e2842c75500156ba9b38c40acbf8 (patch)
tree5d9521027e6a56c7026e5566f643da751ac53dfb /helpers.go
parent3b6b85200d9d42698a58c52b87f6b7ab56a4a99a (diff)
okay?
Diffstat (limited to 'helpers.go')
-rw-r--r--helpers.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/helpers.go b/helpers.go
index 826ef48..97c4d1b 100644
--- a/helpers.go
+++ b/helpers.go
@@ -68,11 +68,11 @@ func (all *Chats) AddFile(filename string) error {
return err
}
- // Iterate through the top-level messages from the source file.
- for _, chatGroup := range logData.GetChats() {
- if len(chatGroup.GetEntries()) > 0 {
- // NEW FORMAT: This is a group, process its entries.
- for _, entry := range chatGroup.GetEntries() {
+ // New logic to handle both flat and nested formats
+ for _, chatOrGroup := range logData.GetChats() {
+ if len(chatOrGroup.GetEntries()) > 0 {
+ // This is a new-style Chat group with entries
+ for _, entry := range chatOrGroup.GetEntries() {
// Convert the ChatEntry into a new Chat object for the flat list.
newChat := convertEntryToChat(entry, filename)
if newChat != nil {
@@ -81,9 +81,9 @@ func (all *Chats) AddFile(filename string) error {
}
}
} else {
- // OLD FORMAT: This is a single, flat Chat message.
+ // This is an old-style flat Chat entry.
// We still process it to handle its external content file correctly.
- newChat := convertChatToChat(chatGroup, filename)
+ newChat := convertChatToChat(chatOrGroup, filename)
if newChat != nil {
newChat.VerifyUuid()
all.AppendByUuid(newChat)
@@ -150,7 +150,6 @@ func convertEntryToChat(entry *ChatEntry, filename string) *Chat {
return newChat
}
-
func (chats *Chats) VerifyUuids() bool {
var changed bool