クライアントから送られるユーザーIDを正規化するために regularizeId が呼ばれる。
正規化とは、例えば "abc " というユーザーと、"abc" というユーザーを同一として扱うかどうかという問題である。同一として扱いたいならば、両者が同じ regularizeId を返せば良い。
std::string SampleAccountModule::regularizeId(const std::string& s)
{
return s;
}
フレームワークでは特に何も変更しない。
サーバー用のアクセプタから接続したログイン処理は、handleServerLogin 関数へ渡される。 一般的にはここでゲームサーバーの認証を行う。
bool SampleAccountModule::handleServerLogin(LoginRequest* pMsg, ResponseMessage* pRes, SessionHandle& hSession)
{
LoginNotify* pNtf = new LoginNotify();
pNtf->userId = pMsg->userId;
hSession.session()->queueMessage(pNtf);
return true;
}
ログイン成功の場合は、真を返すとともに LoginNotify メッセージを投げる必要がある。
クライアント用のアクセプタから接続したログイン処理は、handleClientLogin 関数へ渡される。 一般的にはここでゲームクライアントの認証を行う。
bool SampleAccountModule::handleClientLogin(LoginRequest* pMsg, ResponseMessage* pRes, SessionHandle& hSession)
{
LoginNotify* pNtf = new LoginNotify();
pNtf->userId = pMsg->userId;
hSession.session()->queueMessage(pNtf);
return true;
}