Display room's latest event instead of topic when possible.

This commit is contained in:
Black Hat
2018-08-22 23:21:39 +08:00
parent e428e9f005
commit cca9467703
6 changed files with 25 additions and 3 deletions

View File

@@ -97,3 +97,10 @@ void MatriqueRoom::sendTypingNotification(bool isTyping) {
connection()->callApi<SetTypingJob>(BackgroundRequest, localUser()->id(),
id(), isTyping, 10000);
}
QString MatriqueRoom::lastEvent() {
if (timelineSize() == 0) return "";
const RoomEvent* lastEvent = messageEvents().rbegin()->get();
return user(lastEvent->senderId())->displayname() + ": " +
lastEvent->contentJson().value("body").toString();
}