Use NotifyAuthUserChanged for GameController login, this will help users become aware when their sessions expire.

This commit is contained in:
Simon Robertshaw 2012-12-09 01:25:05 +00:00
parent 05148e8a8d
commit 6478ed121c
4 changed files with 10 additions and 16 deletions

View File

@ -576,7 +576,7 @@ void Client::Tick()
json::Boolean sessionStatus = objDocument["Session"];
if(!sessionStatus.Value())
{
authUser = User(0, "");
SetAuthUser(User(0, ""));
}
//MOTD

View File

@ -28,18 +28,6 @@
using namespace std;
class GameController::LoginCallback: public ControllerCallback
{
GameController * cc;
public:
LoginCallback(GameController * cc_) { cc = cc_; }
virtual void ControllerExit()
{
cc->gameModel->SetUser(cc->loginWindow->GetUser());
}
};
class GameController::SearchCallback: public ControllerCallback
{
GameController * cc;
@ -1015,7 +1003,7 @@ void GameController::OpenLocalBrowse()
void GameController::OpenLogin()
{
loginWindow = new LoginController(new LoginCallback(this));
loginWindow = new LoginController();
ui::Engine::Ref().ShowWindow(loginWindow->GetView());
}
@ -1263,6 +1251,12 @@ std::string GameController::WallName(int type)
return "";
}
void GameController::NotifyAuthUserChanged(Client * sender)
{
User newUser = sender->GetAuthUser();
gameModel->SetUser(newUser);
}
void GameController::NotifyUpdateAvailable(Client * sender)
{
class UpdateConfirmation: public ConfirmDialogueCallback {

View File

@ -46,7 +46,6 @@ private:
CommandInterface * commandInterface;
public:
bool HasDone;
class LoginCallback;
class SearchCallback;
class RenderCallback;
class SSaveCallback;
@ -142,6 +141,7 @@ public:
void RemoveNotification(Notification * notification);
virtual void NotifyUpdateAvailable(Client * sender);
virtual void NotifyAuthUserChanged(Client * sender);
void RunUpdater();
};

View File

@ -777,7 +777,7 @@ ui::Colour GameModel::GetColourSelectorColour()
void GameModel::SetUser(User user)
{
currentUser = user;
Client::Ref().SetAuthUser(user);
//Client::Ref().SetAuthUser(user);
notifyUserChanged();
}