X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fuserinputhandler.cpp;h=e0449befb1c9516e880fe301dd402384203f2af9;hb=ea248ff3a7e04256cb97cdc37caa526e9707ae13;hp=4b4c079659112e4cfd33719181e4399084f147af;hpb=0d2e5ff7439fe7bf9f24f1f55763881382ecb12a;p=quassel.git diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index 4b4c0796..e0449bef 100644 --- a/src/core/userinputhandler.cpp +++ b/src/core/userinputhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -104,7 +104,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 +321,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) { @@ -504,7 +503,14 @@ void UserInputHandler::timerEvent(QTimerEvent *event) { QObject::timerEvent(event); return; } - Command command = _delayedCommands.take(event->timerId()); + BufferInfo bufferInfo = _delayedCommands[event->timerId()].bufferInfo; + QString rawCommand = _delayedCommands[event->timerId()].command; + _delayedCommands.remove(event->timerId()); event->accept(); - handleUserInput(command.bufferInfo, command.command); + + // the stored command might be the result of an alias expansion, so we need to split it up again + QStringList commands = rawCommand.split(QRegExp("; ?")); + foreach(QString command, commands) { + handleUserInput(bufferInfo, command); + } }