1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

make /ME work

This commit is contained in:
Pro 2015-05-12 18:17:12 -07:00
parent 15cc64069f
commit e3ce8b486a
2 changed files with 4 additions and 4 deletions

View File

@ -815,7 +815,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
// Show each messages
ToxID authorId = ToxID::fromString(it.sender);
QString authorStr = authorId.isMine() ? Core::getInstance()->getUsername() : resolveToxID(authorId);
bool isAction = it.message.startsWith("/me ");
bool isAction = it.message.startsWith("/me ") || it.message.startsWith("/ME ");
ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr,
isAction ? it.message.right(it.message.length() - 4) : it.message,
@ -999,7 +999,7 @@ void ChatForm::SendMessageStr(QString msg)
if (msg.isEmpty())
return;
bool isAction = msg.startsWith("/me ");
bool isAction = msg.startsWith("/me ") || msg.startsWith("/ME ");
if (isAction)
msg = msg = msg.right(msg.length() - 4);

View File

@ -101,7 +101,7 @@ void GroupChatForm::onSendTriggered()
if (group->getPeersCount() != 1)
{
if (msg.startsWith("/me "))
if (msg.startsWith("/me ") || msg.startsWith("/ME "))
{
msg = msg.right(msg.length() - 4);
emit sendAction(group->getGroupId(), msg);
@ -113,7 +113,7 @@ void GroupChatForm::onSendTriggered()
}
else
{
if (msg.startsWith("/me "))
if (msg.startsWith("/me ") || msg.startsWith("/ME "))
addSelfMessage(msg.right(msg.length() - 4), true, QDateTime::currentDateTime(), true);
else
addSelfMessage(msg, false, QDateTime::currentDateTime(), true);