author | skyhusker <skyhusker> | 2005-01-16 02:14:38 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-01-16 02:14:38 (UTC) |
commit | 986280fcb93a2c9550aa83a3109deb885ce50e8f (patch) (side-by-side diff) | |
tree | d507028d909e7e7f1703aa80b3b2d7201573bd93 | |
parent | e420e24bb1506e313cc38174111d424ba7274e33 (diff) | |
download | opie-986280fcb93a2c9550aa83a3109deb885ce50e8f.zip opie-986280fcb93a2c9550aa83a3109deb885ce50e8f.tar.gz opie-986280fcb93a2c9550aa83a3109deb885ce50e8f.tar.bz2 |
Fixed a bug in nickname handling with networks using nickname:password for auth
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index fde156c..cfad2c1 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp @@ -66,20 +66,20 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = { { 377, "%1", "1", 0 }, // RPL_MOTD2 { 378, "%1", "1", 0 }, // RPL_MOTD3 { 391, QT_TR_NOOP("Time on server %1 is %2"), "1,2", 0 }, // RPL_TIME { 401, QT_TR_NOOP("Channel or nick %1 doesn't exists"), "1", 0 }, // ERR_NOSUCHNICK { 406, QT_TR_NOOP("There is no history information for %1"), "1" }, // ERR_WASNOSUCHNICK { 409, "%1", "1", 0 }, // ERR_NOORIGIN { 411, "%1", "1", 0 }, // ERR_NORECIPIENT { 412, "%1", "1", 0 }, // ERR_NOTEXTTOSEND - { 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_NOMOTD - { 422, QT_TR_NOOP("You're not on channel %1"), "1", 0}, // ERR_NOTONCHANNEL + { 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_ERR_UNKNOWNCOMMAND { 422, "%1", "1", 0 }, // ERR_NOMOTD { 433, QT_TR_NOOP("Can't change nick to %1: %2"), "1,2", FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE + { 442, QT_TR_NOOP("You're not on channel %1"), "1", 0}, // ERR_NOTONCHANNEL { 477, "%1", "1", 0 }, // ERR_NOCHANMODES || ERR_NEEDREGGEDNICK { 482, QT_TR_NOOP("[%1] Operation not permitted, you don't have enough channel privileges"), "1", 0 }, //ERR_CHANOPRIVSNEEDED { 0, 0, 0, 0 } }; IRCMessageParser::IRCMessageParser(IRCSession *session) { m_session = session; @@ -131,16 +131,20 @@ void IRCMessageParser::parseNumerical(IRCMessage *message, int position) { } if(numericalParserProcTable[position].proc) (this->*(numericalParserProcTable[position].proc))(message); } void IRCMessageParser::parseNumericalServerName(IRCMessage *message) { emit outputReady(IRCOutput(OUTPUT_TITLE, tr("Connected to")+" <b>" + message->prefix() + "</b>")); + /* Register EFFECTIVE nickname, some networks (as irc-hispano) uses nick:password + * for authentication and the parser gets confused */ + m_session->m_server->setNick(message->param(0)); + } void IRCMessageParser::parseNumericalServerFeatures(IRCMessage *message) { m_session->setValidUsermodes(message->param(2)); m_session->setValidChannelmodes(message->param(3)); } @@ -244,35 +248,39 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { if (!person) { /* Person not yet known, create and add to the current session */ person = new IRCPerson(message->prefix()); m_session->addPerson(person); } IRCOutput output(OUTPUT_QUERYPRIVMSG, message->param(1)); output.addParam(person); emit outputReady(output); - } else if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') { - /* IRC Channel message detected, verify sender, channel and display it */ - IRCChannel *channel = m_session->getChannel(message->param(0).lower()); - if (channel) { - IRCPerson mask(message->prefix()); - IRCChannelPerson *person = channel->getPerson(mask.nick()); - if (person) { - IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1)); - output.addParam(channel); - output.addParam(person); - emit outputReady(output); - } else { - emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); + } + else + if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') { + /* IRC Channel message detected, verify sender, channel and display it */ + IRCChannel *channel = m_session->getChannel(message->param(0).lower()); + if (channel) { + IRCPerson mask(message->prefix()); + IRCChannelPerson *person = channel->getPerson(mask.nick()); + if (person) { + IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1)); + output.addParam(channel); + output.addParam(person); + emit outputReady(output); + } + else { + emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); + } + } + else { + emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) )); } - } else { - emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) )); - } - } else { - emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); + } + else {emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); } } void IRCMessageParser::parseLiteralNick(IRCMessage *message) { IRCPerson mask(message->prefix()); m_session->updateNickname(mask.nick(), message->param(0)); /* this way of handling nick changes really sucks if (mask.nick() == m_session->m_server->nick()) { |