modernize: Replace most remaining old-style connects by PMF ones
[quassel.git] / src / core / coresessioneventprocessor.cpp
index 04233f3..99913ad 100644 (file)
@@ -44,8 +44,8 @@ CoreSessionEventProcessor::CoreSessionEventProcessor(CoreSession *session)
     : BasicHandler("handleCtcp", session),
     _coreSession(session)
 {
-    connect(coreSession(), SIGNAL(networkDisconnected(NetworkId)), this, SLOT(destroyNetsplits(NetworkId)));
-    connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *)));
+    connect(coreSession(), &CoreSession::networkDisconnected, this, &CoreSessionEventProcessor::destroyNetsplits);
+    connect(this, &CoreSessionEventProcessor::newEvent, coreSession()->eventManager(), &EventManager::postEvent);
 }
 
 
@@ -459,17 +459,17 @@ void CoreSessionEventProcessor::processIrcEventMode(IrcEvent *e)
         QString modes = e->params()[1];
         bool add = true;
         int paramOffset = 2;
-        for (int c = 0; c < modes.length(); c++) {
-            if (modes[c] == '+') {
+        for (auto mode : modes) {
+            if (mode == '+') {
                 add = true;
                 continue;
             }
-            if (modes[c] == '-') {
+            if (mode == '-') {
                 add = false;
                 continue;
             }
 
-            if (e->network()->prefixModes().contains(modes[c])) {
+            if (e->network()->prefixModes().contains(mode)) {
                 // user channel modes (op, voice, etc...)
                 if (paramOffset < e->params().count()) {
                     IrcUser *ircUser = e->network()->ircUser(e->params()[paramOffset]);
@@ -483,15 +483,15 @@ void CoreSessionEventProcessor::processIrcEventMode(IrcEvent *e)
                             foreach(Netsplit* n, _netsplits.value(e->network())) {
                                 handledByNetsplit = n->userAlreadyJoined(ircUser->hostmask(), channel->name());
                                 if (handledByNetsplit) {
-                                    n->addMode(ircUser->hostmask(), channel->name(), QString(modes[c]));
+                                    n->addMode(ircUser->hostmask(), channel->name(), QString(mode));
                                     break;
                                 }
                             }
                             if (!handledByNetsplit)
-                                channel->addUserMode(ircUser, QString(modes[c]));
+                                channel->addUserMode(ircUser, QString(mode));
                         }
                         else
-                            channel->removeUserMode(ircUser, QString(modes[c]));
+                            channel->removeUserMode(ircUser, QString(mode));
                     }
                 }
                 else {
@@ -502,7 +502,7 @@ void CoreSessionEventProcessor::processIrcEventMode(IrcEvent *e)
             else {
                 // regular channel modes
                 QString value;
-                Network::ChannelModeType modeType = e->network()->channelModeType(modes[c]);
+                Network::ChannelModeType modeType = e->network()->channelModeType(mode);
                 if (modeType == Network::A_CHANMODE || modeType == Network::B_CHANMODE || (modeType == Network::C_CHANMODE && add)) {
                     if (paramOffset < e->params().count()) {
                         value = e->params()[paramOffset];
@@ -514,9 +514,9 @@ void CoreSessionEventProcessor::processIrcEventMode(IrcEvent *e)
                 }
 
                 if (add)
-                    channel->addChannelMode(modes[c], value);
+                    channel->addChannelMode(mode, value);
                 else
-                    channel->removeChannelMode(modes[c], value);
+                    channel->removeChannelMode(mode, value);
             }
         }
     }
@@ -729,13 +729,13 @@ void CoreSessionEventProcessor::processIrcEventQuit(IrcEvent *e)
         Netsplit *n;
         if (!_netsplits[e->network()].contains(msg)) {
             n = new Netsplit(e->network(), this);
-            connect(n, SIGNAL(finished()), this, SLOT(handleNetsplitFinished()));
-            connect(n, SIGNAL(netsplitJoin(Network*, QString, QStringList, QStringList, QString)),
-                this, SLOT(handleNetsplitJoin(Network*, QString, QStringList, QStringList, QString)));
-            connect(n, SIGNAL(netsplitQuit(Network*, QString, QStringList, QString)),
-                this, SLOT(handleNetsplitQuit(Network*, QString, QStringList, QString)));
-            connect(n, SIGNAL(earlyJoin(Network*, QString, QStringList, QStringList)),
-                this, SLOT(handleEarlyNetsplitJoin(Network*, QString, QStringList, QStringList)));
+            connect(n, &Netsplit::finished, this, &CoreSessionEventProcessor::handleNetsplitFinished);
+            connect(n, &Netsplit::netsplitJoin,
+                this, &CoreSessionEventProcessor::handleNetsplitJoin);
+            connect(n, &Netsplit::netsplitQuit,
+                this, &CoreSessionEventProcessor::handleNetsplitQuit);
+            connect(n, &Netsplit::earlyJoin,
+                this, &CoreSessionEventProcessor::handleEarlyNetsplitJoin);
             _netsplits[e->network()].insert(msg, n);
         }
         else {
@@ -801,7 +801,7 @@ void CoreSessionEventProcessor::processKeyEvent(KeyEvent *e)
         emit newEvent(new MessageEvent(Message::Error, e->network(), tr("Unable to perform key exchange, missing qca-ossl plugin."), e->prefix(), e->target(), Message::None, e->timestamp()));
         return;
     }
-    CoreNetwork *net = qobject_cast<CoreNetwork*>(e->network());
+    auto *net = qobject_cast<CoreNetwork*>(e->network());
     Cipher *c = net->cipher(e->target());
     if (!c) // happens when there is no CoreIrcChannel for the target (i.e. never?)
         return;
@@ -1478,7 +1478,7 @@ void CoreSessionEventProcessor::handleEarlyNetsplitJoin(Network *net, const QStr
 
 void CoreSessionEventProcessor::handleNetsplitFinished()
 {
-    Netsplit *n = qobject_cast<Netsplit *>(sender());
+    auto *n = qobject_cast<Netsplit *>(sender());
     Q_ASSERT(n);
     QHash<QString, Netsplit *> splithash  = _netsplits.take(n->network());
     splithash.remove(splithash.key(n));