Skip to content

Commit f9428b7

Browse files
authored
Merge pull request #785 from liamcottle/feature/new-message-timestamps
Update lastmod when a new message is received
2 parents d377ffd + 561dbea commit f9428b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/helpers/BaseChatMesh.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
158158
data[len] = 0; // need to make a C string again, with null terminator
159159

160160
if (flags == TXT_TYPE_PLAIN) {
161+
from.lastmod = getRTCClock()->getCurrentTime(); // update last heard time
161162
onMessageRecv(from, packet, timestamp, (const char *) &data[5]); // let UI know
162163

163164
uint32_t ack_hash; // calc truncated hash of the message timestamp + text + sender pub_key, to prove to sender that we got it
@@ -184,6 +185,7 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
184185
if (timestamp > from.sync_since) { // make sure 'sync_since' is up-to-date
185186
from.sync_since = timestamp;
186187
}
188+
from.lastmod = getRTCClock()->getCurrentTime(); // update last heard time
187189
onSignedMessageRecv(from, packet, timestamp, &data[5], (const char *) &data[9]); // let UI know
188190

189191
uint32_t ack_hash; // calc truncated hash of the message timestamp + text + OUR pub_key, to prove to sender that we got it

0 commit comments

Comments
 (0)