|
|
|
@ -245,12 +245,12 @@ impl Client { |
|
|
|
ServerResponse::RoomMessageResponse(response) =>
|
|
|
|
self.handle_room_message_response(response),
|
|
|
|
|
|
|
|
ServerResponse::RoomUserJoinedResponse(response) =>
|
|
|
|
self.handle_room_user_joined_response(response),
|
|
|
|
|
|
|
|
ServerResponse::RoomUserLeftResponse(response) =>
|
|
|
|
self.handle_room_user_left_response(response),
|
|
|
|
|
|
|
|
ServerResponse::UserJoinedRoomResponse(response) =>
|
|
|
|
self.handle_user_joined_room_response(response),
|
|
|
|
|
|
|
|
ServerResponse::UserStatusResponse(response) =>
|
|
|
|
self.handle_user_status_response(response),
|
|
|
|
|
|
|
|
@ -363,32 +363,32 @@ impl Client { |
|
|
|
control::Response::RoomMessageResponse(control_response));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn handle_room_user_left_response(
|
|
|
|
&mut self, response: RoomUserLeftResponse)
|
|
|
|
fn handle_room_user_joined_response(
|
|
|
|
&mut self, response: RoomUserJoinedResponse)
|
|
|
|
{
|
|
|
|
let result = self.rooms.remove_member(
|
|
|
|
&response.room_name, &response.user_name
|
|
|
|
let result = self.rooms.insert_member(
|
|
|
|
&response.room_name, response.user_name.clone()
|
|
|
|
);
|
|
|
|
match result {
|
|
|
|
Ok(()) => {
|
|
|
|
self.users.insert(response.user_name, response.user);
|
|
|
|
// TODO send control response
|
|
|
|
},
|
|
|
|
Err(err) => error!("RoomUserLeftResponse: {}", err)
|
|
|
|
Err(err) => error!("RoomUserJoinedResponse: {}", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn handle_user_joined_room_response(
|
|
|
|
&mut self, response: UserJoinedRoomResponse)
|
|
|
|
fn handle_room_user_left_response(
|
|
|
|
&mut self, response: RoomUserLeftResponse)
|
|
|
|
{
|
|
|
|
let result = self.rooms.insert_member(
|
|
|
|
&response.room_name, response.user_name.clone()
|
|
|
|
let result = self.rooms.remove_member(
|
|
|
|
&response.room_name, &response.user_name
|
|
|
|
);
|
|
|
|
match result {
|
|
|
|
Ok(()) => {
|
|
|
|
self.users.insert(response.user_name, response.user);
|
|
|
|
// TODO send control response
|
|
|
|
},
|
|
|
|
Err(err) => error!("UserJoinedRoomResponse: {}", err)
|
|
|
|
Err(err) => error!("RoomUserLeftResponse: {}", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|