X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fctcphandler.cpp;h=26697f8206f53e20974b1dcba6c6d86de6aa217e;hp=f902baab6fa7ebecc86d414922e0f487c4d6289b;hb=5c00beb706c7761d19f9a6b86751193056086b4a;hpb=fd7c2c4a41b5bb9cffcfe7a8f86a28ab7f38ac27 diff --git a/src/core/ctcphandler.cpp b/src/core/ctcphandler.cpp index f902baab..26697f82 100644 --- a/src/core/ctcphandler.cpp +++ b/src/core/ctcphandler.cpp @@ -48,7 +48,7 @@ QString CtcpHandler::dequote(QString message) { if(i+1 < message.size()) { for(ctcpquote = ctcpMDequoteHash.begin(); ctcpquote != ctcpMDequoteHash.end(); ++ctcpquote) { if(message.mid(i,2) == ctcpquote.key()) { - dequotedMessage += ctcpquote.value(); + messagepart = ctcpquote.value(); i++; break; } @@ -90,7 +90,8 @@ QStringList CtcpHandler::parse(CtcpType ctcptype, QString prefix, QString target // extract tagged / extended data while(dequotedMessage.contains(XDELIM)) { - messages << dequotedMessage.section(XDELIM,0,0); + if(dequotedMessage.indexOf(XDELIM) > 0) + messages << dequotedMessage.section(XDELIM,0,0); ctcp = XdelimDequote(dequotedMessage.section(XDELIM,1,1)); dequotedMessage = dequotedMessage.section(XDELIM,2,2); @@ -126,29 +127,39 @@ void CtcpHandler::reply(QString bufname, QString ctcpTag, QString message) { // CTCP HANDLER //******************************/ void CtcpHandler::handleAction(CtcpType ctcptype, QString prefix, QString target, QString param) { + Q_UNUSED(ctcptype) emit displayMsg(Message::Action, target, param, prefix); } void CtcpHandler::handlePing(CtcpType ctcptype, QString prefix, QString target, QString param) { + Q_UNUSED(target) if(ctcptype == CtcpQuery) { reply(nickFromMask(prefix), "PING", param); 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)); } } void CtcpHandler::handleVersion(CtcpType ctcptype, QString prefix, QString target, QString param) { + Q_UNUSED(target) if(ctcptype == CtcpQuery) { // FIXME use real Info about quassel :) 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)); } } void CtcpHandler::defaultHandler(QString cmd, CtcpType ctcptype, QString prefix, QString target, QString param) { + Q_UNUSED(ctcptype); + Q_UNUSED(target); + Q_UNUSED(param); emit displayMsg(Message::Error, "", tr("Received unknown CTCP %1 by %2").arg(cmd).arg(prefix)); }