always send PUSH_CODE_NEW_ADVERT when advert was not added to contacts[]
This commit is contained in:
@@ -323,7 +323,7 @@ void MyMesh::onContactsFull() {
|
|||||||
|
|
||||||
void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) {
|
void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) {
|
||||||
if (_serial->isConnected()) {
|
if (_serial->isConnected()) {
|
||||||
if (!shouldAutoAddContactType(contact.type) && is_new) {
|
if (is_new) {
|
||||||
writeContactRespFrame(PUSH_CODE_NEW_ADVERT, contact);
|
writeContactRespFrame(PUSH_CODE_NEW_ADVERT, contact);
|
||||||
} else {
|
} else {
|
||||||
out_frame[0] = PUSH_CODE_ADVERT;
|
out_frame[0] = PUSH_CODE_ADVERT;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void BaseChatMesh::onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id,
|
|||||||
}
|
}
|
||||||
putBlobByKey(id.pub_key, PUB_KEY_SIZE, temp_buf, plen);
|
putBlobByKey(id.pub_key, PUB_KEY_SIZE, temp_buf, plen);
|
||||||
|
|
||||||
bool is_new = false;
|
bool is_new = false; // true = not in contacts[], false = exists in contacts[]
|
||||||
if (from == NULL) {
|
if (from == NULL) {
|
||||||
if (!shouldAutoAddContactType(parser.getType())) {
|
if (!shouldAutoAddContactType(parser.getType())) {
|
||||||
ContactInfo ci;
|
ContactInfo ci;
|
||||||
@@ -142,7 +142,6 @@ void BaseChatMesh::onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_new = true;
|
|
||||||
from = allocateContactSlot();
|
from = allocateContactSlot();
|
||||||
if (from == NULL) {
|
if (from == NULL) {
|
||||||
ContactInfo ci;
|
ContactInfo ci;
|
||||||
|
|||||||
Reference in New Issue
Block a user