hive-matrix-mcp: add a leave_room tool
This commit is contained in:
parent
56ed2e07da
commit
d88a0cc526
1 changed files with 68 additions and 4 deletions
|
|
@ -900,6 +900,22 @@ pub async fn join_room(client: &Client, room_ref: &str) -> DaemonResponse {
|
|||
}
|
||||
}
|
||||
|
||||
/// Leave the joined room `room_ref` (id or alias), so a retired account stops
|
||||
/// receiving its messages.
|
||||
pub async fn leave_room(client: &Client, room_ref: &str) -> DaemonResponse {
|
||||
let room = match resolve_room(client, room_ref).await {
|
||||
Ok(r) => r,
|
||||
Err(e) => return e,
|
||||
};
|
||||
match room.leave().await {
|
||||
Ok(()) => DaemonResponse::ok(&serde_json::json!({
|
||||
"left": true,
|
||||
"room_id": room.room_id().to_string(),
|
||||
})),
|
||||
Err(e) => DaemonResponse::error(format!("leave room {room_ref}: {e}")),
|
||||
}
|
||||
}
|
||||
|
||||
/// Accept or reject a pending invite to `room_ref` (id or alias).
|
||||
///
|
||||
/// `Accept` is exactly `join_room` (joining a room you were invited to
|
||||
|
|
|
|||
Loading…
Reference in a new issue