summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index 6b88f34..400ff41 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -207,6 +207,7 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
- IRCPerson mask(message->prefix());
+ IRCPerson mask(message->prefix());
+ /* this way of handling nick changes really sucks */
if (mask.nick() == m_session->m_server->nick()) {
/* We are changing our nickname */
@@ -219,7 +220,20 @@ void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
IRCPerson *person = m_session->getPerson(mask.nick());
if (person) {
+ //IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0)));
+
+ /* new code starts here -- this removes the person from all channels */
+ QList<IRCChannel> channels;
+ m_session->getChannelsByPerson(person, channels);
+ QListIterator<IRCChannel> it(channels);
+ for (;it.current(); ++it) {
+ IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick());
+ it.current()->removePerson(chanperson);
+ chanperson->person->setNick(message->param(0));
+ it.current()->addPerson(chanperson);
IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0 )));
output.addParam(person);
emit outputReady(output);
+ }
+ /* new code ends here */
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person")));
@@ -398,4 +412,5 @@ void IRCMessageParser::parseLiteralKick(IRCMessage *message) {
emit outputReady(output);
} else {
+ /* someone else got kicked */
channel->removePerson(person);
IRCOutput output(OUTPUT_OTHERKICK, person->person->nick() + tr(" was kicked from ") + channel->channelname() + tr(" by ") + mask.nick()+ " (" + message->param(2) + ")");