mirror of
https://github.com/matrix-construct/construct
synced 2024-05-29 00:03:45 +02:00
ircd:Ⓜ️:sync: Add inline sequence extraction logic from token.
modules/client: Update sites parsing since tokens.
This commit is contained in:
parent
32732a847b
commit
58fb551a13
|
@ -15,8 +15,19 @@ namespace ircd::m::sync
|
|||
{
|
||||
using since = std::tuple<event::idx, event::idx, string_view>;
|
||||
|
||||
event::idx sequence(const since &);
|
||||
since make_since(const string_view &);
|
||||
string_view make_since(const mutable_buffer &, const m::events::range &, const string_view &flags = {});
|
||||
string_view make_since(const mutable_buffer &, const int64_t &, const string_view &flags = {});
|
||||
|
||||
since make_since(const string_view &);
|
||||
}
|
||||
|
||||
inline ircd::m::event::idx
|
||||
ircd::m::sync::sequence(const since &since)
|
||||
{
|
||||
const auto &[token, snapshot, flags]
|
||||
{
|
||||
since
|
||||
};
|
||||
|
||||
return snapshot?: token?: -1UL;
|
||||
}
|
||||
|
|
|
@ -137,11 +137,16 @@ post__keys_query(client &client,
|
|||
std::clamp(request.get("timeout", timeout_default), timeout_min, timeout_max)
|
||||
};
|
||||
|
||||
const auto &token
|
||||
const json::string token
|
||||
{
|
||||
request["token"]
|
||||
};
|
||||
|
||||
const m::event::idx since
|
||||
{
|
||||
m::sync::sequence(m::sync::make_since(token))
|
||||
};
|
||||
|
||||
const json::object &request_keys
|
||||
{
|
||||
request.at("device_keys")
|
||||
|
|
|
@ -55,16 +55,9 @@ get__members(client &client,
|
|||
// an event_idx sequence integer, except during phased-polylog sync
|
||||
// when this is a negative integer. If this is phased sync, we can
|
||||
// parse this token for the snapshot integer.
|
||||
const auto &[since, snapshot, flags]
|
||||
const m::event::idx at_idx
|
||||
{
|
||||
m::sync::make_since(at)
|
||||
};
|
||||
|
||||
const auto &at_idx
|
||||
{
|
||||
snapshot?:
|
||||
since?:
|
||||
-1UL
|
||||
m::sync::sequence(m::sync::make_since(at))
|
||||
};
|
||||
|
||||
const m::room room
|
||||
|
|
Loading…
Reference in a new issue