Update for the API changes to RoomMessageEvent in libquotient 0.9
This commit is contained in:
@@ -75,7 +75,11 @@ bool ActionsHandler::handleQuickEdit(NeoChatRoom *room, const QString &handledTe
|
|||||||
if (event->senderId() == room->localMember().id() && event->hasTextContent()) {
|
if (event->senderId() == room->localMember().id() && event->hasTextContent()) {
|
||||||
QString originalString;
|
QString originalString;
|
||||||
if (event->content()) {
|
if (event->content()) {
|
||||||
|
#if Quotient_VERSION_MINOR > 8
|
||||||
|
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content().get())->body;
|
||||||
|
#else
|
||||||
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content())->body;
|
originalString = static_cast<const Quotient::EventContent::TextContent *>(event->content())->body;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
originalString = event->plainBody();
|
originalString = event->plainBody();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,7 +236,11 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.hasTextContent() && event.content()) {
|
if (event.hasTextContent() && event.content()) {
|
||||||
|
#if Quotient_VERSION_MINOR > 8
|
||||||
|
body = static_cast<const EventContent::TextContent *>(event.content().get())->body;
|
||||||
|
#else
|
||||||
body = static_cast<const EventContent::TextContent *>(event.content())->body;
|
body = static_cast<const EventContent::TextContent *>(event.content())->body;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
body = event.plainBody();
|
body = event.plainBody();
|
||||||
}
|
}
|
||||||
@@ -476,7 +480,11 @@ QString EventHandler::getMessageBody(const NeoChatRoom *room, const RoomMessageE
|
|||||||
|
|
||||||
QString body;
|
QString body;
|
||||||
if (event.hasTextContent() && event.content()) {
|
if (event.hasTextContent() && event.content()) {
|
||||||
|
#if Quotient_VERSION_MINOR > 8
|
||||||
|
body = static_cast<const EventContent::TextContent *>(event.content().get())->body;
|
||||||
|
#else
|
||||||
body = static_cast<const EventContent::TextContent *>(event.content())->body;
|
body = static_cast<const EventContent::TextContent *>(event.content())->body;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
body = event.plainBody();
|
body = event.plainBody();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,7 +363,11 @@ bool NeoChatRoom::lastEventIsSpoiler() const
|
|||||||
if (auto event = lastEvent()) {
|
if (auto event = lastEvent()) {
|
||||||
if (auto e = eventCast<const RoomMessageEvent>(event)) {
|
if (auto e = eventCast<const RoomMessageEvent>(event)) {
|
||||||
if (e->hasTextContent() && e->content() && e->mimeType().name() == "text/html"_ls) {
|
if (e->hasTextContent() && e->content() && e->mimeType().name() == "text/html"_ls) {
|
||||||
|
#if Quotient_VERSION_MINOR > 8
|
||||||
|
auto htmlBody = static_cast<const Quotient::EventContent::TextContent *>(e->content().get())->body;
|
||||||
|
#else
|
||||||
auto htmlBody = static_cast<const Quotient::EventContent::TextContent *>(e->content())->body;
|
auto htmlBody = static_cast<const Quotient::EventContent::TextContent *>(e->content())->body;
|
||||||
|
#endif
|
||||||
return htmlBody.contains("data-mx-spoiler"_ls);
|
return htmlBody.contains("data-mx-spoiler"_ls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user