QTfrontend/newnetclient.cpp
changeset 1844 81abed9d4c11
parent 1842 96a4757dfeb8
child 1856 e71dbf958c87
equal deleted inserted replaced
1843:16cdd1745b73 1844:81abed9d4c11
    16  * along with this program; if not, write to the Free Software
    16  * along with this program; if not, write to the Free Software
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    18  */
    18  */
    19 
    19 
    20 #include <QDebug>
    20 #include <QDebug>
       
    21 #include <QInputDialog>
       
    22 
       
    23 #include <QtCrypto>
    21 
    24 
    22 #include "hwconsts.h"
    25 #include "hwconsts.h"
    23 #include "newnetclient.h"
    26 #include "newnetclient.h"
    24 #include "proto.h"
    27 #include "proto.h"
    25 #include "gameuiconfig.h"
    28 #include "gameuiconfig.h"
   427 		RunGame();
   430 		RunGame();
   428 		return;
   431 		return;
   429 	}
   432 	}
   430 
   433 
   431 	if (lst[0] == "ASKPASSWORD") {
   434 	if (lst[0] == "ASKPASSWORD") {
   432 		RawSendNet(QString("PASSWORD"));
   435 		QString password = QInputDialog::getText(0, tr("Password"), tr("Enter your password:"), QLineEdit::Password);
       
   436 
       
   437 		QCA::Initializer qcaInit;
       
   438 		QCA::Hash shaHash("md5");
       
   439 		shaHash.update(password.toLatin1());
       
   440 		QByteArray hashResult = shaHash.final().toByteArray();
       
   441 		
       
   442 		RawSendNet(QString("PASSWORD%1%2").arg(delimeter).arg(QCA::arrayToHex(hashResult)));
   433 		return;
   443 		return;
   434 	}
   444 	}
   435 
   445 
   436 	if (lst[0] == "TEAM_ACCEPTED") {
   446 	if (lst[0] == "TEAM_ACCEPTED") {
   437 		if (lst.size() != 2)
   447 		if (lst.size() != 2)