mirror of
https://github.com/anope/anope.git
synced 2026-07-07 02:43:12 +02:00
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
This commit is contained in:
+21
-9
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+11
-1
@@ -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];
|
||||
|
||||
+77
-5
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user