From 671c9ed6544ca776079b53d4234f80923fed3f66 Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 27 Aug 2019 20:45:42 +0200 Subject: [PATCH] fixed commands like /mods not working --- src/providers/irc/AbstractIrcServer.cpp | 11 +++++++++-- src/providers/irc/AbstractIrcServer.hpp | 3 ++- src/providers/twitch/TwitchServer.cpp | 16 +++++++++++----- src/providers/twitch/TwitchServer.hpp | 3 ++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/providers/irc/AbstractIrcServer.cpp b/src/providers/irc/AbstractIrcServer.cpp index a314a3de..e6703d9d 100644 --- a/src/providers/irc/AbstractIrcServer.cpp +++ b/src/providers/irc/AbstractIrcServer.cpp @@ -38,7 +38,10 @@ AbstractIrcServer::AbstractIrcServer() [this](auto msg) { this->privateMessageReceived(msg); }); QObject::connect( this->readConnection_.get(), &Communi::IrcConnection::connected, - [this] { this->onConnected(this->readConnection_.get()); }); + [this] { this->onReadConnected(this->readConnection_.get()); }); + QObject::connect( + this->writeConnection_.get(), &Communi::IrcConnection::connected, + [this] { this->onWriteConnected(this->writeConnection_.get()); }); QObject::connect(this->readConnection_.get(), &Communi::IrcConnection::disconnected, [this] { this->onDisconnected(); }); @@ -227,7 +230,7 @@ std::shared_ptr AbstractIrcServer::getChannelOrEmpty( return Channel::getEmpty(); } -void AbstractIrcServer::onConnected(IrcConnection *connection) +void AbstractIrcServer::onReadConnected(IrcConnection *connection) { std::lock_guard lock(this->channelMutex); @@ -262,6 +265,10 @@ void AbstractIrcServer::onConnected(IrcConnection *connection) this->falloffCounter_ = 1; } +void AbstractIrcServer::onWriteConnected(IrcConnection *connection) +{ +} + void AbstractIrcServer::onDisconnected() { std::lock_guard lock(this->channelMutex); diff --git a/src/providers/irc/AbstractIrcServer.hpp b/src/providers/irc/AbstractIrcServer.hpp index 14e2138f..bd71a711 100644 --- a/src/providers/irc/AbstractIrcServer.hpp +++ b/src/providers/irc/AbstractIrcServer.hpp @@ -52,7 +52,8 @@ protected: virtual void messageReceived(Communi::IrcMessage *message); virtual void writeConnectionMessageReceived(Communi::IrcMessage *message); - virtual void onConnected(IrcConnection *connection); + virtual void onReadConnected(IrcConnection *connection); + virtual void onWriteConnected(IrcConnection *connection); virtual void onDisconnected(); virtual void onSocketError(); diff --git a/src/providers/twitch/TwitchServer.cpp b/src/providers/twitch/TwitchServer.cpp index 394a8504..c1834bb0 100644 --- a/src/providers/twitch/TwitchServer.cpp +++ b/src/providers/twitch/TwitchServer.cpp @@ -199,12 +199,18 @@ void TwitchServer::writeConnectionMessageReceived(Communi::IrcMessage *message) } } -void TwitchServer::onConnected(IrcConnection *connection) +void TwitchServer::onReadConnected(IrcConnection *connection) { - AbstractIrcServer::onConnected(connection); - // connection in thise case is the read connection - connection->sendRaw( - "CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership"); + AbstractIrcServer::onReadConnected(connection); + + connection->sendRaw("CAP REQ :twitch.tv/tags twitch.tv/membership"); +} + +void TwitchServer::onWriteConnected(IrcConnection *connection) +{ + AbstractIrcServer::onWriteConnected(connection); + + connection->sendRaw("CAP REQ :twitch.tv/tags twitch.tv/commands"); } std::shared_ptr TwitchServer::getCustomChannel( diff --git a/src/providers/twitch/TwitchServer.hpp b/src/providers/twitch/TwitchServer.hpp index 0a978d17..847fe4c8 100644 --- a/src/providers/twitch/TwitchServer.hpp +++ b/src/providers/twitch/TwitchServer.hpp @@ -55,7 +55,8 @@ protected: virtual void writeConnectionMessageReceived( Communi::IrcMessage *message) override; - virtual void onConnected(IrcConnection *connection) override; + virtual void onReadConnected(IrcConnection *connection) override; + virtual void onWriteConnected(IrcConnection *connection) override; virtual std::shared_ptr getCustomChannel( const QString &channelname) override;