Trim chat messages and don't send any empty ones
This commit is contained in:
parent
4512734395
commit
bb9ed38278
@ -104,6 +104,7 @@ impl ChatBox {
|
||||
}
|
||||
|
||||
pub fn on_submit(&mut self, message: GString) {
|
||||
let message = message.to_string().trim().to_owned();
|
||||
if let Some(line_edit) = &mut self.line_edit {
|
||||
line_edit.clear();
|
||||
if self.in_game {
|
||||
@ -111,6 +112,9 @@ impl ChatBox {
|
||||
}
|
||||
}
|
||||
self.signals().on_closed().emit();
|
||||
if message.is_empty() {
|
||||
return;
|
||||
}
|
||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
||||
match peer {
|
||||
PeerKind::Client(peer, socket_addr) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user