From 8fe92eea9beef8345180c88b007b5d0e66da0855 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 15 Sep 2019 18:06:55 -0700 Subject: [PATCH] ircd::m: Fix the existential room test. --- ircd/m_room.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ircd/m_room.cc b/ircd/m_room.cc index 4a0b5adde..64f1b70d8 100644 --- a/ircd/m_room.cc +++ b/ircd/m_room.cc @@ -1233,7 +1233,21 @@ ircd::m::exists(const id::room &room_id) dbs::room_events.begin(room_id) }; - return bool(it); + if(!it) + return false; + + const auto &[depth, event_idx] + { + dbs::room_events_key(it->first) + }; + + if(likely(depth < 2UL)) + return true; + + if(my_host(room_id.host()) && creator(room_id, m::me)) + return true; + + return false; } bool