✨ Add the capability to join a conversation
This commit is contained in:
@@ -776,6 +776,19 @@ impl Client {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
async fn join_room(&self, room_id: &RoomId) -> anyhow::Result<bool> {
|
||||
let client = self.client.as_ref().unwrap();
|
||||
|
||||
if let Some(room) = client.get_room(room_id) {
|
||||
return match room.join().await {
|
||||
Ok(_) => Ok(true),
|
||||
Err(err) => Err(err.into()),
|
||||
};
|
||||
}
|
||||
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
async fn work(&mut self, mut rx: UnboundedReceiver<WorkerTask>) {
|
||||
while let Some(task) = rx.recv().await {
|
||||
self.run(task).await;
|
||||
@@ -820,6 +833,9 @@ impl Client {
|
||||
)
|
||||
.await;
|
||||
}
|
||||
WorkerTask::JoinRoom(id, reply) => {
|
||||
reply.send(self.join_room(&id).await).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user