Monolithic build features now zero setup configuration: click and run
[quassel.git] / src / core / ircserverhandler.cpp
index 7604cd2..5e3be1d 100644 (file)
@@ -216,6 +216,12 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
     emit displayMsg(Message::Mode, BufferInfo::ChannelBuffer, serverDecode(params[0]), serverDecode(params).join(" "), prefix);
 
     IrcChannel *channel = network()->ircChannel(params[0]);
+    if(!channel) {
+      // we received mode information for a channel we're not in. that means probably we've just been kicked out or something like that
+      // anyways: we don't have a place to store the data --> discard the info.
+      return;
+    }
+
     QString modes = params[1];
     bool add = true;
     int paramOffset = 2;
@@ -238,7 +244,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
          else
            channel->removeUserMode(ircUser, QString(modes[c]));
        } else {
-         quWarning() << "Received MODE with too few parameters: " << serverDecode(params);
+         quWarning() << "Received MODE with too few parameters:" << serverDecode(params);
        }
        paramOffset++;
       } else {
@@ -249,7 +255,7 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
            if(paramOffset < params.count()) {
              value = params[paramOffset];
            } else {
-             quWarning() << "Received MODE with too few parameters: " << serverDecode(params);
+             quWarning() << "Received MODE with too few parameters:" << serverDecode(params);
            }
            paramOffset++;
        }
@@ -382,7 +388,7 @@ void IrcServerHandler::handlePrivmsg(const QString &prefix, const QList<QByteArr
   }
 
   if(params.isEmpty()) {
-    quWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from: " << prefix;
+    quWarning() << "IrcServerHandler::handlePrivmsg(): received PRIVMSG without target or message from:" << prefix;
     return;
   }
      
@@ -790,6 +796,10 @@ void IrcServerHandler::handle324(const QString &prefix, const QList<QByteArray>
 /* RPL_??? - "<channel> <creation time (unix)>" */
 void IrcServerHandler::handle329(const QString &prefix, const QList<QByteArray> &params) {
   Q_UNUSED(prefix);
+  Q_UNUSED(params)
+#ifdef __GNUC__
+#  warning "Implement handle329 (Channel creation time)"
+#endif
   // FIXME implement this... 
 }
 
@@ -800,7 +810,10 @@ void IrcServerHandler::handle331(const QString &prefix, const QList<QByteArray>
     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));
 }
 
@@ -812,7 +825,10 @@ void IrcServerHandler::handle332(const QString &prefix, const QList<QByteArray>
 
   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));
 }
 
@@ -863,7 +879,7 @@ void IrcServerHandler::handle353(const QString &prefix, const QList<QByteArray>
 
   IrcChannel *channel = network()->ircChannel(channelname);
   if(!channel) {
-    quWarning() << "IrcServerHandler::handle353(): received unknown target channel: " << channelname;
+    quWarning() << "IrcServerHandler::handle353(): received unknown target channel:" << channelname;
     return;
   }
 
@@ -947,7 +963,7 @@ void IrcServerHandler::tryNextNick(const QString &errnick) {
 
 bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QByteArray> &params, int minParams) {
   if(params.count() < minParams) {
-    quWarning() << qPrintable(methodName) << " requires " << minParams << " parameters but received only " << params.count() << serverDecode(params);
+    quWarning() << qPrintable(methodName) << "requires" << minParams << "parameters but received only" << params.count() << serverDecode(params);
     return false;
   } else {
     return true;