-void IrcServerHandler::handleNick(const QString &prefix, const QList<QByteArray> ¶ms) {
- if(!checkParamCount("IrcServerHandler::handleNick()", params, 1))
- return;
-
- IrcUser *ircuser = network()->updateNickFromMask(prefix);
- if(!ircuser) {
- qWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!";
- return;
- }
- QString newnick = serverDecode(params[0]);
- QString oldnick = ircuser->nick();
-
- QString sender = network()->isMyNick(oldnick)
- ? newnick
- : prefix;
-
-
- // 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(network()->networkId(), newnick, oldnick);
-
- foreach(QString channel, ircuser->channels())
- emit displayMsg(Message::Nick, BufferInfo::ChannelBuffer, channel, newnick, sender);
-}
-