diff --git a/src/providers/irc/AbstractIrcServer.cpp b/src/providers/irc/AbstractIrcServer.cpp index a314a3de3..e6703d9d7 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 14e2138f5..bd71a711a 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 394a85043..c1834bb0f 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 0a978d17e..847fe4c86 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;