[Client] Keep the message draft and notify when the recipient is offline

This commit is contained in:
Lukas Brübach 2026-08-16 23:16:38 +02:00
parent 078e67c56f
commit 78ce45372b

View file

@ -96,7 +96,15 @@ void TabMessage::closeEvent(QCloseEvent *event)
void TabMessage::sendMessage()
{
if (sayEdit->text().isEmpty() || !userOnline) {
if (sayEdit->text().isEmpty()) {
return;
}
if (!userOnline) {
// Keep the draft: the user may be back momentarily, and the typed text
// should not be lost to a transient offline spell.
chatView->appendMessage(
tr("Message not sent — %1 is offline.").arg(QString::fromStdString(otherUserInfo->name())));
return;
}