Compare commits
11 commits
master
...
better-adm
Author | SHA1 | Date | |
---|---|---|---|
7e07d246df | |||
fbd8780600 | |||
73ef497609 | |||
6e105a8a41 | |||
5443768b5c | |||
0328932c54 | |||
048dfef76c | |||
36dbf8ce89 | |||
7a0ae6c09a | |||
fc8d8df801 | |||
e972ef6891 |
5 changed files with 1027 additions and 656 deletions
|
@ -75,4 +75,28 @@ impl service::rooms::alias::Data for KeyValueDatabase {
|
||||||
})
|
})
|
||||||
.transpose()
|
.transpose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn all_local_aliases<'a>(
|
||||||
|
&'a self,
|
||||||
|
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, String)>> + 'a> {
|
||||||
|
Box::new(
|
||||||
|
self.alias_roomid
|
||||||
|
.iter()
|
||||||
|
.map(|(room_alias_bytes, room_id_bytes)| {
|
||||||
|
let room_alias_localpart = utils::string_from_bytes(&room_alias_bytes)
|
||||||
|
.map_err(|_| {
|
||||||
|
Error::bad_database("Invalid alias bytes in aliasid_alias.")
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let room_id = utils::string_from_bytes(&room_id_bytes)
|
||||||
|
.map_err(|_| {
|
||||||
|
Error::bad_database("Invalid room_id bytes in aliasid_alias.")
|
||||||
|
})?
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| Error::bad_database("Invalid room_id in aliasid_alias."))?;
|
||||||
|
|
||||||
|
Ok((room_id, room_alias_localpart))
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,4 +19,9 @@ pub trait Data: Send + Sync {
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a>;
|
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a>;
|
||||||
|
|
||||||
|
/// Returns all local aliases on the server
|
||||||
|
fn all_local_aliases<'a>(
|
||||||
|
&'a self,
|
||||||
|
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, String)>> + 'a>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,4 +98,11 @@ impl Service {
|
||||||
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a> {
|
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a> {
|
||||||
self.db.local_aliases_for_room(room_id)
|
self.db.local_aliases_for_room(room_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
|
pub fn all_local_aliases<'a>(
|
||||||
|
&'a self,
|
||||||
|
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, String)>> + 'a> {
|
||||||
|
self.db.all_local_aliases()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -506,7 +506,11 @@ impl Service {
|
||||||
.state_cache
|
.state_cache
|
||||||
.is_joined(server_user, &admin_room)?
|
.is_joined(server_user, &admin_room)?
|
||||||
{
|
{
|
||||||
services().admin.process_message(body);
|
services().admin.process_message(
|
||||||
|
body,
|
||||||
|
pdu.event_id.clone(),
|
||||||
|
pdu.sender.clone(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue