X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fircserverhandler.cpp;h=ae92b0935d8efade3d1c1f6203838412b0626b77;hp=05fe413db2fee414bdb4927a94ad88b83f6de178;hb=56607f81246f04db3a0e71c9a8757d7f75d6cfcf;hpb=40b2631f91d4ed5f8361292decf40a92b3d37e1f diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index 05fe413d..ae92b093 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -136,7 +136,7 @@ void IrcServerHandler::defaultHandler(QString cmd, const QString &prefix, const break; } // Server error messages which will be displayed with a colon between the first param and the rest - case 413: case 414: case 423: case 441: case 444: case 461: + case 413: case 414: case 423: case 441: case 444: case 461: // FIXME see below for the 47x codes case 467: case 471: case 473: case 474: case 475: case 476: case 477: case 478: case 482: case 436: // ERR_NICKCOLLISION { QString p = params.takeFirst(); @@ -162,19 +162,20 @@ void IrcServerHandler::defaultHandler(QString cmd, const QString &prefix, const // IRC SERVER HANDLER //******************************/ void IrcServerHandler::handleJoin(const QString &prefix, const QList ¶ms) { - Q_ASSERT(params.count() == 1); + if(params.count() < 1) return; QString channel = serverDecode(params[0]); IrcUser *ircuser = network()->updateNickFromMask(prefix); emit displayMsg(Message::Join, BufferInfo::ChannelBuffer, channel, channel, prefix); //qDebug() << "IrcServerHandler::handleJoin()" << prefix << params; ircuser->joinChannel(channel); + if(network()->isMe(ircuser)) networkConnection()->setChannelJoined(channel); } void IrcServerHandler::handleKick(const QString &prefix, const QList ¶ms) { network()->updateNickFromMask(prefix); IrcUser *victim = network()->ircUser(params[1]); + if(!victim) return; QString channel = serverDecode(params[0]); - Q_ASSERT(victim); victim->partChannel(channel); @@ -185,6 +186,7 @@ void IrcServerHandler::handleKick(const QString &prefix, const QList msg = victim->nick(); emit displayMsg(Message::Kick, BufferInfo::ChannelBuffer, channel, msg, prefix); + //if(network()->isMe(victim)) networkConnection()->setKickedFromChannel(channel); } void IrcServerHandler::handleMode(const QString &prefix, const QList ¶ms) { @@ -202,7 +204,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList // This cannot be fixed unless the SignalProxy() doesn't rely on methodIds anymore QString modes = params[1]; bool add = true; - int modeIndex = 0; + int modeIndex = 2; for(int c = 0; c < modes.length(); c++) { if(modes[c] == '+') { add = true; @@ -241,6 +243,8 @@ void IrcServerHandler::handleNick(const QString &prefix, const QList ? newnick : prefix; + + emit nickChanged(newnick, oldnick); foreach(QString channel, ircuser->channels()) emit displayMsg(Message::Nick, BufferInfo::ChannelBuffer, channel, newnick, sender); @@ -274,6 +278,7 @@ void IrcServerHandler::handlePart(const QString &prefix, const QList msg = userDecode(ircuser->nick(), params[1]); emit displayMsg(Message::Part, BufferInfo::ChannelBuffer, channel, msg, prefix); + if(network()->isMe(ircuser)) networkConnection()->setChannelParted(channel); } void IrcServerHandler::handlePing(const QString &prefix, const QList ¶ms) { @@ -307,7 +312,7 @@ void IrcServerHandler::handlePrivmsg(const QString &prefix, const QList ¶ms) { IrcUser *ircuser = network()->updateNickFromMask(prefix); - Q_ASSERT(ircuser); + if(!ircuser) return; QString msg; if(params.count()) @@ -321,9 +326,10 @@ void IrcServerHandler::handleQuit(const QString &prefix, const QList void IrcServerHandler::handleTopic(const QString &prefix, const QList ¶ms) { IrcUser *ircuser = network()->updateNickFromMask(prefix); + if(!ircuser) return; QString channel = serverDecode(params[0]); - QString topic = channelDecode(channel, params[1]); - Q_ASSERT(ircuser); + QString topic; + if(params.count() >= 2) topic = channelDecode(channel, params[1]); network()->ircChannel(channel)->setTopic(topic); @@ -458,7 +464,9 @@ void IrcServerHandler::handle314(const QString &prefix, const QList /* RPL_ENDOFWHO: " :End of WHO list" */ void IrcServerHandler::handle315(const QString &prefix, const QList ¶ms) { Q_UNUSED(prefix) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); + // FIXME temporarily made silent + Q_UNUSED(params) + // emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); } /* RPL_WHOISIDLE - " :seconds idle" @@ -533,7 +541,8 @@ void IrcServerHandler::handle352(const QString &prefix, const QList ircuser->setRealName(serverDecode(params.last()).section(" ", 1)); } - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); + // FIXME temporarily made silent + //emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("[Who] %1").arg(serverDecode(params).join(" "))); } /* RPL_NAMREPLY */ @@ -549,6 +558,15 @@ void IrcServerHandler::handle353(const QString &prefix, const QList // we don't use this information at the time beeing QString channelname = serverDecode(params[1]); + IrcChannel *channel = network()->ircChannel(channelname); + if(!channel) { + qWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname; + return; + } + + QStringList nicks; + QStringList modes; + foreach(QString nick, serverDecode(params[2]).split(' ')) { QString mode = QString(); @@ -557,12 +575,11 @@ void IrcServerHandler::handle353(const QString &prefix, const QList nick = nick.mid(1); } - IrcUser *ircuser = network()->newIrcUser(nick); - ircuser->joinChannel(channelname); - - if(!mode.isNull()) - network()->ircChannel(channelname)->addUserMode(ircuser, mode); + nicks << nick; + modes << mode; } + + channel->joinIrcUsers(nicks, modes); } /* RPL_ENDOFWHOWAS - " :End of WHOWAS" */ @@ -606,6 +623,13 @@ void IrcServerHandler::handle433(const QString &prefix, const QList tryNextNick(errnick); } +/* */ + +// FIXME networkConnection()->setChannelKey("") for all ERR replies indicating that a JOIN went wrong +// mostly, these are codes in the 47x range + +/* */ + void IrcServerHandler::tryNextNick(const QString &errnick) { QStringList desiredNicks = networkConnection()->coreSession()->identity(network()->identity())->nicks(); int nextNick = desiredNicks.indexOf(errnick) + 1;