summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-11 06:03:25 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-11 06:03:25 +0000
commitb9190ebc16253254cb649faae76119eec3e14b8e (patch)
treee1cc12269825f020a14877be1ecfbfa959781710 /include
parent86e43f1f144cfd04b039a844959af1f7aec3e6da (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/account.h30
-rw-r--r--include/extern.h6
-rw-r--r--include/regchannel.h12
-rw-r--r--include/services.h82
4 files changed, 109 insertions, 21 deletions
diff --git a/include/account.h b/include/account.h
index 075b15e9e..b2ba04950 100644
--- a/include/account.h
+++ b/include/account.h
@@ -69,13 +69,10 @@ enum NickCoreFlag
class NickRequest
{
public:
- NickRequest()
- {
- next = prev = NULL;
- nick = passcode = email = NULL;
- *password = 0;
- requested = lastmail = 0;
- }
+ NickRequest(const std::string &nickname);
+
+ ~NickRequest();
+
NickRequest *next, *prev;
char *nick;
char *passcode;
@@ -90,7 +87,15 @@ class NickCore;
class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag>
{
public:
- NickAlias();
+ /** Default constructor
+ * @param nickname The nick
+ * @param nickcore The nickcofe for this nick
+ */
+ NickAlias(const std::string &nickname, NickCore *nickcore);
+
+ /** Default destructor
+ */
+ ~NickAlias();
NickAlias *next, *prev;
char *nick; /* Nickname */
@@ -105,7 +110,14 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag>
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
{
public:
- NickCore();
+ /** Default constructor
+ * @param display The display nick
+ */
+ NickCore(const std::string &nickdisplay);
+
+ /** Default destructor
+ */
+ ~NickCore();
NickCore *next, *prev;
diff --git a/include/extern.h b/include/extern.h
index 21a4987ff..f64ab78d6 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -73,8 +73,6 @@ E void bot_raw_mode(User * requester, ChannelInfo * ci, const char *mode, char *
E Channel *chanlist[1024];
E void chan_adduser2(User * user, Channel * c);
-E void chan_delete(Channel * c);
-E Channel *chan_create(const char *chan, time_t ts);
E Channel *join_user_update(User * user, Channel * chan, const char *name, time_t chants);
E void get_channel_stats(long *nrec, long *memuse);
@@ -132,7 +130,6 @@ E LevelInfo levelinfo[];
E void get_chanserv_stats(long *nrec, long *memuse);
-E int delchan(ChannelInfo * ci);
E void alpha_insert_chan(ChannelInfo * ci);
E void reset_levels(ChannelInfo * ci);
E void cs_init();
@@ -167,7 +164,6 @@ E void stick_mask(ChannelInfo * ci, AutoKick * akick);
E void stick_all(ChannelInfo * ci);
E int levelinfo_maxwidth;
-E ChannelInfo *makechan(const char *chan);
E char *get_mlock_modes(ChannelInfo * ci, int complete);
/**** compat.c ****/
@@ -605,7 +601,6 @@ E NickAlias *nalists[1024];
E NickCore *nclists[1024];
E NickRequest *nrlists[1024];
E NickRequest *findrequestnick(const char *nick);
-E int delnickrequest(NickRequest * nr);
E unsigned int guestnum;
E void insert_requestnick(NickRequest * nr);
E void alpha_insert_alias(NickAlias * na);
@@ -632,7 +627,6 @@ E int nick_identified(User * u);
E void expire_nicks();
E void expire_requests();
EI int ns_do_register(User * u);
-E int delnick(NickAlias * na);
E NickAlias *findnick(const char *nick);
E NickAlias *findnick(const std::string &nick);
E NickCore *findcore(const char *nick);
diff --git a/include/regchannel.h b/include/regchannel.h
index c094ac2af..33908cb3a 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -69,7 +69,17 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
std::bitset<128> mlock_off; /* Modes mlocked off */
public:
- ChannelInfo();
+ // XXX Hack for defcon, though this really isn't needed now and should be destroyed
+ ChannelInfo() { }
+
+ /** Default constructor
+ * @param chname The channel name
+ */
+ ChannelInfo(const std::string &chname);
+
+ /** Default destructor
+ */
+ ~ChannelInfo();
ChannelInfo *next, *prev;
char name[CHANMAX];
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<ChannelModeName, std::string> 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<std::pair<std::string, std::string> > svsopers_in_config;
*/
E std::list<OperType *> 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<std::map<NickAlias *, NickServCollide *>::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<std::map<NickAlias *, NickServRelease *>::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 */