parent
c2eb2f7ad1
commit
fa0c14b846
16 changed files with 251 additions and 6 deletions
|
|
@ -534,6 +534,27 @@ InputBar::notice(const QString &msg, bool rainbowify)
|
|||
room->sendMessageEvent(notice, mtx::events::EventType::RoomMessage);
|
||||
}
|
||||
|
||||
void
|
||||
InputBar::confetti(const QString &body, bool rainbowify)
|
||||
{
|
||||
auto html = utils::markdownToHtml(body, rainbowify);
|
||||
|
||||
mtx::events::msg::Confetti confetti;
|
||||
confetti.body = body.trimmed().toStdString();
|
||||
|
||||
if (html != body.trimmed().toHtmlEscaped() &&
|
||||
ChatPage::instance()->userSettings()->markdown()) {
|
||||
confetti.formatted_body = html.toStdString();
|
||||
confetti.format = "org.matrix.custom.html";
|
||||
// Remove markdown links by completer
|
||||
confetti.body = replaceMatrixToMarkdownLink(body.trimmed()).toStdString();
|
||||
}
|
||||
|
||||
confetti.relations = generateRelations();
|
||||
|
||||
room->sendMessageEvent(confetti, mtx::events::EventType::RoomMessage);
|
||||
}
|
||||
|
||||
void
|
||||
InputBar::image(const QString &filename,
|
||||
const std::optional<mtx::crypto::EncryptedFile> &file,
|
||||
|
|
@ -777,6 +798,10 @@ InputBar::command(const QString &command, QString args)
|
|||
notice(args, false);
|
||||
} else if (command == QLatin1String("rainbownotice")) {
|
||||
notice(args, true);
|
||||
} else if (command == QLatin1String("confetti")) {
|
||||
confetti(args, false);
|
||||
} else if (command == QLatin1String("rainbowconfetti")) {
|
||||
confetti(args, true);
|
||||
} else if (command == QLatin1String("goto")) {
|
||||
// Goto has three different modes:
|
||||
// 1 - Going directly to a given event ID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue