summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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