X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fircserverhandler.cpp;h=93076ec50ea43b0787bb74631e625445c0966de2;hp=5484d3b4e2ba4eefbe77e8967cca935a945aaf3f;hb=034708a59ca1ee3195263a90941a2b145c520fef;hpb=e128a8ef50a0a3fce1d75d7d06121b2ea6c74d6a diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index 5484d3b4..93076ec5 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -48,7 +48,7 @@ IrcServerHandler::~IrcServerHandler() { void IrcServerHandler::handleServerMsg(QByteArray msg) { try { if(msg.isEmpty()) { - quWarning() << "Received empty string from server!"; + qWarning() << "Received empty string from server!"; return; } @@ -68,7 +68,7 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) { QList params = msg.split(' '); if(!trailing.isEmpty()) params << trailing; if(params.count() < 1) { - quWarning() << "Received invalid string from server!"; + qWarning() << "Received invalid string from server!"; return; } @@ -79,7 +79,7 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) { foo.remove(0, 1); prefix = foo; if(params.count() < 1) { - quWarning() << "Received invalid string from server!"; + qWarning() << "Received invalid string from server!"; return; } foo = serverDecode(params.takeFirst()); @@ -92,7 +92,7 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) { uint num = cmd.toUInt(); if(num > 0) { if(params.count() == 0) { - quWarning() << "Message received from server violates RFC and is ignored!"; + qWarning() << "Message received from server violates RFC and is ignored!"; return; } params.removeFirst(); @@ -244,7 +244,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList else channel->removeUserMode(ircUser, QString(modes[c])); } else { - quWarning() << "Received MODE with too few parameters:" << serverDecode(params); + qWarning() << "Received MODE with too few parameters:" << serverDecode(params); } paramOffset++; } else { @@ -255,7 +255,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList if(paramOffset < params.count()) { value = params[paramOffset]; } else { - quWarning() << "Received MODE with too few parameters:" << serverDecode(params); + qWarning() << "Received MODE with too few parameters:" << serverDecode(params); } paramOffset++; } @@ -304,7 +304,7 @@ void IrcServerHandler::handleNick(const QString &prefix, const QList IrcUser *ircuser = network()->updateNickFromMask(prefix); if(!ircuser) { - quWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!"; + qWarning() << "IrcServerHandler::handleNick(): Unknown IrcUser!"; return; } QString newnick = serverDecode(params[0]); @@ -341,7 +341,7 @@ void IrcServerHandler::handlePart(const QString &prefix, const QList IrcUser *ircuser = network()->updateNickFromMask(prefix); QString channel = serverDecode(params[0]); if(!ircuser) { - quWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!"; + qWarning() << "IrcServerHandler::handlePart(): Unknown IrcUser!"; return; } @@ -383,12 +383,12 @@ void IrcServerHandler::handlePrivmsg(const QString &prefix, const QListupdateNickFromMask(prefix); if(!ircuser) { - quWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!"; + qWarning() << "IrcServerHandler::handlePrivmsg(): Unknown IrcUser!"; return; } if(params.isEmpty()) { - quWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix; + qWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix; return; } @@ -810,7 +810,10 @@ void IrcServerHandler::handle331(const QString &prefix, const QList return; QString channel = serverDecode(params[0]); - network()->ircChannel(channel)->setTopic(QString()); + IrcChannel *chan = network()->ircChannel(channel); + if(chan) + chan->setTopic(QString()); + emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("No topic is set for %1.").arg(channel)); } @@ -822,7 +825,10 @@ void IrcServerHandler::handle332(const QString &prefix, const QList QString channel = serverDecode(params[0]); QString topic = channelDecode(channel, params[1]); - network()->ircChannel(channel)->setTopic(topic); + IrcChannel *chan = network()->ircChannel(channel); + if(chan) + chan->setTopic(topic); + emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Topic for %1 is \"%2\"").arg(channel, topic)); } @@ -864,7 +870,7 @@ void IrcServerHandler::handle352(const QString &prefix, const QList /* RPL_NAMREPLY */ void IrcServerHandler::handle353(const QString &prefix, const QList ¶ms) { Q_UNUSED(prefix); - if(!checkParamCount("IrcServerHandler::handle353()", params, 2)) + if(!checkParamCount("IrcServerHandler::handle353()", params, 3)) return; // param[0] is either "=", "*" or "@" indicating a public, private or secret channel @@ -873,7 +879,7 @@ void IrcServerHandler::handle353(const QString &prefix, const QList IrcChannel *channel = network()->ircChannel(channelname); if(!channel) { - quWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname; + qWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname; return; } @@ -957,7 +963,7 @@ void IrcServerHandler::tryNextNick(const QString &errnick) { bool IrcServerHandler::checkParamCount(const QString &methodName, const QList ¶ms, int minParams) { if(params.count() < minParams) { - quWarning() << qPrintable(methodName) << "requires" << minParams << "parameters but received only" << params.count() << serverDecode(params); + qWarning() << qPrintable(methodName) << "requires" << minParams << "parameters but received only" << params.count() << serverDecode(params); return false; } else { return true;