QTfrontend/newnetclient.cpp
changeset 1081 5be338fa4e2c
parent 1066 1f1b3686a2b0
child 1082 596b1dcdc1df
equal deleted inserted replaced
1080:8735046fc698 1081:5be338fa4e2c
    54   NetSocket.disconnectFromHost();
    54   NetSocket.disconnectFromHost();
    55 }
    55 }
    56 
    56 
    57 void HWNewNet::JoinGame(const QString & game)
    57 void HWNewNet::JoinGame(const QString & game)
    58 {
    58 {
    59   RawSendNet(QString("JOIN %1").arg(game));
    59   RawSendNet(QString("JOIN%1%2").arg(delimeter).arg(game));
    60 }
    60 }
    61 
    61 
    62 void HWNewNet::AddTeam(const HWTeam & team)
    62 void HWNewNet::AddTeam(const HWTeam & team)
    63 {
    63 {
    64   RawSendNet(QString("ADDTEAM:") + delimeter +
    64   RawSendNet(QString("ADDTEAM:") + delimeter +
    96   RawSendNet(str.toUtf8());
    96   RawSendNet(str.toUtf8());
    97 }
    97 }
    98 
    98 
    99 void HWNewNet::RawSendNet(const QByteArray & buf)
    99 void HWNewNet::RawSendNet(const QByteArray & buf)
   100 {
   100 {
       
   101 qDebug() << "Client: " << buf;
   101   NetSocket.write(buf);
   102   NetSocket.write(buf);
   102   NetSocket.write("\n", 1);
   103   NetSocket.write("\n", 1);
   103 }
   104 }
   104 
   105 
   105 void HWNewNet::ClientRead()
   106 void HWNewNet::ClientRead()
   140   }
   141   }
   141 }
   142 }
   142 
   143 
   143 void HWNewNet::ParseLine(const QByteArray & line)
   144 void HWNewNet::ParseLine(const QByteArray & line)
   144 {
   145 {
       
   146 qDebug() << "Server: " << line;
   145   QString msg = QString::fromUtf8 (line.data(), line.size());
   147   QString msg = QString::fromUtf8 (line.data(), line.size());
   146 
   148 
   147   QStringList lst = msg.split(delimeter);
   149   QStringList lst = msg.split(delimeter);
   148 //qDebug() << "Parsing: " << lst;
   150 //qDebug() << "Parsing: " << lst;
   149   if (lst[0] == "ERRONEUSNICKNAME") {
   151   if (lst[0] == "ERRONEUSNICKNAME") {