mirror of
https://github.com/matrix-construct/construct
synced 2024-09-08 17:55:47 +02:00
modules/client/sync/rooms/state: Add unsigned addendum to event output.
This commit is contained in:
parent
6fed8cc360
commit
8b32f0558d
1 changed files with 31 additions and 2 deletions
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
namespace ircd::m::sync
|
namespace ircd::m::sync
|
||||||
{
|
{
|
||||||
|
static void room_state_append(data &, json::stack::array &, const m::event &, const m::event::idx &);
|
||||||
|
|
||||||
static bool room_state_polylog_events(data &);
|
static bool room_state_polylog_events(data &);
|
||||||
static bool _room_state_polylog(data &);
|
static bool _room_state_polylog(data &);
|
||||||
static bool room_state_polylog(data &);
|
static bool room_state_polylog(data &);
|
||||||
|
@ -110,7 +112,7 @@ ircd::m::sync::_room_state_linear(data &data)
|
||||||
*data.out, "events"
|
*data.out, "events"
|
||||||
};
|
};
|
||||||
|
|
||||||
array.append(*data.event);
|
room_state_append(data, array, *data.event, data.event_idx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +168,7 @@ ircd::m::sync::room_state_polylog_events(data &data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::lock_guard lock{mutex};
|
const std::lock_guard lock{mutex};
|
||||||
array.append(event);
|
room_state_append(data, array, event, event_idx);
|
||||||
ret = true;
|
ret = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
@ -187,3 +189,30 @@ ircd::m::sync::room_state_polylog_events(data &data)
|
||||||
parallel.wait_done();
|
parallel.wait_done();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ircd::m::sync::room_state_append(data &data,
|
||||||
|
json::stack::array &events,
|
||||||
|
const m::event &event,
|
||||||
|
const m::event::idx &event_idx)
|
||||||
|
{
|
||||||
|
json::stack::object object
|
||||||
|
{
|
||||||
|
events
|
||||||
|
};
|
||||||
|
|
||||||
|
object.append(event);
|
||||||
|
|
||||||
|
json::stack::object unsigned_
|
||||||
|
{
|
||||||
|
object, "unsigned"
|
||||||
|
};
|
||||||
|
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
unsigned_, "age", json::value
|
||||||
|
{
|
||||||
|
long(vm::current_sequence - event_idx)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue