X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoreuserinputhandler.cpp;h=d060ada286b4bbb160ef98196e6160aedbdba866;hp=8878340824c53b1187c7cacae575ca8782894b25;hb=c194ed5fb3d15e14b9364f9796d3521910dc72fe;hpb=6e7b4039cde65c37f711c8c4c0b0b405aa9054e1 diff --git a/src/core/coreuserinputhandler.cpp b/src/core/coreuserinputhandler.cpp index 88783408..d060ada2 100644 --- a/src/core/coreuserinputhandler.cpp +++ b/src/core/coreuserinputhandler.cpp @@ -30,13 +30,6 @@ # include "cipher.h" #endif -#if QT_VERSION < 0x050000 -// QChar::LineFeed is Qt 5 -static const QChar QCharLF = QChar('\n'); -#else -static const QChar QCharLF = QChar::LineFeed; -#endif - CoreUserInputHandler::CoreUserInputHandler(CoreNetwork *parent) : CoreBasicHandler(parent) { @@ -457,7 +450,7 @@ void CoreUserInputHandler::handleMe(const BufferInfo &bufferInfo, const QString // Split apart messages at line feeds. The IRC protocol uses those to separate commands, so // they need to be split into multiple messages. - QStringList messages = msg.split(QCharLF); + QStringList messages = msg.split(QChar::LineFeed); foreach (auto message, messages) { // Handle each separated message independently @@ -474,7 +467,6 @@ void CoreUserInputHandler::handleMode(const BufferInfo &bufferInfo, const QStrin Q_UNUSED(bufferInfo) QStringList params = msg.split(' ', QString::SkipEmptyParts); - // if the first argument is neither a channel nor us (user modes are only to oneself) the current buffer is assumed to be the target if (!params.isEmpty()) { if (params[0] == "-reset" && params.count() == 1) { network()->resetPersistentModes(); @@ -483,7 +475,11 @@ void CoreUserInputHandler::handleMode(const BufferInfo &bufferInfo, const QStrin return; } if (!network()->isChannelName(params[0]) && !network()->isMyNick(params[0])) - params.prepend(bufferInfo.bufferName()); + // If the first argument is neither a channel nor us (user modes are only to oneself) + // the current buffer is assumed to be the target. + // If the current buffer returns no name (e.g. status buffer), assume target is us. + params.prepend(!bufferInfo.bufferName().isEmpty() ? + bufferInfo.bufferName() : network()->myNick()); if (network()->isMyNick(params[0]) && params.count() == 2) network()->updateIssuedModes(params[1]); } @@ -529,7 +525,7 @@ void CoreUserInputHandler::handleNotice(const BufferInfo &bufferInfo, const QStr QList params; // Split apart messages at line feeds. The IRC protocol uses those to separate commands, so // they need to be split into multiple messages. - QStringList messages = msg.section(' ', 1).split(QCharLF); + QStringList messages = msg.section(' ', 1).split(QChar::LineFeed); foreach (auto message, messages) { // Handle each separated message independently @@ -603,7 +599,7 @@ void CoreUserInputHandler::handleQuery(const BufferInfo &bufferInfo, const QStri QString target = msg.section(' ', 0, 0); // Split apart messages at line feeds. The IRC protocol uses those to separate commands, so // they need to be split into multiple messages. - QStringList messages = msg.section(' ', 1).split(QCharLF); + QStringList messages = msg.section(' ', 1).split(QChar::LineFeed); foreach (auto message, messages) { // Handle each separated message independently @@ -654,7 +650,7 @@ void CoreUserInputHandler::handleSay(const BufferInfo &bufferInfo, const QString // Split apart messages at line feeds. The IRC protocol uses those to separate commands, so // they need to be split into multiple messages. - QStringList messages = msg.split(QCharLF, QString::SkipEmptyParts); + QStringList messages = msg.split(QChar::LineFeed, QString::SkipEmptyParts); foreach (auto message, messages) { // Handle each separated message independently