diff --git a/cockatrice/cockatrice.qrc b/cockatrice/cockatrice.qrc
index 76015af4..b1af7022 100644
--- a/cockatrice/cockatrice.qrc
+++ b/cockatrice/cockatrice.qrc
@@ -307,10 +307,6 @@
resources/countries/zm.svg
resources/countries/zw.svg
- resources/genders/male.svg
- resources/genders/female.svg
- resources/genders/unknown.svg
-
resources/phases/untap.svg
resources/phases/upkeep.svg
resources/phases/draw.svg
diff --git a/cockatrice/resources/genders/female.svg b/cockatrice/resources/genders/female.svg
deleted file mode 100644
index b0fbb130..00000000
--- a/cockatrice/resources/genders/female.svg
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
diff --git a/cockatrice/resources/genders/male.svg b/cockatrice/resources/genders/male.svg
deleted file mode 100644
index 8c58a40f..00000000
--- a/cockatrice/resources/genders/male.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/cockatrice/resources/genders/unknown.svg b/cockatrice/resources/genders/unknown.svg
deleted file mode 100644
index 99f681f9..00000000
--- a/cockatrice/resources/genders/unknown.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/cockatrice/src/abstractclient.h b/cockatrice/src/abstractclient.h
index f58c4186..30c99823 100644
--- a/cockatrice/src/abstractclient.h
+++ b/cockatrice/src/abstractclient.h
@@ -88,7 +88,6 @@ protected slots:
protected:
QMap pendingCommands;
QString userName, password, email, country, realName, token;
- int gender;
void setStatus(ClientStatus _status);
int getNewCmdId()
{
diff --git a/cockatrice/src/dlg_edit_user.h b/cockatrice/src/dlg_edit_user.h
index 77744dd1..3dc6c7eb 100644
--- a/cockatrice/src/dlg_edit_user.h
+++ b/cockatrice/src/dlg_edit_user.h
@@ -21,10 +21,6 @@ public:
{
return emailEdit->text();
}
- int getGender() const
- {
- return -1;
- } // This will return GenderUnknown for protocol purposes.
QString getCountry() const
{
return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText();
diff --git a/cockatrice/src/dlg_register.h b/cockatrice/src/dlg_register.h
index a18fe95c..51dd593a 100644
--- a/cockatrice/src/dlg_register.h
+++ b/cockatrice/src/dlg_register.h
@@ -34,10 +34,6 @@ public:
{
return emailEdit->text();
}
- int getGender() const
- {
- return -1;
- } // This will return GenderUnknown for the protocol.
QString getCountry() const
{
return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText();
diff --git a/cockatrice/src/pixmapgenerator.cpp b/cockatrice/src/pixmapgenerator.cpp
index dfb80177..f15b7bf5 100644
--- a/cockatrice/src/pixmapgenerator.cpp
+++ b/cockatrice/src/pixmapgenerator.cpp
@@ -78,25 +78,6 @@ QPixmap PingPixmapGenerator::generatePixmap(int size, int value, int max)
QMap PingPixmapGenerator::pmCache;
-QPixmap GenderPixmapGenerator::generatePixmap(int height)
-{
- ServerInfo_User::Gender gender = ServerInfo_User::GenderUnknown;
-
- int key = gender * 100000 + height;
- if (pmCache.contains(key))
- return pmCache.value(key);
-
- QString genderStr;
- genderStr = "unknown";
-
- QPixmap pixmap =
- QPixmap("theme:genders/" + genderStr).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- pmCache.insert(key, pixmap);
- return pixmap;
-}
-
-QMap GenderPixmapGenerator::pmCache;
-
QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countryCode)
{
if (countryCode.size() != 2)
diff --git a/cockatrice/src/pixmapgenerator.h b/cockatrice/src/pixmapgenerator.h
index 9fdc7f32..65f9a96f 100644
--- a/cockatrice/src/pixmapgenerator.h
+++ b/cockatrice/src/pixmapgenerator.h
@@ -45,19 +45,6 @@ public:
}
};
-class GenderPixmapGenerator
-{
-private:
- static QMap pmCache;
-
-public:
- static QPixmap generatePixmap(int height);
- static void clear()
- {
- pmCache.clear();
- }
-};
-
class CountryPixmapGenerator
{
private:
diff --git a/cockatrice/src/remoteclient.cpp b/cockatrice/src/remoteclient.cpp
index 5f2dabfa..8f1b1ce6 100644
--- a/cockatrice/src/remoteclient.cpp
+++ b/cockatrice/src/remoteclient.cpp
@@ -152,7 +152,6 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdRegister.set_user_name(userName.toStdString());
cmdRegister.set_password(password.toStdString());
cmdRegister.set_email(email.toStdString());
- cmdRegister.set_gender((ServerInfo_User_Gender)gender);
cmdRegister.set_country(country.toStdString());
cmdRegister.set_real_name(realName.toStdString());
cmdRegister.set_clientid(getSrvClientID(lastHostname).toStdString());
@@ -449,7 +448,6 @@ void RemoteClient::doRegisterToServer(const QString &hostname,
const QString &_userName,
const QString &_password,
const QString &_email,
- const int _gender,
const QString &_country,
const QString &_realname)
{
@@ -458,7 +456,6 @@ void RemoteClient::doRegisterToServer(const QString &hostname,
userName = _userName;
password = _password;
email = _email;
- gender = _gender;
country = _country;
realName = _realname;
lastHostname = hostname;
@@ -539,11 +536,10 @@ void RemoteClient::registerToServer(const QString &hostname,
const QString &_userName,
const QString &_password,
const QString &_email,
- const int _gender,
const QString &_country,
const QString &_realname)
{
- emit sigRegisterToServer(hostname, port, _userName, _password, _email, _gender, _country, _realname);
+ emit sigRegisterToServer(hostname, port, _userName, _password, _email, _country, _realname);
}
void RemoteClient::activateToServer(const QString &_token)
diff --git a/cockatrice/src/remoteclient.h b/cockatrice/src/remoteclient.h
index d1e1eec7..5e001fb5 100644
--- a/cockatrice/src/remoteclient.h
+++ b/cockatrice/src/remoteclient.h
@@ -27,7 +27,6 @@ signals:
const QString &_userName,
const QString &_password,
const QString &_email,
- int _gender,
const QString &_country,
const QString &_realname);
void sigActivateToServer(const QString &_token);
@@ -67,7 +66,6 @@ private slots:
const QString &_userName,
const QString &_password,
const QString &_email,
- int _gender,
const QString &_country,
const QString &_realname);
void doRequestPasswordSalt();
@@ -130,7 +128,6 @@ public:
const QString &_userName,
const QString &_password,
const QString &_email,
- int _gender,
const QString &_country,
const QString &_realname);
void activateToServer(const QString &_token);
diff --git a/cockatrice/src/userinfobox.cpp b/cockatrice/src/userinfobox.cpp
index 33b0ad61..0de162ce 100644
--- a/cockatrice/src/userinfobox.cpp
+++ b/cockatrice/src/userinfobox.cpp
@@ -200,7 +200,6 @@ void UserInfoBox::actEditInternal(const Response &r)
Command_AccountEdit cmd;
cmd.set_real_name(dlg.getRealName().toStdString());
cmd.set_email(dlg.getEmail().toStdString());
- cmd.set_gender((ServerInfo_User_Gender)dlg.getGender());
cmd.set_country(dlg.getCountry().toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd);
diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp
index 703183d6..482029a7 100644
--- a/cockatrice/src/window_main.cpp
+++ b/cockatrice/src/window_main.cpp
@@ -201,8 +201,7 @@ void MainWindow::actRegister()
DlgRegister dlg(this);
if (dlg.exec()) {
client->registerToServer(dlg.getHost(), static_cast(dlg.getPort()), dlg.getPlayerName(),
- dlg.getPassword(), dlg.getEmail(), dlg.getGender(), dlg.getCountry(),
- dlg.getRealName());
+ dlg.getPassword(), dlg.getEmail(), dlg.getCountry(), dlg.getRealName());
}
}
diff --git a/common/pb/game_commands.proto b/common/pb/game_commands.proto
index 3a36cd21..b029d24a 100644
--- a/common/pb/game_commands.proto
+++ b/common/pb/game_commands.proto
@@ -26,7 +26,7 @@ message GameCommand {
NEXT_TURN = 1022;
SET_ACTIVE_PHASE = 1023;
DUMP_ZONE = 1024;
- STOP_DUMP_ZONE = 1025; // deprecated
+ // STOP_DUMP_ZONE = 1025; // obsolete
REVEAL_CARDS = 1026;
MOVE_CARD = 1027;
SET_SIDEBOARD_PLAN = 1028;
diff --git a/common/pb/game_event.proto b/common/pb/game_event.proto
index 45644e2c..cc7584dc 100644
--- a/common/pb/game_event.proto
+++ b/common/pb/game_event.proto
@@ -28,7 +28,7 @@ message GameEvent {
SET_ACTIVE_PLAYER = 2016;
SET_ACTIVE_PHASE = 2017;
DUMP_ZONE = 2018;
- STOP_DUMP_ZONE = 2019; // deprecated
+ // STOP_DUMP_ZONE = 2019; // obsolete
CHANGE_ZONE_PROPERTIES = 2020;
REVERSE_TURN = 2021;
}
diff --git a/common/pb/serverinfo_user.proto b/common/pb/serverinfo_user.proto
index 908d2032..c74ed8ee 100644
--- a/common/pb/serverinfo_user.proto
+++ b/common/pb/serverinfo_user.proto
@@ -8,16 +8,11 @@ message ServerInfo_User {
IsAdmin = 8;
IsJudge = 16;
};
- enum Gender {
- GenderUnknown = -1;
- Male = 0;
- Female = 1;
- };
optional string name = 1;
optional uint32 user_level = 2;
optional string address = 3;
optional string real_name = 4;
- optional Gender gender = 5 [default = GenderUnknown];
+ // gender = 5; // obsolete
optional string country = 6;
optional bytes avatar_bmp = 7;
optional sint32 id = 8 [default = -1];
diff --git a/common/pb/session_commands.proto b/common/pb/session_commands.proto
index 0260aa98..c6a6dcbd 100644
--- a/common/pb/session_commands.proto
+++ b/common/pb/session_commands.proto
@@ -122,8 +122,7 @@ message Command_Register {
required string password = 2;
// Email address of the client for user validation
optional string email = 3;
- // Gender of the user
- optional ServerInfo_User.Gender gender = 4;
+ // gender = 4; // obsolete
// Country code of the user. 2 letter ISO format
optional string country = 5;
optional string real_name = 6;
@@ -148,7 +147,7 @@ message Command_AccountEdit {
}
optional string real_name = 1;
optional string email = 2;
- optional ServerInfo_User.Gender gender = 3;
+ // gender = 3; // obsolete
optional string country = 4;
}
diff --git a/common/server_database_interface.h b/common/server_database_interface.h
index 95fc2916..bac1e520 100644
--- a/common/server_database_interface.h
+++ b/common/server_database_interface.h
@@ -114,7 +114,6 @@ public:
}
virtual bool registerUser(const QString & /* userName */,
const QString & /* realName */,
- ServerInfo_User_Gender const & /* gender */,
const QString & /* password */,
const QString & /* emailAddress */,
const QString & /* country */,
@@ -159,10 +158,6 @@ public:
{
return false;
};
- virtual QChar getGenderChar(ServerInfo_User_Gender const & /* gender */)
- {
- return QChar('u');
- };
};
#endif
diff --git a/servatrice/migrations/servatrice_0027_to_0028.sql b/servatrice/migrations/servatrice_0027_to_0028.sql
new file mode 100644
index 00000000..70bec360
--- /dev/null
+++ b/servatrice/migrations/servatrice_0027_to_0028.sql
@@ -0,0 +1,5 @@
+-- Servatrice db migration from version 27 to version 28
+
+ALTER TABLE cockatrice_users DROP COLUMN gender;
+
+UPDATE cockatrice_schema_version SET version=28 WHERE version=27;
diff --git a/servatrice/servatrice.sql b/servatrice/servatrice.sql
index bb2d3893..df12e0d5 100644
--- a/servatrice/servatrice.sql
+++ b/servatrice/servatrice.sql
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `cockatrice_schema_version` (
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci;
-INSERT INTO cockatrice_schema_version VALUES(27);
+INSERT INTO cockatrice_schema_version VALUES(28);
-- users and user data tables
CREATE TABLE IF NOT EXISTS `cockatrice_users` (
@@ -28,7 +28,6 @@ CREATE TABLE IF NOT EXISTS `cockatrice_users` (
`admin` tinyint(1) NOT NULL,
`name` varchar(35) NOT NULL,
`realname` varchar(255) NOT NULL,
- `gender` char(1) NOT NULL,
`password_sha512` char(120) NOT NULL,
`email` varchar(255) NOT NULL,
`country` char(2) NOT NULL,
diff --git a/servatrice/src/servatrice_database_interface.cpp b/servatrice/src/servatrice_database_interface.cpp
index 601f5099..7e591bcc 100644
--- a/servatrice/src/servatrice_database_interface.cpp
+++ b/servatrice/src/servatrice_database_interface.cpp
@@ -197,7 +197,6 @@ bool Servatrice_DatabaseInterface::usernameIsValid(const QString &user, QString
bool Servatrice_DatabaseInterface::registerUser(const QString &userName,
const QString &realName,
- ServerInfo_User_Gender const &gender,
const QString &password,
const QString &emailAddress,
const QString &country,
@@ -211,14 +210,13 @@ bool Servatrice_DatabaseInterface::registerUser(const QString &userName,
QSqlQuery *query =
prepareQuery("insert into {prefix}_users "
- "(name, realname, gender, password_sha512, email, country, registrationDate, active, token, "
+ "(name, realname, password_sha512, email, country, registrationDate, active, token, "
"admin, avatar_bmp, clientid, privlevel, privlevelStartDate, privlevelEndDate) "
"values "
- "(:userName, :realName, :gender, :password_sha512, :email, :country, UTC_TIMESTAMP(), :active, "
+ "(:userName, :realName, :password_sha512, :email, :country, UTC_TIMESTAMP(), :active, "
":token, 0, '', '', 'NONE', UTC_TIMESTAMP(), UTC_TIMESTAMP())");
query->bindValue(":userName", userName);
query->bindValue(":realName", realName);
- query->bindValue(":gender", getGenderChar(gender));
query->bindValue(":password_sha512", passwordSha512);
query->bindValue(":email", emailAddress);
query->bindValue(":country", country);
@@ -268,20 +266,6 @@ bool Servatrice_DatabaseInterface::activateUser(const QString &userName, const Q
return false;
}
-QChar Servatrice_DatabaseInterface::getGenderChar(ServerInfo_User_Gender const &gender)
-{
- switch (gender) {
- case ServerInfo_User_Gender_GenderUnknown:
- return QChar('u');
- case ServerInfo_User_Gender_Male:
- return QChar('m');
- case ServerInfo_User_Gender_Female:
- return QChar('f');
- default:
- return QChar('u');
- }
-}
-
AuthenticationResult Servatrice_DatabaseInterface::checkUserPassword(Server_ProtocolHandler *handler,
const QString &user,
const QString &password,
@@ -602,31 +586,25 @@ ServerInfo_User Servatrice_DatabaseInterface::evalUserQueryResult(const QSqlQuer
result.set_privlevel(privlevel.toStdString());
if (complete) {
- const QString genderStr = query->value(5).toString();
- if (genderStr == "m")
- result.set_gender(ServerInfo_User::Male);
- else if (genderStr == "f")
- result.set_gender(ServerInfo_User::Female);
-
- const QString realName = query->value(6).toString();
+ const QString realName = query->value(5).toString();
if (!realName.isEmpty())
result.set_real_name(realName.toStdString());
- const QByteArray avatarBmp = query->value(7).toByteArray();
+ const QByteArray avatarBmp = query->value(6).toByteArray();
if (avatarBmp.size())
result.set_avatar_bmp(avatarBmp.data(), avatarBmp.size());
- const QDateTime regDate = query->value(8).toDateTime();
+ const QDateTime regDate = query->value(7).toDateTime();
if (!regDate.toString(Qt::ISODate).isEmpty()) {
qint64 accountAgeInSeconds = regDate.secsTo(QDateTime::currentDateTime());
result.set_accountage_secs(accountAgeInSeconds);
}
- const QString email = query->value(9).toString();
+ const QString email = query->value(8).toString();
if (!email.isEmpty())
result.set_email(email.toStdString());
- const QString clientid = query->value(10).toString();
+ const QString clientid = query->value(9).toString();
if (!clientid.isEmpty())
result.set_clientid(clientid.toStdString());
}
@@ -644,7 +622,7 @@ ServerInfo_User Servatrice_DatabaseInterface::getUserData(const QString &name, b
return result;
QSqlQuery *query =
- prepareQuery("select id, name, admin, country, privlevel, gender, realname, avatar_bmp, registrationDate, "
+ prepareQuery("select id, name, admin, country, privlevel, realname, avatar_bmp, registrationDate, "
"email, clientid from {prefix}_users where name = :name and active = 1");
query->bindValue(":name", name);
if (!execSqlQuery(query))
diff --git a/servatrice/src/servatrice_database_interface.h b/servatrice/src/servatrice_database_interface.h
index 5d6f0abe..7428fd55 100644
--- a/servatrice/src/servatrice_database_interface.h
+++ b/servatrice/src/servatrice_database_interface.h
@@ -9,7 +9,7 @@
#include
#include
-#define DATABASE_SCHEMA_VERSION 27
+#define DATABASE_SCHEMA_VERSION 28
class Servatrice;
@@ -97,7 +97,6 @@ public:
int checkNumberOfUserAccounts(const QString &email);
bool registerUser(const QString &userName,
const QString &realName,
- ServerInfo_User_Gender const &gender,
const QString &password,
const QString &emailAddress,
const QString &country,
@@ -114,7 +113,6 @@ public:
const QString &targetName);
bool
changeUserPassword(const QString &user, const QString &oldPassword, const QString &newPassword, const bool &force);
- QChar getGenderChar(ServerInfo_User_Gender const &gender);
QList getUserBanHistory(const QString userName);
bool
addWarning(const QString userName, const QString adminName, const QString warningReason, const QString clientID);
diff --git a/servatrice/src/serversocketinterface.cpp b/servatrice/src/serversocketinterface.cpp
index b7604f9f..d6baea7a 100644
--- a/servatrice/src/serversocketinterface.cpp
+++ b/servatrice/src/serversocketinterface.cpp
@@ -1164,7 +1164,6 @@ Response::ResponseCode AbstractServerSocketInterface::cmdRegisterAccount(const C
}
QString realName = QString::fromStdString(cmd.real_name());
- ServerInfo_User_Gender gender = cmd.gender();
QString country = QString::fromStdString(cmd.country());
QString password = QString::fromStdString(cmd.password());
@@ -1178,8 +1177,8 @@ Response::ResponseCode AbstractServerSocketInterface::cmdRegisterAccount(const C
}
bool requireEmailActivation = settingsCache->value("registration/requireemailactivation", true).toBool();
- bool regSucceeded = sqlInterface->registerUser(userName, realName, gender, password, emailAddress, country,
- !requireEmailActivation);
+ bool regSucceeded =
+ sqlInterface->registerUser(userName, realName, password, emailAddress, country, !requireEmailActivation);
if (regSucceeded) {
qDebug() << "Accepted register command for user: " << userName;
@@ -1260,16 +1259,14 @@ Response::ResponseCode AbstractServerSocketInterface::cmdAccountEdit(const Comma
QString realName = QString::fromStdString(cmd.real_name());
QString emailAddress = QString::fromStdString(cmd.email());
- ServerInfo_User_Gender gender = cmd.gender();
QString country = QString::fromStdString(cmd.country());
QString userName = QString::fromStdString(userInfo->name());
QSqlQuery *query = sqlInterface->prepareQuery("update {prefix}_users set realname=:realName, email=:email, "
- "gender=:gender, country=:country where name=:userName");
+ "country=:country where name=:userName");
query->bindValue(":realName", realName);
query->bindValue(":email", emailAddress);
- query->bindValue(":gender", sqlInterface->getGenderChar(gender));
query->bindValue(":country", country);
query->bindValue(":userName", userName);
if (!sqlInterface->execSqlQuery(query))
@@ -1277,7 +1274,6 @@ Response::ResponseCode AbstractServerSocketInterface::cmdAccountEdit(const Comma
userInfo->set_real_name(cmd.real_name());
userInfo->set_email(cmd.email());
- userInfo->set_gender(cmd.gender());
userInfo->set_country(cmd.country());
return Response::RespOk;
diff --git a/webclient/src/types/user.tsx b/webclient/src/types/user.tsx
index c501c2b4..8a44da6f 100644
--- a/webclient/src/types/user.tsx
+++ b/webclient/src/types/user.tsx
@@ -3,7 +3,6 @@ export interface User {
name: string;
privlevel: UserAccessLevel;
userLevel: UserPrivLevel;
- gender?: number;
realName?: string;
country?: string;
avatarBmp?: Uint8Array;