0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

modules/client/rooms/context: Minor cleanup extra; remove default token inits.

This commit is contained in:
Jason Volk 2019-03-31 00:36:56 -07:00
parent 40b74a6721
commit 7433daa440

View file

@ -120,10 +120,13 @@ get__context(client &client,
ret, "event", event ret, "event", event
}; };
m::event::id::buf start{event_id}; m::event::id::buf start;
{ {
json::stack::member member{ret, "events_before"}; json::stack::array array
json::stack::array array{member}; {
ret, "events_before"
};
m::room::messages before m::room::messages before
{ {
room, event_id, &default_fetch_opts room, event_id, &default_fetch_opts
@ -151,15 +154,19 @@ get__context(client &client,
start = {}; start = {};
} }
json::stack::member if(start)
{ json::stack::member
ret, "start", json::value{start} {
}; ret, "start", json::value{start}
};
m::event::id::buf end{event_id}; m::event::id::buf end;
{ {
json::stack::member member{ret, "events_after"}; json::stack::array array
json::stack::array array{member}; {
ret, "events_after"
};
m::room::messages after m::room::messages after
{ {
room, event_id, &default_fetch_opts room, event_id, &default_fetch_opts
@ -187,14 +194,18 @@ get__context(client &client,
end = {}; end = {};
} }
json::stack::member if(end)
{ json::stack::member
ret, "end", json::value{end} {
}; ret, "end", json::value{end}
};
{ {
json::stack::member member{ret, "state"}; json::stack::array array
json::stack::array array{member}; {
ret, "state"
};
const m::room::state state const m::room::state state
{ {
room, &default_fetch_opts room, &default_fetch_opts
@ -218,7 +229,7 @@ get__context(client &client,
}); });
} }
return {}; return response;
} }
void void