* companion radio: new command frames: CMD_SET_ADVERT_LATLON, CMD_REMOVE_CONTACT

This commit is contained in:
Scott Powell
2025-02-11 12:02:27 +11:00
parent 5d4a5dce36
commit eb7fec6f1d
3 changed files with 44 additions and 1 deletions

View File

@@ -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>