summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/account.h47
-rw-r--r--include/anope.h78
-rw-r--r--include/extern.h2
-rw-r--r--include/modules.h63
-rw-r--r--include/services.h88
5 files changed, 132 insertions, 146 deletions
diff --git a/include/account.h b/include/account.h
index eda40ef94..4d32edabb 100644
--- a/include/account.h
+++ b/include/account.h
@@ -224,4 +224,51 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
void ClearAccess();
};
+/** Timer for colliding nicks to force people off of nicknames
+ */
+class NickServCollide : public Timer
+{
+ dynamic_reference<User> u;
+ Anope::string nick;
+
+ public:
+ /** Default constructor
+ * @param nick The nick we're colliding
+ * @param delay How long to delay before kicking the user off the nick
+ */
+ NickServCollide(User *user, time_t delay);
+
+ /** Default destructor
+ */
+ virtual ~NickServCollide();
+
+ /** Called when the delay is up
+ * @param t The current time
+ */
+ void Tick(time_t t);
+};
+
+/** Timers for releasing nicks to be available for use
+ */
+class NickServRelease : public User, public Timer
+{
+ Anope::string nick;
+
+ public:
+ /** Default constructor
+ * @param na The nick
+ * @param delay The delay before the nick is released
+ */
+ NickServRelease(NickAlias *na, time_t delay);
+
+ /** Default destructor
+ */
+ virtual ~NickServRelease();
+
+ /** Called when the delay is up
+ * @param t The current time
+ */
+ void Tick(time_t t);
+};
+
#endif // ACCOUNT_H
diff --git a/include/anope.h b/include/anope.h
index 020abd4cd..a2cdc2d06 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include <set>
#include "hashcomp.h"
struct Message;
@@ -396,4 +397,81 @@ class spacesepstream : public sepstream
spacesepstream(const Anope::string &source) : sepstream(source, ' ') { }
};
+/** The base class that most classes in Anope inherit from
+ */
+class dynamic_reference_base;
+class CoreExport Base
+{
+ /* References to this base class */
+ std::set<dynamic_reference_base *> References;
+ public:
+ Base();
+ virtual ~Base();
+ void AddReference(dynamic_reference_base *r);
+ void DelReference(dynamic_reference_base *r);
+};
+
+class dynamic_reference_base : public virtual Base
+{
+ protected:
+ bool invalid;
+ public:
+ dynamic_reference_base() : invalid(false) { }
+ virtual ~dynamic_reference_base() { }
+ inline void Invalidate() { this->invalid = true; }
+};
+
+template<typename T>
+class dynamic_reference : public dynamic_reference_base
+{
+ protected:
+ T *ref;
+ public:
+ dynamic_reference(T *obj) : ref(obj)
+ {
+ if (ref)
+ ref->AddReference(this);
+ }
+
+ virtual ~dynamic_reference()
+ {
+ if (this->invalid)
+ {
+ this->invalid = false;
+ this->ref = NULL;
+ }
+ else if (ref)
+ ref->DelReference(this);
+ }
+
+ virtual operator bool()
+ {
+ if (this->invalid)
+ {
+ this->invalid = false;
+ this->ref = NULL;
+ }
+ return this->ref;
+ }
+
+ virtual inline void operator=(T *newref)
+ {
+ if (this->invalid)
+ {
+ this->invalid = false;
+ this->ref = NULL;
+ }
+ else if (this->ref)
+ this->ref->DelReference(this);
+ this->ref = newref;
+ if (this->ref)
+ this->ref->AddReference(this);
+ }
+
+ virtual inline T *operator->()
+ {
+ return this->ref;
+ }
+};
+
#endif // ANOPE_H
diff --git a/include/extern.h b/include/extern.h
index 2294c3f28..febc0c5c5 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -265,8 +265,6 @@ E uint32 getrandom32();
E char *str_signed(unsigned char *str);
-E void ntoa(struct in_addr addr, char *ipaddr, int len);
-
E std::list<Anope::string> BuildStringList(const Anope::string &, char = ' ');
E std::vector<Anope::string> BuildStringVector(const Anope::string &, char = ' ');
diff --git a/include/modules.h b/include/modules.h
index 05a0bd1a8..e1675c7e6 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1261,69 +1261,6 @@ class Service : public virtual Base
virtual ~Service();
};
-class dynamic_reference_base : public virtual Base
-{
- protected:
- bool invalid;
- public:
- dynamic_reference_base() : invalid(false) { }
- virtual ~dynamic_reference_base() { }
- inline void Invalidate() { this->invalid = true; }
-};
-
-template<typename T>
-class dynamic_reference : public dynamic_reference_base
-{
- protected:
- T *ref;
- public:
- dynamic_reference(T *obj) : ref(obj)
- {
- if (ref)
- ref->AddReference(this);
- }
-
- virtual ~dynamic_reference()
- {
- if (this->invalid)
- {
- this->invalid = false;
- this->ref = NULL;
- }
- else if (ref)
- ref->DelReference(this);
- }
-
- virtual operator bool()
- {
- if (this->invalid)
- {
- this->invalid = false;
- this->ref = NULL;
- }
- return this->ref;
- }
-
- virtual inline void operator=(T *newref)
- {
- if (this->invalid)
- {
- this->invalid = false;
- this->ref = NULL;
- }
- else if (this->ref)
- this->ref->DelReference(this);
- this->ref = newref;
- if (this->ref)
- this->ref->AddReference(this);
- }
-
- virtual inline T *operator->()
- {
- return this->ref;
- }
-};
-
template<typename T>
class service_reference : public dynamic_reference<T>
{
diff --git a/include/services.h b/include/services.h
index 63e2492b2..ada2a5c6a 100644
--- a/include/services.h
+++ b/include/services.h
@@ -194,21 +194,6 @@ extern "C" void __pfnBkCheck() {}
#include "anope.h"
-class dynamic_reference_base;
-
-/** The base class that most classes in Anope inherit from
- */
-class CoreExport Base
-{
- /* References to this base class */
- std::set<dynamic_reference_base *> References;
- public:
- Base();
- virtual ~Base();
- void AddReference(dynamic_reference_base *r);
- void DelReference(dynamic_reference_base *r);
-};
-
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
* When a module whishes to abort, e.g. within a constructor, it should throw an exception using ModuleException or
* a class derived from ModuleException. If a module throws an exception during its constructor, the module will not
@@ -423,6 +408,9 @@ template<typename T> inline T convertTo(const Anope::string &s, bool failIfLefto
/*************************************************************************/
class User;
+class NickCore;
+class NickAlias;
+class NickRequest;
class BotInfo;
class ChannelInfo;
class Channel;
@@ -553,11 +541,6 @@ class CoreExport HostInfo
const time_t GetTime() const;
};
-// For NickServ
-#include "account.h"
-
-/*************************************************************************/
-
enum AccessLevel
{
/* Note that these two levels also serve as exclusive boundaries for valid
@@ -755,6 +738,7 @@ struct LevelInfo
*/
#include "users.h"
+#include "account.h"
#include "bots.h"
struct BanData
@@ -956,7 +940,7 @@ class CoreExport IRCDProto
virtual void SendMessageInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg);
virtual void SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
- virtual void SendQuitInternal(const BotInfo *bi, const Anope::string &buf);
+ virtual void SendQuitInternal(const User *u, const Anope::string &buf);
virtual void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf);
virtual void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf);
virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
@@ -973,7 +957,7 @@ class CoreExport IRCDProto
virtual void SendSVSMode(const User *, int, const char **) = 0;
virtual void SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const User *u, const char *fmt, ...);
- virtual void SendClientIntroduction(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &uid) = 0;
+ virtual void SendClientIntroduction(const User *u, const Anope::string &) = 0;
virtual void SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...);
virtual void SendNoticeChanops(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMessage(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
@@ -983,13 +967,7 @@ class CoreExport IRCDProto
virtual void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg);
virtual void SendGlobalPrivmsg(const BotInfo *bi, const Server *desc, const Anope::string &msg);
- /** XXX: This is a hack for NickServ enforcers. It is deprecated.
- * If I catch any developer using this in new code, I will RIP YOUR BALLS OFF.
- * Thanks.
- * -- w00t
- */
- virtual void SendQuit(const Anope::string &nick, const Anope::string &) MARK_DEPRECATED;
- virtual void SendQuit(const BotInfo *bi, const char *fmt, ...);
+ virtual void SendQuit(const User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
virtual void SendJoin(const BotInfo *, const Anope::string &, time_t) = 0;
@@ -1055,58 +1033,6 @@ struct Uplink
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { }
};
-/** Timer for colliding nicks to force people off of nicknames
- */
-class NickServCollide : public Timer
-{
- /* The nick */
- Anope::string nick;
-
- public:
- /** Default constructor
- * @param _nick The nick were colliding
- * @param delay How long to delay before kicking the user off the nick
- */
- NickServCollide(const Anope::string &_nick, time_t delay);
-
- /** Default destructor
- */
- virtual ~NickServCollide();
-
- /** Called when the delay is up
- * @param t The current time
- */
- void Tick(time_t t);
-};
-
-/** Timers for releasing nicks to be available for use
- */
-class NickServRelease : public Timer
-{
- /* The nick */
- Anope::string nick;
-
- public:
- /* The uid of the services enforcer client (used for TS6 ircds) */
- Anope::string uid;
-
- /** Default constructor
- * @param _nick The nick
- * @param _uid the uid of the enforcer, if any
- * @param delay The delay before the nick is released
- */
- NickServRelease(const Anope::string &_nick, const Anope::string &_uid, time_t delay);
-
- /** Default destructor
- */
- virtual ~NickServRelease();
-
- /** Called when the delay is up
- * @param t The current time
- */
- void Tick(time_t t);
-};
-
/** A timer used to keep the BotServ bot/ChanServ in the channel
* after kicking the last user in a channel
*/