QTfrontend/newnetclient.cpp
changeset 1905 b1ec8db513f2
parent 1899 5763f46d7486
child 1925 ec923e56c444
equal deleted inserted replaced
1904:20348675b015 1905:b1ec8db513f2
    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>
    21 #include <QInputDialog>
       
    22 #include <QCryptographicHash>
    22 
    23 
    23 #include "hwconsts.h"
    24 #include "hwconsts.h"
    24 #include "newnetclient.h"
    25 #include "newnetclient.h"
    25 #include "proto.h"
    26 #include "proto.h"
    26 #include "gameuiconfig.h"
    27 #include "gameuiconfig.h"
    84 	{
    85 	{
    85 		qWarning("Illegal try to create room!");
    86 		qWarning("Illegal try to create room!");
    86 		return;
    87 		return;
    87 	}
    88 	}
    88 	
    89 	
    89 	RawSendNet(QString("CREATE%1%2").arg(delimeter).arg(room));
    90 	RawSendNet(QString("CREATE_ROOM%1%2").arg(delimeter).arg(room));
    90 	m_pGameCFGWidget->setEnabled(true);
    91 	m_pGameCFGWidget->setEnabled(true);
    91 	m_pTeamSelWidget->setInteractivity(true);
    92 	m_pTeamSelWidget->setInteractivity(true);
    92 	isChief = true;
    93 	isChief = true;
    93 }
    94 }
    94 
    95 
   100 		return;
   101 		return;
   101 	}
   102 	}
   102 	
   103 	
   103 	loginStep++;
   104 	loginStep++;
   104 
   105 
   105 	RawSendNet(QString("JOIN%1%2").arg(delimeter).arg(room));
   106 	RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room));
   106 	m_pGameCFGWidget->setEnabled(false);
   107 	m_pGameCFGWidget->setEnabled(false);
   107 	m_pTeamSelWidget->setInteractivity(false);
   108 	m_pTeamSelWidget->setInteractivity(false);
   108 	isChief = false;
   109 	isChief = false;
   109 }
   110 }
   110 
   111 
   445 	}
   446 	}
   446 
   447 
   447 	if (lst[0] == "ASKPASSWORD") {
   448 	if (lst[0] == "ASKPASSWORD") {
   448 		QString password = QInputDialog::getText(0, tr("Password"), tr("Enter your password:"), QLineEdit::Password);
   449 		QString password = QInputDialog::getText(0, tr("Password"), tr("Enter your password:"), QLineEdit::Password);
   449 
   450 
   450 		QString hash = Hash::md5(password.toLatin1());
   451 		QString hash = QCryptographicHash::hash(password.toLatin1(), QCryptographicHash::Md5).toHex();
   451 
   452 
   452 		RawSendNet(QString("PASSWORD%1%2").arg(delimeter).arg(hash));
   453 		RawSendNet(QString("PASSWORD%1%2").arg(delimeter).arg(hash));
   453 		return;
   454 		return;
   454 	}
   455 	}
   455 
   456