summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/account.h27
-rw-r--r--include/extern.h5
-rw-r--r--include/services.h39
-rw-r--r--include/users.h7
4 files changed, 42 insertions, 36 deletions
diff --git a/include/account.h b/include/account.h
index 25c3ff87d..004760699 100644
--- a/include/account.h
+++ b/include/account.h
@@ -11,11 +11,16 @@ enum NickNameFlag
NS_FORBIDDEN,
/* Nick never expires */
NS_NO_EXPIRE,
- /* Nick is being held after a kill */
- NS_KILL_HELD,
- /* SVSNICK has been sent but nick has not yet changed.
- * An enforcer will be introduced when it does change. */
- NS_GUESTED,
+ /* This nick is being held after a kill by an enforcer client
+ * or is being SVSHeld. Used by ns_release to determin if something
+ * should be allowed to be released
+ */
+ NS_HELD,
+ /* We are taking over this nick, either by SVSNICK or KILL.
+ * We are waiting for the confirmation of either of these actions to
+ * proceed. This is checked in NickAlias::OnCancel
+ */
+ NS_COLLIDED,
NS_END
};
@@ -106,6 +111,18 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag>
time_t last_seen; /* When it was seen online for the last time */
NickCore *nc; /* I'm an alias of this */
HostInfo hostinfo;
+
+ /** Release a nick
+ * See the comment in users.cpp
+ */
+ void Release();
+
+ /** This function is called when a user on this nick either disconnects or changes nick.
+ * Note that the user isnt necessarially identified to this nick
+ * See the comment in users.cpp
+ * @param u The user
+ */
+ void OnCancel(User *u);
};
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
diff --git a/include/extern.h b/include/extern.h
index 4194338e9..f3b295bb8 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -371,23 +371,18 @@ E NickAlias *nalists[1024];
E NickCore *nclists[1024];
E NickRequest *nrlists[1024];
E NickRequest *findrequestnick(const char *nick);
-E unsigned int guestnum;
E void insert_requestnick(NickRequest * nr);
E void alpha_insert_alias(NickAlias * na);
E void insert_core(NickCore * nc);
E void get_aliases_stats(long *nrec, long *memuse);
E void get_core_stats(long *nrec, long *memuse);
-E void collide(NickAlias * na, int from_timeout);
-E void del_ns_timeout(NickAlias * na, int type);
E void change_core_display(NickCore * nc);
E void change_core_display(NickCore * nc, const char *newdisplay);
-E void release(NickAlias * na, int from_timeout);
E int do_setmodes(User * u);
E void ns_init();
E void nickserv(User * u, char *buf);
E int validate_user(User * u);
-E void cancel_user(User * u);
E void expire_nicks();
E void expire_requests();
E NickAlias *findnick(const char *nick);
diff --git a/include/services.h b/include/services.h
index 2807c49c8..1eb644c52 100644
--- a/include/services.h
+++ b/include/services.h
@@ -1159,65 +1159,52 @@ class CoreExport Anope
*/
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;
+ /* The nick */
+ std::string nick;
+ public:
/** Default constructor
- * @param nickalias The nick alias were kicking off
+ * @param _nick The nick were colliding
* @param delay How long to delay before kicking the user off the nick
*/
- NickServCollide(NickAlias *nickalias, time_t delay);
+ NickServCollide(const std::string &_nick, time_t delay);
/** Default destructor
*/
- ~NickServCollide();
+ virtual ~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;
+ std::string nick;
+
+ public:
/* 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 _nick The nick
+ * @param _uid the uid of the enforcer, if any
* @param delay The delay before the nick is released
*/
- NickServRelease(NickAlias *nickalias, time_t delay);
+ NickServRelease(const std::string &_nick, const std::string &_uid, time_t delay);
/** Default destructor
*/
- ~NickServRelease();
+ virtual ~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);
};
/** A timer used to keep the BotServ bot/ChanServ in the channel
diff --git a/include/users.h b/include/users.h
index 0d701f839..ff7c74622 100644
--- a/include/users.h
+++ b/include/users.h
@@ -130,6 +130,7 @@ class CoreExport User : public Extensible
/** Get the full mask ( nick!ident@realhost ) of a user
*/
const std::string GetMask();
+
/** Updates the realname of the user record.
*/
void SetRealname(const std::string &realname);
@@ -143,6 +144,12 @@ class CoreExport User : public Extensible
virtual void SendMessage(const std::string &source, const char *fmt, ...);
virtual void SendMessage(const std::string &source, const std::string &msg);
+ /** Collide a nick
+ * See the comment in users.cpp
+ * @param na The nick
+ */
+ void Collide(NickAlias *na);
+
/** Check if the user should become identified because
* their svid matches the one stored in their nickcore
* @param svid Services id