X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fuserinputhandler.cpp;h=8fe87b0396a5a6fc74bc1c75ec2bee898621f997;hp=ae504a9bf6508f2f7726c66cbf958392d43edceb;hb=35e22cad1de9084bc3ddf664bc43e5a620adf1ae;hpb=f824db0e31b54969e0b7fa0b5405b1e9173d482c diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index ae504a9b..8fe87b03 100644 --- a/src/core/userinputhandler.cpp +++ b/src/core/userinputhandler.cpp @@ -63,8 +63,12 @@ void UserInputHandler::handleAway(const BufferInfo &bufferInfo, const QString &m // if there is no message supplied we have to check if we are already away or not if(msg.isEmpty()) { - if(me && !me->isAway()) + if(me && !me->isAway()) { awayMsg = network()->identityPtr()->awayReason(); + if(awayMsg.isEmpty()) { + awayMsg = tr("away"); + } + } } if(me) me->setAwayMessage(awayMsg); @@ -104,7 +108,11 @@ void UserInputHandler::banOrUnban(const BufferInfo &bufferInfo, const QString &m return; } - if(generalizedHost.lastIndexOf(".") != -1 && generalizedHost.lastIndexOf(".", generalizedHost.lastIndexOf(".")-1) != -1) { + static QRegExp ipAddress("\\d+\\.\\d+\\.\\d+\\.\\d+"); + if(ipAddress.exactMatch(generalizedHost)) { + int lastDotPos = generalizedHost.lastIndexOf('.') + 1; + generalizedHost.replace(lastDotPos, generalizedHost.length() - lastDotPos, '*'); + } else if(generalizedHost.lastIndexOf(".") != -1 && generalizedHost.lastIndexOf(".", generalizedHost.lastIndexOf(".")-1) != -1) { int secondLastPeriodPosition = generalizedHost.lastIndexOf(".", generalizedHost.lastIndexOf(".")-1); generalizedHost.replace(0, secondLastPeriodPosition, "*"); } @@ -317,12 +325,7 @@ void UserInputHandler::handleQuit(const BufferInfo &bufferInfo, const QString &m } void UserInputHandler::issueQuit(const QString &reason) { - QString quitReason; - if(reason.isEmpty()) - quitReason = network()->identityPtr()->quitReason(); - else - quitReason = reason; - emit putCmd("QUIT", serverEncode(quitReason)); + emit putCmd("QUIT", serverEncode(reason)); } void UserInputHandler::handleQuote(const BufferInfo &bufferInfo, const QString &msg) {