diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 0e636b2..63ce92c 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -349,6 +349,22 @@ void MainWindow::sendChat() { return; } + int max = 512; + QString chattext = ui->memoTxtChat->toPlainText(); + int size = chattext.size(); + + if (size > max){ + + // auto addr = ""; + // if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) { + QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"), + tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."), + QMessageBox::Ok, this); + + msg.exec(); + return; + } + Tx tx = createTxFromChatPage(); QString error = doSendChatTxValidations(tx); @@ -646,6 +662,22 @@ void MainWindow::ContactRequest() { return; } + int max = 512; + QString chattext = contactRequest.getMemo();; + int size = chattext.size(); + + if (size > max){ + + // auto addr = ""; + // if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) { + QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"), + tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."), + QMessageBox::Ok, this); + + msg.exec(); + return; + } + Tx tx = createTxForSafeContactRequest(); QString error = doSendRequestTxValidations(tx);