Print TextContent when available.

This commit is contained in:
Black Hat
2019-12-28 18:30:02 +08:00
parent a21d0c3eb0
commit 5a154eab04

View File

@@ -260,17 +260,23 @@ QString SpectralRoom::eventToString(const RoomEvent& evt,
return !fileCaption.isEmpty() ? fileCaption : tr("a file");
}
QString plainBody;
if (e.hasTextContent() && e.content()) {
plainBody = static_cast<const TextContent*>(e.content())->body;
} else {
plainBody = e.plainBody();
}
if (prettyPrint) {
auto plainBody = e.plainBody();
if (removeReply) {
plainBody.remove(utils::removeReplyRegex);
}
return Quotient::prettyPrint(plainBody);
}
if (removeReply) {
return e.plainBody().remove(utils::removeReplyRegex);
return plainBody.remove(utils::removeReplyRegex);
}
return e.plainBody();
return plainBody;
},
[this](const RoomMemberEvent& e) {
// FIXME: Rewind to the name that was at the time of this event