From 3064b349dc77b5ebe2bd53460c814573ddc101d6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 31 Jul 2022 04:59:44 -0700 Subject: [PATCH] modules/client/sync/rooms/timeline: Fix redundant private echo of public command. --- modules/client/sync/rooms/timeline.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/client/sync/rooms/timeline.cc b/modules/client/sync/rooms/timeline.cc index af7c02fb4..73911a19f 100644 --- a/modules/client/sync/rooms/timeline.cc +++ b/modules/client/sync/rooms/timeline.cc @@ -224,9 +224,27 @@ ircd::m::sync::room_timeline_linear(data &data) bool ircd::m::sync::_room_timeline_linear_command(data &data) { + const auto content + { + json::get<"content"_>(*data.event) + }; + + const json::string body + { + content["body"] + }; + + // Don't re-echo already public commands + if(startswith(lstrip(body, "\\\\"), '!')) + return false; + + // Don't re-echo already public command-replyings + if(has(body, "\\n\\n\\\\!")) + return false; + const m::room &room { - unquote(json::get<"content"_>(*data.event).get("room_id")) + unquote(content.get("room_id")) }; const scope_restore _room