mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-26 00:23:55 -07:00
Added user analytics table to database
This commit is contained in:
parent
dd4900b038
commit
d7d50def51
8 changed files with 70 additions and 14 deletions
|
|
@ -105,7 +105,7 @@ Server_DatabaseInterface *Server::getDatabaseInterface() const
|
|||
return databaseInterfaces.value(QThread::currentThread());
|
||||
}
|
||||
|
||||
AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reasonStr, int &secondsLeft, QString &clientid)
|
||||
AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reasonStr, int &secondsLeft, QString &clientid, QString &clientVersion)
|
||||
{
|
||||
if (name.size() > 35)
|
||||
name = name.left(35);
|
||||
|
|
@ -190,7 +190,7 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
|
|||
databaseInterface->updateUsersClientID(name, clientid);
|
||||
}
|
||||
|
||||
databaseInterface->updateUsersLastLoginTime(name);
|
||||
databaseInterface->updateUsersLastLoginData(name, clientVersion);
|
||||
se = Server_ProtocolHandler::prepareSessionEvent(event);
|
||||
sendIsl_SessionEvent(*se);
|
||||
delete se;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
Server(bool _threaded, QObject *parent = 0);
|
||||
~Server();
|
||||
void setThreaded(bool _threaded) { threaded = _threaded; }
|
||||
AuthenticationResult loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reason, int &secondsLeft, QString &clientid);
|
||||
AuthenticationResult loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reason, int &secondsLeft, QString &clientid, QString &clientVersion);
|
||||
|
||||
const QMap<int, Server_Room *> &getRooms() { return rooms; }
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual bool registerUser(const QString & /* userName */, const QString & /* realName */, ServerInfo_User_Gender const & /* gender */, const QString & /* password */, const QString & /* emailAddress */, const QString & /* country */, bool /* active = false */) { return false; }
|
||||
virtual bool activateUser(const QString & /* userName */, const QString & /* token */) { return false; }
|
||||
virtual void updateUsersClientID(const QString & /* userName */, const QString & /* userClientID */) { }
|
||||
virtual void updateUsersLastLoginTime(const QString & /* userName */) { }
|
||||
virtual void updateUsersLastLoginData(const QString & /* userName */, const QString & /* clientVersion */) { }
|
||||
|
||||
enum LogMessage_TargetType { MessageTargetRoom, MessageTargetGame, MessageTargetChat, MessageTargetIslRoom };
|
||||
virtual void logMessage(const int /* senderId */, const QString & /* senderName */, const QString & /* senderIp */, const QString & /* logMessage */, LogMessage_TargetType /* targetType */, const int /* targetId */, const QString & /* targetName */) { };
|
||||
|
|
|
|||
|
|
@ -384,6 +384,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
|
|||
{
|
||||
QString userName = QString::fromStdString(cmd.user_name()).simplified();
|
||||
QString clientId = QString::fromStdString(cmd.clientid()).simplified();
|
||||
QString clientVersion = QString::fromStdString(cmd.clientver()).simplified();
|
||||
|
||||
if (userName.isEmpty() || (userInfo != 0))
|
||||
return Response::RespContextError;
|
||||
|
|
@ -412,7 +413,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
|
|||
|
||||
QString reasonStr;
|
||||
int banSecondsLeft = 0;
|
||||
AuthenticationResult res = server->loginUser(this, userName, QString::fromStdString(cmd.password()), reasonStr, banSecondsLeft, clientId);
|
||||
AuthenticationResult res = server->loginUser(this, userName, QString::fromStdString(cmd.password()), reasonStr, banSecondsLeft, clientId, clientVersion);
|
||||
switch (res) {
|
||||
case UserIsBanned: {
|
||||
Response_Login *re = new Response_Login;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue