Use sync ephemeral events in sync Resposne (remove room_id)
Bump ruma to latest master which also fixes some server name as String to now being of type Box<ServerName>.
This commit is contained in:
parent
9a993fa7c1
commit
33bc666859
6 changed files with 82 additions and 102 deletions
|
@ -515,7 +515,7 @@ impl Rooms {
|
|||
event_id: EventId::try_from("$thiswillbefilledinlater").expect("we know this is valid"),
|
||||
room_id: room_id.clone(),
|
||||
sender: sender.clone(),
|
||||
origin: globals.server_name().to_string(),
|
||||
origin: globals.server_name().to_owned(),
|
||||
origin_server_ts: utils::millis_since_unix_epoch()
|
||||
.try_into()
|
||||
.expect("time is valid"),
|
||||
|
|
|
@ -209,8 +209,10 @@ impl RoomEdus {
|
|||
.unwrap_or(0))
|
||||
}
|
||||
|
||||
/// Returns an iterator over all active events (e.g. typing notifications).
|
||||
pub fn roomactives_all(&self, room_id: &RoomId) -> Result<ruma::events::typing::TypingEvent> {
|
||||
pub fn roomactives_all(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
) -> Result<SyncEphemeralRoomEvent<ruma::events::typing::TypingEventContent>> {
|
||||
let mut prefix = room_id.to_string().as_bytes().to_vec();
|
||||
prefix.push(0xff);
|
||||
|
||||
|
@ -234,43 +236,10 @@ impl RoomEdus {
|
|||
user_ids.push(user_id?);
|
||||
}
|
||||
|
||||
Ok(ruma::events::typing::TypingEvent {
|
||||
Ok(SyncEphemeralRoomEvent {
|
||||
content: ruma::events::typing::TypingEventContent { user_ids },
|
||||
room_id: room_id.clone(),
|
||||
})
|
||||
}
|
||||
// REMOVE the above method and uncomment the bottom when ruma/ruma PR #141 is merged
|
||||
// pub fn roomactives_all(
|
||||
// &self,
|
||||
// room_id: &RoomId,
|
||||
// ) -> Result<SyncEphemeralRoomEvent<ruma::events::typing::TypingEventContent>> {
|
||||
// let mut prefix = room_id.to_string().as_bytes().to_vec();
|
||||
// prefix.push(0xff);
|
||||
|
||||
// let mut user_ids = Vec::new();
|
||||
|
||||
// for user_id in self
|
||||
// .roomactiveid_userid
|
||||
// .scan_prefix(prefix)
|
||||
// .values()
|
||||
// .map(|user_id| {
|
||||
// Ok::<_, Error>(
|
||||
// UserId::try_from(utils::string_from_bytes(&user_id?).map_err(|_| {
|
||||
// Error::bad_database("User ID in roomactiveid_userid is invalid unicode.")
|
||||
// })?)
|
||||
// .map_err(|_| {
|
||||
// Error::bad_database("User ID in roomactiveid_userid is invalid.")
|
||||
// })?,
|
||||
// )
|
||||
// })
|
||||
// {
|
||||
// user_ids.push(user_id?);
|
||||
// }
|
||||
|
||||
// Ok(SyncEphemeralRoomEvent {
|
||||
// content: ruma::events::typing::TypingEventContent { user_ids },
|
||||
// })
|
||||
// }
|
||||
|
||||
/// Sets a private read marker at `count`.
|
||||
pub fn room_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue