freechat/server/src/payload.rs
shockrah f343f6d252 new field for online status of users
new short structure describing online users
2020-03-17 21:34:32 -07:00

35 lines
989 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
// TODO: refactor this so that we don't need any optional fields
#[derive(Serialize, Deserialize, Debug)]
pub struct NewUserResponse {
pub userid: Option<u64>,
pub username: Option<String>,
pub key: Option<String>,
pub err: Option<&'static str>,
}
// This is basically anyone that's online at the moment
#[derive(Serialize, Debug)]
pub struct OnlineUser {
pub id: u64,
pub username: String,
}
#[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,
}