fix(core/unsaveable_message): content type check

This commit is contained in:
rhunk 2024-05-01 01:34:33 +02:00
parent 8533bb95d3
commit 51869e56a8

View File

@ -34,9 +34,9 @@ class UnsaveableMessages : MessagingRuleFeature(
event.buffer = ProtoEditor(event.buffer).apply {
edit(4) {
val contentType = firstOrNull(2)?.value
if (contentType != ContentType.STATUS.id.toLong()) {
if (contentType != ContentType.STATUS.id.toLong() && firstOrNull(4)?.toReader()?.contains(11) != true) {
remove(7)
addVarInt(7, if (contentType != ContentType.SNAP.id) 3 else 1) // set savePolicy to PROHIBITED only for snaps
addVarInt(7, 3) // set savePolicy to VIEW_SESSION except for status and snaps
}
}
}.toByteArray()