diff --git a/src/providers/irc/AbstractIrcServer.cpp b/src/providers/irc/AbstractIrcServer.cpp index eb1d0def9..a314a3de3 100644 --- a/src/providers/irc/AbstractIrcServer.cpp +++ b/src/providers/irc/AbstractIrcServer.cpp @@ -36,9 +36,9 @@ AbstractIrcServer::AbstractIrcServer() QObject::connect(this->readConnection_.get(), &Communi::IrcConnection::privateMessageReceived, [this](auto msg) { this->privateMessageReceived(msg); }); - QObject::connect(this->readConnection_.get(), - &Communi::IrcConnection::connected, - [this] { this->onConnected(); }); + QObject::connect( + this->readConnection_.get(), &Communi::IrcConnection::connected, + [this] { this->onConnected(this->readConnection_.get()); }); QObject::connect(this->readConnection_.get(), &Communi::IrcConnection::disconnected, [this] { this->onDisconnected(); }); @@ -227,7 +227,7 @@ std::shared_ptr AbstractIrcServer::getChannelOrEmpty( return Channel::getEmpty(); } -void AbstractIrcServer::onConnected() +void AbstractIrcServer::onConnected(IrcConnection *connection) { std::lock_guard lock(this->channelMutex); diff --git a/src/providers/irc/AbstractIrcServer.hpp b/src/providers/irc/AbstractIrcServer.hpp index e605340cd..14e2138f5 100644 --- a/src/providers/irc/AbstractIrcServer.hpp +++ b/src/providers/irc/AbstractIrcServer.hpp @@ -52,7 +52,7 @@ protected: virtual void messageReceived(Communi::IrcMessage *message); virtual void writeConnectionMessageReceived(Communi::IrcMessage *message); - virtual void onConnected(); + virtual void onConnected(IrcConnection *connection); virtual void onDisconnected(); virtual void onSocketError(); diff --git a/src/providers/twitch/TwitchServer.cpp b/src/providers/twitch/TwitchServer.cpp index 58f98494c..9087f45b6 100644 --- a/src/providers/twitch/TwitchServer.cpp +++ b/src/providers/twitch/TwitchServer.cpp @@ -90,13 +90,6 @@ void TwitchServer::initializeConnection(IrcConnection *connection, bool isRead, connection->setPassword(oauthToken); } - connection->sendCommand( - Communi::IrcCommand::createCapability("REQ", "twitch.tv/membership")); - connection->sendCommand( - Communi::IrcCommand::createCapability("REQ", "twitch.tv/commands")); - connection->sendCommand( - Communi::IrcCommand::createCapability("REQ", "twitch.tv/tags")); - connection->setSecure(true); // https://dev.twitch.tv/docs/irc/guide/#connecting-to-twitch-irc @@ -206,6 +199,13 @@ void TwitchServer::writeConnectionMessageReceived(Communi::IrcMessage *message) } } +void TwitchServer::onConnected(IrcConnection *connection) +{ + // connection in thise case is the read connection + connection->sendRaw( + "CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership"); +} + std::shared_ptr TwitchServer::getCustomChannel( const QString &channelName) { diff --git a/src/providers/twitch/TwitchServer.hpp b/src/providers/twitch/TwitchServer.hpp index da67196b1..0a978d17e 100644 --- a/src/providers/twitch/TwitchServer.hpp +++ b/src/providers/twitch/TwitchServer.hpp @@ -55,6 +55,8 @@ protected: virtual void writeConnectionMessageReceived( Communi::IrcMessage *message) override; + virtual void onConnected(IrcConnection *connection) override; + virtual std::shared_ptr getCustomChannel( const QString &channelname) override;