freechat/server/src/payload.rs

40 lines
990 B
Rust

/* Module containg various structure which we use to pass back
* and forth from client/server as auth tokens
*/
// This structure allows us to provide some critical data for the client to reconnect to
// the server without having to go through a sign in process everytime
#[derive(Serialize, Deserialize, Debug)]
pub struct NewUserResponse {
pub id: u64,
pub secret: String,
pub discriminator: i32,
}
// This is basically anyone that's online at the moment
#[derive(Serialize, Debug)]
pub struct OnlineUser {
pub id: u64,
pub username: String,
status: i32,
}
#[derive(Serialize, Deserialize)]
pub struct ChannelIndexed {
pub name: String,
pub ctype: i32,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct VoiceChannel {
pub id: i32,
pub name: String,
pub usercount: i32, // how many people are in the channel at that moment
}
#[derive(Serialize, Deserialize, Debug)]
pub struct TextChannel {
pub id: i32,
pub name: String,
}