QTfrontend/net/newnetclient.cpp
branchwebgl
changeset 8330 aaefa587e277
parent 8303 6331bceac95c
child 8444 75db7bb8dce8
--- a/QTfrontend/net/newnetclient.cpp	Sun Dec 02 00:03:16 2012 +0100
+++ b/QTfrontend/net/newnetclient.cpp	Tue Dec 25 04:45:22 2012 +0100
@@ -241,6 +241,7 @@
     {
         mynick = lst[1];
         m_playersModel->setNickname(mynick);
+        m_nick_registered = false;
         return ;
     }
 
@@ -304,6 +305,10 @@
         QStringList tmp = lst;
         tmp.removeFirst();
         m_roomsListModel->setRoomsList(tmp);
+        if (m_nick_registered == false)
+        {
+            emit NickNotRegistered(mynick);
+        }
         return;
     }
 
@@ -364,6 +369,14 @@
         return;
     }
 
+    if (lst[0] == "BANLIST")
+    {
+        QStringList tmp = lst;
+        tmp.removeFirst();
+        emit bansList(tmp);
+        return;
+    }
+
     if (lst[0] == "CLIENT_FLAGS")
     {
         if(lst.size() < 3 || lst[1].size() < 2)
@@ -530,7 +543,8 @@
 
     if (lst[0] == "ASKPASSWORD")
     {
-        emit AskForPassword(mynick);
+        emit NickRegistered(mynick);
+        m_nick_registered = true;
         return;
     }
 
@@ -565,6 +579,10 @@
         if (lst[1] == "Authentication failed")
         {
             emit AuthFailed();
+        m_game_connected = false;
+        Disconnect();
+        //omitted 'emit disconnected()', we don't want the error message
+        return;
         }
         m_game_connected = false;
         Disconnect();
@@ -621,6 +639,12 @@
             return;
         }
 
+        if (lst[0] == "ROUND_FINISHED")
+        {
+            emit FromNet(QByteArray("\x01o"));
+            return;
+        }
+
         if (lst[0] == "ADD_TEAM")
         {
             if(lst.size() != 24)
@@ -863,6 +887,26 @@
     RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick));
 }
 
+void HWNewNet::banIP(const QString & ip, const QString & reason, int seconds)
+{
+    RawSendNet(QString("BANIP%1%2%1%3%1%4").arg(delimeter).arg(ip).arg(reason).arg(seconds));
+}
+
+void HWNewNet::banNick(const QString & nick, const QString & reason, int seconds)
+{
+    RawSendNet(QString("BANNICK%1%2%1%3%1%4").arg(delimeter).arg(nick).arg(reason).arg(seconds));
+}
+
+void HWNewNet::getBanList()
+{
+    RawSendNet(QByteArray("BANLIST"));
+}
+
+void HWNewNet::removeBan(const QString & b)
+{
+    RawSendNet(QString("UNBAN%1%2").arg(delimeter).arg(b));
+}
+
 void HWNewNet::kickPlayer(const QString & nick)
 {
     RawSendNet(QString("KICK%1%2").arg(delimeter).arg(nick));