From a4305d8f3c3e613be839bdcd61a1d14c87fed5aa Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 23 Sep 2019 11:49:26 +0100 Subject: Add the server id to the Server class. --- include/server.h | 24 ++++++++++++++++++++++-- include/users.h | 5 +++-- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/server.h b/include/server.h index d73c9673a..491754e13 100644 --- a/include/server.h +++ b/include/server.h @@ -22,6 +22,9 @@ class CoreExport Server : public classbase { protected: + /** The unique identifier for this server. */ + const std::string id; + /** The name of this server */ const std::string name; @@ -44,8 +47,25 @@ class CoreExport Server : public classbase friend class ConfigReaderThread; public: - Server(const std::string& srvname, const std::string& srvdesc) - : name(srvname), description(srvdesc), uline(false), silentuline(false) { } + Server(const std::string& srvid, const std::string& srvname, const std::string& srvdesc) + : id(srvid) + , name(srvname) + , description(srvdesc) + , uline(false) + , silentuline(false) + { + } + + DEPRECATED_METHOD(Server(const std::string& srvname, const std::string& srvdesc)) + : name(srvname) + , description(srvdesc) + , uline(false) + , silentuline(false) + { + } + + /** Retrieves the unique identifier for this server (e.g. 36C). */ + const std::string& GetId() const { return id; } /** * Returns the name of this server diff --git a/include/users.h b/include/users.h index 94a8af9a4..6b7e18953 100644 --- a/include/users.h +++ b/include/users.h @@ -885,13 +885,14 @@ class RemoteUser : public User class CoreExport FakeUser : public User { public: - FakeUser(const std::string& uid, Server* srv) : User(uid, srv, USERTYPE_SERVER) + FakeUser(const std::string& uid, Server* srv) + : User(uid, srv, USERTYPE_SERVER) { nick = srv->GetName(); } FakeUser(const std::string& uid, const std::string& sname, const std::string& sdesc) - : User(uid, new Server(sname, sdesc), USERTYPE_SERVER) + : User(uid, new Server(uid, sname, sdesc), USERTYPE_SERVER) { nick = sname; } -- cgit v1.2.3