Commit 2bda8dca authored by LNJ's avatar LNJ 💬

Fix spoiler messages with QXmpp master

Spoiler message support has been added to QXmpp recently (by me).
parent 16e5845e
......@@ -101,14 +101,21 @@ void MessageHandler::handleMessage(const QXmppMessage &msg)
message.setId(msg.id());
message.setBody(msg.body());
message.setMediaType(MessageType::MessageText); // default to text message without media
#if QXMPP_VERSION >= QT_VERSION_CHECK(1, 0, 1)
message.setIsSpoiler(msg.isSpoiler());
message.setSpoilerHint(msg.spoilerHint());
#else
for (const QXmppElement &extension : msg.extensions()) {
qDebug() << extension.tagName();
if (extension.tagName() == "spoiler" &&
extension.attribute("xmlns") == NS_SPOILERS) {
qDebug() << "SPOILER MESSAGE";
message.setIsSpoiler(true);
message.setSpoilerHint(extension.value());
break;
}
}
#endif
// check if message contains a link and also check out of band url
QStringList bodyWords = message.body().split(" ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment