Update Settings and Signals version (#3398)
Co-authored-by: zneix <zneix@zneix.eu>
This commit is contained in:
@@ -47,11 +47,12 @@ AbstractIrcServer::AbstractIrcServer()
|
||||
&Communi::IrcConnection::connected, this, [this] {
|
||||
this->onWriteConnected(this->writeConnection_.get());
|
||||
});
|
||||
this->writeConnection_->connectionLost.connect([this](bool timeout) {
|
||||
qCDebug(chatterinoIrc)
|
||||
<< "Write connection reconnect requested. Timeout:" << timeout;
|
||||
this->writeConnection_->smartReconnect.invoke();
|
||||
});
|
||||
this->connections_.managedConnect(
|
||||
this->writeConnection_->connectionLost, [this](bool timeout) {
|
||||
qCDebug(chatterinoIrc)
|
||||
<< "Write connection reconnect requested. Timeout:" << timeout;
|
||||
this->writeConnection_->smartReconnect.invoke();
|
||||
});
|
||||
|
||||
// Listen to read connection message signals
|
||||
this->readConnection_.reset(new IrcConnection);
|
||||
@@ -75,18 +76,19 @@ AbstractIrcServer::AbstractIrcServer()
|
||||
&Communi::IrcConnection::disconnected, this, [this] {
|
||||
this->onDisconnected();
|
||||
});
|
||||
this->readConnection_->connectionLost.connect([this](bool timeout) {
|
||||
qCDebug(chatterinoIrc)
|
||||
<< "Read connection reconnect requested. Timeout:" << timeout;
|
||||
if (timeout)
|
||||
{
|
||||
// Show additional message since this is going to interrupt a
|
||||
// connection that is still "connected"
|
||||
this->addGlobalSystemMessage(
|
||||
"Server connection timed out, reconnecting");
|
||||
}
|
||||
this->readConnection_->smartReconnect.invoke();
|
||||
});
|
||||
this->connections_.managedConnect(
|
||||
this->readConnection_->connectionLost, [this](bool timeout) {
|
||||
qCDebug(chatterinoIrc)
|
||||
<< "Read connection reconnect requested. Timeout:" << timeout;
|
||||
if (timeout)
|
||||
{
|
||||
// Show additional message since this is going to interrupt a
|
||||
// connection that is still "connected"
|
||||
this->addGlobalSystemMessage(
|
||||
"Server connection timed out, reconnecting");
|
||||
}
|
||||
this->readConnection_->smartReconnect.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
void AbstractIrcServer::initializeIrc()
|
||||
@@ -217,19 +219,18 @@ ChannelPtr AbstractIrcServer::getOrAddChannel(const QString &dirtyChannelName)
|
||||
}
|
||||
|
||||
this->channels.insert(channelName, chan);
|
||||
this->connections_.emplace_back(
|
||||
chan->destroyed.connect([this, channelName] {
|
||||
// fourtf: issues when the server itself is destroyed
|
||||
this->connections_.managedConnect(chan->destroyed, [this, channelName] {
|
||||
// fourtf: issues when the server itself is destroyed
|
||||
|
||||
qCDebug(chatterinoIrc) << "[AbstractIrcServer::addChannel]"
|
||||
<< channelName << "was destroyed";
|
||||
this->channels.remove(channelName);
|
||||
qCDebug(chatterinoIrc) << "[AbstractIrcServer::addChannel]"
|
||||
<< channelName << "was destroyed";
|
||||
this->channels.remove(channelName);
|
||||
|
||||
if (this->readConnection_)
|
||||
{
|
||||
this->readConnection_->sendRaw("PART #" + channelName);
|
||||
}
|
||||
}));
|
||||
if (this->readConnection_)
|
||||
{
|
||||
this->readConnection_->sendRaw("PART #" + channelName);
|
||||
}
|
||||
});
|
||||
|
||||
// join IRC channel
|
||||
{
|
||||
|
||||
@@ -117,6 +117,12 @@ IrcConnection::IrcConnection(QObject *parent)
|
||||
});
|
||||
}
|
||||
|
||||
IrcConnection::~IrcConnection()
|
||||
{
|
||||
// Prematurely disconnect all QObject connections
|
||||
this->disconnect();
|
||||
}
|
||||
|
||||
void IrcConnection::open()
|
||||
{
|
||||
this->expectConnectionLoss_ = false;
|
||||
|
||||
@@ -13,6 +13,7 @@ class IrcConnection : public Communi::IrcConnection
|
||||
{
|
||||
public:
|
||||
IrcConnection(QObject *parent = nullptr);
|
||||
~IrcConnection() override;
|
||||
|
||||
// Signal to notify that we're unexpectedly no longer connected, either due
|
||||
// to a connection error or if we think we've timed out. It's up to the
|
||||
|
||||
@@ -158,14 +158,16 @@ TwitchChannel::TwitchChannel(const QString &name)
|
||||
{
|
||||
qCDebug(chatterinoTwitch) << "[TwitchChannel" << name << "] Opened";
|
||||
|
||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||
this->setMod(false);
|
||||
});
|
||||
this->signalHolder_.managedConnect(
|
||||
getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||
this->setMod(false);
|
||||
});
|
||||
|
||||
// pubsub
|
||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||
this->refreshPubsub();
|
||||
});
|
||||
this->signalHolder_.managedConnect(
|
||||
getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||
this->refreshPubsub();
|
||||
});
|
||||
this->refreshPubsub();
|
||||
this->userStateChanged.connect([this] {
|
||||
this->refreshPubsub();
|
||||
|
||||
@@ -35,9 +35,7 @@ class BttvEmotes;
|
||||
|
||||
class TwitchIrcServer;
|
||||
|
||||
class TwitchChannel : public Channel,
|
||||
public ChannelChatters,
|
||||
pajlada::Signals::SignalHolder
|
||||
class TwitchChannel : public Channel, public ChannelChatters
|
||||
{
|
||||
public:
|
||||
struct StreamStatus {
|
||||
@@ -184,6 +182,8 @@ private:
|
||||
QElapsedTimer clipCreationTimer_;
|
||||
bool isClipCreationInProgress{false};
|
||||
|
||||
pajlada::Signals::SignalHolder signalHolder_;
|
||||
|
||||
friend class TwitchIrcServer;
|
||||
friend class TwitchMessageBuilder;
|
||||
friend class IrcMessageHandler;
|
||||
|
||||
Reference in New Issue
Block a user