X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoreuserinputhandler.cpp;h=3184f2533d348d66083789603ae523980b83ce39;hp=ecff7ef835cf5464fe3377b3622064e7cb65738b;hb=0f667b4d2fb9a34b8ebbfe1d07b47407ce54468a;hpb=77176474b628e801ba94d9d50d0d961a12aa01c4 diff --git a/src/core/coreuserinputhandler.cpp b/src/core/coreuserinputhandler.cpp index ecff7ef8..3184f253 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"); }