|
|
|
@ -1,5 +1,4 @@ |
|
|
|
use std::io;
|
|
|
|
|
|
|
|
use anyhow::Context as AnyhowContext;
|
|
|
|
use solstice_proto::server::RoomListResponse;
|
|
|
|
|
|
|
|
use crate::context::Context;
|
|
|
|
@ -9,12 +8,14 @@ use crate::message_handler::MessageHandler; |
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct SetRoomListHandler;
|
|
|
|
|
|
|
|
impl MessageHandler<RoomListResponse> for SetRoomListHandler {
|
|
|
|
impl MessageHandler for SetRoomListHandler {
|
|
|
|
type Message = RoomListResponse;
|
|
|
|
|
|
|
|
fn run(
|
|
|
|
self,
|
|
|
|
context: &Context,
|
|
|
|
message: &RoomListResponse,
|
|
|
|
) -> io::Result<()> {
|
|
|
|
) -> anyhow::Result<()> {
|
|
|
|
let response = (*message).clone();
|
|
|
|
{
|
|
|
|
let mut guard = context.state.lock();
|
|
|
|
@ -27,8 +28,10 @@ impl MessageHandler<RoomListResponse> for SetRoomListHandler { |
|
|
|
rooms,
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: decide what to do with errors here.
|
|
|
|
context.control_response_tx.blocking_send(control_response);
|
|
|
|
context
|
|
|
|
.control_response_tx
|
|
|
|
.blocking_send(control_response)
|
|
|
|
.context("sending control response")?;
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|