removed that pile of garbage IrcManager

This commit is contained in:
fourtf 2018-06-28 19:54:40 +02:00
parent 8ced5a1e25
commit 848bbc71aa
11 changed files with 15 additions and 183 deletions

View file

@ -151,7 +151,6 @@ SOURCES += \
src/singletons/helper/GifTimer.cpp \ src/singletons/helper/GifTimer.cpp \
src/singletons/helper/LoggingChannel.cpp \ src/singletons/helper/LoggingChannel.cpp \
src/controllers/moderationactions/ModerationAction.cpp \ src/controllers/moderationactions/ModerationAction.cpp \
src/singletons/IrcManager.cpp \
src/singletons/WindowManager.cpp \ src/singletons/WindowManager.cpp \
src/util/DebugCount.cpp \ src/util/DebugCount.cpp \
src/util/RapidjsonHelpers.cpp \ src/util/RapidjsonHelpers.cpp \
@ -305,7 +304,6 @@ HEADERS += \
src/singletons/helper/GifTimer.hpp \ src/singletons/helper/GifTimer.hpp \
src/singletons/helper/LoggingChannel.hpp \ src/singletons/helper/LoggingChannel.hpp \
src/controllers/moderationactions/ModerationAction.hpp \ src/controllers/moderationactions/ModerationAction.hpp \
src/singletons/IrcManager.hpp \
src/singletons/WindowManager.hpp \ src/singletons/WindowManager.hpp \
src/util/Clamp.hpp \ src/util/Clamp.hpp \
src/util/CombinePath.hpp \ src/util/CombinePath.hpp \

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "singletons/IrcManager.hpp" "
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include <QApplication> #include <QApplication>

View file

@ -4,7 +4,7 @@
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/IrcManager.hpp" "
#include "singletons/Logging.hpp" #include "singletons/Logging.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"

View file

@ -5,7 +5,6 @@
#include "common/UrlFetch.hpp" #include "common/UrlFetch.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/IrcManager.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/PostToThread.hpp" #include "util/PostToThread.hpp"

View file

