0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-02 13:48:53 +02:00

modules/client/directory/room: Rewrite json::not_found; move cacher to after.

This commit is contained in:
Jason Volk 2018-04-04 18:36:54 -07:00
parent 7fef6f5f10
commit 14608f4c6b

View file

@ -50,7 +50,7 @@ get__directory_room(client &client,
};
char buf[256];
const auto room_id
const m::room::id room_id
{
m::room_id(buf, room_alias)
};
@ -178,14 +178,14 @@ try
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
{
unquote(response.at("room_id"))
};
// Cache the result
send(alias_room, m::me.user_id, "ircd.alias", alias, response);
return m::room::id
{
string_view
@ -201,6 +201,13 @@ catch(const http::error &e)
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
/// room cache is not checked or updated from here, this is only the