initialize message counter

This commit is contained in:
erinn 2021-03-17 15:42:09 -07:00
parent d53d81f8d0
commit e439c0954b
2 changed files with 14 additions and 5 deletions

View File

@ -1,8 +1,10 @@
package utils
type Contact struct {
Name string `json:"name"`
Onion string `json:"onion"`
Status string `json:"status"`
Picture string `json:"picture"`
Name string `json:"name"`
Onion string `json:"onion"`
Status string `json:"status"`
Picture string `json:"picture"`
Messages int `json:"numMessages"`
Unread int `json:"numUnread"`
}

View File

@ -106,7 +106,14 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
}
cpicPath := GetPicturePath(cpic)
contactInfo := profile.GetContact(contact)
contacts = append(contacts, Contact{Name: contactInfo.Name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath})
contacts = append(contacts, Contact{
Name: contactInfo.Name,
Onion: contactInfo.Onion,
Status: contactInfo.State,
Picture: cpicPath,
Messages: contactInfo.Timeline.Len(),
Unread: 0,
})
}
bytes, _ := json.Marshal(contacts)