initialize message count #15

Merged
sarah merged 2 commits from rinnmar17 into trunk 2021-03-17 23:00:09 +00:00
2 changed files with 3 additions and 1 deletions

View File

@ -7,4 +7,6 @@ type Contact struct {
Picture string `json:"picture"`
Authorization string `json:"authorization"`
SaveHistory string `json:"saveConversationHistory"`
Messages int `json:"numMessages"`
Unread int `json:"numUnread"`
}

View File

@ -111,7 +111,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if !set {
saveHistory = event.DeleteHistoryDefault
}
contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization), SaveHistory: saveHistory})
contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization), SaveHistory: saveHistory, Messages: contactInfo.Timeline.Len(), Unread: 0,})
}
bytes, _ := json.Marshal(contacts)