Idle Client Timeout Functionality

Added the functionality client side to log users out of servers if they
are idle for more than 1 hour without joining either a game or room.
Sending a message (room/game/private) or performing a game action.
This commit is contained in:
woogerboy21 2016-10-09 13:55:07 -04:00
parent e4127fead3
commit 7af2f3f057
15 changed files with 70 additions and 3 deletions

View file

@ -11,6 +11,8 @@ class RemoteClient : public AbstractClient {
signals:
void maxPingTime(int seconds, int maxSeconds);
void serverTimeout();
void idleTimeout();
void resetIdleTimerClock();
void loginError(Response::ResponseCode resp, QString reasonStr, quint32 endTime, QList<QString> missingFeatures);
void registerError(Response::ResponseCode resp, QString reasonStr, quint32 endTime);
void activateError();
@ -37,6 +39,7 @@ private slots:
void doLogin();
void doDisconnectFromServer();
void doActivateToServer(const QString &_token);
void doIdleTimeOut();
private:
static const int maxTimeout = 10;
@ -48,6 +51,7 @@ private:
int messageLength;
QTimer *timer;
QTimer *idleTimer;
QTcpSocket *socket;
QString lastHostname;
int lastPort;
@ -62,6 +66,7 @@ public:
void registerToServer(const QString &hostname, unsigned int port, const QString &_userName, const QString &_password, const QString &_email, const int _gender, const QString &_country, const QString &_realname);
void activateToServer(const QString &_token);
void disconnectFromServer();
void resetIdleTimer();
};
#endif