mirror of
https://github.com/matrix-construct/construct
synced 2025-01-20 11:31:51 +01:00
ircd:Ⓜ️:event: Allow missing essential keys.
This commit is contained in:
parent
e842f6c383
commit
7ab6144e30
1 changed files with 78 additions and 31 deletions
109
ircd/m_event.cc
109
ircd/m_event.cc
|
@ -2765,52 +2765,99 @@ try
|
||||||
|
|
||||||
if(type == "m.room.aliases")
|
if(type == "m.room.aliases")
|
||||||
{
|
{
|
||||||
content = json::stringify(essential, json::members
|
if(content.has("aliases"))
|
||||||
{
|
content = json::stringify(essential, json::members
|
||||||
{ "aliases", content.at("aliases") }
|
{
|
||||||
});
|
{ "aliases", content.at("aliases") }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(type == "m.room.create")
|
else if(type == "m.room.create")
|
||||||
{
|
{
|
||||||
content = json::stringify(essential, json::members
|
if(content.has("creator"))
|
||||||
{
|
content = json::stringify(essential, json::members
|
||||||
{ "creator", content.at("creator") }
|
{
|
||||||
});
|
{ "creator", content.at("creator") }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(type == "m.room.history_visibility")
|
else if(type == "m.room.history_visibility")
|
||||||
{
|
{
|
||||||
content = json::stringify(essential, json::members
|
if(content.has("history_visibility"))
|
||||||
{
|
content = json::stringify(essential, json::members
|
||||||
{ "history_visibility", content.at("history_visibility") }
|
{
|
||||||
});
|
{ "history_visibility", content.at("history_visibility") }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(type == "m.room.join_rules")
|
else if(type == "m.room.join_rules")
|
||||||
{
|
{
|
||||||
content = json::stringify(essential, json::members
|
if(content.has("join_rule"))
|
||||||
{
|
content = json::stringify(essential, json::members
|
||||||
{ "join_rule", content.at("join_rule") }
|
{
|
||||||
});
|
{ "join_rule", content.at("join_rule") }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(type == "m.room.member")
|
else if(type == "m.room.member")
|
||||||
{
|
{
|
||||||
content = json::stringify(essential, json::members
|
if(content.has("membership"))
|
||||||
{
|
content = json::stringify(essential, json::members
|
||||||
{ "membership", content.at("membership") }
|
{
|
||||||
});
|
{ "membership", content.at("membership") }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(type == "m.room.power_levels")
|
else if(type == "m.room.power_levels")
|
||||||
{
|
{
|
||||||
content = json::stringify(essential, json::members
|
json::stack out{essential};
|
||||||
{
|
json::stack::object top{out};
|
||||||
{ "ban", content.at("ban") },
|
|
||||||
{ "events", content.at("events") },
|
if(content.has("ban"))
|
||||||
{ "events_default", content.at("events_default") },
|
json::stack::member
|
||||||
{ "kick", content.at("kick") },
|
{
|
||||||
{ "redact", content.at("redact") },
|
top, "ban", content.at("ban")
|
||||||
{ "state_default", content.at("state_default") },
|
};
|
||||||
{ "users", content.at("users") },
|
|
||||||
{ "users_default", content.at("users_default") },
|
if(content.has("events"))
|
||||||
});
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "events", content.at("events")
|
||||||
|
};
|
||||||
|
|
||||||
|
if(content.has("events_default"))
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "events_default", content.at("events_default")
|
||||||
|
};
|
||||||
|
|
||||||
|
if(content.has("kick"))
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "kick", content.at("kick")
|
||||||
|
};
|
||||||
|
|
||||||
|
if(content.has("redact"))
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "redact", content.at("redact")
|
||||||
|
};
|
||||||
|
|
||||||
|
if(content.has("state_default"))
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "state_default", content.at("state_default")
|
||||||
|
};
|
||||||
|
|
||||||
|
if(content.has("users"))
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "users", content.at("users")
|
||||||
|
};
|
||||||
|
|
||||||
|
if(content.has("users_default"))
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, "users_default", content.at("users_default")
|
||||||
|
};
|
||||||
|
|
||||||
|
top.~object();
|
||||||
|
content = out.completed();
|
||||||
}
|
}
|
||||||
else if(type == "m.room.redaction")
|
else if(type == "m.room.redaction")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue