Commit e325036526
Unsigned
Layout: unified · split
src/room_buffer.rs +6 −8
| @@ -70,7 +70,6 @@ use weechat::{ | ||
| 70 | 70 | |
| 71 | 71 | #[derive(Clone)] |
| 72 | 72 | pub struct RoomBuffer { |
| 73 | typing_in_flight: Rc<Mutex<()>>, | |
| 74 | 73 | inner: MatrixRoom, |
| 75 | 74 | buffer_handle: BufferHandle, |
| 76 | 75 | } |
| @@ -90,11 +89,14 @@ pub enum RoomError { | ||
| 90 | 89 | |
| 91 | 90 | #[derive(Clone)] |
| 92 | 91 | pub struct MatrixRoom { |
| 93 | server_name: Rc<String>, | |
| 94 | 92 | homeserver: Rc<Url>, |
| 95 | 93 | room_id: Rc<RoomId>, |
| 94 | ||
| 96 | 95 | connection: Rc<RefCell<Option<Connection>>>, |
| 96 | ||
| 97 | 97 | typing_notice_time: Rc<RefCell<Option<Instant>>>, |
| 98 | typing_in_flight: Rc<Mutex<()>>, | |
| 99 | ||
| 98 | 100 | room: Rc<RefCell<Room>>, |
| 99 | 101 | members: HashMap<UserId, WeechatRoomMember>, |
| 100 | 102 | } |
| @@ -134,18 +136,17 @@ impl MatrixRoom { | ||
| 134 | 136 | |
| 135 | 137 | impl RoomBuffer { |
| 136 | 138 | pub fn new( |
| 137 | server_name: &str, | |
| 138 | 139 | connection: &Rc<RefCell<Option<Connection>>>, |
| 139 | 140 | homeserver: &Url, |
| 140 | 141 | room_id: RoomId, |
| 141 | 142 | own_user_id: &UserId, |
| 142 | 143 | ) -> Self { |
| 143 | 144 | let room = MatrixRoom { |
| 144 | server_name: Rc::new(server_name.to_owned()), | |
| 145 | 145 | homeserver: Rc::new(homeserver.clone()), |
| 146 | 146 | room_id: Rc::new(room_id.clone()), |
| 147 | 147 | connection: connection.clone(), |
| 148 | 148 | typing_notice_time: Rc::new(RefCell::new(None)), |
| 149 | typing_in_flight: Rc::new(Mutex::new(())), | |
| 149 | 150 | room: Rc::new(RefCell::new(Room::new(&room_id, &own_user_id))), |
| 150 | 151 | members: HashMap::new(), |
| 151 | 152 | }; |
| @@ -167,7 +168,6 @@ impl RoomBuffer { | ||
| 167 | 168 | buffer.enable_nicklist(); |
| 168 | 169 | |
| 169 | 170 | RoomBuffer { |
| 170 | typing_in_flight: Rc::new(Mutex::new(())), | |
| 171 | 171 | inner: room, |
| 172 | 172 | buffer_handle, |
| 173 | 173 | } |
| @@ -175,12 +175,10 @@ impl RoomBuffer { | ||
| 175 | 175 | |
| 176 | 176 | pub fn restore( |
| 177 | 177 | room: Room, |
| 178 | server_name: &str, | |
| 179 | 178 | connection: &Rc<RefCell<Option<Connection>>>, |
| 180 | 179 | homeserver: &Url, |
| 181 | 180 | ) -> Self { |
| 182 | 181 | let mut room_buffer = RoomBuffer::new( |
| 183 | server_name, | |
| 184 | 182 | connection, |
| 185 | 183 | homeserver, |
| 186 | 184 | room.room_id.clone(), |
| @@ -390,7 +388,7 @@ impl RoomBuffer { | ||
| 390 | 388 | /// |
| 391 | 389 | /// If the input is empty the typing notice is disabled. |
| 392 | 390 | pub fn update_typing_notice(&self) { |
| 393 | let typing_in_flight = self.typing_in_flight.clone(); | |
| 391 | let typing_in_flight = self.inner.typing_in_flight.clone(); | |
| 394 | 392 | let buffer = self.weechat_buffer(); |
| 395 | 393 | let input = buffer.input(); |
| 396 | 394 | |
src/server.rs −2
| @@ -550,7 +550,6 @@ impl InnerServer { | ||
| 550 | 550 | .as_ref() |
| 551 | 551 | .expect("Receiving events while not being logged in"); |
| 552 | 552 | let buffer = RoomBuffer::new( |
| 553 | &self.server_name, | |
| 554 | 553 | &self.connection, |
| 555 | 554 | homeserver, |
| 556 | 555 | room_id.clone(), |
| @@ -585,7 +584,6 @@ impl InnerServer { | ||
| 585 | 584 | |
| 586 | 585 | let buffer = RoomBuffer::restore( |
| 587 | 586 | room, |
| 588 | &self.server_name, | |
| 589 | 587 | &self.connection, |
| 590 | 588 | homeserver, |
| 591 | 589 | ); |