diff --git a/crates/lavina-core/src/player.rs b/crates/lavina-core/src/player.rs
index 4beef24..4f1a699 100644
--- a/crates/lavina-core/src/player.rs
+++ b/crates/lavina-core/src/player.rs
@@ -284,8 +284,11 @@ impl Player {
let player = Player {
player_id,
storage_id,
+ // connections are empty when the actor is just started
connections: AnonTable::new(),
+ // room handlers will be loaded later in the started task
my_rooms: HashMap::new(),
+ // TODO implement and load bans
banned_from: HashSet::new(),
rx,
handle,
@@ -297,6 +300,15 @@ impl Player {
}
async fn main_loop(mut self) -> Self {
+ let rooms = self.storage.get_rooms_of_a_user(self.storage_id).await.unwrap();
+ for room_id in rooms {
+ let room = self.rooms.get_room(&room_id).await;
+ if let Some(room) = room {
+ self.my_rooms.insert(room_id, room);
+ } else {
+ tracing::error!("Room #{room_id:?} not found");
+ }
+ }
while let Some(cmd) = self.rx.recv().await {
match cmd {
ActorCommand::AddConnection { sender, promise } => {
diff --git a/crates/lavina-core/src/repo/mod.rs b/crates/lavina-core/src/repo/mod.rs
index cb94d43..5faa7c4 100644
--- a/crates/lavina-core/src/repo/mod.rs
+++ b/crates/lavina-core/src/repo/mod.rs
@@ -51,7 +51,7 @@ impl Storage {
Ok(res)
}
- pub async fn retrieve_room_by_name(&mut self, name: &str) -> Result