X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoreuserinputhandler.cpp;h=ccba8b8a261ec293b647c3e5de59c25696f43724;hb=63bc3c3a34a0df70cad72b1f36d4fb7b8245d79c;hp=5764605a2d8d43bd6770399047f9a72251c5f18e;hpb=513c0edce6f4c69f16e6a00c144877e8d5940096;p=quassel.git diff --git a/src/core/coreuserinputhandler.cpp b/src/core/coreuserinputhandler.cpp index 5764605a..ccba8b8a 100644 --- a/src/core/coreuserinputhandler.cpp +++ b/src/core/coreuserinputhandler.cpp @@ -51,14 +51,31 @@ void CoreUserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const Q // ==================== void CoreUserInputHandler::handleAway(const BufferInfo &bufferInfo, const QString &msg) { Q_UNUSED(bufferInfo) + if(msg.startsWith("-all")) { + if(msg.length() == 4) { + coreSession()->globalAway(); + return; + } + Q_ASSERT(msg.length() > 4); + if(msg[4] == ' ') { + coreSession()->globalAway(msg.mid(5)); + return; + } + } + issueAway(msg); +} +void CoreUserInputHandler::issueAway(const QString &msg, bool autoCheck) { QString awayMsg = msg; IrcUser *me = network()->me(); // if there is no message supplied we have to check if we are already away or not - if(msg.isEmpty()) { + if(autoCheck && msg.isEmpty()) { if(me && !me->isAway()) { - awayMsg = network()->identityPtr()->awayReason(); + Identity *identity = network()->identityPtr(); + if(identity) { + awayMsg = identity->awayReason(); + } if(awayMsg.isEmpty()) { awayMsg = tr("away"); } @@ -257,8 +274,17 @@ void CoreUserInputHandler::handleMode(const BufferInfo &bufferInfo, const QStrin 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()); + if(!params.isEmpty()) { + if(!network()->isChannelName(params[0]) && !network()->isMyNick(params[0])) + params.prepend(bufferInfo.bufferName()); + if(network()->isMyNick(params[0]) && params.count() == 2) + network()->updateIssuedModes(params[1]); + if(params[0] == "-reset" && params.count() == 1) { + // FIXME: give feedback to the user (I don't want to add new strings right now) + network()->resetPersistentModes(); + return; + } + } // TODO handle correct encoding for buffer modes (channelEncode()) emit putCmd("MODE", serverEncode(params)); @@ -418,7 +444,7 @@ void CoreUserInputHandler::handleWhowas(const BufferInfo &bufferInfo, const QStr void CoreUserInputHandler::defaultHandler(QString cmd, const BufferInfo &bufferInfo, const QString &msg) { Q_UNUSED(bufferInfo); - emit putCmd(serverEncode(cmd.toUpper()), serverEncode(msg)); + emit putCmd(serverEncode(cmd.toUpper()), serverEncode(msg.split(" "))); } void CoreUserInputHandler::putPrivmsg(const QByteArray &target, const QByteArray &message) {