From: Alexander von Renteln Date: Fri, 1 Feb 2008 21:09:05 +0000 (+0000) Subject: beautyfied the code in userinputhandler::handlectcp X-Git-Tag: 0.2.0-alpha1~146 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5c00beb706c7761d19f9a6b86751193056086b4a beautyfied the code in userinputhandler::handlectcp added ctcp version and ping response answers - although they are not being called yet modified version.inc for the second time --- diff --git a/src/core/ctcphandler.cpp b/src/core/ctcphandler.cpp index e1f4dc84..26697f82 100644 --- a/src/core/ctcphandler.cpp +++ b/src/core/ctcphandler.cpp @@ -138,6 +138,9 @@ void CtcpHandler::handlePing(CtcpType ctcptype, QString prefix, QString target, emit displayMsg(Message::Server, "", tr("Received CTCP PING request from %1").arg(prefix)); } else { // display ping answer + uint now = QDateTime::currentDateTime().toTime_t(); + uint then = QDateTime().fromTime_t(param.toInt()).toTime_t(); + emit displayMsg(Message::Server, "", tr("Received CTCP PING answer from %1 with %2 seconds round trip time").arg(prefix).arg(now-then)); } } @@ -148,7 +151,8 @@ void CtcpHandler::handleVersion(CtcpType ctcptype, QString prefix, QString targe reply(nickFromMask(prefix), "VERSION", QString("Quassel IRC (Pre-Release) - http://www.quassel-irc.org")); emit displayMsg(Message::Server, "", tr("Received CTCP VERSION request by %1").arg(prefix)); } else { - // TODO display Version answer + // display Version answer + emit displayMsg(Message::Server, "", tr("Received CTCP VERSION answer from %1: %2").arg(prefix).arg(param)); } } diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index 9007b0f4..b4a74aee 100644 --- a/src/core/userinputhandler.cpp +++ b/src/core/userinputhandler.cpp @@ -67,20 +67,18 @@ void UserInputHandler::handleBan(QString bufname, QString msg) { } void UserInputHandler::handleCtcp(QString bufname, QString msg) { - QStringList params = msg.split(" ", QString::SkipEmptyParts); - if (params.size() != 2) { - // qDebug() << "Ctcp-Request-Error: not exactly two parameters ->" << msg; - return; - } - params[1] = params[1].toUpper(); - QString verboseMessage = tr("sending CTCP-%1-request").arg(params[1]); - if(params[1] == "PING") { + QString nick = msg.section(' ', 0, 0); + QString ctcpTag = msg.section(' ', 1, 1).toUpper(); + if (ctcpTag.isEmpty()) return; + QString message = ""; + QString verboseMessage = tr("sending CTCP-%1-request").arg(ctcpTag); + + if(ctcpTag == "PING") { uint now = QDateTime::currentDateTime().toTime_t(); - params.append(QString::number(now)); - } else { - params.append(""); + message = QString::number(now); } - server->ctcpHandler()->query(params[0], params[1], params[2]); + + server->ctcpHandler()->query(nick, ctcpTag, message); emit displayMsg(Message::Action, "", verboseMessage, network()->myNick()); } diff --git a/version.inc b/version.inc index 18315ef8..833ddf35 100644 --- a/version.inc +++ b/version.inc @@ -5,7 +5,7 @@ quasselVersion = "0.2.0-pre"; quasselDate = "2008-02-01"; - quasselBuild = 431; + quasselBuild = 433; //! Minimum client build number the core needs clientBuildNeeded = 428;