Watch
0
0
Fork
You've already forked hyperhive
0

hive-matrix-mcp: add a leave_room tool

This commit is contained in:
damocles 2026-11-22 19:01:51 +01:00 • committed by mara
commit d88a0cc526

View file

@ -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