Add LocalName it Contact struct
This commit is contained in:
parent
110d58f521
commit
b2a43b9cca
|
@ -4,6 +4,7 @@ import "cwtch.im/cwtch/model"
|
|||
|
||||
type Contact struct {
|
||||
Name string `json:"name"`
|
||||
LocalName string `json:"localname"`
|
||||
Onion string `json:"onion"`
|
||||
Status string `json:"status"`
|
||||
Picture string `json:"picture"`
|
||||
|
|
|
@ -217,12 +217,14 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
}
|
||||
|
||||
// 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 {
|
||||
name, exists = conversationInfo.GetAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||
if !exists {
|
||||
name = conversationInfo.Handle
|
||||
}
|
||||
localname = ""
|
||||
}
|
||||
|
||||
name, exists := conversationInfo.GetAttribute(attr.PublicScope, attr.ProfileZone, constants.Name)
|
||||
if !exists {
|
||||
name = conversationInfo.Handle
|
||||
}
|
||||
|
||||
// Resolve the profile image of the contact
|
||||
|
@ -303,6 +305,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
|
||||
contacts = append(contacts, Contact{
|
||||
Name: name,
|
||||
LocalName: localname,
|
||||
Identifier: conversationInfo.ID,
|
||||
Onion: conversationInfo.Handle,
|
||||
Status: connections.ConnectionStateName[state],
|
||||
|
|
Loading…
Reference in New Issue