X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Feventstringifier.cpp;h=304e36c5d88fe49e97c95275c827d12c4e0c7170;hp=44528e53e1bd42aff2a5edbfdc3f2f279457e2da;hb=d60c5028b49a95d3c27c35b2ea1d74cdd7bb0e46;hpb=32023e27e875eede980d7323c1d05b5d4cc795d8 diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index 44528e53..304e36c5 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -109,3 +109,48 @@ void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) { } } } + +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) { + IrcUser *victim = e->network()->ircUser(e->params().at(1)); + if(victim) { + QString channel = e->params().at(0); + QString msg = victim->nick(); + if(e->params().count() > 2) + msg += " " + e->params().at(2); + + displayMsg(e, Message::Kick, msg, e->prefix(), channel); + } +} + +// this needs to be called before the ircuser is renamed! +void EventStringifier::earlyProcessIrcEventNick(IrcEvent *e) { + if(e->params().count() < 1) + return; + + 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(); + + QString sender = e->network()->isMyNick(oldnick) ? newnick : e->prefix(); + foreach(const QString &channel, ircuser->channels()) + displayMsg(e, Message::Nick, newnick, sender, channel); +} + +void EventStringifier::earlyProcessIrcEventPart(IrcEvent *e) { + if(e->params().count() < 1) + return; + + QString channel = e->params().at(0); + QString msg = e->params().count() > 1? e->params().at(1) : QString(); + + displayMsg(e, Message::Part, msg, e->prefix(), channel); +}