@ -7,7 +7,6 @@
#include "providers/twitch/Pubsub.hpp" #include "providers/twitch/Pubsub.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp" #include "providers/twitch/TwitchMessageBuilder.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/IrcManager.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "util/PostToThread.hpp" #include "util/PostToThread.hpp"
@ -233,8 +232,8 @@ void TwitchChannel::addJoinedUser(const QString &user)
QTimer::singleShot(500, &this->object, [this] { QTimer::singleShot(500, &this->object, [this] {
std::lock_guard<std::mutex> guard(this->joinedUserMutex); std::lock_guard<std::mutex> guard(this->joinedUserMutex);
auto message = Message::createSystemMessage("Users joined: " + auto message =
this->joinedUsers.join(", ")); Message::createSystemMessage("Users joined: " + this->joinedUsers.join(", "));
message->flags |= Message::Collapsed; message->flags |= Message::Collapsed;
this->addMessage(message); this->addMessage(message);
this->joinedUsers.clear(); this->joinedUsers.clear();
@ -262,8 +261,8 @@ void TwitchChannel::addPartedUser(const QString &user)
QTimer::singleShot(500, &this->object, [this] { QTimer::singleShot(500, &this->object, [this] {
std::lock_guard<std::mutex> guard(this->partedUserMutex); std::lock_guard<std::mutex> guard(this->partedUserMutex);
auto message = Message::createSystemMessage("Users parted: " + auto message =
this->partedUsers.join(", ")); Message::createSystemMessage("Users parted: " + this->partedUsers.join(", "));
message->flags |= Message::Collapsed; message->flags |= Message::Collapsed;
this->addMessage(message); this->addMessage(message);
this->partedUsers.clear(); this->partedUsers.clear();

View file

@ -6,7 +6,6 @@
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/MutexValue.hpp" #include "common/MutexValue.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/IrcManager.hpp"
#include "util/ConcurrentMap.hpp" #include "util/ConcurrentMap.hpp"
#include <pajlada/signals/signalholder.hpp> #include <pajlada/signals/signalholder.hpp>

View file

@ -7,7 +7,6 @@
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/IrcManager.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Themes.hpp"
@ -37,8 +36,8 @@ TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel, TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
const Communi::IrcMessage *_ircMessage, const Communi::IrcMessage *_ircMessage,
const MessageParseArgs &_args, const MessageParseArgs &_args, QString content,
QString content, bool isAction) bool isAction)
: channel(_channel) : channel(_channel)
, twitchChannel(dynamic_cast<TwitchChannel *>(_channel)) , twitchChannel(dynamic_cast<TwitchChannel *>(_channel))
, ircMessage(_ircMessage) , ircMessage(_ircMessage)

View file

@ -1,145 +0,0 @@
//#include "singletons/IrcManager.hpp"
//#include "common/Channel.hpp"
//#include "debug/Log.hpp"
//#include "messages/MessageParseArgs.hpp"
//#include "providers/twitch/TwitchAccount.hpp"
//#include "providers/twitch/TwitchMessageBuilder.hpp"
//#include "singletons/accountmanager.hpp"
//#include "singletons/channelmanager.hpp"
//#include "singletons/EmoteManager.hpp"
//#include "singletons/ResourceManager.hpp"
//#include "singletons/SettingsManager.hpp"
//#include "singletons/WindowManager.hpp"
//#include "util/PostToThread.hpp"
//#include "common/UrlFetch.hpp"
//#include <irccommand.h>
//#include <QJsonArray>
//#include <QJsonDocument>
//#include <QJsonObject>
//#include <QNetworkReply>
//#include <QNetworkRequest>
//#include <future>
// using namespace messages;
// void IrcManager::refreshIgnoredUsers(const QString &username, const QString &oauthClient,
// const QString &oauthToken)
//{
// QString nextLink = "https://api.twitch.tv/kraken/users/" + username + "/blocks?limit=" + 100 +
// "&client_id=" + oauthClient;
//
// QNetworkAccessManager *manager = new QNetworkAccessManager();
// QNetworkRequest req(QUrl(nextLink + "&oauth_token=" + oauthToken));
// QNetworkReply *reply = manager->get(req);
//
// QObject::connect(reply, &QNetworkReply::finished, [=] {
// this->twitchBlockedUsersMutex.lock();
// this->twitchBlockedUsers.clear();
// this->twitchBlockedUsersMutex.unlock();
//
// QByteArray data = reply->readAll();
// QJsonDocument jsonDoc(QJsonDocument::fromJson(data));
// QJsonObject root = jsonDoc.object();
//
// // nextLink =
// // root.value("this->links").toObject().value("next").toString();
//
// auto blocks = root.value("blocks").toArray();
//
// this->twitchBlockedUsersMutex.lock();
// for (QJsonValue block : blocks) {
// QJsonObject user = block.toObject().value("user").toObject();
// // displaythis->name
// this->twitchBlockedUsers.insert(user.value("name").toString().toLower(), true);
// }
// this->twitchBlockedUsersMutex.unlock();
//
// manager->deleteLater();
// });
//}
//
//// XXX: This does not fit in IrcManager
// bool IrcManager::isTwitchUserBlocked(QString const &username)
//{
// QMutexLocker locker(&this->twitchBlockedUsersMutex);
//
// auto iterator = this->twitchBlockedUsers.find(username);
//
// return iterator != this->twitchBlockedUsers.end();
//}
//
//// XXX: This does not fit in IrcManager
// bool IrcManager::tryAddIgnoredUser(QString const &username, QString &errorMessage)
//{
// assert(this->account);
//
// QUrl url("https://api.twitch.tv/kraken/users/" + this->account->getUserName() + "/blocks/" +
// username + "?oauth_token=" + this->account->getOAuthToken() +
// "&client_id=" + this->account->getOAuthClient());
//
// QNetworkRequest request(url);
// auto reply = this->networkAccessManager.put(request, QByteArray());
// reply->waitForReadyRead(10000);
//
// if (reply->error() == QNetworkReply::NoError) {
// this->twitchBlockedUsersMutex.lock();
// this->twitchBlockedUsers.insert(username, true);
// this->twitchBlockedUsersMutex.unlock();
//
// return true;
// }
//
// reply->deleteLater();
//
// errorMessage = "Error while ignoring user \"" + username + "\": " + reply->errorString();
//
// return false;
//}
//
//// XXX: This does not fit in IrcManager
// void IrcManager::addIgnoredUser(QString const &username)
//{
// QString errorMessage;
// if (!tryAddIgnoredUser(username, errorMessage)) {
// // TODO: Implement IrcManager::addIgnoredUser
// }
//}
//
//// XXX: This does not fit in IrcManager
// bool IrcManager::tryRemoveIgnoredUser(QString const &username, QString &errorMessage)
//{
// assert(this->account);
//
// QUrl url("https://api.twitch.tv/kraken/users/" + this->account->getUserName() + "/blocks/" +
// username + "?oauth_token=" + this->account->getOAuthToken() +
// "&client_id=" + this->account->getOAuthClient());
//
// QNetworkRequest request(url);
// auto reply = this->networkAccessManager.deleteResource(request);
// reply->waitForReadyRead(10000);
//
// if (reply->error() == QNetworkReply::NoError) {
// this->twitchBlockedUsersMutex.lock();
// this->twitchBlockedUsers.remove(username);
// this->twitchBlockedUsersMutex.unlock();
//
// return true;
// }
//
// reply->deleteLater();
//
// errorMessage = "Error while unignoring user \"" + username + "\": " + reply->errorString();
//
// return false;
//}
//
//// XXX: This does not fit in IrcManager
// void IrcManager::removeIgnoredUser(QString const &username)
//{
// QString errorMessage;
// if (!tryRemoveIgnoredUser(username, errorMessage)) {
// // TODO: Implement IrcManager::removeIgnoredUser
// }
//}

View file

@ -1,13 +0,0 @@
// bool isTwitchUserBlocked(QString const &username);
// bool tryAddIgnoredUser(QString const &username, QString &errorMessage);
// void addIgnoredUser(QString const &username);
// bool tryRemoveIgnoredUser(QString const &username, QString &errorMessage);
// void removeIgnoredUser(QString const &username);
// QMap<QString, bool> twitchBlockedUsers;
// QMutex twitchBlockedUsersMutex;
// QNetworkAccessManager networkAccessManager;
// void refreshIgnoredUsers(const QString &username, const QString &oauthClient,
// const QString &oauthToken);

View file

@ -4,7 +4,6 @@
#include "common/Version.hpp" #include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/IrcManager.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Themes.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
@ -100,16 +99,16 @@ Window::Window(WindowType _type)
auto s = new QShortcut(QKeySequence::ZoomIn, this); auto s = new QShortcut(QKeySequence::ZoomIn, this);
s->setContext(Qt::WindowShortcut); s->setContext(Qt::WindowShortcut);
QObject::connect(s, &QShortcut::activated, this, [] { QObject::connect(s, &QShortcut::activated, this, [] {
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale( getApp()->settings->uiScale.setValue(
getApp()->settings->uiScale.getValue() + 1)); WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() + 1));
}); });
} }
{ {
auto s = new QShortcut(QKeySequence::ZoomOut, this); auto s = new QShortcut(QKeySequence::ZoomOut, this);
s->setContext(Qt::WindowShortcut); s->setContext(Qt::WindowShortcut);
QObject::connect(s, &QShortcut::activated, this, [] { QObject::connect(s, &QShortcut::activated, this, [] {
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale( getApp()->settings->uiScale.setValue(
getApp()->settings->uiScale.getValue() - 1)); WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() - 1));
}); });
} }

View file

@ -5,7 +5,6 @@
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchServer.hpp" #include "providers/twitch/TwitchServer.hpp"
#include "singletons/IrcManager.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "singletons/Themes.hpp" #include "singletons/Themes.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
@ -66,12 +65,10 @@ void SplitInput::initLayout()
// ---- misc // ---- misc
// set edit font // set edit font
this->ui_.textEdit->setFont( this->ui_.textEdit->setFont(app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() { this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() {
this->ui_.textEdit->setFont( this->ui_.textEdit->setFont(app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
})); }));
// open emote popup // open emote popup