fixed commands like /mods not working

This commit is contained in:
fourtf 2019-08-27 20:45:42 +02:00
parent 7aa2bf4fec
commit 671c9ed654
4 changed files with 24 additions and 9 deletions

View file

@ -38,7 +38,10 @@ AbstractIrcServer::AbstractIrcServer()
[this](auto msg) { this->privateMessageReceived(msg); }); [this](auto msg) { this->privateMessageReceived(msg); });
QObject::connect( QObject::connect(
this->readConnection_.get(), &Communi::IrcConnection::connected, 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(), QObject::connect(this->readConnection_.get(),
&Communi::IrcConnection::disconnected, &Communi::IrcConnection::disconnected,
[this] { this->onDisconnected(); }); [this] { this->onDisconnected(); });
@ -227,7 +230,7 @@ std::shared_ptr<Channel> AbstractIrcServer::getChannelOrEmpty(
return Channel::getEmpty(); return Channel::getEmpty();
} }
void AbstractIrcServer::onConnected(IrcConnection *connection) void AbstractIrcServer::onReadConnected(IrcConnection *connection)
{ {
std::lock_guard<std::mutex> lock(this->channelMutex); std::lock_guard<std::mutex> lock(this->channelMutex);
@ -262,6 +265,10 @@ void AbstractIrcServer::onConnected(IrcConnection *connection)
this->falloffCounter_ = 1; this->falloffCounter_ = 1;
} }
void AbstractIrcServer::onWriteConnected(IrcConnection *connection)
{
}
void AbstractIrcServer::onDisconnected() void AbstractIrcServer::onDisconnected()
{ {
std::lock_guard<std::mutex> lock(this->channelMutex); std::lock_guard<std::mutex> lock(this->channelMutex);

View file

@ -52,7 +52,8 @@ protected:
virtual void messageReceived(Communi::IrcMessage *message); virtual void messageReceived(Communi::IrcMessage *message);
virtual void writeConnectionMessageReceived(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 onDisconnected();
virtual void onSocketError(); virtual void onSocketError();

View file

@ -199,12 +199,18 @@ void TwitchServer::writeConnectionMessageReceived(Communi::IrcMessage *message)
} }
} }
void TwitchServer::onConnected(IrcConnection *connection) void TwitchServer::onReadConnected(IrcConnection *connection)
{ {
AbstractIrcServer::onConnected(connection); AbstractIrcServer::onReadConnected(connection);
// connection in thise case is the read connection
connection->sendRaw( connection->sendRaw("CAP REQ :twitch.tv/tags twitch.tv/membership");
"CAP REQ :twitch.tv/tags twitch.tv/commands twitch.tv/membership"); }
void TwitchServer::onWriteConnected(IrcConnection *connection)
{
AbstractIrcServer::onWriteConnected(connection);
connection->sendRaw("CAP REQ :twitch.tv/tags twitch.tv/commands");
} }
std::shared_ptr<Channel> TwitchServer::getCustomChannel( std::shared_ptr<Channel> TwitchServer::getCustomChannel(

View file

@ -55,7 +55,8 @@ protected:
virtual void writeConnectionMessageReceived( virtual void writeConnectionMessageReceived(
Communi::IrcMessage *message) override; 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<Channel> getCustomChannel( virtual std::shared_ptr<Channel> getCustomChannel(
const QString &channelname) override; const QString &channelname) override;