expose getContactByID method
This commit is contained in:
parent
82deccef60
commit
4720224ba2
|
@ -1234,14 +1234,11 @@ func (m *Messenger) Contacts() []*Contact {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContactByID assumes pubKey includes 0x prefix
|
// GetContactByID assumes pubKey includes 0x prefix
|
||||||
func (m *Messenger) GetContactByID(pubKey string) (*Contact, error) {
|
func (m *Messenger) GetContactByID(pubKey string) *Contact {
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
contact, ok := m.allContacts[pubKey]
|
|
||||||
if !ok {
|
return m.allContacts[pubKey]
|
||||||
return nil, errors.New("no contact found")
|
|
||||||
}
|
|
||||||
return contact, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSendChatMessage pulls a message from the database and sends it again
|
// ReSendChatMessage pulls a message from the database and sends it again
|
||||||
|
|
|
@ -260,6 +260,10 @@ func (api *PublicAPI) Contacts(parent context.Context) []*protocol.Contact {
|
||||||
return api.service.messenger.Contacts()
|
return api.service.messenger.Contacts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PublicAPI) GetContactByID(parent context.Context, id string) *protocol.Contact {
|
||||||
|
return api.service.messenger.GetContactByID(id)
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PublicAPI) RemoveFilters(parent context.Context, chats []*transport.Filter) error {
|
func (api *PublicAPI) RemoveFilters(parent context.Context, chats []*transport.Filter) error {
|
||||||
return api.service.messenger.RemoveFilters(chats)
|
return api.service.messenger.RemoveFilters(chats)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue