mirror of
https://github.com/matrix-construct/construct
synced 2024-12-29 08:54:02 +01:00
ircd:Ⓜ️ Special case type=m.room.member state_key for user::id rewrite in hook ctor.
This commit is contained in:
parent
bfc2ab4eef
commit
f75a4bd95e
1 changed files with 22 additions and 0 deletions
22
ircd/m/m.cc
22
ircd/m/m.cc
|
@ -665,6 +665,28 @@ try
|
|||
validate(id::USER, member.second);
|
||||
continue;
|
||||
}
|
||||
|
||||
case hash("state_key"):
|
||||
{
|
||||
const bool is_member_event
|
||||
{
|
||||
end(members) != std::find_if(begin(members), end(members), [](const auto &member)
|
||||
{
|
||||
return member.first == "type" && member.second == "m.room.member";
|
||||
})
|
||||
};
|
||||
|
||||
// Rewrite the sender if the supplied input has no hostname
|
||||
if(valid_local_only(id::USER, member.second))
|
||||
{
|
||||
assert(my_host());
|
||||
thread_local char buf[256];
|
||||
member.second = id::user { buf, member.second, my_host() };
|
||||
}
|
||||
|
||||
validate(id::USER, member.second);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return { copy.data(), copy.data() + copy.size() };
|
||||
|
|
Loading…
Reference in a new issue