X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fcoresessioneventprocessor.cpp;h=ec988ff5ed7b1ebf10afee0a684939373a1ad037;hb=c0d6dc0dec628f2e143e37ecc95cec45e636f8a5;hp=98d833e594668d0d8d4b273c42d33f7a2dd5b64b;hpb=cc6e7c08709c4e761e2fd9c2e322751015497003;p=quassel.git diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 98d833e5..ec988ff5 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2019 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -20,6 +20,8 @@ #include "coresessioneventprocessor.h" +#include + #include "coreirclisthelper.h" #include "corenetwork.h" #include "coresession.h" @@ -132,9 +134,7 @@ void CoreSessionEventProcessor::processIrcEventAuthenticate(IrcEvent* e) CoreNetwork* net = coreNetwork(e); -#ifdef HAVE_SSL if (net->identityPtr()->sslCert().isNull()) { -#endif QString construct = net->saslAccount(); construct.append(QChar(QChar::Null)); construct.append(net->saslAccount()); @@ -143,12 +143,10 @@ void CoreSessionEventProcessor::processIrcEventAuthenticate(IrcEvent* e) QByteArray saslData = QByteArray(construct.toLatin1().toBase64()); saslData.prepend("AUTHENTICATE "); net->putRawLine(saslData); -#ifdef HAVE_SSL } else { net->putRawLine("AUTHENTICATE +"); } -#endif } void CoreSessionEventProcessor::processIrcEventCap(IrcEvent* e) @@ -406,7 +404,7 @@ void CoreSessionEventProcessor::processIrcEventJoin(IrcEvent* e) // Else :nick!user@host JOIN #channelname bool handledByNetsplit = false; - foreach (Netsplit* n, _netsplits.value(e->network())) { + for (Netsplit* n : _netsplits.value(e->network())) { handledByNetsplit = n->userJoined(e->prefix(), channel); if (handledByNetsplit) break; @@ -488,7 +486,7 @@ void CoreSessionEventProcessor::processIrcEventMode(IrcEvent* e) if (add) { bool handledByNetsplit = false; QHash splits = _netsplits.value(e->network()); - foreach (Netsplit* n, _netsplits.value(e->network())) { + for (Netsplit* n : _netsplits.value(e->network())) { handledByNetsplit = n->userAlreadyJoined(ircUser->hostmask(), channel->name()); if (handledByNetsplit) { n->addMode(ircUser->hostmask(), channel->name(), QString(mode)); @@ -1191,7 +1189,7 @@ void CoreSessionEventProcessor::processIrcEvent353(IrcEvent* e) // Cache result of multi-prefix to avoid unneeded casts and lookups with each iteration. bool _useCapMultiPrefix = coreNetwork(e)->capEnabled(IrcCap::MULTI_PREFIX); - foreach (QString nick, e->params()[2].split(' ', QString::SkipEmptyParts)) { + for (QString nick : e->params()[2].split(' ', QString::SkipEmptyParts)) { QString mode; if (_useCapMultiPrefix) { @@ -1427,7 +1425,7 @@ void CoreSessionEventProcessor::handleNetsplitJoin( QStringList newModes = modes; QStringList newUsers = users; - foreach (const QString& user, users) { + for (const QString& user : users) { IrcUser* iu = net->ircUser(nickFromMask(user)); if (iu) ircUsers.append(iu); @@ -1447,10 +1445,9 @@ void CoreSessionEventProcessor::handleNetsplitQuit(Network* net, const QString& { NetworkSplitEvent* event = new NetworkSplitEvent(EventManager::NetworkSplitQuit, net, channel, users, quitMessage); emit newEvent(event); - foreach (QString user, users) { - IrcUser* iu = net->ircUser(nickFromMask(user)); - if (iu) - iu->quit(); + for (const QString& user : users) { + IrcUser* ircUser = net->ircUser(nickFromMask(user)); + if (ircUser) ircUser->quit(); } } @@ -1465,19 +1462,19 @@ void CoreSessionEventProcessor::handleEarlyNetsplitJoin(Network* net, const QStr QList ircUsers; QStringList newModes = modes; - foreach (QString user, users) { - IrcUser* iu = net->updateNickFromMask(user); - if (iu) { - ircUsers.append(iu); + for (const QString& user : users) { + IrcUser* ircUser = net->updateNickFromMask(user); + if (ircUser) { + ircUsers.append(ircUser); // fake event for scripts that consume join events - events << new IrcEvent(EventManager::IrcEventJoin, net, iu->hostmask(), QStringList() << channel); + events << new IrcEvent(EventManager::IrcEventJoin, net, {}, ircUser->hostmask(), QStringList() << channel); } else { newModes.removeAt(users.indexOf(user)); } } ircChannel->joinIrcUsers(ircUsers, newModes); - foreach (NetworkEvent* event, events) { + for (NetworkEvent* event : events) { event->setFlag(EventManager::Fake); // ignore this in here! emit newEvent(event); } @@ -1535,9 +1532,9 @@ void CoreSessionEventProcessor::handleCtcpAction(CtcpEvent* e) void CoreSessionEventProcessor::handleCtcpClientinfo(CtcpEvent* e) { QStringList supportedHandlers; - foreach (QString handler, providesHandlers()) + for (const QString& handler : providesHandlers()) supportedHandlers << handler.toUpper(); - qSort(supportedHandlers); + std::sort(supportedHandlers.begin(), supportedHandlers.end()); e->setReply(supportedHandlers.join(" ")); }