Implement /ignore and /unignore commands

Simplify authorized network requests for Twitch V5 api
add onShow virtual function to settings pages if they need to be refreshed when shown
Actually ignoring messages from ignored users is still not implemented

Working on #247
This commit is contained in:
Rasmus Karlsson
2018-05-12 20:34:13 +02:00
parent 98082d1064
commit bf0b5d08d8
12 changed files with 512 additions and 19 deletions
+27 -15
View File
@@ -119,26 +119,38 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
return "";
} else if (commandName == "/ignore" && words.size() >= 2) {
// fourtf: ignore user
// QString messageText;
auto app = getApp();
// if (IrcManager::getInstance().tryAddIgnoredUser(words.at(1),
// messageText)) {
// messageText = "Ignored user \"" + words.at(1) + "\".";
// }
auto user = app->accounts->Twitch.getCurrent();
auto target = words.at(1);
if (user->isAnon()) {
channel->addMessage(messages::Message::createSystemMessage(
"You must be logged in to ignore someone"));
return "";
}
user->ignore(target, [channel](const QString &message) {
channel->addMessage(messages::Message::createSystemMessage(message));
});
// channel->addMessage(messages::Message::createSystemMessage(messageText));
return "";
} else if (commandName == "/unignore") {
// fourtf: ignore user
// QString messageText;
} else if (commandName == "/unignore" && words.size() >= 2) {
auto app = getApp();
// if (IrcManager::getInstance().tryRemoveIgnoredUser(words.at(1),
// messageText)) {
// messageText = "Ignored user \"" + words.at(1) + "\".";
// }
auto user = app->accounts->Twitch.getCurrent();
auto target = words.at(1);
if (user->isAnon()) {
channel->addMessage(messages::Message::createSystemMessage(
"You must be logged in to ignore someone"));
return "";
}
user->unignore(target, [channel](const QString &message) {
channel->addMessage(messages::Message::createSystemMessage(message));
});
// channel->addMessage(messages::Message::createSystemMessage(messageText));
return "";
} else if (commandName == "/w") {
if (words.length() <= 2) {