mirror of
https://github.com/matrix-construct/construct
synced 2024-12-01 19:22:53 +01:00
modules/client/directory/room: Rewrite json::not_found; move cacher to after.
This commit is contained in:
parent
7fef6f5f10
commit
14608f4c6b
1 changed files with 11 additions and 4 deletions
|
@ -50,7 +50,7 @@ get__directory_room(client &client,
|
||||||
};
|
};
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
const auto room_id
|
const m::room::id room_id
|
||||||
{
|
{
|
||||||
m::room_id(buf, room_alias)
|
m::room_id(buf, room_alias)
|
||||||
};
|
};
|
||||||
|
@ -178,14 +178,14 @@ try
|
||||||
room_alias_fetch(buf, alias)
|
room_alias_fetch(buf, alias)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cache the result
|
|
||||||
send(alias_room, m::me.user_id, "ircd.alias", alias, response);
|
|
||||||
|
|
||||||
const m::id::room &room_id
|
const m::id::room &room_id
|
||||||
{
|
{
|
||||||
unquote(response.at("room_id"))
|
unquote(response.at("room_id"))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Cache the result
|
||||||
|
send(alias_room, m::me.user_id, "ircd.alias", alias, response);
|
||||||
|
|
||||||
return m::room::id
|
return m::room::id
|
||||||
{
|
{
|
||||||
string_view
|
string_view
|
||||||
|
@ -201,6 +201,13 @@ catch(const http::error &e)
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
catch(const json::not_found &e)
|
||||||
|
{
|
||||||
|
throw m::NOT_FOUND
|
||||||
|
{
|
||||||
|
"Remote sent malformed response: %s", e.what()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/// This function makes a room alias request to a remote. The alias
|
/// This function makes a room alias request to a remote. The alias
|
||||||
/// room cache is not checked or updated from here, this is only the
|
/// room cache is not checked or updated from here, this is only the
|
||||||
|
|
Loading…
Reference in a new issue