Add Client.get_room_by_alias

This commit is contained in:
2016-03-18 11:17:04 +01:00
committed by Gergely Polonkai
parent 0e4a572058
commit 3ddac22f78
2 changed files with 32 additions and 0 deletions

View File

@@ -453,4 +453,24 @@ public class Matrix.HTTPClient : Matrix.HTTPAPI, Matrix.Client {
return room;
}
public Room
get_room_by_alias(string room_alias)
throws Matrix.Error
{
foreach (var entry in _rooms.entries) {
var room = entry.value;
if (room.canonical_alias == room_alias) {
return room;
}
if (room_alias in room.aliases) {
return room;
}
}
throw new Matrix.Error.UNAVAILABLE(
"Noo room data found for alias %s", room_alias);
}
}