QTfrontend/net/newnetclient.cpp
changeset 9702 27006953d901
parent 9549 ac5c1f691ce2
child 9730 20dca3377887
equal deleted inserted replaced
9700:3034605a4604 9702:27006953d901
   309         return;
   309         return;
   310     }
   310     }
   311 
   311 
   312     if (lst[0] == "ROOMS")
   312     if (lst[0] == "ROOMS")
   313     {
   313     {
   314         if(lst.size() % 8 != 1)
   314         if(lst.size() % 9 != 1)
   315         {
   315         {
   316             qWarning("Net: Malformed ROOMS message");
   316             qWarning("Net: Malformed ROOMS message");
   317             return;
   317             return;
   318         }
   318         }
   319         QStringList tmp = lst;
   319         m_roomsListModel->setRoomsList(lst.mid(1));
   320         tmp.removeFirst();
       
   321         m_roomsListModel->setRoomsList(tmp);
       
   322         if (m_private_game == false && m_nick_registered == false)
   320         if (m_private_game == false && m_nick_registered == false)
   323         {
   321         {
   324             emit NickNotRegistered(mynick);
   322             emit NickNotRegistered(mynick);
   325         }
   323         }
   326         return;
   324         return;
   404         tmp.removeFirst();
   402         tmp.removeFirst();
   405         emit bansList(tmp);
   403         emit bansList(tmp);
   406         return;
   404         return;
   407     }
   405     }
   408 
   406 
   409     if (lst[0] == "CLIENT_FLAGS")
   407     if (lst[0] == "CLIENT_FLAGS" || lst[0] == "CF")
   410     {
   408     {
   411         if(lst.size() < 3 || lst[1].size() < 2)
   409         if(lst.size() < 3 || lst[1].size() < 2)
   412         {
   410         {
   413             qWarning("Net: Malformed CLIENT_FLAGS message");
   411             qWarning("Net: Malformed CLIENT_FLAGS message");
   414             return;
   412             return;
   525             m_playersModel->addPlayer(lst[i], false);
   523             m_playersModel->addPlayer(lst[i], false);
   526         }
   524         }
   527         return;
   525         return;
   528     }
   526     }
   529 
   527 
   530     if(lst[0] == "ROOM" && lst.size() == 10 && lst[1] == "ADD")
   528     if(lst[0] == "ROOM" && lst.size() == 11 && lst[1] == "ADD")
   531     {
   529     {
   532         QStringList tmp = lst;
   530         QStringList tmp = lst;
   533         tmp.removeFirst();
   531         tmp.removeFirst();
   534         tmp.removeFirst();
   532         tmp.removeFirst();
   535 
   533 
   536         m_roomsListModel->addRoom(tmp);
   534         m_roomsListModel->addRoom(tmp);
   537         return;
   535         return;
   538     }
   536     }
   539 
   537 
   540     if(lst[0] == "ROOM" && lst.size() == 11 && lst[1] == "UPD")
   538     if(lst[0] == "ROOM" && lst.size() == 12 && lst[1] == "UPD")
   541     {
   539     {
   542         QStringList tmp = lst;
   540         QStringList tmp = lst;
   543         tmp.removeFirst();
   541         tmp.removeFirst();
   544         tmp.removeFirst();
   542         tmp.removeFirst();
   545 
   543 
   622             return;
   620             return;
   623         }
   621         }
   624         m_game_connected = false;
   622         m_game_connected = false;
   625         Disconnect();
   623         Disconnect();
   626         emit disconnected(HWApplication::translate("server", lst[1].toAscii().constData()));
   624         emit disconnected(HWApplication::translate("server", lst[1].toAscii().constData()));
   627         return;
       
   628     }
       
   629 
       
   630     if (lst[0] == "ADMIN_ACCESS")
       
   631     {
       
   632         // obsolete, see +a client flag
       
   633         return;
   625         return;
   634     }
   626     }
   635 
   627 
   636     if(lst[0] == "JOINING")
   628     if(lst[0] == "JOINING")
   637     {
   629     {
   816             else
   808             else
   817                 emit chatStringFromNet(tr("%1 *** %2 has left (%3)").arg('\x03').arg(lst[1], lst[2]));
   809                 emit chatStringFromNet(tr("%1 *** %2 has left (%3)").arg('\x03').arg(lst[1], lst[2]));
   818             m_playersModel->playerLeftRoom(lst[1]);
   810             m_playersModel->playerLeftRoom(lst[1]);
   819             return;
   811             return;
   820         }
   812         }
   821 
       
   822         // obsolete
       
   823         if (lst[0] == "ROOM_CONTROL_ACCESS")
       
   824         {
       
   825             if (lst.size() < 2)
       
   826             {
       
   827                 qWarning("Net: Bad ROOM_CONTROL_ACCESS message");
       
   828                 return;
       
   829             }
       
   830             return;
       
   831         }
       
   832     }
   813     }
   833 
   814 
   834     qWarning() << "Net: Unknown message or wrong state:" << lst;
   815     qWarning() << "Net: Unknown message or wrong state:" << lst;
   835 }
   816 }
   836 
   817