X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresessioneventprocessor.cpp;h=7a44fd0ffad83f56873c8d3d07c2811d4aed1064;hp=2147071e55a6ce955984c16be93797dd78fcca65;hb=46984aca05b2d5f8dddd0c8739e60a1753078123;hpb=96cd8441f9ab217b1d3c2ba0f2899ef64ca781e4;ds=sidebyside diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 2147071e..7a44fd0f 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -58,6 +58,39 @@ void CoreSessionEventProcessor::processIrcEventNumeric(IrcEventNumeric *e) { } } +void CoreSessionEventProcessor::processIrcEventAuthenticate(IrcEvent *e) { + if(!checkParamCount(e, 1)) + return; + + if(e->params().at(0) != "+") { + qWarning() << "Invalid AUTHENTICATE" << e; + return; + } + + CoreNetwork *net = coreNetwork(e); + + QString construct = net->saslAccount(); + construct.append(QChar(QChar::Null)); + construct.append(net->saslAccount()); + construct.append(QChar(QChar::Null)); + construct.append(net->saslPassword()); + QByteArray saslData = QByteArray(construct.toAscii().toBase64()); + saslData.prepend("AUTHENTICATE "); + net->putRawLine(saslData); +} + +void CoreSessionEventProcessor::processIrcEventCap(IrcEvent *e) { + // for SASL, there will only be a single param of 'sasl', however you can check here for + // additional CAP messages (ls, multi-prefix, et cetera). + + if(e->params().count() == 3) { + if(e->params().at(2) == "sasl") { + // FIXME use event + coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE PLAIN")); // Only working with PLAIN atm, blowfish later + } + } +} + void CoreSessionEventProcessor::processIrcEventInvite(IrcEvent *e) { if(checkParamCount(e, 2)) { e->network()->updateNickFromMask(e->prefix()); @@ -106,3 +139,41 @@ void CoreSessionEventProcessor::processIrcEventPart(IrcEvent *e) { qobject_cast(e->network())->setChannelParted(channel); } } + +void CoreSessionEventProcessor::processIrcEventPong(IrcEvent *e) { + // the server is supposed to send back what we passed as param. and we send a timestamp + // but using quote and whatnought one can send arbitrary pings, so we have to do some sanity checks + if(checkParamCount(e, 2)) { + QString timestamp = e->params().at(1); + QTime sendTime = QTime::fromString(timestamp, "hh:mm:ss.zzz"); + if(sendTime.isValid()) + e->network()->setLatency(sendTime.msecsTo(QTime::currentTime()) / 2); + } +} + +void CoreSessionEventProcessor::processIrcEventTopic(IrcEvent *e) { + if(checkParamCount(e, 2)) { + e->network()->updateNickFromMask(e->prefix()); + IrcChannel *channel = e->network()->ircChannel(e->params().at(0)); + if(channel) + channel->setTopic(e->params().at(1)); + } +} + +/* RPL_WELCOME */ +void CoreSessionEventProcessor::processIrcEvent001(IrcEvent *e) { + if(!checkParamCount(e, 1)) + return; + + QString myhostmask = e->params().at(0).section(' ', -1, -1); + e->network()->setCurrentServer(e->prefix()); + e->network()->setMyNick(nickFromMask(myhostmask)); +} + +/* template +void CoreSessionEventProcessor::processIrcEvent(IrcEvent *e) { + if(!checkParamCount(e, 1)) + return; + +} +*/