server side preparation

This commit is contained in:
2026-02-18 21:52:22 -05:00
parent 1c6b6de8f6
commit 6fad5b1852
15 changed files with 547 additions and 535 deletions
+48
View File
@@ -0,0 +1,48 @@
use iris::core::util::HashSet;
pub use openworm::net::{AccountToken, ServerPerms};
pub type UserId = u64;
pub type MsgId = i128;
pub type ChannelId = u64;
pub type ImageId = u64;
#[derive(bitcode::Encode, bitcode::Decode)]
pub struct User {
pub username: String,
pub password_hash: String,
pub pfp: Option<ImageId>,
pub bio: String,
pub friends: Friends,
pub server_perms: ServerPerms,
}
impl User {
pub fn new(username: String, password_hash: String, perms: ServerPerms) -> Self {
Self {
username,
password_hash,
bio: String::new(),
pfp: None,
friends: Default::default(),
server_perms: perms,
}
}
}
#[derive(Default, bitcode::Encode, bitcode::Decode)]
pub struct Friends {
pub current: HashSet<UserId>,
pub outgoing: HashSet<UserId>,
pub incoming: HashSet<UserId>,
}
#[derive(bitcode::Encode, bitcode::Decode)]
pub struct Msg {
pub content: String,
pub author: UserId,
}
pub struct Channel {
pub name: String,
pub desc: String,
}