diff options
| -rw-r--r-- | src/ClientInfo.hpp | 10 | ||||
| -rw-r--r-- | src/PatchedClonkParser.cpp | 20 | ||||
| -rw-r--r-- | src/PatchedClonkParser.hpp | 2 | ||||
| -rw-r--r-- | src/crsm.cpp | 4 |
4 files changed, 14 insertions, 22 deletions
diff --git a/src/ClientInfo.hpp b/src/ClientInfo.hpp index 416fd4a..f84df7d 100644 --- a/src/ClientInfo.hpp +++ b/src/ClientInfo.hpp @@ -32,7 +32,6 @@ public: QStringList players; ClientInterface interface = Clonk; - int CUID = 0; bool activated = false; bool dcc = false; @@ -53,13 +52,12 @@ public: return ret; } - static inline ClientInfo clonkClient(QString nick, QString pcName, int CUID, bool activated = false) + static inline ClientInfo clonkClient(QString nick, QString pcName, bool activated = false) { ClientInfo ret; ret.interface = Clonk; ret.nick = nick; ret.pcName = pcName; - ret.CUID = CUID; ret.activated = activated; return ret; } @@ -92,7 +90,7 @@ public: } else { - return other.interface == interface && other.nick == nick && (interface == Clonk ? other.pcName == pcName && other.CUID == CUID : true); + return other.interface == interface && other.nick == nick && (interface == Clonk ? other.pcName == pcName : true); } } @@ -166,7 +164,7 @@ public: { if(parts.length() != 6 && parts.length() != 5) throw ConfigException("Cannot read corrupt ClientInfo with Clonk-ClientInterface: " + string.toStdString()); info.pcName = parts.at(1); - info.CUID = parts.at(2).toInt(); + // CUID used to be 2; keep compatible info.nick = parts.at(3); info.activated = ConfigValueBase::getValue<bool>(parts.at(4)); if(parts.length() > 5) @@ -199,7 +197,7 @@ public: switch(info.interface) { case Auto: break; - case Clonk: ret.append(info.pcName); ret.append(QString::number(info.CUID)); ret.append(info.nick); ret.append(ConfigValueBase::getStringValue(info.activated)); ret.append(ConfigValueBase::getStringValue<QList<QString>>(info.players)); break; + case Clonk: ret.append(info.pcName); ret.append("0"); ret.append(info.nick); ret.append(ConfigValueBase::getStringValue(info.activated)); ret.append(ConfigValueBase::getStringValue<QList<QString>>(info.players)); break; case IRC: ret.append(info.nick); break; case Management: ret.append(info.management.name); break; } diff --git a/src/PatchedClonkParser.cpp b/src/PatchedClonkParser.cpp index d8e13f4..e5abd7d 100644 --- a/src/PatchedClonkParser.cpp +++ b/src/PatchedClonkParser.cpp @@ -6,12 +6,12 @@ PatchedClonkParser::PatchedClonkParser(CRSMSession& session) : ClonkParser(sessi } namespace { - void parseClientInfo(QString& message, QString& pcName, int& CUID, QString& user) + void parseClientInfo(QString& message, QString& pcName, QString& user) { if(message.length() > 5 && message.at(0) == '\\') { - QString parts[3]; - for(int i = 1, part = 0; i < message.length() && part < 3; ++i) + QString parts[2]; + for(int i = 1, part = 0; i < message.length() && part < 2; ++i) { bool last = (i == message.length() -1); QChar c = message.at(i); @@ -22,13 +22,12 @@ namespace { } if(c == '\\') { - if((last || next == ' ') && part == 2) + if((last || next == ' ') && part == 1) { message = message.mid(i + 2); pcName = parts[0]; - CUID = parts[1].toInt(); - user = parts[2]; + user = parts[1]; return; } else @@ -117,14 +116,13 @@ void PatchedClonkParser::parseMessage(const QString &line) } QString pcName, user; - int CUID = 0; - parseClientInfo(what, pcName, CUID, user); + parseClientInfo(what, pcName, user); if(pcName.isEmpty()) { return; } - ClientInfo& client = getClientInfo(pcName, CUID, user); + ClientInfo& client = getClientInfo(pcName, user); if(type == "Pli" || type == "Pla") { @@ -197,7 +195,7 @@ void PatchedClonkParser::parseMessage(const QString &line) } } -ClientInfo &PatchedClonkParser::getClientInfo(const QString &pcName, int CUID, const QString &user) +ClientInfo &PatchedClonkParser::getClientInfo(const QString &pcName, const QString &user) { if(pcName == Session.Clonk.Server.pcName) { @@ -206,7 +204,7 @@ ClientInfo &PatchedClonkParser::getClientInfo(const QString &pcName, int CUID, c if(!Session.Clonk.Clients.contains(pcName)) { - Session.Clonk.Clients.insert(pcName, ClientInfo::clonkClient(user, pcName, CUID)); + Session.Clonk.Clients.insert(pcName, ClientInfo::clonkClient(user, pcName)); } return Session.Clonk.Clients[pcName]; } diff --git a/src/PatchedClonkParser.hpp b/src/PatchedClonkParser.hpp index dd4a661..1d5a34a 100644 --- a/src/PatchedClonkParser.hpp +++ b/src/PatchedClonkParser.hpp @@ -10,5 +10,5 @@ public: void parseMessage(const QString& line); protected: - ClientInfo& getClientInfo(const QString& pcName, int CUID, const QString& user); + ClientInfo& getClientInfo(const QString& pcName, const QString& user); }; diff --git a/src/crsm.cpp b/src/crsm.cpp index 023b0cf..902e813 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -1612,8 +1612,6 @@ UserType CRSM::clientUserType(const ClientInfo &client) switch(client.interface) { case Clonk: - if(Config.Clonk.Chat.Moderators.contains(client.CUID)) - return Moderator; if(Session.Clonk.Admin == client) return Admin; break; @@ -2247,8 +2245,6 @@ QString CRSM::clientModName(const ClientInfo &client) { case IRC: return Config.IRC.Moderators.value(client.nick); - case Clonk: - return Config.Clonk.Chat.Moderators.value(client.CUID); case Management: return client.management.name; case Auto: default: |
