improvement: bundle typing events and only send on changes

Fixes #67 and #49
This commit is contained in:
timokoesters 2020-06-04 11:17:36 +02:00
parent 8328eeb5ac
commit 168f2281fd
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
4 changed files with 141 additions and 98 deletions

View file

@ -52,31 +52,6 @@ impl Rooms {
.is_some())
}
// TODO: Remove and replace with public room dir
/// Returns a vector over all rooms.
pub fn all_rooms(&self) -> Vec<RoomId> {
let mut room_ids = self
.roomid_pduleaves
.iter()
.keys()
.map(|key| {
RoomId::try_from(
&*utils::string_from_bytes(
&key.unwrap()
.iter()
.copied()
.take_while(|&x| x != 0xff) // until delimiter
.collect::<Vec<_>>(),
)
.unwrap(),
)
.unwrap()
})
.collect::<Vec<_>>();
room_ids.dedup();
room_ids
}
/// Returns the full room state.
pub fn room_state(&self, room_id: &RoomId) -> Result<HashMap<(EventType, String), PduEvent>> {
let mut hashmap = HashMap::new();