From 6acaa5644262014f070a949feeae71acc7ee57d3 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Tue, 6 Jun 2017 16:06:13 +0200 Subject: [PATCH] rename sendJoin to joinChannel --- src/channelmanager.cpp | 2 +- src/ircmanager.cpp | 34 +++++++++++++++++----------------- src/ircmanager.h | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp index 7985e357a..04515a76b 100644 --- a/src/channelmanager.cpp +++ b/src/channelmanager.cpp @@ -58,7 +58,7 @@ SharedChannel ChannelManager::addChannel(const QString &channel) auto channel = SharedChannel(new Channel(channelName)); _channels.insert(channelName, std::make_tuple(channel, 1)); - IrcManager::getInstance().sendJoin(channelName); + IrcManager::getInstance().joinChannel(channelName); return channel; } diff --git a/src/ircmanager.cpp b/src/ircmanager.cpp index 484b7452d..f51c1a4fe 100644 --- a/src/ircmanager.cpp +++ b/src/ircmanager.cpp @@ -169,8 +169,7 @@ void IrcManager::beginConnecting() this->readConnection->moveToThread(QCoreApplication::instance()->thread()); for (auto &channel : ChannelManager::getInstance().getItems()) { - this->writeConnection->sendRaw("JOIN #" + channel->getName()); - this->readConnection->sendRaw("JOIN #" + channel->getName()); + this->joinChannel(channel->getName()); } this->writeConnection->open(); @@ -194,18 +193,6 @@ void IrcManager::disconnect() _connectionMutex.unlock(); } -void IrcManager::sendJoin(const QString &channel) -{ - _connectionMutex.lock(); - - if (this->readConnection && this->writeConnection) { - this->readConnection->sendRaw("JOIN #" + channel); - this->writeConnection->sendRaw("JOIN #" + channel); - } - - _connectionMutex.unlock(); -} - void IrcManager::sendMessage(const QString &channelName, const QString &message) { _connectionMutex.lock(); @@ -217,13 +204,26 @@ void IrcManager::sendMessage(const QString &channelName, const QString &message) _connectionMutex.unlock(); } -void IrcManager::partChannel(const QString &channel) +void IrcManager::joinChannel(const QString &channelName) { _connectionMutex.lock(); if (this->readConnection && this->writeConnection) { - this->readConnection->sendRaw("PART #" + channel); - this->writeConnection->sendRaw("PART #" + channel); + this->readConnection->sendRaw("JOIN #" + channelName); + this->writeConnection->sendRaw("JOIN #" + channelName); + } + + _connectionMutex.unlock(); +} + + +void IrcManager::partChannel(const QString &channelName) +{ + _connectionMutex.lock(); + + if (this->readConnection && this->writeConnection) { + this->readConnection->sendRaw("PART #" + channelName); + this->writeConnection->sendRaw("PART #" + channelName); } _connectionMutex.unlock(); diff --git a/src/ircmanager.h b/src/ircmanager.h index 14071eed6..e212af285 100644 --- a/src/ircmanager.h +++ b/src/ircmanager.h @@ -38,10 +38,10 @@ public: QNetworkAccessManager &getAccessManager(); - void sendJoin(const QString &channel); void sendMessage(const QString &channelName, const QString &message); - void partChannel(const QString &channel); + void joinChannel(const QString &channelName); + void partChannel(const QString &channelName); const twitch::TwitchUser &getUser() const; void setUser(const twitch::TwitchUser &account);