From 68128dd3093c1d3f53fdb29908d4705a405219ef Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Wed, 18 Jun 2008 16:58:09 +0200 Subject: [PATCH] Fixing BR #157 (default argument to /mode) --- src/core/userinputhandler.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index ee335e6c..c42c475f 100644 --- a/src/core/userinputhandler.cpp +++ b/src/core/userinputhandler.cpp @@ -193,7 +193,6 @@ void UserInputHandler::handleList(const BufferInfo &bufferInfo, const QString &m emit putCmd("LIST", serverEncode(msg.split(' ', QString::SkipEmptyParts))); } - void UserInputHandler::handleMe(const BufferInfo &bufferInfo, const QString &msg) { if(bufferInfo.bufferName().isEmpty()) return; // server buffer networkConnection()->ctcpHandler()->query(bufferInfo.bufferName(), "ACTION", msg); @@ -202,8 +201,14 @@ void UserInputHandler::handleMe(const BufferInfo &bufferInfo, const QString &msg void UserInputHandler::handleMode(const BufferInfo &bufferInfo, const QString &msg) { 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() && !network()->isChannelName(params[0]) && !network()->isMyNick(params[0])) + params.prepend(bufferInfo.bufferName()); + // TODO handle correct encoding for buffer modes (channelEncode()) - emit putCmd("MODE", serverEncode(msg.split(' ', QString::SkipEmptyParts))); + emit putCmd("MODE", serverEncode(params)); } // TODO: show privmsgs -- 2.20.1