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 {
|
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"`
|
||||||
|
|
|
@ -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],
|
||||||
|
|
Loading…
Reference in New Issue