diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a7602..25a4042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - On unix based systems, the created key file is no longer readable system-wide. - The message subsystem no longer removes peeked message if a topic filter is set. +- Properly send back a read acknowledgement after popping/peeking a message while + a topic filter is set. ### Deprecated diff --git a/mycelium/src/message.rs b/mycelium/src/message.rs index 8961704..98ce21c 100644 --- a/mycelium/src/message.rs +++ b/mycelium/src/message.rs @@ -1338,7 +1338,14 @@ where .enumerate() .find(|(_, v)| &v.topic == topic) { - return inbox.complete_msges.remove(idx).unwrap(); + let msg = if pop { + inbox.complete_msges.remove(idx).unwrap(); + } else { + inbox.complete_msges[idx].clone(); + }; + + self.notify_read(&msg); + return msg; } else { break 'check; }