remove box ids from admin room command arguments

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-04-08 04:39:01 +00:00 committed by Jade Ellis
parent 83126cc667
commit b3e5d2f683
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
20 changed files with 128 additions and 129 deletions

View file

@ -1,7 +1,7 @@
use clap::Subcommand;
use conduwuit::Result;
use futures::StreamExt;
use ruma::{RoomId, UserId, events::room::message::RoomMessageEventContent};
use ruma::{OwnedRoomId, OwnedUserId, events::room::message::RoomMessageEventContent};
use crate::{admin_command, admin_command_dispatch};
@ -12,30 +12,30 @@ pub(crate) enum AccountDataCommand {
/// - Returns all changes to the account data that happened after `since`.
ChangesSince {
/// Full user ID
user_id: Box<UserId>,
user_id: OwnedUserId,
/// UNIX timestamp since (u64)
since: u64,
/// Optional room ID of the account data
room_id: Option<Box<RoomId>>,
room_id: Option<OwnedRoomId>,
},
/// - Searches the account data for a specific kind.
AccountDataGet {
/// Full user ID
user_id: Box<UserId>,
user_id: OwnedUserId,
/// Account data event type
kind: String,
/// Optional room ID of the account data
room_id: Option<Box<RoomId>>,
room_id: Option<OwnedRoomId>,
},
}
#[admin_command]
async fn changes_since(
&self,
user_id: Box<UserId>,
user_id: OwnedUserId,
since: u64,
room_id: Option<Box<RoomId>>,
room_id: Option<OwnedRoomId>,
) -> Result<RoomMessageEventContent> {
let timer = tokio::time::Instant::now();
let results: Vec<_> = self
@ -54,9 +54,9 @@ async fn changes_since(
#[admin_command]
async fn account_data_get(
&self,
user_id: Box<UserId>,
user_id: OwnedUserId,
kind: String,
room_id: Option<Box<RoomId>>,
room_id: Option<OwnedRoomId>,
) -> Result<RoomMessageEventContent> {
let timer = tokio::time::Instant::now();
let results = self

View file

@ -9,7 +9,7 @@ pub(crate) enum AppserviceCommand {
/// - Gets the appservice registration info/details from the ID as a string
GetRegistration {
/// Appservice registration ID
appservice_id: Box<str>,
appservice_id: String,
},
/// - Gets all appservice registrations with their ID and registration info

View file

@ -1,6 +1,6 @@
use clap::Subcommand;
use conduwuit::Result;
use ruma::ServerName;
use ruma::OwnedServerName;
use crate::Command;
@ -16,7 +16,7 @@ pub(crate) enum GlobalsCommand {
/// - This returns an empty `Ok(BTreeMap<..>)` when there are no keys found
/// for the server.
SigningKeysFor {
origin: Box<ServerName>,
origin: OwnedServerName,
},
}

View file

@ -1,7 +1,7 @@
use clap::Subcommand;
use conduwuit::Result;
use futures::StreamExt;
use ruma::UserId;
use ruma::OwnedUserId;
use crate::Command;
@ -11,7 +11,7 @@ pub(crate) enum PresenceCommand {
/// - Returns the latest presence event for the given user.
GetPresence {
/// Full user ID
user_id: Box<UserId>,
user_id: OwnedUserId,
},
/// - Iterator of the most recent presence updates that happened after the

View file

@ -1,6 +1,6 @@
use clap::Subcommand;
use conduwuit::Result;
use ruma::UserId;
use ruma::OwnedUserId;
use crate::Command;
@ -9,7 +9,7 @@ pub(crate) enum PusherCommand {
/// - Returns all the pushers for the user.
GetPushers {
/// Full user ID
user_id: Box<UserId>,
user_id: OwnedUserId,
},
}

View file

@ -1,7 +1,7 @@
use clap::Subcommand;
use conduwuit::Result;
use futures::StreamExt;
use ruma::{RoomAliasId, RoomId};
use ruma::{OwnedRoomAliasId, OwnedRoomId};
use crate::Command;
@ -10,13 +10,13 @@ use crate::Command;
pub(crate) enum RoomAliasCommand {
ResolveLocalAlias {
/// Full room alias
alias: Box<RoomAliasId>,
alias: OwnedRoomAliasId,
},
/// - Iterator of all our local room aliases for the room ID
LocalAliasesForRoom {
/// Full room ID
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
/// - Iterator of all our local aliases in our database with their room IDs

View file

@ -1,78 +1,80 @@
use clap::Subcommand;
use conduwuit::{Error, Result};
use futures::StreamExt;
use ruma::{RoomId, ServerName, UserId, events::room::message::RoomMessageEventContent};
use ruma::{
OwnedRoomId, OwnedServerName, OwnedUserId, events::room::message::RoomMessageEventContent,
};
use crate::Command;
#[derive(Debug, Subcommand)]
pub(crate) enum RoomStateCacheCommand {
ServerInRoom {
server: Box<ServerName>,
room_id: Box<RoomId>,
server: OwnedServerName,
room_id: OwnedRoomId,
},
RoomServers {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
ServerRooms {
server: Box<ServerName>,
server: OwnedServerName,
},
RoomMembers {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
LocalUsersInRoom {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
ActiveLocalUsersInRoom {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
RoomJoinedCount {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
RoomInvitedCount {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
RoomUserOnceJoined {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
RoomMembersInvited {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
GetInviteCount {
room_id: Box<RoomId>,
user_id: Box<UserId>,
room_id: OwnedRoomId,
user_id: OwnedUserId,
},
GetLeftCount {
room_id: Box<RoomId>,
user_id: Box<UserId>,
room_id: OwnedRoomId,
user_id: OwnedUserId,
},
RoomsJoined {
user_id: Box<UserId>,
user_id: OwnedUserId,
},
RoomsLeft {
user_id: Box<UserId>,
user_id: OwnedUserId,
},
RoomsInvited {
user_id: Box<UserId>,
user_id: OwnedUserId,
},
InviteState {
user_id: Box<UserId>,
room_id: Box<RoomId>,
user_id: OwnedUserId,
room_id: OwnedRoomId,
},
}

View file

@ -1,7 +1,7 @@
use clap::Subcommand;
use conduwuit::Result;
use futures::StreamExt;
use ruma::{ServerName, UserId, events::room::message::RoomMessageEventContent};
use ruma::{OwnedServerName, OwnedUserId, events::room::message::RoomMessageEventContent};
use service::sending::Destination;
use crate::Command;
@ -27,9 +27,9 @@ pub(crate) enum SendingCommand {
#[arg(short, long)]
appservice_id: Option<String>,
#[arg(short, long)]
server_name: Option<Box<ServerName>>,
server_name: Option<OwnedServerName>,
#[arg(short, long)]
user_id: Option<Box<UserId>>,
user_id: Option<OwnedUserId>,
#[arg(short, long)]
push_key: Option<String>,
},
@ -49,15 +49,15 @@ pub(crate) enum SendingCommand {
#[arg(short, long)]
appservice_id: Option<String>,
#[arg(short, long)]
server_name: Option<Box<ServerName>>,
server_name: Option<OwnedServerName>,
#[arg(short, long)]
user_id: Option<Box<UserId>>,
user_id: Option<OwnedUserId>,
#[arg(short, long)]
push_key: Option<String>,
},
GetLatestEduCount {
server_name: Box<ServerName>,
server_name: OwnedServerName,
},
}
@ -120,7 +120,7 @@ pub(super) async fn reprocess(
| (None, Some(server_name), None, None) => services
.sending
.db
.queued_requests(&Destination::Federation(server_name.into())),
.queued_requests(&Destination::Federation(server_name)),
| (None, None, Some(user_id), Some(push_key)) => {
if push_key.is_empty() {
return Ok(RoomMessageEventContent::text_plain(
@ -132,7 +132,7 @@ pub(super) async fn reprocess(
services
.sending
.db
.queued_requests(&Destination::Push(user_id.into(), push_key))
.queued_requests(&Destination::Push(user_id, push_key))
},
| (Some(_), Some(_), Some(_), Some(_)) => {
return Ok(RoomMessageEventContent::text_plain(
@ -190,7 +190,7 @@ pub(super) async fn reprocess(
| (None, Some(server_name), None, None) => services
.sending
.db
.active_requests_for(&Destination::Federation(server_name.into())),
.active_requests_for(&Destination::Federation(server_name)),
| (None, None, Some(user_id), Some(push_key)) => {
if push_key.is_empty() {
return Ok(RoomMessageEventContent::text_plain(
@ -202,7 +202,7 @@ pub(super) async fn reprocess(
services
.sending
.db
.active_requests_for(&Destination::Push(user_id.into(), push_key))
.active_requests_for(&Destination::Push(user_id, push_key))
},
| (Some(_), Some(_), Some(_), Some(_)) => {
return Ok(RoomMessageEventContent::text_plain(