add GetContactByID to Messenger
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
19fc448c85
commit
7a97325850
|
@ -1147,10 +1147,20 @@ func (m *Messenger) Contacts() []*Contact {
|
||||||
for _, contact := range m.allContacts {
|
for _, contact := range m.allContacts {
|
||||||
contacts = append(contacts, contact)
|
contacts = append(contacts, contact)
|
||||||
}
|
}
|
||||||
|
|
||||||
return contacts
|
return contacts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetContactByID assumes pubKey includes 0x prefix
|
||||||
|
func (m *Messenger) GetContactByID(pubKey string) (*Contact, error) {
|
||||||
|
m.mutex.Lock()
|
||||||
|
defer m.mutex.Unlock()
|
||||||
|
contact, ok := m.allContacts[pubKey]
|
||||||
|
if !ok {
|
||||||
|
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
|
||||||
func (m *Messenger) ReSendChatMessage(ctx context.Context, messageID string) error {
|
func (m *Messenger) ReSendChatMessage(ctx context.Context, messageID string) error {
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
|
|
Loading…
Reference in New Issue