mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
modules/federation/make_join: Spit out some auth_event for synapse to chew on.
This commit is contained in:
parent
b3ba8c6d4b
commit
1a0c359a6d
1 changed files with 30 additions and 7 deletions
|
@ -72,12 +72,6 @@ get__make_join(client &client,
|
||||||
prev_event_id, std::nothrow
|
prev_event_id, std::nothrow
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &auth_events
|
|
||||||
{
|
|
||||||
json::get<"auth_events"_>(evf)?
|
|
||||||
json::get<"auth_events"_>(evf) : json::array{"[]"}
|
|
||||||
};
|
|
||||||
|
|
||||||
const json::value prev[]
|
const json::value prev[]
|
||||||
{
|
{
|
||||||
{ string_view{prev_event_id} },
|
{ string_view{prev_event_id} },
|
||||||
|
@ -89,6 +83,35 @@ get__make_join(client &client,
|
||||||
{ prev, 2 }
|
{ prev, 2 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const m::room::state state
|
||||||
|
{
|
||||||
|
room_id
|
||||||
|
};
|
||||||
|
|
||||||
|
auto auth_event_id
|
||||||
|
{
|
||||||
|
state.get(std::nothrow, "m.room.member", user_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!auth_event_id)
|
||||||
|
auth_event_id = state.get("m.room.create");
|
||||||
|
|
||||||
|
const m::event::fetch aevf
|
||||||
|
{
|
||||||
|
auth_event_id, std::nothrow
|
||||||
|
};
|
||||||
|
|
||||||
|
const json::value auth[]
|
||||||
|
{
|
||||||
|
{ string_view{auth_event_id} },
|
||||||
|
{ json::get<"hashes"_>(aevf) }
|
||||||
|
};
|
||||||
|
|
||||||
|
const json::value auths[]
|
||||||
|
{
|
||||||
|
{ auth, 2 }
|
||||||
|
};
|
||||||
|
|
||||||
thread_local char bufs[96_KiB];
|
thread_local char bufs[96_KiB];
|
||||||
mutable_buffer buf{bufs};
|
mutable_buffer buf{bufs};
|
||||||
|
|
||||||
|
@ -104,7 +127,7 @@ get__make_join(client &client,
|
||||||
{ event, { "depth", int64_t(depth) + 1 }},
|
{ event, { "depth", int64_t(depth) + 1 }},
|
||||||
{ event, { "membership", "join" }},
|
{ event, { "membership", "join" }},
|
||||||
{ content, { "membership", "join" }},
|
{ content, { "membership", "join" }},
|
||||||
{ event, { "auth_events", auth_events }},
|
{ event, { "auth_events", { auths, 1 } }},
|
||||||
{ event, { "prev_state", "[]" }},
|
{ event, { "prev_state", "[]" }},
|
||||||
{ event, { "prev_events", { prevs, 1 } }},
|
{ event, { "prev_events", { prevs, 1 } }},
|
||||||
{ event, { "content", stringify(buf, content) }},
|
{ event, { "content", stringify(buf, content) }},
|
||||||
|
|
Loading…
Reference in a new issue