Chore: Proper Lambda Formatting (#2167)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Leon Richardt
2020-11-08 12:02:19 +01:00
committed by GitHub
parent fbd5df53d8
commit 0eed45ae67
71 changed files with 712 additions and 415 deletions
+30 -19
View File
@@ -22,36 +22,47 @@ AbstractIrcServer::AbstractIrcServer()
this->writeConnection_->moveToThread(
QCoreApplication::instance()->thread());
QObject::connect(
this->writeConnection_.get(), &Communi::IrcConnection::messageReceived,
this, [this](auto msg) { this->writeConnectionMessageReceived(msg); });
QObject::connect(
this->writeConnection_.get(), &Communi::IrcConnection::connected, this,
[this] { this->onWriteConnected(this->writeConnection_.get()); });
QObject::connect(this->writeConnection_.get(),
&Communi::IrcConnection::messageReceived, this,
[this](auto msg) {
this->writeConnectionMessageReceived(msg);
});
QObject::connect(this->writeConnection_.get(),
&Communi::IrcConnection::connected, this, [this] {
this->onWriteConnected(this->writeConnection_.get());
});
// Listen to read connection message signals
this->readConnection_.reset(new IrcConnection);
this->readConnection_->moveToThread(QCoreApplication::instance()->thread());
QObject::connect(
this->readConnection_.get(), &Communi::IrcConnection::messageReceived,
this, [this](auto msg) { this->readConnectionMessageReceived(msg); });
QObject::connect(this->readConnection_.get(),
&Communi::IrcConnection::messageReceived, this,
[this](auto msg) {
this->readConnectionMessageReceived(msg);
});
QObject::connect(this->readConnection_.get(),
&Communi::IrcConnection::privateMessageReceived, this,
[this](auto msg) { this->privateMessageReceived(msg); });
QObject::connect(
this->readConnection_.get(), &Communi::IrcConnection::connected, this,
[this] { this->onReadConnected(this->readConnection_.get()); });
[this](auto msg) {
this->privateMessageReceived(msg);
});
QObject::connect(this->readConnection_.get(),
&Communi::IrcConnection::disconnected, this,
[this] { this->onDisconnected(); });
&Communi::IrcConnection::connected, this, [this] {
this->onReadConnected(this->readConnection_.get());
});
QObject::connect(this->readConnection_.get(),
&Communi::IrcConnection::socketError, this,
[this] { this->onSocketError(); });
&Communi::IrcConnection::disconnected, this, [this] {
this->onDisconnected();
});
QObject::connect(this->readConnection_.get(),
&Communi::IrcConnection::socketError, this, [this] {
this->onSocketError();
});
// listen to reconnect request
this->readConnection_->reconnectRequested.connect(
[this] { this->connect(); });
this->readConnection_->reconnectRequested.connect([this] {
this->connect();
});
// this->writeConnection->reconnectRequested.connect([this] {
// this->connect(); });
this->reconnectTimer_.setInterval(RECONNECT_BASE_INTERVAL);
+3 -1
View File
@@ -137,7 +137,9 @@ Irc::Irc()
}
});
this->connections.delayedItemsChanged.connect([this] { this->save(); });
this->connections.delayedItemsChanged.connect([this] {
this->save();
});
}
QAbstractTableModel *Irc::newConnectionModel(QObject *parent)
+6 -2
View File
@@ -33,9 +33,13 @@ Outcome invokeIrcCommand(const QString &commandName, const QString &allParams,
// CUSTOM COMMANDS
auto params = allParams.split(' ');
auto paramsAfter = [&](int i) { return params.mid(i + 1).join(' '); };
auto paramsAfter = [&](int i) {
return params.mid(i + 1).join(' ');
};
auto sendRaw = [&](QString str) { channel.server()->sendRawMessage(str); };
auto sendRaw = [&](QString str) {
channel.server()->sendRawMessage(str);
};
if (cmd == "msg")
{
+3 -2
View File
@@ -45,8 +45,9 @@ IrcConnection::IrcConnection(QObject *parent)
}
});
QObject::connect(this, &Communi::IrcConnection::connected, this,
[this] { this->waitingForPong_ = false; });
QObject::connect(this, &Communi::IrcConnection::connected, this, [this] {
this->waitingForPong_ = false;
});
QObject::connect(this, &Communi::IrcConnection::pongMessageReceived,
[this](Communi::IrcPongMessage *message) {
+1 -1
View File
@@ -702,7 +702,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
// channels
app->twitch.server->forEachChannelAndSpecialChannels(
[msg](const auto &c) {
c->addMessage(msg); //
c->addMessage(msg);
});
return;
+1 -1
View File
@@ -166,7 +166,7 @@ namespace detail {
return;
}
self->ping(); //
self->ping();
});
}
+2 -2
View File
@@ -153,7 +153,7 @@ void TwitchAccount::ignore(
{
const auto onUserFetched = [this, targetName,
onFinished](const auto &user) {
this->ignoreByID(user.id, targetName, onFinished); //
this->ignoreByID(user.id, targetName, onFinished);
};
const auto onUserFetchFailed = [] {};
@@ -230,7 +230,7 @@ void TwitchAccount::unignore(
{
const auto onUserFetched = [this, targetName,
onFinished](const auto &user) {
this->unignoreByID(user.id, targetName, onFinished); //
this->unignoreByID(user.id, targetName, onFinished);
};
const auto onUserFetchFailed = [] {};
@@ -17,7 +17,7 @@ TwitchAccountManager::TwitchAccountManager()
currentUser->loadIgnores();
});
this->accounts.itemRemoved.connect([this](const auto &acc) { //
this->accounts.itemRemoved.connect([this](const auto &acc) {
this->removeUser(acc.item.get());
});
}
+15 -9
View File
@@ -156,14 +156,18 @@ TwitchChannel::TwitchChannel(const QString &name,
}
});
this->managedConnect(getApp()->accounts->twitch.currentUserChanged,
[=] { this->setMod(false); });
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
this->setMod(false);
});
// pubsub
this->managedConnect(getApp()->accounts->twitch.currentUserChanged,
[=] { this->refreshPubsub(); });
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
this->refreshPubsub();
});
this->refreshPubsub();
this->userStateChanged.connect([this] { this->refreshPubsub(); });
this->userStateChanged.connect([this] {
this->refreshPubsub();
});
// room id loaded -> refresh live status
this->roomIdChanged.connect([this]() {
@@ -177,12 +181,14 @@ TwitchChannel::TwitchChannel(const QString &name,
});
// timers
QObject::connect(&this->chattersListTimer_, &QTimer::timeout,
[=] { this->refreshChatters(); });
QObject::connect(&this->chattersListTimer_, &QTimer::timeout, [=] {
this->refreshChatters();
});
this->chattersListTimer_.start(5 * 60 * 1000);
QObject::connect(&this->liveStatusTimer_, &QTimer::timeout,
[=] { this->refreshLiveStatus(); });
QObject::connect(&this->liveStatusTimer_, &QTimer::timeout, [=] {
this->refreshLiveStatus();
});
this->liveStatusTimer_.start(60 * 1000);
// debugging
+5 -2
View File
@@ -38,8 +38,11 @@ TwitchIrcServer::TwitchIrcServer()
void TwitchIrcServer::initialize(Settings &settings, Paths &paths)
{
getApp()->accounts->twitch.currentUserChanged.connect(
[this]() { postToThread([this] { this->connect(); }); });
getApp()->accounts->twitch.currentUserChanged.connect([this]() {
postToThread([this] {
this->connect();
});
});
this->twitchBadges.loadTwitchBadges();
this->bttv.loadEmotes();
+10 -4
View File
@@ -295,7 +295,7 @@ MessagePtr TwitchMessageBuilder::build()
std::sort(twitchEmotes.begin(), twitchEmotes.end(),
[](const auto &a, const auto &b) {
return a.start < b.start; //
return a.start < b.start;
});
twitchEmotes.erase(std::unique(twitchEmotes.begin(), twitchEmotes.end(),
[](const auto &first, const auto &second) {
@@ -399,7 +399,10 @@ void TwitchMessageBuilder::addWords(
for (auto &variant : getApp()->emotes->emojis.parse(preText))
{
boost::apply_visitor(
[&](auto &&arg) { this->addTextOrEmoji(arg); }, variant);
[&](auto &&arg) {
this->addTextOrEmoji(arg);
},
variant);
}
cursor += preText.size();
@@ -415,8 +418,11 @@ void TwitchMessageBuilder::addWords(
// split words
for (auto &variant : getApp()->emotes->emojis.parse(word))
{
boost::apply_visitor([&](auto &&arg) { this->addTextOrEmoji(arg); },
variant);
boost::apply_visitor(
[&](auto &&arg) {
this->addTextOrEmoji(arg);
},
variant);
}
cursor += word.size() + 1;