Watch
0
0
Fork
You've already forked hyperhive
0

also stop provisioning the hive space and make hivectl matrix invite take a room

This commit is contained in:
damocles 2026-10-28 20:57:41 +01:00
commit fd01848d4d
2 changed files with 83 additions and 437 deletions

View file

@ -38,9 +38,7 @@ pub enum Cmd {
},
/// matrix-tuwunel invites.
///
/// Manual invites into the hive Space and its rooms; c0re's periodic
/// matrix sweep provisions the Space and the agents' invites on
/// its own.
/// Manual invites into a room by id or alias.
Matrix {
#[command(subcommand)]
cmd: MatrixCmd,
@ -250,16 +248,14 @@ impl From<ReconcileFrom> for hive_host_sock::ReconcileDirection {
#[derive(Subcommand)]
pub enum MatrixCmd {
/// Invite a matrix user to the hive Space, or a specific room with
/// `--room`. Idempotent.
/// Invite a matrix user to a room. Idempotent.
Invite {
/// User to invite: a full id (`@mara:server`) or a bare
/// localpart (qualified with the homeserver's `server_name`).
user: String,
/// Target room id (`!abc:server`) or alias (`#name:server`).
/// Omit to invite to the hive Space.
#[arg(long)]
room: Option<String>,
room: String,
},
}

View file

@ -12,7 +12,7 @@ use crate::cli::MatrixCmd;
/// dispatch match so the top-level router stays small.
pub(crate) async fn run_matrix_cmd(socket: &Path, cmd: MatrixCmd) -> Result<()> {
match cmd {
MatrixCmd::Invite { user, room } => matrix_invite(socket, &user, room.as_deref()).await,
MatrixCmd::Invite { user, room } => matrix_invite(socket, &user, &room).await,
}
}
@ -36,12 +36,12 @@ async fn matrix_request(socket: &Path, req: hive_host_sock::HostRequest) -> Resu
Ok(())
}
async fn matrix_invite(socket: &Path, user: &str, room: Option<&str>) -> Result<()> {
async fn matrix_invite(socket: &Path, user: &str, room: &str) -> Result<()> {
matrix_request(
socket,
hive_host_sock::HostRequest::MatrixInvite {
user: user.to_owned(),
room: room.map(str::to_owned),
room: room.to_owned(),
},
)
.await