Add LocalName it Contact struct
continuous-integration/drone/pr Build is running Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2023-04-20 15:37:06 -07:00
parent 110d58f521
commit b2a43b9cca
2 changed files with 9 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import "cwtch.im/cwtch/model"
type Contact struct { type Contact struct {
Name string `json:"name"` Name string `json:"name"`
LocalName string `json:"localname"`
Onion string `json:"onion"` Onion string `json:"onion"`
Status string `json:"status"` Status string `json:"status"`
Picture string `json:"picture"` Picture string `json:"picture"`

View File

@ -217,12 +217,14 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
} }
// Prefer local override to public name... // Prefer local override to public name...
name, exists := conversationInfo.GetAttribute(attr.LocalScope, attr.ProfileZone, constants.Name) localname, exists := conversationInfo.GetAttribute(attr.LocalScope, attr.ProfileZone, constants.Name)
if !exists { if !exists {
name, exists = conversationInfo.GetAttribute(attr.PublicScope, attr.ProfileZone, constants.Name) localname = ""
if !exists { }
name = conversationInfo.Handle
} name, exists := conversationInfo.GetAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
if !exists {
name = conversationInfo.Handle
} }
// Resolve the profile image of the contact // Resolve the profile image of the contact
@ -303,6 +305,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
contacts = append(contacts, Contact{ contacts = append(contacts, Contact{
Name: name, Name: name,
LocalName: localname,
Identifier: conversationInfo.ID, Identifier: conversationInfo.ID,
Onion: conversationInfo.Handle, Onion: conversationInfo.Handle,
Status: connections.ConnectionStateName[state], Status: connections.ConnectionStateName[state],