Files
continuwuity/src/admin/room/mod.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
2.0 KiB
Rust
Raw Normal View History

2024-07-27 00:11:41 +00:00
mod alias;
mod commands;
mod directory;
mod info;
mod moderation;
2024-04-20 19:55:14 -04:00
use clap::Subcommand;
2025-05-22 13:49:22 +01:00
use commands::RoomTargetOption;
2024-12-14 21:58:01 -05:00
use conduwuit::Result;
use ruma::{OwnedRoomId, OwnedRoomOrAliasId};
2024-04-20 19:55:14 -04:00
2024-07-27 00:11:41 +00:00
use self::{
alias::RoomAliasCommand, directory::RoomDirectoryCommand, info::RoomInfoCommand,
moderation::RoomModerationCommand,
2024-07-27 00:11:41 +00:00
};
use crate::admin_command_dispatch;
2024-04-20 19:55:14 -04:00
2024-07-27 00:11:41 +00:00
#[admin_command_dispatch]
#[derive(Debug, Subcommand)]
2025-05-24 00:28:09 +01:00
pub enum RoomCommand {
/// List all rooms the server knows about
2024-07-27 00:11:41 +00:00
#[clap(alias = "list")]
ListRooms {
2024-04-20 19:55:14 -04:00
page: Option<usize>,
/// Excludes rooms that we have federation disabled with
#[arg(long)]
exclude_disabled: bool,
/// Excludes rooms that we have banned
#[arg(long)]
exclude_banned: bool,
/// Includes disconnected/empty rooms (rooms with zero members)
#[arg(long)]
include_empty: bool,
#[arg(long)]
/// Whether to only output room IDs without supplementary room
/// information
no_details: bool,
2024-04-20 19:55:14 -04:00
},
#[command(subcommand)]
/// View information about a room we know about
Info(RoomInfoCommand),
2024-04-20 19:55:14 -04:00
#[command(subcommand)]
/// Manage moderation of remote or local rooms
2024-04-20 19:55:14 -04:00
Moderation(RoomModerationCommand),
#[command(subcommand)]
/// Manage rooms' aliases
2024-04-20 19:55:14 -04:00
Alias(RoomAliasCommand),
#[command(subcommand)]
/// Manage the room directory
2024-04-20 19:55:14 -04:00
Directory(RoomDirectoryCommand),
2024-08-08 17:18:30 +00:00
/// Check if we know about a room
2024-08-08 17:18:30 +00:00
Exists {
room_id: OwnedRoomId,
},
/// - Delete all sync tokens for a room
PurgeSyncTokens {
/// Room ID or alias to purge sync tokens for
#[arg(value_parser)]
room: OwnedRoomOrAliasId,
},
/// - Delete sync tokens for all rooms that have no local users
///
2025-05-22 13:49:22 +01:00
/// By default, processes all empty rooms.
PurgeEmptyRoomTokens {
/// Confirm you want to delete tokens from potentially many rooms
#[arg(long)]
yes: bool,
2025-05-22 13:49:22 +01:00
/// Target specific room types
#[arg(long, value_enum)]
target_option: Option<RoomTargetOption>,
/// Perform a dry run without actually deleting any tokens
#[arg(long)]
dry_run: bool,
},
2024-04-20 19:55:14 -04:00
}