Added handling of not registered nicks (no change-server side tho), clearPasswordHash() also now sets the savepassword setting to false
--- a/QTfrontend/gameuiconfig.cpp Fri Dec 14 18:57:31 2012 +0100
+++ b/QTfrontend/gameuiconfig.cpp Fri Dec 14 21:09:07 2012 +0100
@@ -483,6 +483,7 @@
{
setValue("net/passwordhash", QString());
setValue("net/passwordlength", 0);
+ setValue("net/savepassword", false);
}
void GameUIConfig::setPasswordHash(const QString & passwordhash)
--- a/QTfrontend/hwform.cpp Fri Dec 14 18:57:31 2012 +0100
+++ b/QTfrontend/hwform.cpp Fri Dec 14 21:09:07 2012 +0100
@@ -1094,6 +1094,26 @@
NetPassword(nick);
}
+void HWForm::NetNickNotRegistered(const QString & nick)
+{
+ QMessageBox noRegMsg(this);
+ noRegMsg.setIcon(QMessageBox::Information);
+ noRegMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Nick not registered"));
+ noRegMsg.setWindowModality(Qt::WindowModal);
+ noRegMsg.setText(tr("Your nickname is not registered.\nTo prevent someone else from using it,\nplease register it at www.hedgewars.org"));
+
+ if (!config->passwordHash().isEmpty())
+ {
+ config->clearPasswordHash();
+ noRegMsg.setText(noRegMsg.text()+tr("\n\nYour password wasn't saved either."));
+ }
+ if (!config->tempHash().isEmpty())
+ {
+ config->clearTempHash();
+ }
+ noRegMsg.exec();
+}
+
void HWForm::NetNickTaken(const QString & nick)
{
bool ok = false;
@@ -1207,6 +1227,7 @@
connect(hwnet, SIGNAL(RemoveNetTeam(const HWTeam&)), this, SLOT(RemoveNetTeam(const HWTeam&)), Qt::QueuedConnection);
connect(hwnet, SIGNAL(TeamAccepted(const QString&)), this, SLOT(NetTeamAccepted(const QString&)), Qt::QueuedConnection);
connect(hwnet, SIGNAL(NickRegistered(const QString&)), this, SLOT(NetNickRegistered(const QString&)), Qt::QueuedConnection);
+ connect(hwnet, SIGNAL(NickNotRegistered(const QString&)), this, SLOT(NetNickNotRegistered(const QString&)), Qt::QueuedConnection);
connect(hwnet, SIGNAL(NickTaken(const QString&)), this, SLOT(NetNickTaken(const QString&)), Qt::QueuedConnection);
connect(hwnet, SIGNAL(AuthFailed()), this, SLOT(NetAuthFailed()), Qt::QueuedConnection);
//connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
--- a/QTfrontend/hwform.h Fri Dec 14 18:57:31 2012 +0100
+++ b/QTfrontend/hwform.h Fri Dec 14 21:09:07 2012 +0100
@@ -106,6 +106,7 @@
void NetGameEnter();
void NetPassword(const QString & nick);
void NetNickRegistered(const QString & nick);
+ void NetNickNotRegistered(const QString & nick);
void NetNickTaken(const QString & nick);
void NetAuthFailed();
bool RetryDialog(const QString & title, const QString & label);
--- a/QTfrontend/net/newnetclient.cpp Fri Dec 14 18:57:31 2012 +0100
+++ b/QTfrontend/net/newnetclient.cpp Fri Dec 14 21:09:07 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;
}
@@ -539,6 +544,7 @@
if (lst[0] == "ASKPASSWORD")
{
emit NickRegistered(mynick);
+ m_nick_registered = true;
return;
}
--- a/QTfrontend/net/newnetclient.h Fri Dec 14 18:57:31 2012 +0100
+++ b/QTfrontend/net/newnetclient.h Fri Dec 14 21:09:07 2012 +0100
@@ -69,6 +69,7 @@
QTcpSocket NetSocket;
QString seed;
bool m_game_connected;
+ bool m_nick_registered;
RoomsListModel * m_roomsListModel;
PlayersListModel * m_playersModel;
QSortFilterProxyModel * m_lobbyPlayersModel;
@@ -91,6 +92,7 @@
void Error(const QString & errmsg);
void Warning(const QString & wrnmsg);
void NickRegistered(const QString & nick);
+ void NickNotRegistered(const QString & nick);
void NickTaken(const QString & nick);
void AuthFailed();
void EnteredGame();