mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
removed that pile of garbage IrcManager
This commit is contained in:
parent
8ced5a1e25
commit
848bbc71aa
11 changed files with 15 additions and 183 deletions
|
@ -151,7 +151,6 @@ SOURCES += \
|
|||
src/singletons/helper/GifTimer.cpp \
|
||||
src/singletons/helper/LoggingChannel.cpp \
|
||||
src/controllers/moderationactions/ModerationAction.cpp \
|
||||
src/singletons/IrcManager.cpp \
|
||||
src/singletons/WindowManager.cpp \
|
||||
src/util/DebugCount.cpp \
|
||||
src/util/RapidjsonHelpers.cpp \
|
||||
|
@ -305,7 +304,6 @@ HEADERS += \
|
|||
src/singletons/helper/GifTimer.hpp \
|
||||
src/singletons/helper/LoggingChannel.hpp \
|
||||
src/controllers/moderationactions/ModerationAction.hpp \
|
||||
src/singletons/IrcManager.hpp \
|
||||
src/singletons/WindowManager.hpp \
|
||||
src/util/Clamp.hpp \
|
||||
src/util/CombinePath.hpp \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "singletons/IrcManager.hpp"
|
||||
"
|
||||
#include "singletons/Resources.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "debug/Log.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
"
|
||||
#include "singletons/Logging.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "common/UrlFetch.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "util/PostToThread.hpp"
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "providers/twitch/Pubsub.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/PostToThread.hpp"
|
||||
|
||||
|
@ -145,7 +144,7 @@ void TwitchChannel::sendMessage(const QString &message)
|
|||
// manager" dialog
|
||||
this->addMessage(
|
||||
Message::createSystemMessage("You need to log in to send messages. You can "
|
||||
"link your Twitch account in the settings."));
|
||||
"link your Twitch account in the settings."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -233,8 +232,8 @@ void TwitchChannel::addJoinedUser(const QString &user)
|
|||
QTimer::singleShot(500, &this->object, [this] {
|
||||
std::lock_guard<std::mutex> guard(this->joinedUserMutex);
|
||||
|
||||
auto message = Message::createSystemMessage("Users joined: " +
|
||||
this->joinedUsers.join(", "));
|
||||
auto message =
|
||||
Message::createSystemMessage("Users joined: " + this->joinedUsers.join(", "));
|
||||
message->flags |= Message::Collapsed;
|
||||
this->addMessage(message);
|
||||
this->joinedUsers.clear();
|
||||
|
@ -262,8 +261,8 @@ void TwitchChannel::addPartedUser(const QString &user)
|
|||
QTimer::singleShot(500, &this->object, [this] {
|
||||
std::lock_guard<std::mutex> guard(this->partedUserMutex);
|
||||
|
||||
auto message = Message::createSystemMessage("Users parted: " +
|
||||
this->partedUsers.join(", "));
|
||||
auto message =
|
||||
Message::createSystemMessage("Users parted: " + this->partedUsers.join(", "));
|
||||
message->flags |= Message::Collapsed;
|
||||
this->addMessage(message);
|
||||
this->partedUsers.clear();
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "common/Common.hpp"
|
||||
#include "common/MutexValue.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "util/ConcurrentMap.hpp"
|
||||
|
||||
#include <pajlada/signals/signalholder.hpp>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "debug/Log.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Themes.hpp"
|
||||
|
@ -37,8 +36,8 @@ TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
|
|||
|
||||
TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
|
||||
const Communi::IrcMessage *_ircMessage,
|
||||
const MessageParseArgs &_args,
|
||||
QString content, bool isAction)
|
||||
const MessageParseArgs &_args, QString content,
|
||||
bool isAction)
|
||||
: channel(_channel)
|
||||
, twitchChannel(dynamic_cast<TwitchChannel *>(_channel))
|
||||
, ircMessage(_ircMessage)
|
||||
|
|
|
@ -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
|
||||
// }
|
||||
//}
|
|
@ -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);
|
|
@ -4,7 +4,6 @@
|
|||
#include "common/Version.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Themes.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
|
@ -100,16 +99,16 @@ Window::Window(WindowType _type)
|
|||
auto s = new QShortcut(QKeySequence::ZoomIn, this);
|
||||
s->setContext(Qt::WindowShortcut);
|
||||
QObject::connect(s, &QShortcut::activated, this, [] {
|
||||
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
|
||||
getApp()->settings->uiScale.getValue() + 1));
|
||||
getApp()->settings->uiScale.setValue(
|
||||
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() + 1));
|
||||
});
|
||||
}
|
||||
{
|
||||
auto s = new QShortcut(QKeySequence::ZoomOut, this);
|
||||
s->setContext(Qt::WindowShortcut);
|
||||
QObject::connect(s, &QShortcut::activated, this, [] {
|
||||
getApp()->settings->uiScale.setValue(WindowManager::clampUiScale(
|
||||
getApp()->settings->uiScale.getValue() - 1));
|
||||
getApp()->settings->uiScale.setValue(
|
||||
WindowManager::clampUiScale(getApp()->settings->uiScale.getValue() - 1));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "controllers/commands/CommandController.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Themes.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
|
@ -66,12 +65,10 @@ void SplitInput::initLayout()
|
|||
// ---- misc
|
||||
|
||||
// set edit font
|
||||
this->ui_.textEdit->setFont(
|
||||
app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
|
||||
this->ui_.textEdit->setFont(app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
|
||||
|
||||
this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() {
|
||||
this->ui_.textEdit->setFont(
|
||||
app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
|
||||
this->ui_.textEdit->setFont(app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
|
||||
}));
|
||||
|
||||
// open emote popup
|
||||
|
|
Loading…
Reference in a new issue