forked from lavina/lavina
fix some stuff
This commit is contained in:
parent
3950ee1d7a
commit
7dfe6e0295
|
@ -294,17 +294,13 @@ impl Player {
|
||||||
room.subscribe(self.player_id.clone(), self.handle.clone())
|
room.subscribe(self.player_id.clone(), self.handle.clone())
|
||||||
.await;
|
.await;
|
||||||
self.my_rooms.insert(room_id.clone(), room.clone());
|
self.my_rooms.insert(room_id.clone(), room.clone());
|
||||||
let members = room.get_members().await;
|
let room_info = room.get_room_info().await;
|
||||||
promise.send(RoomInfo {
|
promise.send(room_info);
|
||||||
id: room_id.clone(),
|
|
||||||
members,
|
|
||||||
topic: b"some topic lol".to_vec(),
|
|
||||||
});
|
|
||||||
let update = Updates::RoomJoined {
|
let update = Updates::RoomJoined {
|
||||||
room_id,
|
room_id,
|
||||||
new_member_id: self.player_id.clone(),
|
new_member_id: self.player_id.clone(),
|
||||||
};
|
};
|
||||||
self.broadcast_update(update, connection_id);
|
self.broadcast_update(update, connection_id).await;
|
||||||
}
|
}
|
||||||
Cmd::SendMessage {
|
Cmd::SendMessage {
|
||||||
room_id,
|
room_id,
|
||||||
|
@ -324,7 +320,7 @@ impl Player {
|
||||||
author_id: self.player_id.clone(),
|
author_id: self.player_id.clone(),
|
||||||
body,
|
body,
|
||||||
};
|
};
|
||||||
self.broadcast_update(update, connection_id);
|
self.broadcast_update(update, connection_id).await;
|
||||||
}
|
}
|
||||||
Cmd::ChangeTopic {
|
Cmd::ChangeTopic {
|
||||||
room_id,
|
room_id,
|
||||||
|
@ -340,7 +336,7 @@ impl Player {
|
||||||
}
|
}
|
||||||
promise.send(());
|
promise.send(());
|
||||||
let update = Updates::RoomTopicChanged { room_id, new_topic };
|
let update = Updates::RoomTopicChanged { room_id, new_topic };
|
||||||
self.broadcast_update(update, connection_id);
|
self.broadcast_update(update, connection_id).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,14 +90,6 @@ impl RoomHandle {
|
||||||
lock.send_message(player_id, body).await;
|
lock.send_message(player_id, body).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_members(&self) -> Vec<PlayerId> {
|
|
||||||
let lock = self.0.read().await;
|
|
||||||
lock.subscriptions
|
|
||||||
.keys()
|
|
||||||
.map(|x| x.clone())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn get_room_info(&self) -> RoomInfo {
|
pub async fn get_room_info(&self) -> RoomInfo {
|
||||||
let lock = self.0.read().await;
|
let lock = self.0.read().await;
|
||||||
RoomInfo {
|
RoomInfo {
|
||||||
|
|
Loading…
Reference in New Issue