Initial commit: EifelDC - Discord-like Matrix chat platform
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Rust Tests (push) Has been cancelled
CI / Frontend Check (push) Has been cancelled
CI / Build Tauri (macOS) (push) Has been cancelled
CI / Build Tauri (macOS Intel) (push) Has been cancelled
CI / Build Tauri (Linux) (push) Has been cancelled
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Rust Tests (push) Has been cancelled
CI / Frontend Check (push) Has been cancelled
CI / Build Tauri (macOS) (push) Has been cancelled
CI / Build Tauri (macOS Intel) (push) Has been cancelled
CI / Build Tauri (Linux) (push) Has been cancelled
Includes server (Rust/Axum API proxy with voice management), Tauri desktop client with Svelte UI, bot-sdk, Docker infra (Synapse, PostgreSQL, Coturn, Nginx), and CI/CD pipeline.
This commit is contained in:
38
bot-sdk/src/room.rs
Normal file
38
bot-sdk/src/room.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RoomInfo {
|
||||
pub room_id: String,
|
||||
pub name: String,
|
||||
pub is_encrypted: bool,
|
||||
}
|
||||
|
||||
pub struct RoomManager {
|
||||
rooms: HashMap<String, RoomInfo>,
|
||||
}
|
||||
|
||||
impl RoomManager {
|
||||
pub fn new() -> Self {
|
||||
Self { rooms: HashMap::new() }
|
||||
}
|
||||
|
||||
pub fn add_room(&mut self, room: RoomInfo) {
|
||||
self.rooms.insert(room.room_id.clone(), room);
|
||||
}
|
||||
|
||||
pub fn remove_room(&mut self, room_id: &str) {
|
||||
self.rooms.remove(room_id);
|
||||
}
|
||||
|
||||
pub fn get_room(&self, room_id: &str) -> Option<&RoomInfo> {
|
||||
self.rooms.get(room_id)
|
||||
}
|
||||
|
||||
pub fn list_rooms(&self) -> Vec<&RoomInfo> {
|
||||
self.rooms.values().collect()
|
||||
}
|
||||
|
||||
pub fn room_count(&self) -> usize {
|
||||
self.rooms.len()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user