|
|
|
@ -4,9 +4,7 @@ use solstice_proto::User; |
|
|
|
|
|
|
|
/// This enumeration is the list of possible control responses from the client
|
|
|
|
/// to the controller.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub enum Response {
|
|
|
|
LoginStatusResponse(LoginStatusResponse),
|
|
|
|
RoomJoinResponse(RoomJoinResponse),
|
|
|
|
@ -19,25 +17,19 @@ pub enum Response { |
|
|
|
UserListResponse(UserListResponse),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct RoomJoinResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct RoomLeaveResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This enumeration is the list of possible login states, and the associated
|
|
|
|
/// information.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub enum LoginStatusResponse {
|
|
|
|
/// The login request has been sent to the server, but the response hasn't
|
|
|
|
/// been received yet.
|
|
|
|
@ -65,9 +57,7 @@ pub enum LoginStatusResponse { |
|
|
|
|
|
|
|
/// This structure contains the list of all visible rooms, and their associated
|
|
|
|
/// data.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct RoomListResponse {
|
|
|
|
/// The list of (room name, room data) pairs.
|
|
|
|
pub rooms: Vec<(String, room::Room)>,
|
|
|
|
@ -75,9 +65,7 @@ pub struct RoomListResponse { |
|
|
|
|
|
|
|
/// This structure contains a message said in a chat room the user is a member
|
|
|
|
/// of.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct RoomMessageResponse {
|
|
|
|
/// The name of the room in which the message was said.
|
|
|
|
pub room_name: String,
|
|
|
|
@ -88,36 +76,28 @@ pub struct RoomMessageResponse { |
|
|
|
}
|
|
|
|
|
|
|
|
/// This struct describes the fact that the given user joined the given room.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct RoomUserJoinedResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub user_name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This struct describes the fact that the given user left the given room.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct RoomUserLeftResponse {
|
|
|
|
pub room_name: String,
|
|
|
|
pub user_name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This struct contains the last known information about a given user.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct UserInfoResponse {
|
|
|
|
pub user_name: String,
|
|
|
|
pub user_info: User,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This stuct contains the last known information about every user.
|
|
|
|
#[derive(
|
|
|
|
Debug, PartialEq, Eq, RustcDecodable, RustcEncodable, Serialize, Deserialize,
|
|
|
|
)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct UserListResponse {
|
|
|
|
pub user_list: Vec<(String, User)>,
|
|
|
|
}
|
|
|
|
|