diff --git a/src/timeline/TimelineItem.cpp b/src/timeline/TimelineItem.cpp
index 267dea15..8e0401a8 100644
--- a/src/timeline/TimelineItem.cpp
+++ b/src/timeline/TimelineItem.cpp
@@ -265,16 +265,16 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
auto timestamp = QDateTime::currentDateTime();
if (ty == mtx::events::MessageType::Emote) {
- body = QString("* %1 %2").arg(displayName).arg(body);
+ body = QString("%1 %2").arg(displayName).arg(body);
descriptionMsg_ = {"", userid, body, utils::descriptiveTime(timestamp), timestamp};
} else {
descriptionMsg_ = {
"You: ", userid, body, utils::descriptiveTime(timestamp), timestamp};
}
- body = body.toHtmlEscaped();
- body.replace(conf::strings::url_regex, conf::strings::url_html);
- body.replace("\n", "<br/>");
+ body = QString::fromStdString(utils::markdownToHtml(body));
+ body = utils::linkifyMessage(body);
+
generateTimestamp(timestamp);
if (withSender) {
@@ -489,7 +489,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
auto timestamp = QDateTime::fromMSecsSinceEpoch(event.origin_server_ts);
auto displayName = Cache::displayName(room_id_, sender);
- auto emoteMsg = QString("* %1 %2").arg(displayName).arg(formatted_body);
+ auto emoteMsg = QString("%1 %2").arg(displayName).arg(formatted_body);
descriptionMsg_ = {"", sender, emoteMsg, utils::descriptiveTime(timestamp), timestamp};
diff --git a/src/timeline/TimelineView.cpp b/src/timeline/TimelineView.cpp
index bf828a8e..d09f5d5f 100644
--- a/src/timeline/TimelineView.cpp
+++ b/src/timeline/TimelineView.cpp
@@ -1233,8 +1233,12 @@ template<>
mtx::events::msg::Emote
toRoomMessage<mtx::events::msg::Emote>(const PendingMessage &m)
{
+ auto html = utils::markdownToHtml(m.body);
+
mtx::events::msg::Emote emote;
- emote.body = m.body.toStdString();
+ emote.body = utils::stripHtml(html);
+ emote.formatted_body = html;
+
return emote;
}
@@ -1254,8 +1258,15 @@ template<>
mtx::events::msg::Text
toRoomMessage<mtx::events::msg::Text>(const PendingMessage &m)
{
+ auto html = utils::markdownToHtml(m.body);
+
mtx::events::msg::Text text;
- text.body = m.body.toStdString();
+ text.body = utils::stripHtml(html);
+ text.formatted_body = html;
+
+ std::cout << "body: " << text.body << std::endl;
+ std::cout << "formatted_body: " << text.formatted_body << std::endl;
+
return text;
}
|