Preparing to fix login for network game and dedicated server without login backend. Currently broken.
This commit is contained in:
@@ -122,6 +122,8 @@ void ServerGuiWrapper::SignalNetClientServerListAdd(unsigned serverId) { if (myC
|
|||||||
void ServerGuiWrapper::SignalNetClientServerListClear() { if (myClientcb) myClientcb->SignalNetClientServerListClear(); }
|
void ServerGuiWrapper::SignalNetClientServerListClear() { if (myClientcb) myClientcb->SignalNetClientServerListClear(); }
|
||||||
void ServerGuiWrapper::SignalNetClientServerListShow() { if (myClientcb) myClientcb->SignalNetClientServerListShow(); }
|
void ServerGuiWrapper::SignalNetClientServerListShow() { if (myClientcb) myClientcb->SignalNetClientServerListShow(); }
|
||||||
|
|
||||||
|
void ServerGuiWrapper::SignalNetClientLoginShow() { if (myClientcb) myClientcb->SignalNetClientLoginShow(); }
|
||||||
|
|
||||||
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
|
void ServerGuiWrapper::SignalNetClientConnect(int actionID) { if (myClientcb) myClientcb->SignalNetClientConnect(actionID); }
|
||||||
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
|
void ServerGuiWrapper::SignalNetClientGameInfo(int actionID) { if (myClientcb) myClientcb->SignalNetClientGameInfo(actionID); }
|
||||||
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
|
void ServerGuiWrapper::SignalNetClientError(int errorID, int osErrorID) { if (myClientcb) myClientcb->SignalNetClientError(errorID, osErrorID); }
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ public:
|
|||||||
void SignalNetClientServerListClear();
|
void SignalNetClientServerListClear();
|
||||||
void SignalNetClientServerListShow();
|
void SignalNetClientServerListShow();
|
||||||
|
|
||||||
|
void SignalNetClientLoginShow();
|
||||||
|
|
||||||
void SignalNetServerSuccess(int actionID);
|
void SignalNetServerSuccess(int actionID);
|
||||||
void SignalNetServerError(int errorID, int osErrorID);
|
void SignalNetServerError(int errorID, int osErrorID);
|
||||||
|
|
||||||
|
|||||||
@@ -446,8 +446,7 @@ void startWindowImpl::callJoinNetworkGameDialog() {
|
|||||||
myJoinNetworkGameDialog->lineEdit_ipAddress->text().toUtf8().constData(),
|
myJoinNetworkGameDialog->lineEdit_ipAddress->text().toUtf8().constData(),
|
||||||
myJoinNetworkGameDialog->spinBox_port->value(),
|
myJoinNetworkGameDialog->spinBox_port->value(),
|
||||||
myJoinNetworkGameDialog->checkBox_ipv6->isChecked(),
|
myJoinNetworkGameDialog->checkBox_ipv6->isChecked(),
|
||||||
myJoinNetworkGameDialog->checkBox_sctp->isChecked(),
|
myJoinNetworkGameDialog->checkBox_sctp->isChecked());
|
||||||
myJoinNetworkGameDialog->lineEdit_password->text().toUtf8().constData());
|
|
||||||
|
|
||||||
//Dialog mit Statusbalken
|
//Dialog mit Statusbalken
|
||||||
myConnectToServerDialog->exec();
|
myConnectToServerDialog->exec();
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ public:
|
|||||||
virtual void SignalNetClientServerListClear() = 0;
|
virtual void SignalNetClientServerListClear() = 0;
|
||||||
virtual void SignalNetClientServerListShow() = 0;
|
virtual void SignalNetClientServerListShow() = 0;
|
||||||
|
|
||||||
|
virtual void SignalNetClientLoginShow() = 0;
|
||||||
|
|
||||||
virtual void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName) = 0;
|
virtual void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName) = 0;
|
||||||
virtual void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) = 0;
|
virtual void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) = 0;
|
||||||
virtual void SignalLobbyPlayerLeft(unsigned playerId) = 0;
|
virtual void SignalLobbyPlayerLeft(unsigned playerId) = 0;
|
||||||
|
|||||||
+38
-18
@@ -234,24 +234,6 @@ private:
|
|||||||
boost::asio::ip::tcp::resolver::iterator m_remoteEndpointIterator;
|
boost::asio::ip::tcp::resolver::iterator m_remoteEndpointIterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
// State: Session init.
|
|
||||||
class ClientStateStartSession : public ClientState
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Access the state singleton.
|
|
||||||
static ClientStateStartSession &Instance();
|
|
||||||
virtual ~ClientStateStartSession();
|
|
||||||
|
|
||||||
virtual void Enter(boost::shared_ptr<ClientThread> client);
|
|
||||||
virtual void Exit(boost::shared_ptr<ClientThread> client);
|
|
||||||
|
|
||||||
virtual void HandlePacket(boost::shared_ptr<ClientThread> /*client*/, boost::shared_ptr<NetPacket> /*tmpPacket*/) {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Protected constructor - this is a singleton.
|
|
||||||
ClientStateStartSession();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Abstract State: Receiving
|
// Abstract State: Receiving
|
||||||
class AbstractClientStateReceiving : public ClientState
|
class AbstractClientStateReceiving : public ClientState
|
||||||
{
|
{
|
||||||
@@ -266,6 +248,44 @@ protected:
|
|||||||
virtual void InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket) = 0;
|
virtual void InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// State: Session init.
|
||||||
|
class ClientStateStartSession : public AbstractClientStateReceiving
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Access the state singleton.
|
||||||
|
static ClientStateStartSession &Instance();
|
||||||
|
virtual ~ClientStateStartSession();
|
||||||
|
|
||||||
|
virtual void Enter(boost::shared_ptr<ClientThread> client);
|
||||||
|
virtual void Exit(boost::shared_ptr<ClientThread> client);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected constructor - this is a singleton.
|
||||||
|
ClientStateStartSession();
|
||||||
|
|
||||||
|
virtual void InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket);
|
||||||
|
};
|
||||||
|
|
||||||
|
// State: Waiting for the user to enter login data.
|
||||||
|
class ClientStateWaitEnterLogin : public ClientState
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static ClientStateWaitEnterLogin &Instance();
|
||||||
|
virtual ~ClientStateWaitEnterLogin();
|
||||||
|
|
||||||
|
virtual void Enter(boost::shared_ptr<ClientThread> client);
|
||||||
|
virtual void Exit(boost::shared_ptr<ClientThread> client);
|
||||||
|
|
||||||
|
virtual void HandlePacket(boost::shared_ptr<ClientThread> /*client*/, boost::shared_ptr<NetPacket> /*tmpPacket*/) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected constructor - this is a singleton.
|
||||||
|
ClientStateWaitEnterLogin();
|
||||||
|
|
||||||
|
void TimerLoop(const boost::system::error_code& ec, boost::shared_ptr<ClientThread> client);
|
||||||
|
};
|
||||||
|
|
||||||
// State: Wait for Authentication Challenge.
|
// State: Wait for Authentication Challenge.
|
||||||
class ClientStateWaitAuthChallenge : public AbstractClientStateReceiving
|
class ClientStateWaitAuthChallenge : public AbstractClientStateReceiving
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ public:
|
|||||||
bool sctp,
|
bool sctp,
|
||||||
const std::string &avatarServerAddress,
|
const std::string &avatarServerAddress,
|
||||||
const std::string &playerName,
|
const std::string &playerName,
|
||||||
const std::string &playerPwd,
|
|
||||||
const std::string &avatarFile,
|
const std::string &avatarFile,
|
||||||
const std::string &cacheDir);
|
const std::string &cacheDir);
|
||||||
virtual void SignalTermination();
|
virtual void SignalTermination();
|
||||||
@@ -267,6 +266,7 @@ friend class ClientStateWaitChooseServer;
|
|||||||
friend class ClientStateStartConnect;
|
friend class ClientStateStartConnect;
|
||||||
friend class ClientStateConnecting;
|
friend class ClientStateConnecting;
|
||||||
friend class ClientStateStartSession;
|
friend class ClientStateStartSession;
|
||||||
|
friend class ClientStateWaitEnterLogin;
|
||||||
friend class ClientStateWaitAuthChallenge;
|
friend class ClientStateWaitAuthChallenge;
|
||||||
friend class ClientStateWaitAuthVerify;
|
friend class ClientStateWaitAuthVerify;
|
||||||
friend class ClientStateWaitSession;
|
friend class ClientStateWaitSession;
|
||||||
|
|||||||
+162
-92
@@ -649,82 +649,6 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ClientStateStartSession &
|
|
||||||
ClientStateStartSession::Instance()
|
|
||||||
{
|
|
||||||
static ClientStateStartSession state;
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientStateStartSession::ClientStateStartSession()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientStateStartSession::~ClientStateStartSession()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ClientStateStartSession::Enter(boost::shared_ptr<ClientThread> client)
|
|
||||||
{
|
|
||||||
ClientContext &context = client->GetContext();
|
|
||||||
|
|
||||||
boost::shared_ptr<NetPacket> init(new NetPacket(NetPacket::Alloc));
|
|
||||||
init->GetMsg()->present = PokerTHMessage_PR_initMessage;
|
|
||||||
InitMessage_t *netInit = &init->GetMsg()->choice.initMessage;
|
|
||||||
netInit->requestedVersion.major = NET_VERSION_MAJOR;
|
|
||||||
netInit->requestedVersion.minor = NET_VERSION_MINOR;
|
|
||||||
|
|
||||||
// CASE 1: Authenticated login (username, challenge/response for password).
|
|
||||||
if (!context.GetPassword().empty())
|
|
||||||
{
|
|
||||||
netInit->login.present = login_PR_authenticatedLogin;
|
|
||||||
AuthenticatedLogin_t *authLogin = &netInit->login.choice.authenticatedLogin;
|
|
||||||
// Send authentication user data for challenge/response in init.
|
|
||||||
boost::shared_ptr<SessionData> tmpSession = context.GetSessionData();
|
|
||||||
tmpSession->CreateClientAuthSession(client->GetAuthContext(), context.GetPlayerName(), context.GetPassword());
|
|
||||||
if (!tmpSession->AuthStep(1, ""))
|
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PASSWORD, 0);
|
|
||||||
string outUserData(tmpSession->AuthGetNextOutMsg());
|
|
||||||
OCTET_STRING_fromBuf(&authLogin->clientUserData,
|
|
||||||
outUserData.c_str(),
|
|
||||||
outUserData.length());
|
|
||||||
string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
|
|
||||||
if (!avatarFile.empty())
|
|
||||||
{
|
|
||||||
MD5Buf tmpMD5;
|
|
||||||
if (client->GetAvatarManager().GetHashForAvatar(avatarFile, tmpMD5))
|
|
||||||
{
|
|
||||||
// TODO: use sha1.
|
|
||||||
authLogin->avatar =
|
|
||||||
OCTET_STRING_new_fromBuf(
|
|
||||||
&asn_DEF_OCTET_STRING,
|
|
||||||
(const char *)tmpMD5.data,
|
|
||||||
MD5_DATA_SIZE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// CASE 2: Guest login (no password, but restrictions may apply).
|
|
||||||
else
|
|
||||||
{
|
|
||||||
netInit->login.present = login_PR_guestLogin;
|
|
||||||
GuestLogin_t *guestLogin = &netInit->login.choice.guestLogin;
|
|
||||||
OCTET_STRING_fromBuf(&guestLogin->nickName,
|
|
||||||
context.GetPlayerName().c_str(),
|
|
||||||
context.GetPlayerName().length());
|
|
||||||
}
|
|
||||||
client->GetSender().Send(context.GetSessionData(), init);
|
|
||||||
|
|
||||||
client->SetState(ClientStateWaitAuthChallenge::Instance());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ClientStateStartSession::Exit(boost::shared_ptr<ClientThread> /*client*/)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
AbstractClientStateReceiving::AbstractClientStateReceiving()
|
AbstractClientStateReceiving::AbstractClientStateReceiving()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -1023,6 +947,167 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ClientStateStartSession &
|
||||||
|
ClientStateStartSession::Instance()
|
||||||
|
{
|
||||||
|
static ClientStateStartSession state;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientStateStartSession::ClientStateStartSession()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientStateStartSession::~ClientStateStartSession()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientStateStartSession::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientStateStartSession::Exit(boost::shared_ptr<ClientThread> /*client*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientStateStartSession::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
||||||
|
{
|
||||||
|
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_announceMessage)
|
||||||
|
{
|
||||||
|
// Server has send announcement - check data.
|
||||||
|
AnnounceMessage_t *netAnnounce = &tmpPacket->GetMsg()->choice.announceMessage;
|
||||||
|
// Check current game version.
|
||||||
|
if (netAnnounce->latestGameVersion.major != POKERTH_VERSION_MAJOR
|
||||||
|
|| netAnnounce->latestGameVersion.minor != POKERTH_VERSION_MINOR)
|
||||||
|
{
|
||||||
|
client->GetCallback().SignalNetClientNotification(NTF_NET_NEW_RELEASE_AVAILABLE);
|
||||||
|
}
|
||||||
|
else if (POKERTH_BETA_REVISION && netAnnounce->latestBetaRevision != POKERTH_BETA_REVISION)
|
||||||
|
{
|
||||||
|
client->GetCallback().SignalNetClientNotification(NTF_NET_OUTDATED_BETA);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClientContext &context = client->GetContext();
|
||||||
|
|
||||||
|
// CASE 1: Authenticated login (username, challenge/response for password).
|
||||||
|
if (netAnnounce->serverType == serverType_serverTypeInternetAuth)
|
||||||
|
{
|
||||||
|
client->GetCallback().SignalNetClientLoginShow();
|
||||||
|
client->SetState(ClientStateWaitEnterLogin::Instance());
|
||||||
|
}
|
||||||
|
// CASE 2: Unauthenticated login (dedicated server without auth backend).
|
||||||
|
else if (netAnnounce->serverType == serverType_serverTypeInternetNoAuth
|
||||||
|
|| netAnnounce->serverType == serverType_serverTypeLAN)
|
||||||
|
{
|
||||||
|
boost::shared_ptr<NetPacket> init(new NetPacket(NetPacket::Alloc));
|
||||||
|
init->GetMsg()->present = PokerTHMessage_PR_initMessage;
|
||||||
|
InitMessage_t *netInit = &init->GetMsg()->choice.initMessage;
|
||||||
|
netInit->requestedVersion.major = NET_VERSION_MAJOR;
|
||||||
|
netInit->requestedVersion.minor = NET_VERSION_MINOR;
|
||||||
|
netInit->login.present = login_PR_guestLogin;
|
||||||
|
GuestLogin_t *guestLogin = &netInit->login.choice.guestLogin;
|
||||||
|
OCTET_STRING_fromBuf(&guestLogin->nickName,
|
||||||
|
context.GetPlayerName().c_str(),
|
||||||
|
context.GetPlayerName().length());
|
||||||
|
client->GetSender().Send(context.GetSessionData(), init);
|
||||||
|
client->SetState(ClientStateWaitAuthChallenge::Instance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ClientStateWaitEnterLogin &
|
||||||
|
ClientStateWaitEnterLogin::Instance()
|
||||||
|
{
|
||||||
|
static ClientStateWaitEnterLogin state;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientStateWaitEnterLogin::ClientStateWaitEnterLogin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientStateWaitEnterLogin::~ClientStateWaitEnterLogin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientStateWaitEnterLogin::Enter(boost::shared_ptr<ClientThread> client)
|
||||||
|
{
|
||||||
|
client->GetStateTimer().expires_from_now(
|
||||||
|
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
|
client->GetStateTimer().async_wait(
|
||||||
|
boost::bind(
|
||||||
|
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientStateWaitEnterLogin::Exit(boost::shared_ptr<ClientThread> client)
|
||||||
|
{
|
||||||
|
client->GetStateTimer().cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost::shared_ptr<ClientThread> client)
|
||||||
|
{
|
||||||
|
if (!ec && &client->GetState() == this)
|
||||||
|
{
|
||||||
|
ClientContext &context = client->GetContext();
|
||||||
|
if (!context.GetPassword().empty())
|
||||||
|
{
|
||||||
|
boost::shared_ptr<NetPacket> init(new NetPacket(NetPacket::Alloc));
|
||||||
|
init->GetMsg()->present = PokerTHMessage_PR_initMessage;
|
||||||
|
InitMessage_t *netInit = &init->GetMsg()->choice.initMessage;
|
||||||
|
netInit->requestedVersion.major = NET_VERSION_MAJOR;
|
||||||
|
netInit->requestedVersion.minor = NET_VERSION_MINOR;
|
||||||
|
netInit->login.present = login_PR_authenticatedLogin;
|
||||||
|
AuthenticatedLogin_t *authLogin = &netInit->login.choice.authenticatedLogin;
|
||||||
|
// Send authentication user data for challenge/response in init.
|
||||||
|
boost::shared_ptr<SessionData> tmpSession = context.GetSessionData();
|
||||||
|
tmpSession->CreateClientAuthSession(client->GetAuthContext(), context.GetPlayerName(), context.GetPassword());
|
||||||
|
if (!tmpSession->AuthStep(1, ""))
|
||||||
|
throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PASSWORD, 0);
|
||||||
|
string outUserData(tmpSession->AuthGetNextOutMsg());
|
||||||
|
OCTET_STRING_fromBuf(&authLogin->clientUserData,
|
||||||
|
outUserData.c_str(),
|
||||||
|
outUserData.length());
|
||||||
|
string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
|
||||||
|
if (!avatarFile.empty())
|
||||||
|
{
|
||||||
|
MD5Buf tmpMD5;
|
||||||
|
if (client->GetAvatarManager().GetHashForAvatar(avatarFile, tmpMD5))
|
||||||
|
{
|
||||||
|
// TODO: use sha1.
|
||||||
|
authLogin->avatar =
|
||||||
|
OCTET_STRING_new_fromBuf(
|
||||||
|
&asn_DEF_OCTET_STRING,
|
||||||
|
(const char *)tmpMD5.data,
|
||||||
|
MD5_DATA_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
client->GetSender().Send(context.GetSessionData(), init);
|
||||||
|
client->SetState(ClientStateWaitAuthChallenge::Instance());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client->GetStateTimer().expires_from_now(
|
||||||
|
boost::posix_time::milliseconds(CLIENT_WAIT_TIMEOUT_MSEC));
|
||||||
|
client->GetStateTimer().async_wait(
|
||||||
|
boost::bind(
|
||||||
|
&ClientStateWaitEnterLogin::TimerLoop, this, boost::asio::placeholders::error, client));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ClientStateWaitAuthChallenge &
|
ClientStateWaitAuthChallenge &
|
||||||
ClientStateWaitAuthChallenge::Instance()
|
ClientStateWaitAuthChallenge::Instance()
|
||||||
{
|
{
|
||||||
@@ -1053,22 +1138,7 @@ ClientStateWaitAuthChallenge::Exit(boost::shared_ptr<ClientThread> /*client*/)
|
|||||||
void
|
void
|
||||||
ClientStateWaitAuthChallenge::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
ClientStateWaitAuthChallenge::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
||||||
{
|
{
|
||||||
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_announceMessage)
|
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_authMessage)
|
||||||
{
|
|
||||||
// Server has send announcement - check data.
|
|
||||||
AnnounceMessage_t *netAnnounce = &tmpPacket->GetMsg()->choice.announceMessage;
|
|
||||||
// Check current game version.
|
|
||||||
if (netAnnounce->latestGameVersion.major != POKERTH_VERSION_MAJOR
|
|
||||||
|| netAnnounce->latestGameVersion.minor != POKERTH_VERSION_MINOR)
|
|
||||||
{
|
|
||||||
client->GetCallback().SignalNetClientNotification(NTF_NET_NEW_RELEASE_AVAILABLE);
|
|
||||||
}
|
|
||||||
else if (POKERTH_BETA_REVISION && netAnnounce->latestBetaRevision != POKERTH_BETA_REVISION)
|
|
||||||
{
|
|
||||||
client->GetCallback().SignalNetClientNotification(NTF_NET_OUTDATED_BETA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_authMessage)
|
|
||||||
{
|
{
|
||||||
// Check subtype.
|
// Check subtype.
|
||||||
AuthMessage_t *netAuth = &tmpPacket->GetMsg()->choice.authMessage;
|
AuthMessage_t *netAuth = &tmpPacket->GetMsg()->choice.authMessage;
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ ClientThread::Init(
|
|||||||
const string &serverAddress, const string &serverListUrl,
|
const string &serverAddress, const string &serverListUrl,
|
||||||
bool useServerList, unsigned serverPort, bool ipv6, bool sctp,
|
bool useServerList, unsigned serverPort, bool ipv6, bool sctp,
|
||||||
const string &avatarServerAddress, const string &playerName,
|
const string &avatarServerAddress, const string &playerName,
|
||||||
const string &playerPwd, const string &avatarFile,
|
const string &avatarFile, const string &cacheDir)
|
||||||
const string &cacheDir)
|
|
||||||
{
|
{
|
||||||
if (IsRunning())
|
if (IsRunning())
|
||||||
{
|
{
|
||||||
@@ -105,7 +104,6 @@ ClientThread::Init(
|
|||||||
context.SetServerPort(serverPort);
|
context.SetServerPort(serverPort);
|
||||||
context.SetAvatarServerAddr(avatarServerAddress);
|
context.SetAvatarServerAddr(avatarServerAddress);
|
||||||
context.SetPlayerName(playerName);
|
context.SetPlayerName(playerName);
|
||||||
context.SetPassword(playerPwd);
|
|
||||||
context.SetAvatarFile(avatarFile);
|
context.SetAvatarFile(avatarFile);
|
||||||
context.SetCacheDir(cacheDir);
|
context.SetCacheDir(cacheDir);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -179,13 +179,12 @@ void Session::startInternetClient()
|
|||||||
myConfig->readConfigInt("InternetServerUseSctp") == 1,
|
myConfig->readConfigInt("InternetServerUseSctp") == 1,
|
||||||
useAvatarServer ? myConfig->readConfigString("AvatarServerAddress") : "",
|
useAvatarServer ? myConfig->readConfigString("AvatarServerAddress") : "",
|
||||||
myConfig->readConfigString("MyName"),
|
myConfig->readConfigString("MyName"),
|
||||||
"testpw",
|
|
||||||
myConfig->readConfigString("MyAvatar"),
|
myConfig->readConfigString("MyAvatar"),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
myNetClient->Run();
|
myNetClient->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startNetworkClient(const string &serverAddress, unsigned serverPort, bool ipv6, bool sctp, const string &pwd)
|
void Session::startNetworkClient(const string &serverAddress, unsigned serverPort, bool ipv6, bool sctp)
|
||||||
{
|
{
|
||||||
if (myNetClient || !myGui)
|
if (myNetClient || !myGui)
|
||||||
{
|
{
|
||||||
@@ -204,7 +203,6 @@ void Session::startNetworkClient(const string &serverAddress, unsigned serverPor
|
|||||||
sctp,
|
sctp,
|
||||||
"", // no avatar server
|
"", // no avatar server
|
||||||
myConfig->readConfigString("MyName"),
|
myConfig->readConfigString("MyName"),
|
||||||
pwd,
|
|
||||||
myConfig->readConfigString("MyAvatar"),
|
myConfig->readConfigString("MyAvatar"),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
myNetClient->Run();
|
myNetClient->Run();
|
||||||
@@ -232,7 +230,6 @@ void Session::startNetworkClientForLocalServer(const GameData &gameData)
|
|||||||
myConfig->readConfigInt("ServerUseSctp") == 1,
|
myConfig->readConfigInt("ServerUseSctp") == 1,
|
||||||
"", // no avatar server
|
"", // no avatar server
|
||||||
myConfig->readConfigString("MyName"),
|
myConfig->readConfigString("MyName"),
|
||||||
myConfig->readConfigString("ServerPassword"),
|
|
||||||
myConfig->readConfigString("MyAvatar"),
|
myConfig->readConfigString("MyAvatar"),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
myNetClient->Run();
|
myNetClient->Run();
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ public:
|
|||||||
boost::shared_ptr<AvatarManager> getAvatarManager();
|
boost::shared_ptr<AvatarManager> getAvatarManager();
|
||||||
|
|
||||||
void startInternetClient();
|
void startInternetClient();
|
||||||
void startNetworkClient(const std::string &serverAddress, unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd);
|
void startNetworkClient(const std::string &serverAddress, unsigned serverPort, bool ipv6, bool sctp);
|
||||||
void startNetworkClientForLocalServer(const GameData &gameData);
|
void startNetworkClientForLocalServer(const GameData &gameData);
|
||||||
void terminateNetworkClient();
|
void terminateNetworkClient();
|
||||||
void clientCreateGame(const GameData &gameData, const std::string &name, const std::string &password);
|
void clientCreateGame(const GameData &gameData, const std::string &name, const std::string &password);
|
||||||
|
|||||||
Reference in New Issue
Block a user