initialize message counter
This commit is contained in:
parent
d53d81f8d0
commit
e439c0954b
|
@ -5,4 +5,6 @@ type Contact struct {
|
||||||
Onion string `json:"onion"`
|
Onion string `json:"onion"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Picture string `json:"picture"`
|
Picture string `json:"picture"`
|
||||||
|
Messages int `json:"numMessages"`
|
||||||
|
Unread int `json:"numUnread"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,14 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
}
|
}
|
||||||
cpicPath := GetPicturePath(cpic)
|
cpicPath := GetPicturePath(cpic)
|
||||||
contactInfo := profile.GetContact(contact)
|
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)
|
bytes, _ := json.Marshal(contacts)
|
||||||
|
|
Loading…
Reference in New Issue