X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresessioneventprocessor.cpp;h=2147071e55a6ce955984c16be93797dd78fcca65;hp=85995247150eea99f12f7225e6fde60cd386453e;hb=d60c5028b49a95d3c27c35b2ea1d74cdd7bb0e46;hpb=32023e27e875eede980d7323c1d05b5d4cc795d8;ds=sidebyside diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index 85995247..2147071e 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -57,3 +57,52 @@ void CoreSessionEventProcessor::processIrcEventNumeric(IrcEventNumeric *e) { break; } } + +void CoreSessionEventProcessor::processIrcEventInvite(IrcEvent *e) { + if(checkParamCount(e, 2)) { + e->network()->updateNickFromMask(e->prefix()); + } +} + +void CoreSessionEventProcessor::processIrcEventKick(IrcEvent *e) { + if(checkParamCount(e, 2)) { + e->network()->updateNickFromMask(e->prefix()); + IrcUser *victim = e->network()->ircUser(e->params().at(1)); + if(victim) { + victim->partChannel(e->params().at(0)); + //if(e->network()->isMe(victim)) e->network()->setKickedFromChannel(channel); + } + } +} + +void CoreSessionEventProcessor::processIrcEventNick(IrcEvent *e) { + if(checkParamCount(e, 1)) { + IrcUser *ircuser = e->network()->updateNickFromMask(e->prefix()); + if(!ircuser) { + qWarning() << Q_FUNC_INFO << "Unknown IrcUser!"; + return; + } + QString newnick = e->params().at(0); + QString oldnick = ircuser->nick(); + + // the order is cruicial + // otherwise the client would rename the buffer, see that the assigned ircuser doesn't match anymore + // and remove the ircuser from the querybuffer leading to a wrong on/offline state + ircuser->setNick(newnick); + coreSession()->renameBuffer(e->networkId(), newnick, oldnick); + } +} + +void CoreSessionEventProcessor::processIrcEventPart(IrcEvent *e) { + if(checkParamCount(e, 1)) { + IrcUser *ircuser = e->network()->updateNickFromMask(e->prefix()); + if(!ircuser) { + qWarning() << Q_FUNC_INFO<< "Unknown IrcUser!"; + return; + } + QString channel = e->params().at(0); + ircuser->partChannel(channel); + if(e->network()->isMe(ircuser)) + qobject_cast(e->network())->setChannelParted(channel); + } +}