mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* companion radio: new command frames: CMD_SET_ADVERT_LATLON, CMD_REMOVE_CONTACT
This commit is contained in:
parent
5d4a5dce36
commit
eb7fec6f1d
3 changed files with 44 additions and 1 deletions
|
|
@ -281,6 +281,22 @@ bool BaseChatMesh::addContact(const ContactInfo& contact) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool BaseChatMesh::removeContact(ContactInfo& contact) {
|
||||
int idx = 0;
|
||||
while (idx < num_contacts && !contacts[idx].id.matches(contact.id)) {
|
||||
idx++;
|
||||
}
|
||||
if (idx >= num_contacts) return false; // not found
|
||||
|
||||
// remove from contacts array
|
||||
num_contacts--;
|
||||
while (idx < num_contacts) {
|
||||
contacts[idx] = contacts[idx + 1];
|
||||
idx++;
|
||||
}
|
||||
return true; // Success
|
||||
}
|
||||
|
||||
#ifdef MAX_GROUP_CHANNELS
|
||||
#include <base64.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public:
|
|||
void scanRecentContacts(int last_n, ContactVisitor* visitor);
|
||||
ContactInfo* searchContactsByPrefix(const char* name_prefix);
|
||||
ContactInfo* lookupContactByPubKey(const uint8_t* pub_key, int prefix_len);
|
||||
bool removeContact(ContactInfo& contact);
|
||||
bool addContact(const ContactInfo& contact);
|
||||
int getNumContacts() const { return num_contacts; }
|
||||
ContactsIterator startContactsIterator();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue