Properly handle html tags

This commit is contained in:
Konstantinos Sideris 2017-09-22 22:12:36 +03:00
parent 1024198228
commit ed5a96341b

View file

@ -90,6 +90,7 @@ TimelineItem::TimelineItem(events::MessageEventType ty,
}; };
} }
body = body.toHtmlEscaped();
body.replace(URL_REGEX, URL_HTML); body.replace(URL_REGEX, URL_HTML);
generateTimestamp(timestamp); generateTimestamp(timestamp);
@ -230,7 +231,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Emote> &event,
{ {
init(); init();
auto body = event.content().body().trimmed().toHtmlEscaped(); auto body = event.content().body().trimmed();
auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp());
auto displayName = TimelineViewManager::displayName(event.sender()); auto displayName = TimelineViewManager::displayName(event.sender());
auto emoteMsg = QString("* %1 %2").arg(displayName).arg(body); auto emoteMsg = QString("* %1 %2").arg(displayName).arg(body);
@ -241,6 +242,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Emote> &event,
descriptiveTime(QDateTime::fromMSecsSinceEpoch(event.timestamp())) }; descriptiveTime(QDateTime::fromMSecsSinceEpoch(event.timestamp())) };
generateTimestamp(timestamp); generateTimestamp(timestamp);
emoteMsg = emoteMsg.toHtmlEscaped();
emoteMsg.replace(URL_REGEX, URL_HTML); emoteMsg.replace(URL_REGEX, URL_HTML);
if (with_sender) { if (with_sender) {
@ -267,7 +269,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Text> &event,
{ {
init(); init();
auto body = event.content().body().trimmed().toHtmlEscaped(); auto body = event.content().body().trimmed();
auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp());
auto displayName = TimelineViewManager::displayName(event.sender()); auto displayName = TimelineViewManager::displayName(event.sender());
@ -279,6 +281,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Text> &event,
generateTimestamp(timestamp); generateTimestamp(timestamp);
body = body.toHtmlEscaped();
body.replace(URL_REGEX, URL_HTML); body.replace(URL_REGEX, URL_HTML);
if (with_sender) { if (with_sender) {