X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=29f10f06af865b9c834d0b738653d72d25435219;hp=4b32f2c8aca0c04c9edbfd46445aef04b19765aa;hb=714b39660fe19e7f092880019429c8da76ee2bd5;hpb=3e63cb8a6e83765069a45101b86ae9e21dcc57ad diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 4b32f2c8..29f10f06 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -438,32 +438,32 @@ void CoreNetwork::removeChannelKey(const QString &channel) Cipher *CoreNetwork::cipher(const QString &target) { if (target.isEmpty()) - return 0; + return nullptr; if (!Cipher::neededFeaturesAvailable()) - return 0; + return nullptr; - CoreIrcChannel *channel = qobject_cast(ircChannel(target)); + auto *channel = qobject_cast(ircChannel(target)); if (channel) { return channel->cipher(); } - CoreIrcUser *user = qobject_cast(ircUser(target)); + auto *user = qobject_cast(ircUser(target)); if (user) { return user->cipher(); } else if (!isChannelName(target)) { return qobject_cast(newIrcUser(target))->cipher(); } - return 0; + return nullptr; } QByteArray CoreNetwork::cipherKey(const QString &target) const { - CoreIrcChannel *c = qobject_cast(ircChannel(target)); + auto *c = qobject_cast(ircChannel(target)); if (c) return c->cipher()->key(); - CoreIrcUser *u = qobject_cast(ircUser(target)); + auto *u = qobject_cast(ircUser(target)); if (u) return u->cipher()->key(); @@ -473,14 +473,14 @@ QByteArray CoreNetwork::cipherKey(const QString &target) const void CoreNetwork::setCipherKey(const QString &target, const QByteArray &key) { - CoreIrcChannel *c = qobject_cast(ircChannel(target)); + auto *c = qobject_cast(ircChannel(target)); if (c) { c->setEncrypted(c->cipher()->setKey(key)); coreSession()->setBufferCipher(networkId(), target, key); return; } - CoreIrcUser *u = qobject_cast(ircUser(target)); + auto *u = qobject_cast(ircUser(target)); if (!u && !isChannelName(target)) u = qobject_cast(newIrcUser(target)); @@ -494,10 +494,10 @@ void CoreNetwork::setCipherKey(const QString &target, const QByteArray &key) bool CoreNetwork::cipherUsesCBC(const QString &target) { - CoreIrcChannel *c = qobject_cast(ircChannel(target)); + auto *c = qobject_cast(ircChannel(target)); if (c) return c->cipher()->usesCBC(); - CoreIrcUser *u = qobject_cast(ircUser(target)); + auto *u = qobject_cast(ircUser(target)); if (u) return u->cipher()->usesCBC(); @@ -814,20 +814,20 @@ void CoreNetwork::updateIssuedModes(const QString &requestedModes) QString removeModes; bool addMode = true; - for (int i = 0; i < requestedModes.length(); i++) { - if (requestedModes[i] == '+') { + for (auto requestedMode : requestedModes) { + if (requestedMode == '+') { addMode = true; continue; } - if (requestedModes[i] == '-') { + if (requestedMode == '-') { addMode = false; continue; } if (addMode) { - addModes += requestedModes[i]; + addModes += requestedMode; } else { - removeModes += requestedModes[i]; + removeModes += requestedMode; } }