X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fuserinputhandler.cpp;h=722c3fc41bc3a62793670c0eccf76d3b977fc1ee;hp=de56d85bd94b5f1598fa9526c14577439a96996a;hb=63cd73c7a036ce3c4f6ca7428a7c0939c1640a1e;hpb=1083b65ff728a303caf700adf4179f337c6528fe diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index de56d85b..722c3fc4 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, "*"); }