mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
Encode HTML messages, reported as bug in Discord
This commit is contained in:
committed by
Mat Sutcliffe
parent
8a2d3458b4
commit
1ceac51771
@@ -101,7 +101,7 @@ namespace BlackGui
|
|||||||
c = connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CTextMessageComponent::onChangedAircraftCockpit, Qt::QueuedConnection);
|
c = connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CTextMessageComponent::onChangedAircraftCockpit, Qt::QueuedConnection);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
|
||||||
}
|
}
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c)
|
||||||
|
|
||||||
// init by settings
|
// init by settings
|
||||||
const QPointer<CTextMessageComponent> myself(this);
|
const QPointer<CTextMessageComponent> myself(this);
|
||||||
@@ -267,7 +267,7 @@ namespace BlackGui
|
|||||||
void CTextMessageComponent::onChangedAircraftCockpit(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
void CTextMessageComponent::onChangedAircraftCockpit(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
||||||
{
|
{
|
||||||
// this is called for every overlay widget as well
|
// this is called for every overlay widget as well
|
||||||
Q_UNUSED(originator);
|
Q_UNUSED(originator)
|
||||||
if (!this->isActivated()) { return; }
|
if (!this->isActivated()) { return; }
|
||||||
this->showCurrentFrequenciesFromCockpit(aircraft);
|
this->showCurrentFrequenciesFromCockpit(aircraft);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace BlackGui
|
|||||||
html += u"<td class=\"recipient\">" % message.getRecipientCallsignOrFrequency() % u"</td>";
|
html += u"<td class=\"recipient\">" % message.getRecipientCallsignOrFrequency() % u"</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
html += u"<td class=\"message\">" % message.getMessage() % u"</td></tr>";
|
html += u"<td class=\"message\">" % message.getHtmlEncodedMessage() % u"</td></tr>";
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,12 @@ namespace BlackMisc
|
|||||||
return asciiOnlyString(simplifyAccents(m_message));
|
return asciiOnlyString(simplifyAccents(m_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CTextMessage::getHtmlEncodedMessage() const
|
||||||
|
{
|
||||||
|
if (m_message.isEmpty()) { return {}; }
|
||||||
|
return m_message.toHtmlEscaped();
|
||||||
|
}
|
||||||
|
|
||||||
void CTextMessage::setMessage(const QString &message)
|
void CTextMessage::setMessage(const QString &message)
|
||||||
{
|
{
|
||||||
m_message = message.simplified().trimmed();
|
m_message = message.simplified().trimmed();
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ namespace BlackMisc
|
|||||||
//! Get ASCII only message
|
//! Get ASCII only message
|
||||||
QString getAsciiOnlyMessage() const;
|
QString getAsciiOnlyMessage() const;
|
||||||
|
|
||||||
|
//! Get HTML escaped message
|
||||||
|
QString getHtmlEncodedMessage() const;
|
||||||
|
|
||||||
//! Empty message
|
//! Empty message
|
||||||
bool isEmpty() const { return m_message.isEmpty(); }
|
bool isEmpty() const { return m_message.isEmpty(); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user