Add Client.get_room_by_id()
This commit is contained in:
parent
9f236de0b9
commit
c8f815c542
@ -193,4 +193,16 @@ public interface Matrix.Client : GLib.Object {
|
|||||||
public abstract Presence
|
public abstract Presence
|
||||||
get_user_presence(string user_id, string? room_id = null)
|
get_user_presence(string user_id, string? room_id = null)
|
||||||
throws Matrix.Error;
|
throws Matrix.Error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a room object by the room ID specified in @param room_id.
|
||||||
|
* If room data is not cached yet, Matrix.Error.UNAVAILABLE is
|
||||||
|
* thrown.
|
||||||
|
*
|
||||||
|
* @param room_id the ID of a room
|
||||||
|
* @return a Matrix.Room object
|
||||||
|
*/
|
||||||
|
public abstract Room
|
||||||
|
get_room_by_id(string room_id)
|
||||||
|
throws Matrix.Error;
|
||||||
}
|
}
|
||||||
|
@ -439,4 +439,18 @@ public class Matrix.HTTPClient : Matrix.HTTPAPI, Matrix.Client {
|
|||||||
throw new Matrix.Error.UNSUPPORTED(
|
throw new Matrix.Error.UNSUPPORTED(
|
||||||
"Per-room presences are not supported yet.");
|
"Per-room presences are not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Room
|
||||||
|
get_room_by_id(string room_id)
|
||||||
|
throws Matrix.Error
|
||||||
|
{
|
||||||
|
Room? room;
|
||||||
|
|
||||||
|
if ((room = _rooms[room_id]) == null) {
|
||||||
|
throw new Matrix.Error.UNAVAILABLE(
|
||||||
|
"Room data for %s is not cached yet.", room_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return room;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user