X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Feventstringifier.cpp;h=c301dbf989fa3516ae18800b594a9c28da3c6402;hp=94c967de89433dba323eff4dd323993c04bba898;hb=712781ef33198acb7267e02ee6f8f9bfc8598d5a;hpb=5ff4265bbd3a682a6d6542480760eaf4a2b85d77 diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index 94c967de..c301dbf9 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -64,6 +64,19 @@ bool EventStringifier::checkParamCount(IrcEvent *e, int minParams) { return true; } +/* These are only for legacy reasons; remove as soon as we handle NetworkSplitEvents properly */ +void EventStringifier::processNetworkSplitJoin(NetworkSplitEvent *e) { + QString msg = e->users().join("#:#") + "#:#" + e->quitMessage(); + displayMsg(e, Message::NetsplitJoin, msg, QString(), e->channel()); +} + +void EventStringifier::processNetworkSplitQuit(NetworkSplitEvent *e) { + QString msg = e->users().join("#:#") + "#:#" + e->quitMessage(); + displayMsg(e, Message::NetsplitQuit, msg, QString(), e->channel()); +} + +/* End legacy */ + void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) { //qDebug() << e->number(); switch(e->number()) { @@ -105,11 +118,11 @@ void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) { } // Ignore these commands. - case 321: case 366: case 376: + case 321: case 353: case 366: case 376: break; // CAP stuff - case 903: case 904: case 905: case 906: case 907: + case 900: case 903: case 904: case 905: case 906: case 907: { displayMsg(e, Message::Info, "CAP: " + e->params().join("")); break; @@ -134,7 +147,17 @@ void EventStringifier::processIrcEventInvite(IrcEvent *e) { displayMsg(e, Message::Invite, tr("%1 invited you to channel %2").arg(e->nick(), e->params().at(1))); } -void EventStringifier::earlyProcessIrcEventKick(IrcEvent *e) { +void EventStringifier::processIrcEventJoin(IrcEvent *e) { + if(e->testFlag(EventManager::Netsplit)) + return; + + displayMsg(e, Message::Join, e->params()[0], e->prefix(), e->params()[0]); +} + +void EventStringifier::processIrcEventKick(IrcEvent *e) { + if(!checkParamCount(e, 2)) + return; + IrcUser *victim = e->network()->ircUser(e->params().at(1)); if(victim) { QString channel = e->params().at(0); @@ -146,8 +169,19 @@ void EventStringifier::earlyProcessIrcEventKick(IrcEvent *e) { } } +void EventStringifier::processIrcEventMode(IrcEvent *e) { + if(e->network()->isChannelName(e->params().first())) { + // Channel Modes + displayMsg(e, Message::Mode, e->params().join(" "), e->prefix(), e->params().first()); + } else { + // User Modes + // FIXME: redirect + displayMsg(e, Message::Mode, e->params().join(" "), e->prefix()); + } +} + // this needs to be called before the ircuser is renamed! -void EventStringifier::earlyProcessIrcEventNick(IrcEvent *e) { +void EventStringifier::processIrcEventNick(IrcEvent *e) { if(!checkParamCount(e, 1)) return; @@ -165,7 +199,7 @@ void EventStringifier::earlyProcessIrcEventNick(IrcEvent *e) { displayMsg(e, Message::Nick, newnick, sender, channel); } -void EventStringifier::earlyProcessIrcEventPart(IrcEvent *e) { +void EventStringifier::processIrcEventPart(IrcEvent *e) { if(!checkParamCount(e, 1)) return; @@ -182,6 +216,18 @@ void EventStringifier::processIrcEventPong(IrcEvent *e) { displayMsg(e, Message::Server, "PONG " + e->params().join(" "), e->prefix()); } +void EventStringifier::processIrcEventQuit(IrcEvent *e) { + if(e->testFlag(EventManager::Netsplit)) + return; + + IrcUser *ircuser = e->network()->updateNickFromMask(e->prefix()); + if(!ircuser) + return; + + foreach(const QString &channel, ircuser->channels()) + displayMsg(e, Message::Quit, e->params().count()? e->params().first() : QString(), e->prefix(), channel); +} + void EventStringifier::processIrcEventTopic(IrcEvent *e) { displayMsg(e, Message::Topic, tr("%1 has changed topic for %2 to: \"%3\"") .arg(e->nick(), e->params().at(0), e->params().at(1)), QString(), e->params().at(0)); @@ -350,6 +396,11 @@ void EventStringifier::processIrcEvent323(IrcEvent *e) { displayMsg(e, Message::Server, tr("End of channel list")); } +/* RPL_CHANNELMODEIS - " " */ +void EventStringifier::processIrcEvent324(IrcEvent *e) { + processIrcEventMode(e); +} + /* RPL_??? - " */ void EventStringifier::processIrcEvent328(IrcEvent *e) { if(!checkParamCount(e, 2)) @@ -424,6 +475,21 @@ void EventStringifier::processIrcEvent369(IrcEvent *e) { displayMsg(e, Message::Server, tr("End of /WHOWAS")); } +/* ERR_ERRONEUSNICKNAME */ +void EventStringifier::processIrcEvent432(IrcEvent *e) { + displayMsg(e, Message::Error, tr("Nick %1 contains illegal characters").arg(e->params()[0])); +} + +/* ERR_NICKNAMEINUSE */ +void EventStringifier::processIrcEvent433(IrcEvent *e) { + displayMsg(e, Message::Error, tr("Nick already in use: %1").arg(e->params()[0])); +} + +/* ERR_UNAVAILRESOURCE */ +void EventStringifier::processIrcEvent437(IrcEvent *e) { + displayMsg(e, Message::Error, tr("Nick/channel is temporarily unavailable: %1").arg(e->params()[0])); +} + // template /*