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
|
||||
func (m *Messenger) GetContactByID(pubKey string) (*Contact, error) {
|
||||
func (m *Messenger) GetContactByID(pubKey string) *Contact {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
contact, ok := m.allContacts[pubKey]
|
||||
if !ok {
|
||||
return nil, errors.New("no contact found")
|
||||
}
|
||||
return contact, nil
|
||||
|
||||
return m.allContacts[pubKey]
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
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 {
|
||||
return api.service.messenger.RemoveFilters(chats)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue