mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 01:30:12 +01:00
ircd:Ⓜ️:v1: Add ids_only to event_auth opts.
This commit is contained in:
parent
ae85585454
commit
541d95f47e
2 changed files with 18 additions and 7 deletions
|
@ -39,4 +39,5 @@ struct ircd::m::v1::event_auth::opts
|
|||
server::in in;
|
||||
const struct server::request::opts *sopts {nullptr};
|
||||
bool dynamic {true};
|
||||
bool ids_only {false};
|
||||
};
|
||||
|
|
24
ircd/m_v1.cc
24
ircd/m_v1.cc
|
@ -409,10 +409,11 @@ ircd::m::v1::state::state(const room::id &room_id,
|
|||
thread_local char urlbuf[2048], ridbuf[768], eidbuf[768];
|
||||
json::get<"uri"_>(opts.request) = fmt::sprintf
|
||||
{
|
||||
urlbuf, "/_matrix/federation/v1/%s/%s/?event_id=%s",
|
||||
urlbuf, "/_matrix/federation/v1/%s/%s/?event_id=%s%s",
|
||||
opts.ids_only? "state_ids" : "state",
|
||||
url::encode(ridbuf, room_id),
|
||||
url::encode(eidbuf, opts.event_id),
|
||||
opts.ids_only? "&auth_chain_ids=0"_sv : ""_sv,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -524,12 +525,21 @@ ircd::m::v1::event_auth::event_auth(const m::room::id &room_id,
|
|||
if(!defined(json::get<"uri"_>(opts.request)))
|
||||
{
|
||||
thread_local char urlbuf[2048], ridbuf[768], eidbuf[768];
|
||||
json::get<"uri"_>(opts.request) = fmt::sprintf
|
||||
{
|
||||
urlbuf, "/_matrix/federation/v1/event_auth/%s/%s",
|
||||
url::encode(ridbuf, room_id),
|
||||
url::encode(eidbuf, event_id),
|
||||
};
|
||||
|
||||
if(opts.ids_only)
|
||||
json::get<"uri"_>(opts.request) = fmt::sprintf
|
||||
{
|
||||
urlbuf, "/_matrix/federation/v1/state_ids/%s/?event_id=%s&pdu_ids=0",
|
||||
url::encode(ridbuf, room_id),
|
||||
url::encode(eidbuf, event_id),
|
||||
};
|
||||
else
|
||||
json::get<"uri"_>(opts.request) = fmt::sprintf
|
||||
{
|
||||
urlbuf, "/_matrix/federation/v1/event_auth/%s/%s",
|
||||
url::encode(ridbuf, room_id),
|
||||
url::encode(eidbuf, event_id),
|
||||
};
|
||||
}
|
||||
|
||||
json::get<"method"_>(opts.request) = "GET";
|
||||
|
|
Loading…
Add table
Reference in a new issue