mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
Added size limit for chat types - Public, Private, Lobby, Distant
Set the size limit for private and distant chat to unlimited. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7761 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
93f77a0e2c
commit
55be6675af
6 changed files with 60 additions and 17 deletions
|
@ -848,10 +848,29 @@ void ChatWidget::updateLenOfChatTextEdit()
|
|||
QString text;
|
||||
RsHtml::optimizeHtml(chatWidget, text);
|
||||
std::wstring msg = text.toStdWString();
|
||||
bool msgToLarge = (msg.length()>=size_t(rsMsgs->getMaxMessageSecuritySize()));
|
||||
|
||||
uint32_t maxMessageSize = 0;
|
||||
switch (chatType()) {
|
||||
case CHATTYPE_UNKNOWN:
|
||||
break;
|
||||
case CHATTYPE_PRIVATE:
|
||||
maxMessageSize = rsMsgs->getMaxMessageSecuritySize(RS_CHAT_TYPE_PRIVATE);
|
||||
break;
|
||||
case CHATTYPE_LOBBY:
|
||||
maxMessageSize = rsMsgs->getMaxMessageSecuritySize(RS_CHAT_TYPE_LOBBY);
|
||||
break;
|
||||
case CHATTYPE_DISTANT:
|
||||
maxMessageSize = rsMsgs->getMaxMessageSecuritySize(RS_CHAT_TYPE_DISTANT);
|
||||
break;
|
||||
}
|
||||
|
||||
bool msgToLarge = false;
|
||||
if (maxMessageSize > 0) {
|
||||
msgToLarge = (msg.length() >= maxMessageSize);
|
||||
}
|
||||
|
||||
ui->sendButton->setEnabled(!msgToLarge);
|
||||
text = tr("%1This message counts %2 characters.").arg(msgToLarge?tr("Warning: "):"").arg(msg.length());
|
||||
text = tr("%1This message counts %2 characters.").arg(msgToLarge ? tr("Warning: ") : "").arg(msg.length());
|
||||
ui->sendButton->setToolTip(text);
|
||||
ui->chatTextEdit->setToolTip(msgToLarge?text:"");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue