forked from lavina/lavina
Merge remote-tracking branch 'lavina/main' into feature/muc-join-messages
This commit is contained in:
commit
538de5e849
|
@ -893,25 +893,33 @@ async fn handle_join(
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
match chan {
|
match chan {
|
||||||
Chan::Global(chan_name) => {
|
Chan::Global(chan_name) => {
|
||||||
let room_id = RoomId::try_from(chan_name.clone())?;
|
let room_id = RoomId::from(chan_name.clone())?;
|
||||||
if let JoinResult::Success(room_info) = user_handle.join_room(room_id).await? {
|
match user_handle.join_room(room_id).await? {
|
||||||
produce_on_join_cmd_messages(&config, &user, chan, &room_info, writer).await?;
|
JoinResult::Success(room_info) => {
|
||||||
} else {
|
produce_on_join_cmd_messages(&config, &user, chan, &room_info, writer).await?;
|
||||||
ServerMessage {
|
}
|
||||||
tags: vec![],
|
JoinResult::AlreadyJoined => {
|
||||||
sender: Some(config.server_name.clone()),
|
// we do nothing on repeated joins
|
||||||
body: ServerMessageBody::N474BannedFromChan {
|
}
|
||||||
client: user.nickname.clone(),
|
JoinResult::Banned => {
|
||||||
chan: chan.clone(),
|
ServerMessage {
|
||||||
message: "U dun goofed".into(),
|
tags: vec![],
|
||||||
},
|
sender: Some(config.server_name.clone()),
|
||||||
|
body: ServerMessageBody::N474BannedFromChan {
|
||||||
|
client: user.nickname.clone(),
|
||||||
|
chan: chan.clone(),
|
||||||
|
message: "U dun goofed".into(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
.write_async(writer)
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
.write_async(writer)
|
|
||||||
.await?;
|
|
||||||
}
|
}
|
||||||
writer.flush().await?;
|
writer.flush().await?;
|
||||||
}
|
}
|
||||||
Chan::Local(_) => {}
|
Chan::Local(_) => {
|
||||||
|
// TODO handle join attempts to local chans with an error, we don't support these
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue