summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmessageparser.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircmessageparser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp23
1 files changed, 19 insertions, 4 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
@@ -203,27 +203,41 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
}
}
void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
+
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 */
m_session->m_server->setNick(message->param(0));
IRCOutput output(OUTPUT_NICKCHANGE, tr("You are now known as %1").arg( message->param(0)));
output.addParam(0);
emit outputReady(output);
} else {
/* Someone else is */
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 )));
- output.addParam(person);
- emit outputReady(output);
+ //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")));
}
}
}
@@ -394,12 +408,13 @@ void IRCMessageParser::parseLiteralKick(IRCMessage *message) {
if (person->person->nick() == m_session->m_server->nick()) {
m_session->removeChannel(channel);
IRCOutput output(OUTPUT_SELFKICK, tr("You were kicked from ") + channel->channelname() + tr(" by ") + mask.nick() + " (" + message->param(2) + ")");
output.addParam(channel);
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) + ")");
output.addParam(channel);
output.addParam(person);
emit outputReady(output);
}