mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-05 20:26:15 +00:00
* companion radio: new command frames: CMD_SET_ADVERT_LATLON, CMD_REMOVE_CONTACT
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user