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

Fix ACTION messages, status, username HTML parsing

This commit is contained in:
TheNain38 2015-10-02 00:06:06 +02:00 committed by TheNain38
parent 80fa36e134
commit f99c9f127d
5 changed files with 10 additions and 4 deletions

View File

@ -58,7 +58,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
{
case ACTION:
senderText = "*";
text = wrapDiv(QString("%1 %2").arg(sender, text), "action");
text = wrapDiv(QString("%1 %2").arg(sender.toHtmlEscaped(), text), "action");
msg->setAsAction();
break;
case ALERT:

View File

@ -858,6 +858,9 @@ QSplitter:handle{
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item>
@ -937,6 +940,9 @@ QSplitter:handle{
<pointsize>8</pointsize>
</font>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
</layout>

View File

@ -995,7 +995,7 @@ void ChatForm::setFriendTyping(bool isTyping)
chatWidget->setTypingNotificationVisible(isTyping);
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName()) + "</div>");
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName().toHtmlEscaped()) + "</div>");
}
void ChatForm::show(ContentLayout* contentLayout)

View File

@ -8,7 +8,7 @@ RemoveFriendDialog::RemoveFriendDialog(QWidget *parent, const Friend *f)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WA_QuitOnClose, false);
ui.setupUi(this);
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName()));
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName().toHtmlEscaped()));
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
auto cancelButton = ui.buttonBox->button(QDialogButtonBox::Cancel);
removeButton->setText(tr("Remove"));

View File

@ -1425,7 +1425,7 @@ void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray in
{
if (type == TOX_GROUPCHAT_TYPE_TEXT || type == TOX_GROUPCHAT_TYPE_AV)
{
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId)), true, false))
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId).toHtmlEscaped()), true, false))
{
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
if (groupId < 0)