summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp

index bcb30aa0..ca320d04 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -30,6 +30,7 @@ #include "ChatPage.h" #include "EventAccessors.h" #include "Logging.h" +#include "MainWindow.h" #include "MatrixClient.h" #include "TimelineModel.h" #include "TimelineViewManager.h" @@ -239,7 +240,8 @@ InputBar::updateTextContentProperties(const QString &t) QStringLiteral("msgtype"), QStringLiteral("goto"), QStringLiteral("converttodm"), - QStringLiteral("converttoroom")}; + QStringLiteral("converttoroom"), + QStringLiteral("ignore")}; bool hasInvalidCommand = !commandName.isNull() && !validCommands.contains(commandName); bool hasIncompleteCommand = hasInvalidCommand && '/' + commandName == t; @@ -937,6 +939,16 @@ InputBar::command(const QString &command, QString args) cache::getMembers(this->room->roomId().toStdString(), 0, -1)); } else if (command == QLatin1String("converttoroom")) { utils::removeDirectFromRoom(this->room->roomId()); + } else if (command == QLatin1String("ignore")) { + QSharedPointer<UserProfile> user( + new UserProfile(QString(), args, TimelineViewManager::instance())); + connect(user.get(), &UserProfile::failedToFetchProfile, [args] { + MainWindow::instance()->showNotification(tr("Failed to fetch user %1").arg(args)); + }); + connect(user.get(), &UserProfile::globalUsernameRetrieved, [user](const QString &user_id) { + Q_UNUSED(user_id) + user->setIgnored(true); + }); } else { return false; }