From b31f343eacdf248aebd6869f2190a3464fd5d555 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:46:11 +0000 Subject: [PATCH] Remove unneeded Extensible inheritance and remove "age" field from classbase git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11611 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/base.h | 4 ---- include/channelmanager.h | 2 +- include/channels.h | 4 ++++ include/configreader.h | 6 +++--- include/mode.h | 4 ++-- include/snomasks.h | 2 +- include/socketengine.h | 2 +- include/threadengines/threadengine_pthread.h | 2 +- include/threadengines/threadengine_win32.h | 2 +- include/timer.h | 4 ++-- include/users.h | 4 ++++ src/base.cpp | 1 - src/modules/m_ident.cpp | 2 ++ src/modules/m_spanningtree/treeserver.cpp | 2 ++ src/modules/m_spanningtree/treeserver.h | 1 + src/modules/m_spanningtree/treesocket.h | 1 + src/modules/m_spanningtree/treesocket1.cpp | 2 ++ 17 files changed, 28 insertions(+), 17 deletions(-) diff --git a/include/base.h b/include/base.h index fa4e5c002..6bcf76817 100644 --- a/include/base.h +++ b/include/base.h @@ -29,10 +29,6 @@ typedef std::map ExtensibleStore; class CoreExport classbase { public: - /** Time that the object was instantiated (used for TS calculation etc) - */ - time_t age; - /** Constructor. * Sets the object's time */ diff --git a/include/channelmanager.h b/include/channelmanager.h index ea2c60282..a4a56b632 100644 --- a/include/channelmanager.h +++ b/include/channelmanager.h @@ -18,7 +18,7 @@ * the container which holds them. For some reason, nobody finished this. * TODO: Finish in future release! */ -class CoreExport ChannelManager : public Extensible +class CoreExport ChannelManager { private: InspIRCd *ServerInstance; diff --git a/include/channels.h b/include/channels.h index 9b4bfb1a5..e471e30cb 100644 --- a/include/channels.h +++ b/include/channels.h @@ -136,6 +136,10 @@ class CoreExport Channel : public Extensible */ std::string name; /* CHANMAX */ + /** Time that the object was instantiated (used for TS calculation etc) + */ + time_t age; + /** Modes for the channel. * This is not a null terminated string! It is a bitset where * each item in it represents if a mode is set. For example diff --git a/include/configreader.h b/include/configreader.h index b5e6a887b..e70a1478a 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -42,7 +42,7 @@ typedef std::map opertype_t; /** Holds an oper class. */ -struct operclass_data : public Extensible +struct operclass_data : public classbase { /** Command list for the class */ @@ -68,7 +68,7 @@ typedef std::map operclass_t; /** Defines the server's length limits on various length-limited * items such as topics, nicknames, channel names etc. */ -class ServerLimits : public Extensible +class ServerLimits { public: /** Maximum nickname length */ @@ -119,7 +119,7 @@ class ServerLimits : public Extensible * and storage of the configuration data needed to run the ircd, such as * the servername, connect classes, /ADMIN data, MOTDs and filenames etc. */ -class CoreExport ServerConfig : public Extensible +class CoreExport ServerConfig : public classbase { private: /** Creator/owner pointer diff --git a/include/mode.h b/include/mode.h index cbb9b9e94..a5a510367 100644 --- a/include/mode.h +++ b/include/mode.h @@ -91,7 +91,7 @@ typedef std::pair ModePair; * mode is expected to have a parameter, then this is * equivalent to returning MODEACTION_DENY. */ -class CoreExport ModeHandler : public Extensible +class CoreExport ModeHandler : public classbase { protected: /** @@ -345,7 +345,7 @@ class CoreExport SimpleChannelModeHandler : public ModeHandler * and attach it to the mode using Server::AddModeWatcher and Server::DelModeWatcher. * A ModeWatcher will be called both before and after the mode change. */ -class CoreExport ModeWatcher : public Extensible +class CoreExport ModeWatcher : public classbase { protected: /** diff --git a/include/snomasks.h b/include/snomasks.h index e1af1a109..c35fc92b7 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -49,7 +49,7 @@ typedef std::map SnoList; * Modules and the core can enable and disable snomask characters. If they do, * then sending snomasks using these characters becomes possible. */ -class CoreExport SnomaskManager : public Extensible +class CoreExport SnomaskManager { private: /** Creator/owner diff --git a/include/socketengine.h b/include/socketengine.h index 16913972d..a191ff12d 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -174,7 +174,7 @@ class CoreExport EventHandler : public Extensible * have to be aware of which SocketEngine derived * class they are using. */ -class CoreExport SocketEngine : public Extensible +class CoreExport SocketEngine { protected: /** Owner/Creator diff --git a/include/threadengines/threadengine_pthread.h b/include/threadengines/threadengine_pthread.h index bad263d18..79b00e629 100644 --- a/include/threadengines/threadengine_pthread.h +++ b/include/threadengines/threadengine_pthread.h @@ -31,7 +31,7 @@ class Thread; * access non-threadsafe code from a Thread, use the Mutex class to wrap * access to the code carefully. */ -class CoreExport ThreadEngine : public Extensible +class CoreExport ThreadEngine { public: diff --git a/include/threadengines/threadengine_win32.h b/include/threadengines/threadengine_win32.h index 6bd1c2c00..64ad87ab8 100644 --- a/include/threadengines/threadengine_win32.h +++ b/include/threadengines/threadengine_win32.h @@ -30,7 +30,7 @@ class Thread; * access non-threadsafe code from a Thread, use the Mutex class to wrap * access to the code carefully. */ -class CoreExport ThreadEngine : public Extensible +class CoreExport ThreadEngine { public: diff --git a/include/timer.h b/include/timer.h index 85755d654..05ce136d2 100644 --- a/include/timer.h +++ b/include/timer.h @@ -26,7 +26,7 @@ * your object (which you should override) will be called * at the given time. */ -class CoreExport Timer : public Extensible +class CoreExport Timer { private: /** The triggering time @@ -111,7 +111,7 @@ class CoreExport Timer : public Extensible * This will ensure timers are not missed, as well as removing timers that have * expired and allowing the addition of new ones. */ -class CoreExport TimerManager : public Extensible +class CoreExport TimerManager { protected: /** A list of all pending timers diff --git a/include/users.h b/include/users.h index 9023d7728..19d78ec23 100644 --- a/include/users.h +++ b/include/users.h @@ -339,6 +339,10 @@ class CoreExport User : public EventHandler */ time_t lastping; + /** Time that the object was instantiated (used for TS calculation etc) + */ + time_t age; + /** Time the connection was created, set in the constructor. This * may be different from the time the user's classbase object was * created. diff --git a/src/base.cpp b/src/base.cpp index b24646ab8..7e0cf482a 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -23,7 +23,6 @@ const int inverted_bitfields[] = {~1,~2,~4,~8,~16,~32,~64,~128}; classbase::classbase() { - this->age = time(NULL); } bool Extensible::Shrink(const std::string &key) diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 80f2c0b99..8d21d5cc8 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -79,9 +79,11 @@ class IdentRequestSocket : public EventHandler bool done; /* True if lookup is finished */ std::string result; /* Holds the ident string if done */ public: + time_t age; IdentRequestSocket(InspIRCd *Server, User* u) : user(u), ServerInstance(Server), result(u->ident) { + age = ServerInstance->Time(); socklen_t size = 0; SetFd(socket(user->server_sa.sa.sa_family, SOCK_STREAM, 0)); diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index b6ec7a305..97aab7266 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -30,6 +30,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id) : ServerInstance(Instance), ServerName(Name.c_str()), ServerDesc(Desc), Utils(Util) { + age = Instance->Time(); bursting = false; Parent = NULL; VersionString.clear(); @@ -50,6 +51,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide) : ServerInstance(Instance), Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide) { + age = Instance->Time(); bursting = true; VersionString.clear(); ServerUserCount = ServerOperCount = 0; diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index f39778eb0..e8db09cdf 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -52,6 +52,7 @@ class TreeServer : public classbase void SetID(const std::string &id); public: + time_t age; bool Warned; /* True if we've warned opers about high latency on this server */ bool bursting; /* whether or not this server is bursting */ diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 6d99c2a76..3c736b341 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -93,6 +93,7 @@ class TreeSocket : public BufferedSocket bool auth_challenge; /* Did we auth using challenge/response */ public: HandshakeTimer* hstimer; /* Handshake timer, needed to work around I/O hook buffering */ + time_t age; /** Because most of the I/O gubbins are encapsulated within * BufferedSocket, we just call the superclass constructor for diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 46f2657ff..9706271bf 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -39,6 +39,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string shost, int iport, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod) : BufferedSocket(SI, shost, iport, maxtime, bindto), Utils(Util), Hook(HookMod) { + age = SI->Time(); myhost = ServerName; theirchallenge.clear(); ourchallenge.clear(); @@ -56,6 +57,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string sh TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, int newfd, char* ip, Module* HookMod) : BufferedSocket(SI, newfd, ip), Utils(Util), Hook(HookMod) { + age = SI->Time(); this->LinkState = WAIT_AUTH_1; theirchallenge.clear(); ourchallenge.clear(); -- 2.39.2