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"]; json::Boolean sessionStatus = objDocument["Session"];
if(!sessionStatus.Value()) if(!sessionStatus.Value())
{ {
authUser = User(0, ""); SetAuthUser(User(0, ""));
} }
//MOTD //MOTD

View File

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

View File

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

View File

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