made the handlers for ERR_ERRONEUSNICKNAME and ERR_NICKNAMEINUSE more verbose
authorMarcus Eggenberger <egs@quassel-irc.org>
Mon, 28 Jan 2008 19:09:12 +0000 (19:09 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Mon, 28 Jan 2008 19:09:12 +0000 (19:09 +0000)
src/core/ircserverhandler.cpp
src/core/ircserverhandler.h
version.inc

index d701441..5b4c895 100644 (file)
@@ -444,7 +444,7 @@ void IrcServerHandler::handle432(QString prefix, QList<QByteArray> params) {
   } else {
     QString errnick = params[0];
     emit displayMsg(Message::Error, "", tr("Nick %1 contains illegal characters").arg(errnick));
   } else {
     QString errnick = params[0];
     emit displayMsg(Message::Error, "", tr("Nick %1 contains illegal characters").arg(errnick));
-    handle433(prefix, params);
+    tryNextNick(errnick);
   }
 }
 
   }
 }
 
@@ -452,13 +452,18 @@ void IrcServerHandler::handle432(QString prefix, QList<QByteArray> params) {
 void IrcServerHandler::handle433(QString prefix, QList<QByteArray> params) {
   Q_UNUSED(prefix);
 
 void IrcServerHandler::handle433(QString prefix, QList<QByteArray> params) {
   Q_UNUSED(prefix);
 
-  // if there is a problem while connecting to the server -> we handle it
+  QString errnick = serverDecode(params[0]);
+  emit displayMsg(Message::Error, "", tr("Nick already in use: %1").arg(errnick));
 
 
+  // if there is a problem while connecting to the server -> we handle it
   // but only if our connection has not been finished yet...
   if(!networkConnection->network()->currentServer().isEmpty())
     return;
   // but only if our connection has not been finished yet...
   if(!networkConnection->network()->currentServer().isEmpty())
     return;
-  
-  QString errnick = serverDecode(params[0]);
+
+  tryNextNick(errnick);
+}
+
+void IrcServerHandler::tryNextNick(const QString &errnick) {
   QStringList desiredNicks = networkConnection->coreSession()->identity(networkConnection->network()->identity())->nicks();
   int nextNick = desiredNicks.indexOf(errnick) + 1;
   if(desiredNicks.size() > nextNick) {
   QStringList desiredNicks = networkConnection->coreSession()->identity(networkConnection->network()->identity())->nicks();
   int nextNick = desiredNicks.indexOf(errnick) + 1;
   if(desiredNicks.size() > nextNick) {
@@ -466,9 +471,9 @@ void IrcServerHandler::handle433(QString prefix, QList<QByteArray> params) {
   } else {
     emit displayMsg(Message::Error, "", tr("No free and valid nicks in nicklist found. use: /nick <othernick> to continue"));
   }
   } else {
     emit displayMsg(Message::Error, "", tr("No free and valid nicks in nicklist found. use: /nick <othernick> to continue"));
   }
-  
 }
 
 }
 
+
 /***********************************************************************************/
 
 
 /***********************************************************************************/
 
 
index d9b65b1..c8894de 100644 (file)
@@ -63,8 +63,9 @@ public slots:
 
   void defaultHandler(QString cmd, QString prefix, QList<QByteArray> params);
 
 
   void defaultHandler(QString cmd, QString prefix, QList<QByteArray> params);
 
-  private:
-    NetworkConnection *networkConnection;
+private:
+  void tryNextNick(const QString &errnick);
+  NetworkConnection *networkConnection;
 };
 
 
 };
 
 
index 104d0fd..9922abb 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-01-28";
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-01-28";
-  quasselBuild = 398;
+  quasselBuild = 399;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 358;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 358;