From b9190ebc16253254cb649faae76119eec3e14b8e Mon Sep 17 00:00:00 2001 From: Adam- Date: Wed, 11 Nov 2009 06:03:25 +0000 Subject: Moved alot of stuff to constructors and destructors, instead of having functions everywhere to create and destroy objects git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2639 5417fbe8-f217-4b02-8779-1006273d7864 --- include/services.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 5 deletions(-) (limited to 'include/services.h') diff --git a/include/services.h b/include/services.h index 1680d4d1a..8ec13d225 100644 --- a/include/services.h +++ b/include/services.h @@ -946,12 +946,15 @@ class CoreExport Channel : public Extensible std::map Params; public: - Channel() { } + /** Default constructor + * @param name The channel name + * @param ts The time the channel was created + */ + Channel(const std::string &name, time_t ts = time(NULL)); - ~Channel() - { - Params.clear(); - } + /** Default destructor + */ + ~Channel(); Channel *next, *prev; char name[CHANMAX]; @@ -1784,4 +1787,73 @@ E std::list > svsopers_in_config; */ E std::list MyOperTypes; +/*************************************************************************/ + +#include "timers.h" + +/** Timer for colliding nicks to force people off of nicknames + */ +class NickServCollide : public Timer +{ + public: + /* NickAlias of the nick who were kicking off */ + NickAlias *na; + /* Return for the std::map::insert */ + std::pair::iterator, bool> it; + + /** Default constructor + * @param nickalias The nick alias were kicking off + * @param delay How long to delay before kicking the user off the nick + */ + NickServCollide(NickAlias *nickalias, time_t delay); + + /** Default destructor + */ + ~NickServCollide(); + + /** Called when the delay is up + * @param t The current time + */ + void Tick(time_t t); + + /** Clear all timers for a nick + * @param na The nick to remove the timers for + */ + static void ClearTimers(NickAlias *na); +}; + +/** Timers for releasing nicks to be available for use + */ +class NickServRelease : public Timer +{ + public: + /* The nick */ + NickAlias *na; + /* The uid of the services enforcer client (used for TS6 ircds) */ + std::string uid; + /* Return for std::map::insert */ + std::pair::iterator, bool> it; + + /** Default constructor + * @param nickalias The nick + * @param delay The delay before the nick is released + */ + NickServRelease(NickAlias *nickalias, time_t delay); + + /** Default destructor + */ + ~NickServRelease(); + + /** Called when the delay is up + * @param t The current time + */ + void Tick(time_t t); + + /** Clear all timers for a nick + * @param na The nick to remove the timers for + * @param dorelase true to actually call release(), false to just remove the timers + */ + static void ClearTimers(NickAlias *na, bool dorelease = false); +}; + #endif /* SERVICES_H */ -- cgit