summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-05-28 12:07:29 -0400
committerAdam <Adam@anope.org>2014-05-28 12:07:54 -0400
commitf29e1cf383529a1a29f02b0669d973f5ee0b7a66 (patch)
tree3c33db276dc9328235bbd572641521ed44458176 /include
parent1253c70e0682fa1490c99c3d2869049a0e3fa2e0 (diff)
Move most of the core pseudoclient logic to modules
Diffstat (limited to 'include')
-rw-r--r--include/access.h169
-rw-r--r--include/account.h279
-rw-r--r--include/anope.h10
-rw-r--r--include/bots.h10
-rw-r--r--include/channels.h17
-rw-r--r--include/commands.h12
-rw-r--r--include/config.h2
-rw-r--r--include/defs.h26
-rw-r--r--include/event.h70
-rw-r--r--include/language.h4
-rw-r--r--include/lists.h8
-rw-r--r--include/logger.h6
-rw-r--r--include/mail.h4
-rw-r--r--include/memo.h53
-rw-r--r--include/messages.h68
-rw-r--r--include/modes.h6
-rw-r--r--include/module.h9
-rw-r--r--include/modules/botserv.h22
-rw-r--r--include/modules/bs_badwords.h4
-rw-r--r--include/modules/bs_info.h2
-rw-r--r--include/modules/bs_kick.h4
-rw-r--r--include/modules/chanserv.h595
-rw-r--r--include/modules/cs_access.h2
-rw-r--r--include/modules/cs_akick.h34
-rw-r--r--include/modules/cs_drop.h2
-rw-r--r--include/modules/cs_info.h2
-rw-r--r--include/modules/cs_mode.h4
-rw-r--r--include/modules/cs_set.h2
-rw-r--r--include/modules/dns.h42
-rw-r--r--include/modules/fantasy.h4
-rw-r--r--include/modules/hs_del.h2
-rw-r--r--include/modules/memoserv.h58
-rw-r--r--include/modules/nickserv.h288
-rw-r--r--include/modules/ns_cert.h16
-rw-r--r--include/modules/ns_drop.h2
-rw-r--r--include/modules/ns_group.h2
-rw-r--r--include/modules/ns_info.h2
-rw-r--r--include/modules/ns_set.h2
-rw-r--r--include/modules/os_ignore.h2
-rw-r--r--include/modules/os_news.h6
-rw-r--r--include/modules/os_session.h2
-rw-r--r--include/modules/redis.h2
-rw-r--r--include/modules/sasl.h20
-rw-r--r--include/modules/ssl.h2
-rw-r--r--include/modules/suspend.h8
-rw-r--r--include/modules/xmlrpc.h2
-rw-r--r--include/opertype.h5
-rw-r--r--include/protocol.h4
-rw-r--r--include/regchannel.h246
-rw-r--r--include/users.h19
-rw-r--r--include/version.cpp2
51 files changed, 1187 insertions, 977 deletions
diff --git a/include/access.h b/include/access.h
deleted file mode 100644
index 292e95228..000000000
--- a/include/access.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- *
- * (C) 2003-2014 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- *
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
- */
-
-#pragma once
-
-#include "services.h"
-#include "anope.h"
-#include "serialize.h"
-#include "service.h"
-
-enum
-{
- ACCESS_INVALID = -10000,
- ACCESS_FOUNDER = 10001
-};
-
-/* A privilege, probably configured using a privilege{} block. Most
- * commands require specific privileges to be executed. The AccessProvider
- * backing each ChanAccess determines whether that ChanAccess has a given
- * privilege.
- */
-struct CoreExport Privilege
-{
- Anope::string name;
- Anope::string desc;
- /* Rank relative to other privileges */
- int rank;
-
- Privilege(const Anope::string &name, const Anope::string &desc, int rank);
- bool operator==(const Privilege &other) const;
-};
-
-class CoreExport PrivilegeManager
-{
- static std::vector<Privilege> Privileges;
- public:
- static void AddPrivilege(Privilege p);
- static void RemovePrivilege(Privilege &p);
- static Privilege *FindPrivilege(const Anope::string &name);
- static std::vector<Privilege> &GetPrivileges();
- static void ClearPrivileges();
-};
-
-/* A provider of access. Only used for creating ChanAccesses, as
- * they contain pure virtual functions.
- */
-class CoreExport AccessProvider : public Service
-{
- public:
- AccessProvider(Module *owner, const Anope::string &name);
- virtual ~AccessProvider();
-
- /** Creates a new ChanAccess entry using this provider.
- * @return The new entry
- */
- virtual ChanAccess *Create() = 0;
-
- private:
- static std::list<AccessProvider *> Providers;
- public:
- static const std::list<AccessProvider *>& GetProviders();
-};
-
-/* Represents one entry of an access list on a channel. */
-class CoreExport ChanAccess : public Serializable
-{
- public:
- typedef std::multimap<const ChanAccess *, const ChanAccess *> Set;
- /* shows the 'path' taken to determine if an access entry matches a user
- * .first are access entries checked
- * .second are access entries which match
- */
- typedef std::pair<Set, Set> Path;
-
- /* The provider that created this access entry */
- AccessProvider *provider;
- /* Channel this access entry is on */
- Serialize::Reference<ChannelInfo> ci;
- /* account this access entry is for, if any */
- Serialize::Reference<NickCore> nc;
- Anope::string mask;
- Anope::string creator;
- time_t last_seen;
- time_t created;
-
- ChanAccess(AccessProvider *p);
- virtual ~ChanAccess();
-
- void Serialize(Serialize::Data &data) const override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
-
- /** Check if this access entry matches the given user or account
- * @param u The user
- * @param nc The account
- * @param p The path to the access object which matches will be put here
- */
- virtual bool Matches(const User *u, const NickCore *nc, Path &p) const;
-
- /** Check if this access entry has the given privilege.
- * @param name The privilege name
- */
- virtual bool HasPriv(const Anope::string &name) const = 0;
-
- /** Serialize the access given by this access entry into a human
- * readable form. chanserv/access will return a number, chanserv/xop
- * will be AOP, SOP, etc.
- */
- virtual Anope::string AccessSerialize() const = 0;
-
- /** Unserialize this access entry from the given data. This data
- * will be fetched from AccessSerialize.
- */
- virtual void AccessUnserialize(const Anope::string &data) = 0;
-
- /* Comparison operators to other Access entries */
- virtual bool operator>(const ChanAccess &other) const;
- virtual bool operator<(const ChanAccess &other) const;
- bool operator>=(const ChanAccess &other) const;
- bool operator<=(const ChanAccess &other) const;
-};
-
-/* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor,
- * to show what access a user has on a channel because users can match multiple access entries.
- */
-class CoreExport AccessGroup : public std::vector<ChanAccess *>
-{
- public:
- /* Channel these access entries are on */
- const ChannelInfo *ci;
- /* Path from these entries to other entries that they depend on */
- ChanAccess::Path path;
- /* Account these entries affect, if any */
- const NickCore *nc;
- /* super_admin always gets all privs. founder is a special case where ci->founder == nc */
- bool super_admin, founder;
-
- AccessGroup();
-
- /** Check if this access group has a certain privilege. Eg, it
- * will check every ChanAccess entry of this group for any that
- * has the given privilege.
- * @param priv The privilege
- * @return true if any entry has the given privilege
- */
- bool HasPriv(const Anope::string &priv) const;
-
- /** Get the "highest" access entry from this group of entries.
- * The highest entry is determined by the entry that has the privilege
- * with the highest rank (see Privilege::rank).
- * @return The "highest" entry
- */
- const ChanAccess *Highest() const;
-
- /* Comparison operators to other AccessGroups */
- bool operator>(const AccessGroup &other) const;
- bool operator<(const AccessGroup &other) const;
- bool operator>=(const AccessGroup &other) const;
- bool operator<=(const AccessGroup &other) const;
-};
-
diff --git a/include/account.h b/include/account.h
deleted file mode 100644
index 381047ac4..000000000
--- a/include/account.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- *
- * (C) 2003-2014 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- *
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
- */
-
-#pragma once
-
-#include "extensible.h"
-#include "serialize.h"
-#include "anope.h"
-#include "memo.h"
-#include "base.h"
-
-typedef Anope::hash_map<NickAlias *> nickalias_map;
-typedef Anope::hash_map<NickCore *> nickcore_map;
-
-extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
-extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
-
-/* A registered nickname.
- * It matters that Base is here before Extensible (it is inherited by Serializable)
- */
-class CoreExport NickAlias : public Serializable, public Extensible
-{
- Anope::string vhost_ident, vhost_host, vhost_creator;
- time_t vhost_created;
-
- public:
- Anope::string nick;
- Anope::string last_quit;
- Anope::string last_realname;
- /* Last usermask this nick was seen on, eg user@host */
- Anope::string last_usermask;
- /* Last uncloaked usermask, requires nickserv/auspex to see */
- Anope::string last_realhost;
- time_t time_registered;
- time_t last_seen;
- /* Account this nick is tied to. Multiple nicks can be tied to a single account. */
- Serialize::Reference<NickCore> nc;
-
- /** Constructor
- * @param nickname The nick
- * @param nickcore The nickcore for this nick
- */
- NickAlias(const Anope::string &nickname, NickCore *nickcore);
- ~NickAlias();
-
- void Serialize(Serialize::Data &data) const override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
-
- /** Set a vhost for the user
- * @param ident The ident
- * @param host The host
- * @param creator Who created the vhost
- * @param time When the vhost was craated
- */
- void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
-
- /** Remove a users vhost
- **/
- void RemoveVhost();
-
- /** Check if the user has a vhost
- * @return true or false
- */
- bool HasVhost() const;
-
- /** Retrieve the vhost ident
- * @return the ident
- */
- const Anope::string &GetVhostIdent() const;
-
- /** Retrieve the vhost host
- * @return the host
- */
- const Anope::string &GetVhostHost() const;
-
- /** Retrieve the vhost creator
- * @return the creator
- */
- const Anope::string &GetVhostCreator() const;
-
- /** Retrieve when the vhost was created
- * @return the time it was created
- */
- time_t GetVhostCreated() const;
-
- /** Finds a registered nick
- * @param nick The nick to lookup
- * @return the nick, if found
- */
- static NickAlias *Find(const Anope::string &nick);
-};
-
-/* A registered account. Each account must have a NickAlias with the same nick as the
- * account's display.
- * It matters that Base is here before Extensible (it is inherited by Serializable)
- */
-class CoreExport NickCore : public Serializable, public Extensible
-{
- /* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
- Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
- public:
- /* Name of the account. Find(display)->nc == this. */
- Anope::string display;
- /* User password in form of hashm:data */
- Anope::string pass;
- Anope::string email;
- /* Locale name of the language of the user. Empty means default language */
- Anope::string language;
- /* Access list, contains user@host masks of users who get certain privileges based
- * on if NI_SECURE is set and what (if any) kill protection is enabled. */
- std::vector<Anope::string> access;
- MemoInfo memos;
- std::map<Anope::string, Anope::string> last_modes;
-
- /* Nicknames registered that are grouped to this account.
- * for n in aliases, n->nc == this.
- */
- Serialize::Checker<std::vector<NickAlias *> > aliases;
-
- /* Set if this user is a services operattor. o->ot must exist. */
- Oper *o;
-
- /* Unsaved data */
-
- /* Number of channels registered by this account */
- uint16_t channelcount;
- /* Last time an email was sent to this user */
- time_t lastmail;
- /* Users online now logged into this account */
- std::list<User *> users;
-
- /** Constructor
- * @param display The display nick
- */
- NickCore(const Anope::string &nickdisplay);
- ~NickCore();
-
- void Serialize(Serialize::Data &data) const override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
-
- /** Changes the display for this account
- * @param na The new display, must be grouped to this account.
- */
- void SetDisplay(const NickAlias *na);
-
- /** Checks whether this account is a services oper or not.
- * @return True if this account is a services oper, false otherwise.
- */
- virtual bool IsServicesOper() const;
-
- /** Add an entry to the nick's access list
- *
- * @param entry The nick!ident@host entry to add to the access list
- *
- * Adds a new entry into the access list.
- */
- void AddAccess(const Anope::string &entry);
-
- /** Get an entry from the nick's access list by index
- *
- * @param entry Index in the access list vector to retrieve
- * @return The access list entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds
- *
- * Retrieves an entry from the access list corresponding to the given index.
- */
- Anope::string GetAccess(unsigned entry) const;
-
- /** Get the number of entries on the access list for this account.
- */
- unsigned GetAccessCount() const;
-
- /** Find an entry in the nick's access list
- *
- * @param entry The nick!ident@host entry to search for
- * @return True if the entry is found in the access list, false otherwise
- *
- * Search for an entry within the access list.
- */
- bool FindAccess(const Anope::string &entry);
-
- /** Erase an entry from the nick's access list
- *
- * @param entry The nick!ident@host entry to remove
- *
- * Removes the specified access list entry from the access list.
- */
- void EraseAccess(const Anope::string &entry);
-
- /** Clears the entire nick's access list
- *
- * Deletes all the memory allocated in the access list vector and then clears the vector.
- */
- void ClearAccess();
-
- /** Is the given user on this accounts access list?
- *
- * @param u The user
- *
- * @return true if the user is on the access list
- */
- bool IsOnAccess(const User *u) const;
-
- /** Finds an account
- * @param nick The account name to find
- * @return The account, if it exists
- */
- static NickCore* Find(const Anope::string &nick);
-
- void AddChannelReference(ChannelInfo *ci);
- void RemoveChannelReference(ChannelInfo *ci);
- void GetChannelReferences(std::deque<ChannelInfo *> &queue);
-};
-
-/* A request to check if an account/password is valid. These can exist for
- * extended periods due to the time some authentication modules take.
- */
-class CoreExport IdentifyRequest
-{
- /* Owner of this request, used to cleanup requests if a module is unloaded
- * while a reqyest us pending */
- Module *owner;
- Anope::string account;
- Anope::string password;
-
- std::set<Module *> holds;
- bool dispatched;
- bool success;
-
- static std::set<IdentifyRequest *> Requests;
-
- protected:
- IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass);
- virtual ~IdentifyRequest();
-
- public:
- /* One of these is called when the request goes through */
- virtual void OnSuccess() = 0;
- virtual void OnFail() = 0;
-
- const Anope::string &GetAccount() const { return account; }
- const Anope::string &GetPassword() const { return password; }
-
- /* Holds this request. When a request is held it must be Released later
- * for the request to complete. Multiple modules may hold a request at any time,
- * but the request is not complete until every module has released it. If you do not
- * require holding this (eg, your password check is done in this thread and immediately)
- * then you don't need to hold the request before Successing it.
- * @param m The module holding this request
- */
- void Hold(Module *m);
-
- /** Releases a held request
- * @param m The module releaseing the hold
- */
- void Release(Module *m);
-
- /** Called by modules when this IdentifyRequest has successeded successfully.
- * If this request is behind held it must still be Released after calling this.
- * @param m The module confirming authentication
- */
- void Success(Module *m);
-
- /** Used to either finalize this request or marks
- * it as dispatched and begins waiting for the module(s)
- * that have holds to finish.
- */
- void Dispatch();
-
- static void ModuleUnload(Module *m);
-};
diff --git a/include/anope.h b/include/anope.h
index bb20299e4..845a2b1fb 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -441,13 +441,13 @@ namespace Anope
*/
extern CoreExport void Unhex(const string &src, string &dest);
extern CoreExport void Unhex(const string &src, char *dest, size_t sz);
-
+
/** Base 64 encode a string
* @param src The string to encode
* @param target Where the encoded string is placed
*/
extern CoreExport void B64Encode(const string &src, string &target);
-
+
/** Base 64 decode a string
* @param src The base64 encoded string
* @param target The plain text result
@@ -502,21 +502,21 @@ namespace Anope
* @param nc The account to use language settings for to translate this string, if applicable
* @return A human readable string, eg "1 minute"
*/
- extern CoreExport Anope::string Duration(time_t seconds, const NickCore *nc = NULL);
+ extern CoreExport Anope::string Duration(time_t seconds, const NickServ::Account *nc = NULL);
/** Generates a human readable string of type "expires in ..."
* @param expires time in seconds
* @param nc The account to use language settings for to translate this string, if applicable
* @return A human readable string, eg "expires in 5 days"
*/
- extern CoreExport Anope::string Expires(time_t seconds, const NickCore *nc = NULL);
+ extern CoreExport Anope::string Expires(time_t seconds, const NickServ::Account *nc = NULL);
/** Converts a time in seconds (epoch) to a human readable format.
* @param t The time
* @param nc The account to use language settings for to translate this string, if applicable
* @param short_output If true, the output is just a date (eg, "Apr 12 20:18:22 2009 MSD"), else it includes the date and how long ago/from now that date is, (eg "Apr 12 20:18:22 2009 MSD (1313 days, 9 hours, 32 minutes ago)"
*/
- extern CoreExport Anope::string strftime(time_t t, const NickCore *nc = NULL, bool short_output = false);
+ extern CoreExport Anope::string strftime(time_t t, const NickServ::Account *nc = NULL, bool short_output = false);
/** Normalize buffer, stripping control characters and colors
* @param A string to be parsed for control and color codes
diff --git a/include/bots.h b/include/bots.h
index 353be89cb..9a2c5d237 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -15,7 +15,7 @@
#include "commands.h"
-typedef Anope::map<BotInfo *> botinfo_map;
+typedef Anope::hash_map<BotInfo *> botinfo_map;
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
@@ -23,7 +23,7 @@ extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
class CoreExport BotInfo : public User, public Serializable
{
/* Channels this bot is assigned to */
- Serialize::Checker<std::set<ChannelInfo *> > channels;
+ Serialize::Checker<std::set<ChanServ::Channel *> > channels;
public:
time_t created;
/* Last time this bot said something (via privmsg) */
@@ -68,19 +68,19 @@ class CoreExport BotInfo : public User, public Serializable
/** Return the channels this bot is assigned to
*/
- const std::set<ChannelInfo *> &GetChannels() const;
+ const std::set<ChanServ::Channel *> &GetChannels() const;
/** Assign this bot to a given channel, removing the existing assigned bot if one exists.
* @param u The user assigning the bot, or NULL
* @param ci The channel registration to assign the bot to.
*/
- void Assign(User *u, ChannelInfo *ci);
+ void Assign(User *u, ChanServ::Channel *ci);
/** Remove this bot from a given channel.
* @param u The user requesting the unassign, or NULL.
* @param ci The channel registration to remove the bot from.
*/
- void UnAssign(User *u, ChannelInfo *ci);
+ void UnAssign(User *u, ChanServ::Channel *ci);
/** Get the number of channels this bot is assigned to
*/
diff --git a/include/channels.h b/include/channels.h
index e676bb924..3deadce5b 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -42,7 +42,7 @@ class CoreExport Channel : public Base, public Extensible
/* Channel name */
Anope::string name;
/* Set if this channel is registered. ci->c == this. Contains information relevant to the registered channel */
- Serialize::Reference<ChannelInfo> ci;
+ Serialize::Reference<ChanServ::Channel> ci;
/* When the channel was created */
time_t creation_time;
/* If the channel has just been created in a netjoin */
@@ -163,7 +163,7 @@ class CoreExport Channel : public Base, public Extensible
* @param param Optional param arg for the mode
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
- void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
+ void SetMode(User *bi, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
/**
* Set a mode on a channel
@@ -172,7 +172,7 @@ class CoreExport Channel : public Base, public Extensible
* @param param Optional param arg for the mode
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
- void SetMode(BotInfo *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
+ void SetMode(User *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
/** Remove a mode from a channel
* @param bi The client setting the modes
@@ -180,7 +180,7 @@ class CoreExport Channel : public Base, public Extensible
* @param param Optional param arg for the mode
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
- void RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
+ void RemoveMode(User *bi, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
/**
* Remove a mode from a channel
@@ -189,7 +189,7 @@ class CoreExport Channel : public Base, public Extensible
* @param param Optional param arg for the mode
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
- void RemoveMode(BotInfo *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
+ void RemoveMode(User *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
/** Get a modes parameter for the channel
* @param name The mode
@@ -203,7 +203,7 @@ class CoreExport Channel : public Base, public Extensible
* @param enforce_mlock Should mlock be enforced on this mode change
* @param cmodes The modes to set
*/
- void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...);
+ void SetModes(User *bi, bool enforce_mlock, const char *cmodes, ...);
/** Set a string of modes internally on a channel
* @param source The setter
@@ -223,8 +223,9 @@ class CoreExport Channel : public Base, public Extensible
* @param source The sender of the kick
* @param nick The nick being kicked
* @param reason The reason for the kick
+ * @return true if the kick was scucessful, false if a module blocked the kick or was otherwise unsuccessful
*/
- void KickInternal(const MessageSource &source, const Anope::string &nick, const Anope::string &reason);
+ bool KickInternal(const MessageSource &source, const Anope::string &nick, const Anope::string &reason);
/** Kick a user from the channel
* @param bi The sender, can be NULL for the service bot for this channel
@@ -232,7 +233,7 @@ class CoreExport Channel : public Base, public Extensible
* @param reason The reason for the kick
* @return true if the kick was scucessful, false if a module blocked the kick
*/
- bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...);
+ bool Kick(User *bi, User *u, const char *reason = NULL, ...);
/** Get all modes set on this channel, excluding status modes.
* @return a map of modes and their optional parameters.
diff --git a/include/commands.h b/include/commands.h
index 2be64d00d..ac79267ae 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -45,7 +45,7 @@ struct CommandInfo
struct CoreExport CommandReply
{
virtual ~CommandReply() { }
- virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
+ virtual void SendMessage(const MessageSource &, const Anope::string &msg) anope_abstract;
};
/* The source for a command */
@@ -57,7 +57,7 @@ class CoreExport CommandSource
Reference<User> u;
public:
/* The account executing the command */
- Reference<NickCore> nc;
+ Reference<NickServ::Account> nc;
/* Where the reply should go */
CommandReply *reply;
/* Channel the command was executed on (fantasy) */
@@ -69,13 +69,13 @@ class CoreExport CommandSource
/* The permission of the command being executed */
Anope::string permission;
- CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi);
+ CommandSource(const Anope::string &n, User *user, NickServ::Account *core, CommandReply *reply, BotInfo *bi);
const Anope::string &GetNick() const;
User *GetUser();
- NickCore *GetAccount();
- AccessGroup AccessFor(ChannelInfo *ci);
- bool IsFounder(ChannelInfo *ci);
+ NickServ::Account *GetAccount();
+ ChanServ::AccessGroup AccessFor(ChanServ::Channel *ci);
+ bool IsFounder(ChanServ::Channel *ci);
void Reply(const char *message, ...);
void Reply(const Anope::string &message);
diff --git a/include/config.h b/include/config.h
index 903c41120..3d0133409 100644
--- a/include/config.h
+++ b/include/config.h
@@ -12,8 +12,6 @@
#pragma once
-#include "account.h"
-#include "regchannel.h"
#include "users.h"
#include "opertype.h"
#include <stack>
diff --git a/include/defs.h b/include/defs.h
index b53e512d6..4c1e9ce91 100644
--- a/include/defs.h
+++ b/include/defs.h
@@ -11,13 +11,16 @@
*/
-class AccessGroup;
class AutoKick;
class BotInfo;
-class ChanAccess;
class Channel;
-class ChannelInfo;
class ChannelStatus;
+namespace ChanServ
+{
+ class AccessGroup;
+ class ChanAccess;
+ class Channel;
+}
struct ChanUserContainer;
class ClientSocket;
class Command;
@@ -25,16 +28,24 @@ class CommandSource;
namespace Configuration { struct Conf; }
class ConnectionSocket;
class Entry;
-class IdentifyRequest;
class InfoFormatter;
class IRCDProto;
class ListenSocket;
class Log;
-class Memo;
+class LogInfo;
+namespace NickServ
+{
+ class Account;
+ class Nick;
+ class IdentifyRequest;
+}
+namespace MemoServ
+{
+ class Memo;
+ struct MemoInfo;
+}
class MessageSource;
class Module;
-class NickAlias;
-class NickCore;
class OperType;
class ReferenceBase;
class Regex;
@@ -47,7 +58,6 @@ class XLine;
class XLineManager;
struct BadWord;
struct Exception;
-struct MemoInfo;
struct ModeLock;
struct Oper;
namespace SASL { struct Message; }
diff --git a/include/event.h b/include/event.h
index aab854750..83d5a79e1 100644
--- a/include/event.h
+++ b/include/event.h
@@ -147,8 +147,9 @@ namespace Event
* @param source The kicker
* @param cu The user, channel, and status of the user being kicked
* @param kickmsg The reason for the kick.
+ * @return EVENT_STOP to stop the kick, which can only be done if source is 'Me' or from me
*/
- virtual void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) anope_abstract;
+ virtual EventReturn OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) anope_abstract;
};
extern CoreExport EventHandlers<PreUserKicked> OnPreUserKicked;
@@ -173,7 +174,7 @@ namespace Event
* @param bi The bot being assigned.
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the assign.
*/
- virtual EventReturn OnPreBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) anope_abstract;
+ virtual EventReturn OnPreBotAssign(User *sender, ChanServ::Channel *ci, BotInfo *bi) anope_abstract;
};
extern CoreExport EventHandlers<PreBotAssign> OnPreBotAssign;
@@ -181,7 +182,7 @@ namespace Event
{
/** Called when a bot is assigned ot a channel
*/
- virtual void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) anope_abstract;
+ virtual void OnBotAssign(User *sender, ChanServ::Channel *ci, BotInfo *bi) anope_abstract;
};
extern CoreExport EventHandlers<BotAssign> OnBotAssign;
@@ -192,7 +193,7 @@ namespace Event
* @param ci The channel the bot is being removed from
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the unassign.
*/
- virtual EventReturn OnBotUnAssign(User *sender, ChannelInfo *ci) anope_abstract;
+ virtual EventReturn OnBotUnAssign(User *sender, ChanServ::Channel *ci) anope_abstract;
};
extern CoreExport EventHandlers<BotUnAssign> OnBotUnAssign;
@@ -297,19 +298,6 @@ namespace Event
};
extern CoreExport EventHandlers<DelBot> OnDelBot;
- struct CoreExport BotKick : Events
- {
- /** Called before a bot kicks a user
- * @param bi The bot sending the kick
- * @param c The channel the user is being kicked on
- * @param u The user being kicked
- * @param reason The reason
- * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
- */
- virtual EventReturn OnBotKick(BotInfo *bi, Channel *c, User *u, const Anope::string &reason) anope_abstract;
- };
- extern CoreExport EventHandlers<BotKick> OnBotKick;
-
struct CoreExport PrePartChannel : Events
{
/** Called before a user parts a channel
@@ -492,7 +480,7 @@ namespace Event
* @param source The source of the command
* @param access The access entry that was removed
*/
- virtual void OnAccessDel(ChannelInfo *ci, CommandSource &source, ChanAccess *access) anope_abstract;
+ virtual void OnAccessDel(ChanServ::Channel *ci, CommandSource &source, ChanServ::ChanAccess *access) anope_abstract;
};
extern CoreExport EventHandlers<AccessDel> OnAccessDel;
@@ -503,7 +491,7 @@ namespace Event
* @param source The source of the command
* @param access The access changed
*/
- virtual void OnAccessAdd(ChannelInfo *ci, CommandSource &source, ChanAccess *access) anope_abstract;
+ virtual void OnAccessAdd(ChanServ::Channel *ci, CommandSource &source, ChanServ::ChanAccess *access) anope_abstract;
};
extern CoreExport EventHandlers<AccessAdd> OnAccessAdd;
@@ -513,7 +501,7 @@ namespace Event
* @param ci The channel
* @param u The user who cleared the access
*/
- virtual void OnAccessClear(ChannelInfo *ci, CommandSource &source) anope_abstract;
+ virtual void OnAccessClear(ChanServ::Channel *ci, CommandSource &source) anope_abstract;
};
extern CoreExport EventHandlers<AccessClear> OnAccessClear;
@@ -522,7 +510,7 @@ namespace Event
/** Called when a channel is registered
* @param ci The channel
*/
- virtual void OnChanRegistered(ChannelInfo *ci) anope_abstract;
+ virtual void OnChanRegistered(ChanServ::Channel *ci) anope_abstract;
};
extern CoreExport EventHandlers<ChanRegistered> OnChanRegistered;
@@ -532,7 +520,7 @@ namespace Event
/** Called when a channel is being created, for any reason
* @param ci The channel
*/
- virtual void OnCreateChan(ChannelInfo *ci) anope_abstract;
+ virtual void OnCreateChan(ChanServ::Channel *ci) anope_abstract;
};
extern CoreExport EventHandlers<CreateChan> OnCreateChan;
@@ -541,7 +529,7 @@ namespace Event
/** Called when a channel is being deleted, for any reason
* @param ci The channel
*/
- virtual void OnDelChan(ChannelInfo *ci) anope_abstract;
+ virtual void OnDelChan(ChanServ::Channel *ci) anope_abstract;
};
extern CoreExport EventHandlers<DelChan> OnDelChan;
@@ -586,7 +574,7 @@ namespace Event
* @param priv The privilege being checked for
* @return EVENT_ALLOW for yes, EVENT_STOP to stop all processing
*/
- virtual EventReturn OnCheckPriv(const ChanAccess *access, const Anope::string &priv) anope_abstract;
+ virtual EventReturn OnCheckPriv(const ChanServ::ChanAccess *access, const Anope::string &priv) anope_abstract;
};
extern CoreExport EventHandlers<CheckPriv> OnCheckPriv;
@@ -597,7 +585,7 @@ namespace Event
* @param priv The privilege
* @return MOD_ALLOW to allow, MOD_STOP to stop
*/
- virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) anope_abstract;
+ virtual EventReturn OnGroupCheckPriv(const ChanServ::AccessGroup *group, const Anope::string &priv) anope_abstract;
};
extern CoreExport EventHandlers<GroupCheckPriv> OnGroupCheckPriv;
@@ -633,7 +621,7 @@ namespace Event
/** Called on delnick()
* @ param na pointer to the nickalias
*/
- virtual void OnDelNick(NickAlias *na) anope_abstract;
+ virtual void OnDelNick(NickServ::Nick *na) anope_abstract;
};
extern CoreExport EventHandlers<DelNick> OnDelNick;
@@ -642,35 +630,35 @@ namespace Event
/** Called when a nickcore is created
* @param nc The nickcore
*/
- virtual void OnNickCoreCreate(NickCore *nc) anope_abstract;
+ virtual void OnNickCoreCreate(NickServ::Account *nc) anope_abstract;
};
extern CoreExport EventHandlers<NickCoreCreate> OnNickCoreCreate;
struct CoreExport DelCore : Events
{
/** Called on delcore()
- * @param nc pointer to the NickCore
+ * @param nc pointer to the NickServ::Account
*/
- virtual void OnDelCore(NickCore *nc) anope_abstract;
+ virtual void OnDelCore(NickServ::Account *nc) anope_abstract;
};
extern CoreExport EventHandlers<DelCore> OnDelCore;
struct CoreExport ChangeCoreDisplay : Events
{
/** Called on change_core_display()
- * @param nc pointer to the NickCore
+ * @param nc pointer to the NickServ::Account
* @param newdisplay the new display
*/
- virtual void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) anope_abstract;
+ virtual void OnChangeCoreDisplay(NickServ::Account *nc, const Anope::string &newdisplay) anope_abstract;
};
extern CoreExport EventHandlers<ChangeCoreDisplay> OnChangeCoreDisplay;
struct CoreExport NickClearAccess : Events
{
- /** called from NickCore::ClearAccess()
- * @param nc pointer to the NickCore
+ /** called from NickServ::Account::ClearAccess()
+ * @param nc pointer to the NickServ::Account
*/
- virtual void OnNickClearAccess(NickCore *nc) anope_abstract;
+ virtual void OnNickClearAccess(NickServ::Account *nc) anope_abstract;
};
extern CoreExport EventHandlers<NickClearAccess> OnNickClearAccess;
@@ -680,17 +668,17 @@ namespace Event
* @param nc The nick
* @param entry The entry
*/
- virtual void OnNickAddAccess(NickCore *nc, const Anope::string &entry) anope_abstract;
+ virtual void OnNickAddAccess(NickServ::Account *nc, const Anope::string &entry) anope_abstract;
};
extern CoreExport EventHandlers<NickAddAccess> OnNickAddAccess;
struct CoreExport NickEraseAccess : Events
{
- /** Called from NickCore::EraseAccess()
- * @param nc pointer to the NickCore
+ /** Called from NickServ::Account::EraseAccess()
+ * @param nc pointer to the NickServ::Account
* @param entry The access mask
*/
- virtual void OnNickEraseAccess(NickCore *nc, const Anope::string &entry) anope_abstract;
+ virtual void OnNickEraseAccess(NickServ::Account *nc, const Anope::string &entry) anope_abstract;
};
extern CoreExport EventHandlers<NickEraseAccess> OnNickEraseAccess;
@@ -702,7 +690,7 @@ namespace Event
* @param u The user trying to identify, if applicable.
* @param req The login request
*/
- virtual void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_abstract;
+ virtual void OnCheckAuthentication(User *u, NickServ::IdentifyRequest *req) anope_abstract;
};
extern CoreExport EventHandlers<CheckAuthentication> OnCheckAuthentication;
@@ -741,7 +729,7 @@ namespace Event
/** Called when a vhost is set
* @param na The nickalias of the vhost
*/
- virtual void OnSetVhost(NickAlias *na) anope_abstract;
+ virtual void OnSetVhost(NickServ::Nick *na) anope_abstract;
};
extern CoreExport EventHandlers<SetVhost> OnSetVhost;
@@ -943,7 +931,7 @@ namespace Event
* @param give_modes If giving modes is desired
* @param take_modes If taking modes is desired
*/
- virtual void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_abstract;
+ virtual void OnSetCorrectModes(User *user, Channel *chan, ChanServ::AccessGroup &access, bool &give_modes, bool &take_modes) anope_abstract;
};
extern CoreExport EventHandlers<SetCorrectModes> OnSetCorrectModes;
diff --git a/include/language.h b/include/language.h
index 041f90b11..55726b8d6 100644
--- a/include/language.h
+++ b/include/language.h
@@ -24,7 +24,7 @@ namespace Language
* and we detect a language file exists for at least one of the supported
* languages for the module, then we add the module's domain (its name)
* here.
- *
+ *
* When strings are translated they are checked against all domains.
*/
extern std::vector<Anope::string> Domains;
@@ -52,7 +52,7 @@ namespace Language
* @param string A string to translate
* @return The translated string if count, else the original string
*/
- extern CoreExport const char *Translate(const NickCore *nc, const char *string);
+ extern CoreExport const char *Translate(const NickServ::Account *nc, const char *string);
/** Translatesa string to the given language.
* @param lang The language to translate to
diff --git a/include/lists.h b/include/lists.h
index 36e5ae30d..c40d97e7d 100644
--- a/include/lists.h
+++ b/include/lists.h
@@ -66,11 +66,11 @@ class CoreExport ListFormatter
public:
typedef std::map<Anope::string, Anope::string> ListEntry;
private:
- NickCore *nc;
+ NickServ::Account *nc;
std::vector<Anope::string> columns;
std::vector<ListEntry> entries;
public:
- ListFormatter(NickCore *nc);
+ ListFormatter(NickServ::Account *nc);
ListFormatter &AddColumn(const Anope::string &name);
void AddEntry(const ListEntry &entry);
bool IsEmpty() const;
@@ -81,11 +81,11 @@ class CoreExport ListFormatter
*/
class CoreExport InfoFormatter
{
- NickCore *nc;
+ NickServ::Account *nc;
std::vector<std::pair<Anope::string, Anope::string> > replies;
unsigned longest;
public:
- InfoFormatter(NickCore *nc);
+ InfoFormatter(NickServ::Account *nc);
void Process(std::vector<Anope::string> &);
Anope::string &operator[](const Anope::string &key);
void AddOption(const Anope::string &opt);
diff --git a/include/logger.h b/include/logger.h
index 73180e66e..8ed316e94 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -57,7 +57,7 @@ class CoreExport Log
/* For commands, the user executing the command, but might not always exist */
User *u;
/* For commands, the account executing the command, but will not always exist */
- NickCore *nc;
+ NickServ::Account *nc;
/* For commands, the command being executed */
Command *c;
/* For commands, the command source */
@@ -65,7 +65,7 @@ class CoreExport Log
/* Used for LOG_CHANNEL */
Channel *chan;
/* For commands, the channel the command was executed on, will not always exist */
- const ChannelInfo *ci;
+ const ChanServ::Channel *ci;
/* For LOG_SERVER */
Server *s;
/* For LOG_MODULE */
@@ -78,7 +78,7 @@ class CoreExport Log
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = NULL);
/* LOG_COMMAND/OVERRIDE/ADMIN */
- Log(LogType type, CommandSource &source, Command *c, ChannelInfo *ci = NULL);
+ Log(LogType type, CommandSource &source, Command *c, ChanServ::Channel *ci = NULL);
/* LOG_CHANNEL */
Log(User *u, Channel *c, const Anope::string &category = "");
diff --git a/include/mail.h b/include/mail.h
index 2f59b5000..7ef5a265e 100644
--- a/include/mail.h
+++ b/include/mail.h
@@ -19,8 +19,8 @@
namespace Mail
{
- extern CoreExport bool Send(User *from, NickCore *to, BotInfo *service, const Anope::string &subject, const Anope::string &message);
- extern CoreExport bool Send(NickCore *to, const Anope::string &subject, const Anope::string &message);
+ extern CoreExport bool Send(User *from, NickServ::Account *to, BotInfo *service, const Anope::string &subject, const Anope::string &message);
+ extern CoreExport bool Send(NickServ::Account *to, const Anope::string &subject, const Anope::string &message);
extern CoreExport bool Validate(const Anope::string &email);
/* A email message being sent */
diff --git a/include/memo.h b/include/memo.h
deleted file mode 100644
index 103f00ca1..000000000
--- a/include/memo.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * (C) 2003-2014 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- *
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
- */
-
-#pragma once
-
-#include "anope.h"
-#include "serialize.h"
-
-class CoreExport Memo : public Serializable
-{
- public:
- bool unread;
- bool receipt;
- Memo();
- ~Memo();
-
- void Serialize(Serialize::Data &data) const override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
-
- Anope::string owner;
- /* When it was sent */
- time_t time;
- Anope::string sender;
- Anope::string text;
-};
-
-/* Memo info structures. Since both nicknames and channels can have memos,
- * we encapsulate memo data in a MemoInfo to make it easier to handle.
- */
-struct CoreExport MemoInfo
-{
- int16_t memomax;
- Serialize::Checker<std::vector<Memo *> > memos;
- std::vector<Anope::string> ignores;
-
- MemoInfo();
- Memo *GetMemo(unsigned index) const;
- unsigned GetIndex(Memo *m) const;
- void Del(unsigned index);
- bool HasIgnore(User *u);
-
- static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan);
-};
-
diff --git a/include/messages.h b/include/messages.h
index 070fcb84f..58d32aaf5 100644
--- a/include/messages.h
+++ b/include/messages.h
@@ -23,21 +23,21 @@ namespace Message
struct CoreExport Away : IRCDMessage
{
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Capab : IRCDMessage
{
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Error : IRCDMessage
{
Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
@@ -47,15 +47,15 @@ namespace Message
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Join : IRCDMessage
{
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
-
+
typedef std::pair<ChannelStatus, User *> SJoinUser;
-
+
/** Handle a SJOIN.
* @param source The source of the SJOIN
* @param chan The channel the users are joining to
@@ -65,18 +65,18 @@ namespace Message
*/
static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
};
-
+
struct CoreExport Kick : IRCDMessage
{
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Kill : IRCDMessage
{
Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
@@ -86,14 +86,14 @@ namespace Message
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport MOTD : IRCDMessage
{
MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Notice : IRCDMessage
{
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
@@ -104,70 +104,70 @@ namespace Message
struct CoreExport Part : IRCDMessage
{
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Ping : IRCDMessage
{
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Privmsg : IRCDMessage
{
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Quit : IRCDMessage
{
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport SQuit : IRCDMessage
{
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Stats : IRCDMessage
{
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Time : IRCDMessage
{
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Topic : IRCDMessage
{
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Version : IRCDMessage
{
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-
+
struct CoreExport Whois : IRCDMessage
{
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
+
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
diff --git a/include/modes.h b/include/modes.h
index 279d1dbc1..e13470669 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -179,7 +179,7 @@ class CoreExport ChannelModeStatus : public ChannelMode
/** constructor
* @param name The mode name
* @param mc The mode char
- * @param msymbol The symbol for the mode, eg @ %
+ * @param msymbol The symbol for the mode, eg @ %
* @param mlevel A level for the mode, which is usually determined by the PREFIX capab
*/
ChannelModeStatus(const Anope::string &name, char mc, char msymbol, short mlevel);
@@ -333,7 +333,7 @@ class CoreExport ModeManager
* @param set true for setting, false for removing
* @param param The param, if there is one
*/
- static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string &param = "");
+ static void StackerAdd(User *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string &param = "");
/** Add a mode to the stacker to be set on a user
* @param bi The client to set the modes from
@@ -342,7 +342,7 @@ class CoreExport ModeManager
* @param set true for setting, false for removing
* @param param The param, if there is one
*/
- static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string &param = "");
+ static void StackerAdd(User *bi, User *u, UserMode *um, bool set, const Anope::string &param = "");
/** Process all of the modes in the stacker and send them to the IRCd to be set on channels/users
*/
diff --git a/include/module.h b/include/module.h
index 0efbb7334..bb7f1c815 100644
--- a/include/module.h
+++ b/include/module.h
@@ -11,8 +11,6 @@
#pragma once
-#include "access.h"
-#include "account.h"
#include "anope.h"
#include "base.h"
#include "bots.h"
@@ -26,13 +24,11 @@
#include "lists.h"
#include "logger.h"
#include "mail.h"
-#include "memo.h"
#include "messages.h"
#include "modes.h"
#include "modules.h"
#include "opertype.h"
#include "protocol.h"
-#include "regchannel.h"
#include "serialize.h"
#include "servers.h"
#include "service.h"
@@ -44,3 +40,8 @@
#include "uplink.h"
#include "users.h"
#include "xline.h"
+
+#include "modules/chanserv.h"
+#include "modules/nickserv.h"
+#include "modules/botserv.h"
+#include "modules/memoserv.h"
diff --git a/include/modules/botserv.h b/include/modules/botserv.h
new file mode 100644
index 000000000..09183b53a
--- /dev/null
+++ b/include/modules/botserv.h
@@ -0,0 +1,22 @@
+/*
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+#pragma once
+
+namespace BotServ
+{
+ class BotServService : public Service
+ {
+ public:
+ BotServService(Module *m) : Service(m, "BotServService", "BotServ")
+ {
+ }
+
+ };
+ static ServiceReference<BotServService> service("BotServService", "BotServ");
+}
diff --git a/include/modules/bs_badwords.h b/include/modules/bs_badwords.h
index 390e502c0..ad75aa5bb 100644
--- a/include/modules/bs_badwords.h
+++ b/include/modules/bs_badwords.h
@@ -79,13 +79,13 @@ namespace Event
* @param ci The channel
* @param bw The badword
*/
- virtual void OnBadWordAdd(ChannelInfo *ci, const BadWord *bw) anope_abstract;
+ virtual void OnBadWordAdd(ChanServ::Channel *ci, const BadWord *bw) anope_abstract;
/** Called before a badword is deleted from a channel
* @param ci The channel
* @param bw The badword
*/
- virtual void OnBadWordDel(ChannelInfo *ci, const BadWord *bw) anope_abstract;
+ virtual void OnBadWordDel(ChanServ::Channel *ci, const BadWord *bw) anope_abstract;
};
}
diff --git a/include/modules/bs_info.h b/include/modules/bs_info.h
index c9f360dfc..72180e312 100644
--- a/include/modules/bs_info.h
+++ b/include/modules/bs_info.h
@@ -13,7 +13,7 @@ namespace Event
{
/** Called when a user uses botserv/info on a bot or channel.
*/
- virtual void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) anope_abstract;
+ virtual void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) anope_abstract;
};
extern CoreExport EventHandlers<BotInfoEvent> OnBotInfo;
}
diff --git a/include/modules/bs_kick.h b/include/modules/bs_kick.h
index a783b6017..fed90346c 100644
--- a/include/modules/bs_kick.h
+++ b/include/modules/bs_kick.h
@@ -42,7 +42,7 @@ struct KickerData
public:
virtual ~KickerData() { }
- virtual void Check(ChannelInfo *ci) = 0;
+ virtual void Check(ChanServ::Channel *ci) = 0;
};
namespace Event
@@ -54,7 +54,7 @@ namespace Event
* @param ci Channel the ban is placed on
* @param mask The mask being banned
*/
- virtual void OnBotBan(User *u, ChannelInfo *ci, const Anope::string &mask) anope_abstract;
+ virtual void OnBotBan(User *u, ChanServ::Channel *ci, const Anope::string &mask) anope_abstract;
};
}
diff --git a/include/modules/chanserv.h b/include/modules/chanserv.h
index 37a96e9e7..9170ea2d2 100644
--- a/include/modules/chanserv.h
+++ b/include/modules/chanserv.h
@@ -6,8 +6,89 @@
*
*/
+#pragma once
+
+#include "event.h"
+#include "channels.h"
+#include "modules/nickserv.h"
+#include "modules/memoserv.h"
+#include "bots.h"
+
namespace ChanServ
{
+ static struct
+ {
+ Anope::string name;
+ Anope::string desc;
+ } descriptions[] = {
+ {"ACCESS_CHANGE", _("Allowed to modify the access list")},
+ {"ACCESS_LIST", _("Allowed to view the access list")},
+ {"AKICK", _("Allowed to use the AKICK command")},
+ {"ASSIGN", _("Allowed to assign/unassign a bot")},
+ {"AUTOHALFOP", _("Automatic halfop upon join")},
+ {"AUTOOP", _("Automatic channel operator status upon join")},
+ {"AUTOOWNER", _("Automatic owner upon join")},
+ {"AUTOPROTECT", _("Automatic protect upon join")},
+ {"AUTOVOICE", _("Automatic voice on join")},
+ {"BADWORDS", _("Allowed to modify channel badwords list")},
+ {"BAN", _("Allowed to ban users")},
+ {"FANTASIA", _("Allowed to use fantasy commands")},
+ {"FOUNDER", _("Allowed to issue commands restricted to channel founders")},
+ {"GETKEY", _("Allowed to use GETKEY command")},
+ {"GREET", _("Greet message displayed on join")},
+ {"HALFOP", _("Allowed to (de)halfop users")},
+ {"HALFOPME", _("Allowed to (de)halfop him/herself")},
+ {"INFO", _("Allowed to get full INFO output")},
+ {"INVITE", _("Allowed to use the INVITE command")},
+ {"KICK", _("Allowed to use the KICK command")},
+ {"MEMO", _("Allowed to read channel memos")},
+ {"MODE", _("Allowed to use the MODE command")},
+ {"NOKICK", _("Prevents users being kicked by Services")},
+ {"OP", _("Allowed to (de)op users")},
+ {"OPME", _("Allowed to (de)op him/herself")},
+ {"OWNER", _("Allowed to (de)owner users")},
+ {"OWNERME", _("Allowed to (de)owner him/herself")},
+ {"PROTECT", _("Allowed to (de)protect users")},
+ {"PROTECTME", _("Allowed to (de)protect him/herself")},
+ {"SAY", _("Allowed to use SAY and ACT commands")},
+ {"SET", _("Allowed to set channel settings")},
+ {"SIGNKICK", _("No signed kick when SIGNKICK LEVEL is used")},
+ {"TOPIC", _("Allowed to change channel topics")},
+ {"UNBAN", _("Allowed to unban users")},
+ {"VOICE", _("Allowed to (de)voice users")},
+ {"VOICEME", _("Allowed to (de)voice him/herself")}
+ };
+
+ /* A privilege, probably configured using a privilege{} block. Most
+ * commands require specific privileges to be executed. The AccessProvider
+ * backing each ChanAccess determines whether that ChanAccess has a given
+ * privilege.
+ */
+ struct CoreExport Privilege
+ {
+ Anope::string name;
+ Anope::string desc;
+ /* Rank relative to other privileges */
+ int rank;
+
+ Privilege(const Anope::string &n, const Anope::string &d, int r) : name(n), desc(d), rank(r)
+ {
+ if (this->desc.empty())
+ for (unsigned j = 0; j < sizeof(descriptions) / sizeof(*descriptions); ++j)
+ if (descriptions[j].name.equals_ci(name))
+ this->desc = descriptions[j].desc;
+ }
+
+ bool operator==(const Privilege &other) const
+ {
+ return this->name.equals_ci(other.name);
+ }
+ };
+
+ class Channel;
+ using registered_channel_map = Anope::hash_map<Channel *>;
+
+ class AccessProvider;
class ChanServService : public Service
{
public:
@@ -15,13 +96,38 @@ namespace ChanServ
{
}
+ virtual Channel *Create(const Anope::string &name) anope_abstract;
+ virtual Channel *Create(const Channel &) anope_abstract;
+ virtual Channel *Find(const Anope::string &name) anope_abstract;
+ virtual registered_channel_map& GetChannels() anope_abstract;
+
/* Have ChanServ hold the channel, that is, join and set +nsti and wait
* for a few minutes so no one can join or rejoin.
*/
- virtual void Hold(Channel *c) anope_abstract;
+ virtual void Hold(::Channel *c) anope_abstract;
+
+ virtual void AddPrivilege(Privilege p) anope_abstract;
+ virtual void RemovePrivilege(Privilege &p) anope_abstract;
+ virtual Privilege *FindPrivilege(const Anope::string &name) anope_abstract;
+ virtual std::vector<Privilege> &GetPrivileges() anope_abstract;
+ virtual void ClearPrivileges() anope_abstract;
+
+ virtual std::vector<AccessProvider *>& GetProviders() anope_abstract;
+
+ virtual void Destruct(ChanAccess *) anope_abstract;
+ virtual void Serialize(const ChanAccess *, Serialize::Data &data) anope_abstract;
+ //XXX
+ typedef std::multimap<const ChanAccess *, const ChanAccess *> Set;
+ typedef std::pair<Set, Set> Path;
+ virtual bool Matches(const ChanAccess *, const User *u, const NickServ::Account *acc, Path &p) anope_abstract;
};
static ServiceReference<ChanServService> service("ChanServService", "ChanServ");
+ inline Channel *Find(const Anope::string name)
+ {
+ return service ? service->Find(name) : nullptr;
+ }
+
namespace Event
{
struct CoreExport PreChanExpire : Events
@@ -30,7 +136,7 @@ namespace ChanServ
* @param ci The channel
* @param expire Set to true to allow the chan to expire
*/
- virtual void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_abstract;
+ virtual void OnPreChanExpire(Channel *ci, bool &expire) anope_abstract;
};
static EventHandlersReference<PreChanExpire> OnPreChanExpire("OnPreChanExpire");
@@ -39,8 +145,491 @@ namespace ChanServ
/** Called before a channel expires
* @param ci The channel
*/
- virtual void OnChanExpire(ChannelInfo *ci) anope_abstract;
+ virtual void OnChanExpire(Channel *ci) anope_abstract;
};
static EventHandlersReference<ChanExpire> OnChanExpire("OnChanExpire");
}
+
+ /* It matters that Base is here before Extensible (it is inherited by Serializable)
+ */
+ class CoreExport Channel : public Serializable, public Extensible
+ {
+ public:
+ /* channels who reference this one */
+ Anope::map<int> references;
+ Serialize::Reference<NickServ::Account> founder; /* Channel founder */
+ Serialize::Reference<NickServ::Account> successor; /* Who gets the channel if the founder nick is dropped or expires */
+ Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
+ Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
+ Anope::map<int16_t> levels;
+
+ Anope::string name; /* Channel name */
+ Anope::string desc;
+
+ time_t time_registered;
+ time_t last_used;
+
+ Anope::string last_topic; /* The last topic that was set on this channel */
+ Anope::string last_topic_setter; /* Setter */
+ time_t last_topic_time; /* Time */
+
+ ::Channel::ModeList last_modes; /* The last modes set on this channel */
+
+ int16_t bantype;
+
+ MemoServ::MemoInfo *memos = nullptr;
+
+ ::Channel *c; /* Pointer to channel, if the channel exists */
+
+ /* For BotServ */
+ Serialize::Reference<BotInfo> bi; /* Bot used on this channel */
+
+ time_t banexpire; /* Time bans expire in */
+
+ protected:
+ Channel() : Serializable("ChannelInfo"), access("ChanAccess"), akick("AutoKick") { }
+
+ public:
+ /** Is the user the real founder?
+ * @param user The user
+ * @return true or false
+ */
+ virtual bool IsFounder(const User *user) anope_abstract;
+
+ /** Change the founder of the channek
+ * @params nc The new founder
+ */
+ virtual void SetFounder(NickServ::Account *nc) anope_abstract;
+
+ /** Get the founder of the channel
+ * @return The founder
+ */
+ virtual NickServ::Account *GetFounder() const anope_abstract;
+
+ virtual void SetSuccessor(NickServ::Account *nc) anope_abstract;
+ virtual NickServ::Account *GetSuccessor() const anope_abstract;
+
+ /** Find which bot should send mode/topic/etc changes for this channel
+ * @return The bot
+ */
+ virtual BotInfo *WhoSends() const anope_abstract;
+
+ /** Add an entry to the channel access list
+ * @param access The entry
+ */
+ virtual void AddAccess(ChanAccess *access) anope_abstract;
+
+ /** Get an entry from the channel access list by index
+ *
+ * @param index The index in the access list vector
+ * @return A ChanAccess struct corresponding to the index given, or NULL if outside the bounds
+ *
+ * Retrieves an entry from the access list that matches the given index.
+ */
+ virtual ChanAccess *GetAccess(unsigned index) const anope_abstract;
+
+ /** Retrieve the access for a user or group in the form of a vector of access entries
+ * (as multiple entries can affect a single user).
+ */
+ virtual AccessGroup AccessFor(const User *u) anope_abstract;
+ virtual AccessGroup AccessFor(const NickServ::Account *nc) anope_abstract;
+
+ /** Get the size of the accss vector for this channel
+ * @return The access vector size
+ */
+ virtual unsigned GetAccessCount() const anope_abstract;
+
+ /** Get the number of access entries for this channel,
+ * including those that are on other channels.
+ */
+ virtual unsigned GetDeepAccessCount() const anope_abstract;
+
+ /** Erase an entry from the channel access list
+ *
+ * @param index The index in the access list vector
+ *
+ * @return The erased entry
+ */
+ virtual ChanAccess *EraseAccess(unsigned index) anope_abstract;
+
+ /** Clear the entire channel access list
+ *
+ * Clears the entire access list by deleting every item and then clearing the vector.
+ */
+ virtual void ClearAccess() anope_abstract;
+
+ /** Add an akick entry to the channel by NickServ::Account
+ * @param user The user who added the akick
+ * @param akicknc The nickcore being akicked
+ * @param reason The reason for the akick
+ * @param t The time the akick was added, defaults to now
+ * @param lu The time the akick was last used, defaults to never
+ */
+ virtual AutoKick* AddAkick(const Anope::string &user, NickServ::Account *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) anope_abstract;
+
+ /** Add an akick entry to the channel by reason
+ * @param user The user who added the akick
+ * @param mask The mask of the akick
+ * @param reason The reason for the akick
+ * @param t The time the akick was added, defaults to now
+ * @param lu The time the akick was last used, defaults to never
+ */
+ virtual AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) anope_abstract;
+
+ /** Get an entry from the channel akick list
+ * @param index The index in the akick vector
+ * @return The akick structure, or NULL if not found
+ */
+ virtual AutoKick* GetAkick(unsigned index) const anope_abstract;
+
+ /** Get the size of the akick vector for this channel
+ * @return The akick vector size
+ */
+ virtual unsigned GetAkickCount() const anope_abstract;
+
+ /** Erase an entry from the channel akick list
+ * @param index The index of the akick
+ */
+ virtual void EraseAkick(unsigned index) anope_abstract;
+
+ /** Clear the whole akick list
+ */
+ virtual void ClearAkick() anope_abstract;
+
+ /** Get the level for a privilege
+ * @param priv The privilege name
+ * @return the level
+ * @throws CoreException if priv is not a valid privilege
+ */
+ virtual int16_t GetLevel(const Anope::string &priv) const anope_abstract;
+
+ /** Set the level for a privilege
+ * @param priv The privilege priv
+ * @param level The new level
+ */
+ virtual void SetLevel(const Anope::string &priv, int16_t level) anope_abstract;
+
+ /** Remove a privilege from the channel
+ * @param priv The privilege
+ */
+ virtual void RemoveLevel(const Anope::string &priv) anope_abstract;
+
+ /** Clear all privileges from the channel
+ */
+ virtual void ClearLevels() anope_abstract;
+
+ /** Gets a ban mask for the given user based on the bantype
+ * of the channel.
+ * @param u The user
+ * @return A ban mask that affects the user
+ */
+ virtual Anope::string GetIdealBan(User *u) const anope_abstract;
+
+ virtual void AddChannelReference(const Anope::string &what) anope_abstract;
+ virtual void RemoveChannelReference(const Anope::string &what) anope_abstract;
+ virtual void GetChannelReferences(std::deque<Anope::string> &chans) anope_abstract;
+ };
+
+ enum
+ {
+ ACCESS_INVALID = -10000,
+ ACCESS_FOUNDER = 10001
+ };
+
+ /* A provider of access. Only used for creating ChanAccesses, as
+ * they contain pure virtual functions.
+ */
+ class CoreExport AccessProvider : public Service
+ {
+ public:
+ AccessProvider(Module *o, const Anope::string &n) : Service(o, "AccessProvider", n)
+ {
+ std::vector<AccessProvider *>& providers = service->GetProviders();
+ providers.push_back(this);
+ }
+
+ virtual ~AccessProvider()
+ {
+ std::vector<AccessProvider *>& providers = service->GetProviders();
+ std::vector<AccessProvider *>::iterator it = std::find(providers.begin(), providers.end(), this);
+ if (it != providers.end())
+ providers.erase(it);
+ }
+
+ /** Creates a new ChanAccess entry using this provider.
+ * @return The new entry
+ */
+ virtual ChanAccess *Create() anope_abstract;
+ };
+
+ /* Represents one entry of an access list on a channel. */
+ class CoreExport ChanAccess : public Serializable
+ {
+ public:
+ typedef std::multimap<const ChanAccess *, const ChanAccess *> Set;
+ /* shows the 'path' taken to determine if an access entry matches a user
+ * .first are access entries checked
+ * .second are access entries which match
+ */
+ typedef std::pair<Set, Set> Path;
+
+ /* The provider that created this access entry */
+ AccessProvider *provider;
+ /* Channel this access entry is on */
+ Serialize::Reference<Channel> ci;
+ /* account this access entry is for, if any */
+ Serialize::Reference<NickServ::Account> nc;
+ Anope::string mask;
+ Anope::string creator;
+ time_t last_seen;
+ time_t created;
+
+ ChanAccess(AccessProvider *p) : Serializable("ChanAccess"), provider(p) { }
+
+ virtual ~ChanAccess()
+ {
+ service->Destruct(this);
+ }
+
+ void Serialize(Serialize::Data &data) const override
+ {
+ service->Serialize(this, data);
+ }
+
+ /** Check if this access entry matches the given user or account
+ * @param u The user
+ * @param nc The account
+ * @param p The path to the access object which matches will be put here
+ */
+ virtual bool Matches(const User *u, const NickServ::Account *acc, Path &p) const
+ {
+ return service->Matches(this, u, acc, p);
+ }
+
+ /** Check if this access entry has the given privilege.
+ * @param name The privilege name
+ */
+ virtual bool HasPriv(const Anope::string &name) const anope_abstract;
+
+ /** Serialize the access given by this access entry into a human
+ * readable form. chanserv/access will return a number, chanserv/xop
+ * will be AOP, SOP, etc.
+ */
+ virtual Anope::string AccessSerialize() const anope_abstract;
+
+ /** Unserialize this access entry from the given data. This data
+ * will be fetched from AccessSerialize.
+ */
+ virtual void AccessUnserialize(const Anope::string &data) anope_abstract;
+
+ /* Comparison operators to other Access entries */
+ virtual bool operator>(const ChanAccess &other) const
+ {
+ const std::vector<Privilege> &privs = service->GetPrivileges();
+ for (unsigned i = privs.size(); i > 0; --i)
+ {
+ bool this_p = this->HasPriv(privs[i - 1].name),
+ other_p = other.HasPriv(privs[i - 1].name);
+
+ if (!this_p && !other_p)
+ continue;
+
+ return this_p && !other_p;
+ }
+
+ return false;
+ }
+
+ virtual bool operator<(const ChanAccess &other) const
+ {
+ const std::vector<Privilege> &privs = service->GetPrivileges();
+ for (unsigned i = privs.size(); i > 0; --i)
+ {
+ bool this_p = this->HasPriv(privs[i - 1].name),
+ other_p = other.HasPriv(privs[i - 1].name);
+
+ if (!this_p && !other_p)
+ continue;
+
+ return !this_p && other_p;
+ }
+
+ return false;
+ }
+
+ bool operator>=(const ChanAccess &other) const
+ {
+ return !(*this < other);
+ }
+
+ bool operator<=(const ChanAccess &other) const
+ {
+ return !(*this > other);
+ }
+ };
+
+ /* A group of access entries. This is used commonly, for example with ChanServ::Channel::AccessFor,
+ * to show what access a user has on a channel because users can match multiple access entries.
+ */
+ class CoreExport AccessGroup : public std::vector<ChanAccess *>
+ {
+ public:
+ /* Channel these access entries are on */
+ const ChanServ::Channel *ci;
+ /* Path from these entries to other entries that they depend on */
+ ChanAccess::Path path;
+ /* Account these entries affect, if any */
+ const NickServ::Account *nc;
+ /* super_admin always gets all privs. founder is a special case where ci->founder == nc */
+ bool super_admin, founder;
+
+ AccessGroup()
+ {
+ this->ci = NULL;
+ this->nc = NULL;
+ this->super_admin = this->founder = false;
+ }
+
+ private:
+ bool HasPriv(const ChanAccess *access, const Anope::string &name) const
+ {
+ EventReturn MOD_RESULT = ::Event::OnCheckPriv(&::Event::CheckPriv::OnCheckPriv, access, name);
+ if (MOD_RESULT == EVENT_ALLOW || access->HasPriv(name))
+ {
+ typedef std::multimap<const ChanAccess *, const ChanAccess *> P;
+ std::pair<P::const_iterator, P::const_iterator> it = this->path.second.equal_range(access);
+ if (it.first != it.second)
+ /* check all of the paths for this entry */
+ for (; it.first != it.second; ++it.first)
+ {
+ const ChanAccess *a = it.first->second;
+ /* if only one path fully matches then we are ok */
+ if (HasPriv(a, name))
+ return true;
+ }
+ else
+ /* entry is the end of a chain, all entries match, ok */
+ return true;
+ }
+
+ /* entry does not match or none of the chains fully match */
+ return false;
+ }
+
+ public:
+ /** Check if this access group has a certain privilege. Eg, it
+ * will check every ChanAccess entry of this group for any that
+ * has the given privilege.
+ * @param priv The privilege
+ * @return true if any entry has the given privilege
+ */
+ bool HasPriv(const Anope::string &priv) const
+ {
+ if (this->super_admin)
+ return true;
+ else if (!ci || ci->GetLevel(priv) == ACCESS_INVALID)
+ return false;
+
+ /* Privileges prefixed with auto are understood to be given
+ * automatically. Sometimes founders want to not automatically
+ * obtain privileges, so we will let them */
+ bool auto_mode = !priv.find("AUTO");
+
+ /* Only grant founder privilege if this isn't an auto mode or if they don't match any entries in this group */
+ if ((!auto_mode || this->empty()) && this->founder)
+ return true;
+
+ EventReturn MOD_RESULT;
+ MOD_RESULT = ::Event::OnGroupCheckPriv(&::Event::GroupCheckPriv::OnGroupCheckPriv, this, priv);
+ if (MOD_RESULT != EVENT_CONTINUE)
+ return MOD_RESULT == EVENT_ALLOW;
+
+ for (unsigned i = this->size(); i > 0; --i)
+ {
+ ChanAccess *access = this->at(i - 1);
+
+ if (HasPriv(access, priv))
+ return true;
+ }
+
+ return false;
+ }
+
+ /** Get the "highest" access entry from this group of entries.
+ * The highest entry is determined by the entry that has the privilege
+ * with the highest rank (see Privilege::rank).
+ * @return The "highest" entry
+ */
+ const ChanAccess *Highest() const
+ {
+ ChanAccess *highest = NULL;
+ for (unsigned i = 0; i < this->size(); ++i)
+ if (highest == NULL || *this->at(i) > *highest)
+ highest = this->at(i);
+ return highest;
+ }
+
+ /* Comparison operators to other AccessGroups */
+ bool operator>(const AccessGroup &other) const
+ {
+ if (other.super_admin)
+ return false;
+ else if (this->super_admin)
+ return true;
+ else if (other.founder)
+ return false;
+ else if (this->founder)
+ return true;
+
+ const std::vector<Privilege> &privs = service->GetPrivileges();
+ for (unsigned i = privs.size(); i > 0; --i)
+ {
+ bool this_p = this->HasPriv(privs[i - 1].name),
+ other_p = other.HasPriv(privs[i - 1].name);
+
+ if (!this_p && !other_p)
+ continue;
+
+ return this_p && !other_p;
+ }
+
+ return false;
+ }
+
+ bool operator<(const AccessGroup &other) const
+ {
+ if (this->super_admin)
+ return false;
+ else if (other.super_admin)
+ return true;
+ else if (this->founder)
+ return false;
+ else if (other.founder)
+ return true;
+
+ const std::vector<Privilege> &privs = service->GetPrivileges();
+ for (unsigned i = privs.size(); i > 0; --i)
+ {
+ bool this_p = this->HasPriv(privs[i - 1].name),
+ other_p = other.HasPriv(privs[i - 1].name);
+
+ if (!this_p && !other_p)
+ continue;
+
+ return !this_p && other_p;
+ }
+
+ return false;
+ }
+
+ bool operator>=(const AccessGroup &other) const
+ {
+ return !(*this < other);
+ }
+
+ bool operator<=(const AccessGroup &other) const
+ {
+ return !(*this > other);
+ }
+ };
}
diff --git a/include/modules/cs_access.h b/include/modules/cs_access.h
index 8c6778799..877a98f02 100644
--- a/include/modules/cs_access.h
+++ b/include/modules/cs_access.h
@@ -17,6 +17,6 @@ namespace Event
* @param priv The privilege changed
* @param what The new level
*/
- virtual void OnLevelChange(CommandSource &source, ChannelInfo *ci, const Anope::string &priv, int16_t what) anope_abstract;
+ virtual void OnLevelChange(CommandSource &source, ChanServ::Channel *ci, const Anope::string &priv, int16_t what) anope_abstract;
};
}
diff --git a/include/modules/cs_akick.h b/include/modules/cs_akick.h
index ab02985c1..08a72260f 100644
--- a/include/modules/cs_akick.h
+++ b/include/modules/cs_akick.h
@@ -7,6 +7,36 @@
*
*/
+ /* AutoKick data. */
+class CoreExport AutoKick : public Serializable
+{
+ public:
+ /* Channel this autokick is on */
+ Serialize::Reference<ChanServ::Channel> ci;
+
+ Anope::string mask;
+ Serialize::Reference<NickServ::Account> nc;
+
+ Anope::string reason;
+ Anope::string creator;
+ time_t addtime;
+ time_t last_used;
+
+ protected:
+ AutoKick() : Serializable("AutoKick") { }
+ public:
+ virtual ~AutoKick() { }
+};
+
+class AutoKickService : public Service
+{
+ public:
+ AutoKickService(Module *o) : Service(o, "AutoKickService", "AutoKickService") { }
+
+ virtual AutoKick* Create() anope_abstract;
+};
+static ServiceReference<AutoKickService> akick("AutoKickService", "AutoKickService");
+
namespace Event
{
struct CoreExport Akick : Events
@@ -16,13 +46,13 @@ namespace Event
* @param ci The channel
* @param ak The akick
*/
- virtual void OnAkickAdd(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) anope_abstract;
+ virtual void OnAkickAdd(CommandSource &source, ChanServ::Channel *ci, const AutoKick *ak) anope_abstract;
/** Called before removing an akick from a channel
* @param source The source of the command
* @param ci The channel
* @param ak The akick
*/
- virtual void OnAkickDel(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) anope_abstract;
+ virtual void OnAkickDel(CommandSource &source, ChanServ::Channel *ci, const AutoKick *ak) anope_abstract;
};
}
diff --git a/include/modules/cs_drop.h b/include/modules/cs_drop.h
index e2a9ace8a..49247b3cb 100644
--- a/include/modules/cs_drop.h
+++ b/include/modules/cs_drop.h
@@ -15,6 +15,6 @@ namespace Event
* @param source The user dropping the channel
* @param ci The channel
*/
- virtual EventReturn OnChanDrop(CommandSource &source, ChannelInfo *ci) anope_abstract;
+ virtual EventReturn OnChanDrop(CommandSource &source, ChanServ::Channel *ci) anope_abstract;
};
}
diff --git a/include/modules/cs_info.h b/include/modules/cs_info.h
index 7f0429387..7b19abd19 100644
--- a/include/modules/cs_info.h
+++ b/include/modules/cs_info.h
@@ -17,7 +17,7 @@ namespace Event
* @param info Data to show the user requesting information
* @param show_hidden true if we should show the user everything
*/
- virtual void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_abstract;
+ virtual void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_hidden) anope_abstract;
};
}
diff --git a/include/modules/cs_mode.h b/include/modules/cs_mode.h
index 4c1dc5d55..61ef93f95 100644
--- a/include/modules/cs_mode.h
+++ b/include/modules/cs_mode.h
@@ -97,14 +97,14 @@ namespace Event
* @param lock The mode lock
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
*/
- virtual EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_abstract;
+ virtual EventReturn OnMLock(ChanServ::Channel *ci, ModeLock *lock) anope_abstract;
/** Called when a mode is about to be unlocked
* @param ci The channel the mode is being unlocked from
* @param lock The mode lock
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
*/
- virtual EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_abstract;
+ virtual EventReturn OnUnMLock(ChanServ::Channel *ci, ModeLock *lock) anope_abstract;
};
}
diff --git a/include/modules/cs_set.h b/include/modules/cs_set.h
index 3ddf2f41c..355459f7c 100644
--- a/include/modules/cs_set.h
+++ b/include/modules/cs_set.h
@@ -18,7 +18,7 @@ namespace Event
* @param setting The setting passed to the command. Probably ON/OFF.
* @return EVENT_ALLOW to bypass access checks, EVENT_STOP to halt immediately.
*/
- virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) anope_abstract;
+ virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChanServ::Channel *ci, const Anope::string &setting) anope_abstract;
};
static EventHandlersReference<SetChannelOption> OnSetChannelOption("OnSetChannelOption");
}
diff --git a/include/modules/dns.h b/include/modules/dns.h
index e340c3f2b..d0cecf080 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -9,7 +9,7 @@
* Based on the original code of Services by Andy Church.
*
*/
-
+
#ifndef DNS_H
#define DNS_H
@@ -53,7 +53,7 @@ namespace DNS
QUERYFLAGS_Z = 0x70,
QUERYFLAGS_RCODE = 0xF
};
-
+
enum Error
{
ERROR_NONE,
@@ -70,42 +70,42 @@ namespace DNS
ERROR_NO_RECORDS,
ERROR_INVALIDTYPE
};
-
+
struct Question
{
Anope::string name;
QueryType type;
unsigned short qclass;
-
+
Question() : type(QUERY_NONE), qclass(0) { }
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { }
- inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
+ inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
struct hash
{
- size_t operator()(const Question &q) const
+ size_t operator()(const Question &q) const
{
return Anope::hash_ci()(q.name);
}
};
};
-
+
struct ResourceRecord : Question
{
unsigned int ttl;
Anope::string rdata;
time_t created;
-
+
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { }
ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { }
};
-
+
struct Query
{
std::vector<Question> questions;
std::vector<ResourceRecord> answers, authorities, additional;
Error error;
-
+
Query() : error(ERROR_NONE) { }
Query(const Question &q) : error(ERROR_NONE) { questions.push_back(q); }
};
@@ -123,14 +123,14 @@ namespace DNS
virtual void Process(Request *req) = 0;
virtual void RemoveRequest(Request *req) = 0;
-
+
virtual bool HandlePacket(ReplySocket *s, const unsigned char *const data, int len, sockaddrs *from) = 0;
-
+
virtual void UpdateSerial() = 0;
virtual void Notify(const Anope::string &zone) = 0;
virtual uint32_t GetSerial() const = 0;
};
-
+
/** A DNS query.
*/
class Request : public Timer, public Question
@@ -146,22 +146,22 @@ namespace DNS
Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr),
use_cache(cache), id(0), creator(c) { }
-
+
virtual ~Request()
{
manager->RemoveRequest(this);
}
-
+
/** Called when this request succeeds
* @param r The query sent back from the nameserver
*/
virtual void OnLookupComplete(const Query *r) = 0;
-
+
/** Called when this request fails or times out.
* @param r The query sent back from the nameserver, check the error code.
*/
virtual void OnError(const Query *r) { }
-
+
/** Used to time out the query, xalls OnError and lets the TimerManager
* delete this request.
*/
@@ -173,7 +173,7 @@ namespace DNS
this->OnError(&rr);
}
};
-
+
} // namespace DNS
namespace Event
@@ -189,7 +189,7 @@ namespace Event
static EventHandlersReference<DnsRequest> OnDnsRequest("OnDnsRequest");
}
-
+
#endif // DNS_H
-
-
+
+
diff --git a/include/modules/fantasy.h b/include/modules/fantasy.h
index a7944cef9..bb13b959d 100644
--- a/include/modules/fantasy.h
+++ b/include/modules/fantasy.h
@@ -18,7 +18,7 @@ namespace Event
* @param params The params
* @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
*/
- virtual EventReturn OnBotFantasy(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) anope_abstract;
+ virtual EventReturn OnBotFantasy(CommandSource &source, Command *c, ChanServ::Channel *ci, const std::vector<Anope::string> &params) anope_abstract;
};
struct CoreExport BotNoFantasyAccess : Events
@@ -30,6 +30,6 @@ namespace Event
* @param params The params
* @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
*/
- virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) anope_abstract;
+ virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChanServ::Channel *ci, const std::vector<Anope::string> &params) anope_abstract;
};
}
diff --git a/include/modules/hs_del.h b/include/modules/hs_del.h
index d4a5c7666..fdec23b21 100644
--- a/include/modules/hs_del.h
+++ b/include/modules/hs_del.h
@@ -13,6 +13,6 @@ namespace Event
/** Called when a vhost is deleted
* @param na The nickalias of the vhost
*/
- virtual void OnDeleteVhost(NickAlias *na) anope_abstract;
+ virtual void OnDeleteVhost(NickServ::Nick *na) anope_abstract;
};
}
diff --git a/include/modules/memoserv.h b/include/modules/memoserv.h
index 4e5d67de6..99f34b6e9 100644
--- a/include/modules/memoserv.h
+++ b/include/modules/memoserv.h
@@ -6,6 +6,10 @@
*
*/
+#pragma once
+
+#include "module.h"
+
namespace MemoServ
{
class MemoServService : public Service
@@ -18,26 +22,29 @@ namespace MemoServ
MEMO_TOO_FAST,
MEMO_TARGET_FULL
};
-
+
MemoServService(Module *m) : Service(m, "MemoServService", "MemoServ")
{
}
-
+
/** Sends a memo.
* @param source The source of the memo, can be anythin.
* @param target The target of the memo, nick or channel.
* @param message Memo text
* @param force true to force the memo, restrictions/delays etc are not checked
*/
- virtual MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force = false) = 0;
-
+ virtual MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force = false) anope_abstract;
+
/** Check for new memos and notify the user if there are any
* @param u The user
*/
- virtual void Check(User *u) = 0;
+ virtual void Check(User *u) anope_abstract;
+
+ virtual Memo *CreateMemo() anope_abstract;
+ virtual MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_registered, bool &is_chan, bool create) anope_abstract;
};
static ServiceReference<MemoServService> service("MemoServService", "MemoServ");
-
+
namespace Event
{
struct CoreExport MemoSend : Events
@@ -51,7 +58,7 @@ namespace MemoServ
virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) anope_abstract;
};
static EventHandlersReference<MemoSend> OnMemoSend("OnMemoSend");
-
+
struct CoreExport MemoDel : Events
{
/** Called when a memo is deleted
@@ -63,4 +70,41 @@ namespace MemoServ
};
static EventHandlersReference<MemoDel> OnMemoDel("OnMemoDel");
}
+
+ class Memo : public Serializable
+ {
+ public:
+ bool unread;
+ bool receipt;
+ protected:
+ Memo() : Serializable("Memo") { }
+ public:
+
+ Anope::string owner;
+ /* When it was sent */
+ time_t time;
+ Anope::string sender;
+ Anope::string text;
+ };
+
+ /* Memo info structures. Since both nicknames and channels can have memos,
+ * we encapsulate memo data in a MemoInfo to make it easier to handle.
+ */
+ struct CoreExport MemoInfo
+ {
+ int16_t memomax = 0;
+ Serialize::Checker<std::vector<Memo *> > memos;
+ std::vector<Anope::string> ignores;
+
+ MemoInfo() : memos("Memo") { }
+ virtual ~MemoInfo() { }
+
+ virtual Memo *GetMemo(unsigned index) const anope_abstract;
+
+ virtual unsigned GetIndex(Memo *m) const anope_abstract;
+
+ virtual void Del(unsigned index) anope_abstract;
+
+ virtual bool HasIgnore(User *u) anope_abstract;
+ };
}
diff --git a/include/modules/nickserv.h b/include/modules/nickserv.h
index 0ede4130e..a55786ffb 100644
--- a/include/modules/nickserv.h
+++ b/include/modules/nickserv.h
@@ -7,8 +7,20 @@
*
*/
+#pragma once
+
+#include "event.h"
+#include "service.h"
+
namespace NickServ
{
+ class Nick;
+ class Account;
+ class IdentifyRequestListener;
+
+ typedef Anope::hash_map<Nick *> nickalias_map;
+ typedef Anope::hash_map<Account *> nickcore_map;
+
class NickServService : public Service
{
public:
@@ -17,11 +29,33 @@ namespace NickServ
}
virtual void Validate(User *u) anope_abstract;
- virtual void Collide(User *u, NickAlias *na) anope_abstract;
- virtual void Release(NickAlias *na) anope_abstract;
+ virtual void Collide(User *u, Nick *na) anope_abstract;
+ virtual void Release(Nick *na) anope_abstract;
+
+ virtual IdentifyRequest *CreateIdentifyRequest(IdentifyRequestListener *l, Module *owner, const Anope::string &acc, const Anope::string &pass) anope_abstract;
+ virtual std::set<IdentifyRequest *>& GetIdentifyRequests() anope_abstract;
+
+ virtual nickalias_map& GetNickList() anope_abstract;
+ virtual nickcore_map& GetAccountList() anope_abstract;
+
+ virtual Nick *CreateNick(const Anope::string &nick, Account *acc) anope_abstract;
+ virtual Account *CreateAccount(const Anope::string &acc) anope_abstract;
+
+ virtual Nick *FindNick(const Anope::string &nick) anope_abstract;
+ virtual Account *FindAccount(const Anope::string &acc) anope_abstract;
};
static ServiceReference<NickServService> service("NickServService", "NickServ");
+ inline Nick *FindNick(const Anope::string &nick)
+ {
+ return service ? service->FindNick(nick) : nullptr;
+ }
+
+ inline Account *FindAccount(const Anope::string &account)
+ {
+ return service ? service->FindAccount(account) : nullptr;
+ }
+
namespace Event
{
struct CoreExport PreNickExpire : Events
@@ -30,7 +64,7 @@ namespace NickServ
* @param na The nick
* @param expire Set to true to allow the nick to expire
*/
- virtual void OnPreNickExpire(NickAlias *na, bool &expire) anope_abstract;
+ virtual void OnPreNickExpire(Nick *na, bool &expire) anope_abstract;
};
static EventHandlersReference<PreNickExpire> OnPreNickExpire("OnPreNickExpire");
@@ -39,7 +73,7 @@ namespace NickServ
/** Called when a nick drops
* @param na The nick
*/
- virtual void OnNickExpire(NickAlias *na) anope_abstract;
+ virtual void OnNickExpire(Nick *na) anope_abstract;
};
static EventHandlersReference<NickExpire> OnNickExpire("OnNickExpire");
@@ -49,7 +83,7 @@ namespace NickServ
* @param user The user registering the nick, of any
* @param The nick
*/
- virtual void OnNickRegister(User *user, NickAlias *na) anope_abstract;
+ virtual void OnNickRegister(User *user, Nick *na) anope_abstract;
};
static EventHandlersReference<NickRegister> OnNickRegister("OnNickRegister");
@@ -61,8 +95,250 @@ namespace NickServ
* @param na The nick they are on
* @return EVENT_STOP to force the user off of the nick
*/
- virtual EventReturn OnNickValidate(User *u, NickAlias *na) anope_abstract;
+ virtual EventReturn OnNickValidate(User *u, Nick *na) anope_abstract;
};
static EventHandlersReference<NickValidate> OnNickValidate("OnNickValidate");
}
+
+ /* A registered nickname.
+ * It matters that Base is here before Extensible (it is inherited by Serializable)
+ */
+ class CoreExport Nick : public Serializable, public Extensible
+ {
+ protected:
+ Anope::string vhost_ident, vhost_host, vhost_creator;
+ time_t vhost_created;
+
+ public:
+ Anope::string nick;
+ Anope::string last_quit;
+ Anope::string last_realname;
+ /* Last usermask this nick was seen on, eg user@host */
+ Anope::string last_usermask;
+ /* Last uncloaked usermask, requires nickserv/auspex to see */
+ Anope::string last_realhost;
+ time_t time_registered;
+ time_t last_seen;
+ /* Account this nick is tied to. Multiple nicks can be tied to a single account. */
+ Serialize::Reference<Account> nc;
+
+ protected:
+ Nick() : Serializable("NickAlias") { }
+
+ public:
+ virtual ~Nick() { }
+
+ /** Set a vhost for the user
+ * @param ident The ident
+ * @param host The host
+ * @param creator Who created the vhost
+ * @param time When the vhost was craated
+ */
+ virtual void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime) anope_abstract;
+
+ /** Remove a users vhost
+ **/
+ virtual void RemoveVhost() anope_abstract;
+
+ /** Check if the user has a vhost
+ * @return true or false
+ */
+ virtual bool HasVhost() const anope_abstract;
+
+ /** Retrieve the vhost ident
+ * @return the ident
+ */
+ virtual const Anope::string &GetVhostIdent() const anope_abstract;
+
+ /** Retrieve the vhost host
+ * @return the host
+ */
+ virtual const Anope::string &GetVhostHost() const anope_abstract;
+
+ /** Retrieve the vhost creator
+ * @return the creator
+ */
+ virtual const Anope::string &GetVhostCreator() const anope_abstract;
+
+ /** Retrieve when the vhost was created
+ * @return the time it was created
+ */
+ virtual time_t GetVhostCreated() const anope_abstract;
+ };
+
+ /* A registered account. Each account must have a Nick with the same nick as the
+ * account's display.
+ * It matters that Base is here before Extensible (it is inherited by Serializable)
+ */
+ class CoreExport Account : public Serializable, public Extensible
+ {
+ protected:
+ /* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
+ Serialize::Checker<std::map<ChanServ::Channel *, int> > chanaccess;
+ public:
+ /* Name of the account. Find(display)->nc == this. */
+ Anope::string display;
+ /* User password in form of hashm:data */
+ Anope::string pass;
+ Anope::string email;
+ /* Locale name of the language of the user. Empty means default language */
+ Anope::string language;
+ /* Access list, contains user@host masks of users who get certain privileges based
+ * on if NI_SECURE is set and what (if any) kill protection is enabled. */
+ std::vector<Anope::string> access;
+ MemoServ::MemoInfo *memos = nullptr;
+ std::map<Anope::string, Anope::string> last_modes;
+
+ /* Nicknames registered that are grouped to this account.
+ * for n in aliases, n->nc == this.
+ */
+ Serialize::Checker<std::vector<Nick *> > aliases;
+
+ /* Set if this user is a services operattor. o->ot must exist. */
+ Oper *o;
+
+ /* Unsaved data */
+
+ /* Number of channels registered by this account */
+ uint16_t channelcount;
+ /* Last time an email was sent to this user */
+ time_t lastmail;
+ /* Users online now logged into this account */
+ std::list<User *> users;
+
+ protected:
+ /** Constructor
+ * @param display The display nick
+ */
+ Account() : Serializable("NickCore"), chanaccess("ChannelInfo"), aliases("NickAlias") { }
+
+ public:
+ virtual ~Account() { }
+
+ /** Changes the display for this account
+ * @param na The new display, must be grouped to this account.
+ */
+ virtual void SetDisplay(const Nick *na) anope_abstract;
+
+ /** Checks whether this account is a services oper or not.
+ * @return True if this account is a services oper, false otherwise.
+ */
+ virtual bool IsServicesOper() const anope_abstract;
+
+ /** Add an entry to the nick's access list
+ *
+ * @param entry The nick!ident@host entry to add to the access list
+ *
+ * Adds a new entry into the access list.
+ */
+ virtual void AddAccess(const Anope::string &entry) anope_abstract;
+
+ /** Get an entry from the nick's access list by index
+ *
+ * @param entry Index in the access list vector to retrieve
+ * @return The access list entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds
+ *
+ * Retrieves an entry from the access list corresponding to the given index.
+ */
+ virtual Anope::string GetAccess(unsigned entry) const anope_abstract;
+
+ /** Get the number of entries on the access list for this account.
+ */
+ virtual unsigned GetAccessCount() const anope_abstract;
+
+ /** Find an entry in the nick's access list
+ *
+ * @param entry The nick!ident@host entry to search for
+ * @return True if the entry is found in the access list, false otherwise
+ *
+ * Search for an entry within the access list.
+ */
+ virtual bool FindAccess(const Anope::string &entry) anope_abstract;
+
+ /** Erase an entry from the nick's access list
+ *
+ * @param entry The nick!ident@host entry to remove
+ *
+ * Removes the specified access list entry from the access list.
+ */
+ virtual void EraseAccess(const Anope::string &entry) anope_abstract;
+
+ /** Clears the entire nick's access list
+ *
+ * Deletes all the memory allocated in the access list vector and then clears the vector.
+ */
+ virtual void ClearAccess() anope_abstract;
+
+ /** Is the given user on this accounts access list?
+ *
+ * @param u The user
+ *
+ * @return true if the user is on the access list
+ */
+ virtual bool IsOnAccess(const User *u) const anope_abstract;
+
+ virtual void AddChannelReference(ChanServ::Channel *ci) anope_abstract;
+ virtual void RemoveChannelReference(ChanServ::Channel *ci) anope_abstract;
+ virtual void GetChannelReferences(std::deque<ChanServ::Channel *> &queue) anope_abstract;
+ };
+
+ /* A request to check if an account/password is valid. These can exist for
+ * extended periods due to the time some authentication modules take.
+ */
+ class CoreExport IdentifyRequest
+ {
+ protected:
+ /* Owner of this request, used to cleanup requests if a module is unloaded
+ * while a request us pending */
+ Module *owner;
+ IdentifyRequestListener *l;
+ Anope::string account;
+ Anope::string password;
+
+ std::set<Module *> holds;
+ bool dispatched = false;
+ bool success = false;
+
+ IdentifyRequest(IdentifyRequestListener *li, Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), l(li), account(acc), password(pass) { }
+ public:
+ virtual ~IdentifyRequest() { }
+
+ const Anope::string &GetAccount() const { return account; }
+ const Anope::string &GetPassword() const { return password; }
+ Module *GetOwner() const { return owner; }
+
+ /* Holds this request. When a request is held it must be Released later
+ * for the request to complete. Multiple modules may hold a request at any time,
+ * but the request is not complete until every module has released it. If you do not
+ * require holding this (eg, your password check is done in this thread and immediately)
+ * then you don't need to hold the request before Successing it.
+ * @param m The module holding this request
+ */
+ virtual void Hold(Module *m) anope_abstract;
+
+ /** Releases a held request
+ * @param m The module releaseing the hold
+ */
+ virtual void Release(Module *m) anope_abstract;
+
+ /** Called by modules when this IdentifyRequest has successeded successfully.
+ * If this request is behind held it must still be Released after calling this.
+ * @param m The module confirming authentication
+ */
+ virtual void Success(Module *m) anope_abstract;
+
+ /** Used to either finalize this request or marks
+ * it as dispatched and begins waiting for the module(s)
+ * that have holds to finish.
+ */
+ virtual void Dispatch() anope_abstract;
+ };
+
+ class IdentifyRequestListener
+ {
+ public:
+ virtual ~IdentifyRequestListener() { }
+ virtual void OnSuccess(IdentifyRequest *) anope_abstract;
+ virtual void OnFail(IdentifyRequest *) anope_abstract;
+ };
}
diff --git a/include/modules/ns_cert.h b/include/modules/ns_cert.h
index b0614b2e6..f464d7fde 100644
--- a/include/modules/ns_cert.h
+++ b/include/modules/ns_cert.h
@@ -66,7 +66,7 @@ class CertService : public Service
public:
CertService(Module *c) : Service(c, "CertService", "certs") { }
- virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0;
+ virtual NickServ::Account* FindAccountFromCert(const Anope::string &cert) = 0;
};
namespace Event
@@ -77,18 +77,18 @@ namespace Event
* @param nc The nick
* @param entry The entry
*/
- virtual void OnNickAddCert(NickCore *nc, const Anope::string &entry) anope_abstract;
+ virtual void OnNickAddCert(NickServ::Account *nc, const Anope::string &entry) anope_abstract;
- /** Called from NickCore::EraseCert()
- * @param nc pointer to the NickCore
+ /** Called from NickServ::Account::EraseCert()
+ * @param nc pointer to the NickServ::Account
* @param entry The fingerprint
*/
- virtual void OnNickEraseCert(NickCore *nc, const Anope::string &entry) anope_abstract;
+ virtual void OnNickEraseCert(NickServ::Account *nc, const Anope::string &entry) anope_abstract;
- /** called from NickCore::ClearCert()
- * @param nc pointer to the NickCore
+ /** called from NickServ::Account::ClearCert()
+ * @param nc pointer to the NickServ::Account
*/
- virtual void OnNickClearCert(NickCore *nc) anope_abstract;
+ virtual void OnNickClearCert(NickServ::Account *nc) anope_abstract;
};
}
diff --git a/include/modules/ns_drop.h b/include/modules/ns_drop.h
index 2aef2b965..9217a924c 100644
--- a/include/modules/ns_drop.h
+++ b/include/modules/ns_drop.h
@@ -14,7 +14,7 @@ namespace Event
* @param source The source of the command
* @param na The nick
*/
- virtual void OnNickDrop(CommandSource &source, NickAlias *na) anope_abstract;
+ virtual void OnNickDrop(CommandSource &source, NickServ::Nick *na) anope_abstract;
};
extern CoreExport EventHandlers<NickDrop> OnNickDrop;
}
diff --git a/include/modules/ns_group.h b/include/modules/ns_group.h
index 8b3fa49f9..a254c4412 100644
--- a/include/modules/ns_group.h
+++ b/include/modules/ns_group.h
@@ -15,6 +15,6 @@ namespace Event
* @param u The user grouping
* @param target The target they're grouping to
*/
- virtual void OnNickGroup(User *u, NickAlias *target) anope_abstract;
+ virtual void OnNickGroup(User *u, NickServ::Nick *target) anope_abstract;
};
}
diff --git a/include/modules/ns_info.h b/include/modules/ns_info.h
index 8fae2b536..dd593ce59 100644
--- a/include/modules/ns_info.h
+++ b/include/modules/ns_info.h
@@ -17,6 +17,6 @@ namespace Event
* @param info Data to show the user requesting information
* @param show_hidden true if we should show the user everything
*/
- virtual void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_abstract;
+ virtual void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) anope_abstract;
};
}
diff --git a/include/modules/ns_set.h b/include/modules/ns_set.h
index a45fa0b5e..b958b4cf5 100644
--- a/include/modules/ns_set.h
+++ b/include/modules/ns_set.h
@@ -18,7 +18,7 @@ namespace Event
* @param setting The setting passed to the command. Probably ON/OFF.
* @return EVENT_STOP to halt immediately
*/
- virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickCore *nc, const Anope::string &setting) anope_abstract;
+ virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickServ::Account *nc, const Anope::string &setting) anope_abstract;
};
static EventHandlersReference<SetNickOption> OnSetNickOption("OnSetNickOption");
}
diff --git a/include/modules/os_ignore.h b/include/modules/os_ignore.h
index 2511d47b2..598122663 100644
--- a/include/modules/os_ignore.h
+++ b/include/modules/os_ignore.h
@@ -26,7 +26,7 @@ class IgnoreService : public Service
{
protected:
IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { }
-
+
public:
virtual void AddIgnore(IgnoreData *) = 0;
diff --git a/include/modules/os_news.h b/include/modules/os_news.h
index 458a5a82b..b076f62af 100644
--- a/include/modules/os_news.h
+++ b/include/modules/os_news.h
@@ -31,11 +31,11 @@ class NewsService : public Service
NewsService(Module *m) : Service(m, "NewsService", "news") { }
virtual NewsItem *CreateNewsItem() = 0;
-
+
virtual void AddNewsItem(NewsItem *n) = 0;
-
+
virtual void DelNewsItem(NewsItem *n) = 0;
-
+
virtual std::vector<NewsItem *> &GetNewsList(NewsType t) = 0;
};
diff --git a/include/modules/os_session.h b/include/modules/os_session.h
index 91548a5c2..1c1966e06 100644
--- a/include/modules/os_session.h
+++ b/include/modules/os_session.h
@@ -40,7 +40,7 @@ class SessionService : public Service
virtual Exception *FindException(User *u) = 0;
- virtual Exception *FindException(const Anope::string &host) = 0;
+ virtual Exception *FindException(const Anope::string &host) = 0;
virtual ExceptionVector &GetExceptions() = 0;
diff --git a/include/modules/redis.h b/include/modules/redis.h
index 941691a72..ae444e782 100644
--- a/include/modules/redis.h
+++ b/include/modules/redis.h
@@ -24,7 +24,7 @@ namespace Redis
Reply() { Clear(); }
~Reply() { Clear(); }
-
+
void Clear()
{
type = NOT_PARSED;
diff --git a/include/modules/sasl.h b/include/modules/sasl.h
index dbe6441e9..28bdb1ca6 100644
--- a/include/modules/sasl.h
+++ b/include/modules/sasl.h
@@ -33,7 +33,7 @@ namespace SASL
virtual void SendMessage(SASL::Session *session, const Anope::string &type, const Anope::string &data) = 0;
- virtual void Succeed(Session *, NickCore *) = 0;
+ virtual void Succeed(Session *, NickServ::Account *) = 0;
virtual void Fail(Session *) = 0;
virtual void SendMechs(Session *) = 0;
virtual void DeleteSessions(Mechanism *, bool = false) = 0;
@@ -73,32 +73,32 @@ namespace SASL
}
};
- class IdentifyRequest : public ::IdentifyRequest
+ class IdentifyRequestListener : public NickServ::IdentifyRequestListener
{
Anope::string uid;
public:
- IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass) : ::IdentifyRequest(m, acc, pass), uid(id) { }
+ IdentifyRequestListener(const Anope::string &id) : uid(id) { }
- void OnSuccess() override
+ void OnSuccess(NickServ::IdentifyRequest *req) override
{
if (!sasl)
return;
- NickAlias *na = NickAlias::Find(GetAccount());
+ NickServ::Nick *na = NickServ::FindNick(req->GetAccount());
if (!na || na->nc->HasExt("NS_SUSPENDED"))
- return OnFail();
+ return OnFail(req);
Session *s = sasl->GetSession(uid);
if (s)
{
- Log(Config->GetClient("NickServ")) << "A user identified to account " << this->GetAccount() << " using SASL";
+ Log(Config->GetClient("NickServ")) << "A user identified to account " << req->GetAccount() << " using SASL";
sasl->Succeed(s, na->nc);
delete s;
}
}
- void OnFail() override
+ void OnFail(NickServ::IdentifyRequest *req) override
{
if (!sasl)
return;
@@ -111,13 +111,13 @@ namespace SASL
}
Anope::string accountstatus;
- NickAlias *na = NickAlias::Find(GetAccount());
+ NickServ::Nick *na = NickServ::FindNick(req->GetAccount());
if (!na)
accountstatus = "nonexistent ";
else if (na->nc->HasExt("NS_SUSPENDED"))
accountstatus = "suspended ";
- Log(Config->GetClient("NickServ")) << "A user failed to identify for " << accountstatus << "account " << this->GetAccount() << " using SASL";
+ Log(Config->GetClient("NickServ")) << "A user failed to identify for " << accountstatus << "account " << req->GetAccount() << " using SASL";
}
};
}
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
index 6eb97582c..fab3c35cc 100644
--- a/include/modules/ssl.h
+++ b/include/modules/ssl.h
@@ -3,7 +3,7 @@ class SSLService : public Service
{
public:
SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { }
-
+
virtual void Init(Socket *s) = 0;
};
diff --git a/include/modules/suspend.h b/include/modules/suspend.h
index bd4eacd3b..3f5a8ded3 100644
--- a/include/modules/suspend.h
+++ b/include/modules/suspend.h
@@ -22,14 +22,14 @@ namespace Event
/** Called when a channel is suspended
* @param ci The channel
*/
- virtual void OnChanSuspend(ChannelInfo *ci) anope_abstract;
+ virtual void OnChanSuspend(ChanServ::Channel *ci) anope_abstract;
};
struct CoreExport ChanUnsuspend : Events
{
/** Called when a channel is unsuspended
* @param ci The channel
*/
- virtual void OnChanUnsuspend(ChannelInfo *ci) anope_abstract;
+ virtual void OnChanUnsuspend(ChanServ::Channel *ci) anope_abstract;
};
extern CoreExport EventHandlers<ChanUnsuspend> OnChanUnsuspend;
@@ -38,7 +38,7 @@ namespace Event
/** Called when a nick is suspended
* @param na The nick alias
*/
- virtual void OnNickSuspend(NickAlias *na) anope_abstract;
+ virtual void OnNickSuspend(NickServ::Nick *na) anope_abstract;
};
struct CoreExport NickUnsuspended : Events
@@ -46,7 +46,7 @@ namespace Event
/** Called when a nick is unsuspneded
* @param na The nick alias
*/
- virtual void OnNickUnsuspended(NickAlias *na) anope_abstract;
+ virtual void OnNickUnsuspended(NickServ::Nick *na) anope_abstract;
};
}
diff --git a/include/modules/xmlrpc.h b/include/modules/xmlrpc.h
index d5a5ea4a7..55962db24 100644
--- a/include/modules/xmlrpc.h
+++ b/include/modules/xmlrpc.h
@@ -9,7 +9,7 @@ class XMLRPCRequest
Anope::string id;
std::deque<Anope::string> data;
HTTPReply& r;
-
+
XMLRPCRequest(HTTPReply &_r) : r(_r) { }
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.insert(std::make_pair(dname, ddata)); }
inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
diff --git a/include/opertype.h b/include/opertype.h
index 9cbd3347a..fded241c7 100644
--- a/include/opertype.h
+++ b/include/opertype.h
@@ -9,10 +9,9 @@
#pragma once
#include "services.h"
-#include "account.h"
/* A services operator. Usually made by the configuration file, but not always.
- * NickAlias::Find(name)->nc->o == this
+ * NickServ::FindNick(name)->nc->o == this
*/
struct CoreExport Oper
{
@@ -32,7 +31,7 @@ struct CoreExport Oper
virtual ~Oper();
static std::vector<Oper *> opers;
-
+
/** Find an oper block by name
* @param name The name
* @return the oper block
diff --git a/include/protocol.h b/include/protocol.h
index 06f9d35c9..dc57d2e10 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -186,7 +186,7 @@ class CoreExport IRCDProto : public Service
* initial handshake requirements.
*/
virtual void SendConnect() = 0;
-
+
/** Called right before we begin our burst, after we have handshaked successfully with the uplink/
* At this point none of our servesr, users, or channels exist on the uplink
*/
@@ -205,7 +205,7 @@ class CoreExport IRCDProto : public Service
virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...);
- virtual void SendLogin(User *u, NickAlias *na) = 0;
+ virtual void SendLogin(User *u, NickServ::Nick *na) = 0;
virtual void SendLogout(User *u) = 0;
/** Send a channel creation message to the uplink.
diff --git a/include/regchannel.h b/include/regchannel.h
deleted file mode 100644
index 402ed065b..000000000
--- a/include/regchannel.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *
- * (C) 2008-2014 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- *
- */
-
-#pragma once
-
-#include "memo.h"
-#include "modes.h"
-#include "extensible.h"
-#include "logger.h"
-#include "modules.h"
-#include "serialize.h"
-#include "bots.h"
-
-typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
-
-extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
-
-/* AutoKick data. */
-class CoreExport AutoKick : public Serializable
-{
- public:
- /* Channel this autokick is on */
- Serialize::Reference<ChannelInfo> ci;
-
- Anope::string mask;
- Serialize::Reference<NickCore> nc;
-
- Anope::string reason;
- Anope::string creator;
- time_t addtime;
- time_t last_used;
-
- AutoKick();
- ~AutoKick();
- void Serialize(Serialize::Data &data) const override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
-};
-
-/* It matters that Base is here before Extensible (it is inherited by Serializable)
- */
-class CoreExport ChannelInfo : public Serializable, public Extensible
-{
- /* channels who reference this one */
- Anope::map<int> references;
- private:
- Serialize::Reference<NickCore> founder; /* Channel founder */
- Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
- Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
- Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
- Anope::map<int16_t> levels;
-
- public:
- friend class ChanAccess;
- friend class AutoKick;
-
- Anope::string name; /* Channel name */
- Anope::string desc;
-
- time_t time_registered;
- time_t last_used;
-
- Anope::string last_topic; /* The last topic that was set on this channel */
- Anope::string last_topic_setter; /* Setter */
- time_t last_topic_time; /* Time */
-
- Channel::ModeList last_modes; /* The last modes set on this channel */
-
- int16_t bantype;
-
- MemoInfo memos;
-
- Channel *c; /* Pointer to channel, if the channel exists */
-
- /* For BotServ */
- Serialize::Reference<BotInfo> bi; /* Bot used on this channel */
-
- time_t banexpire; /* Time bans expire in */
-
- /** Constructor
- * @param chname The channel name
- */
- ChannelInfo(const Anope::string &chname);
-
- /** Copy constructor
- * @param ci The ChannelInfo to copy settings from
- */
- ChannelInfo(const ChannelInfo &ci);
-
- ~ChannelInfo();
-
- void Serialize(Serialize::Data &data) const override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
-
- /** Change the founder of the channek
- * @params nc The new founder
- */
- void SetFounder(NickCore *nc);
-
- /** Get the founder of the channel
- * @return The founder
- */
- NickCore *GetFounder() const;
-
- void SetSuccessor(NickCore *nc);
- NickCore *GetSuccessor() const;
-
- /** Find which bot should send mode/topic/etc changes for this channel
- * @return The bot
- */
- BotInfo *WhoSends() const;
-
- /** Add an entry to the channel access list
- * @param access The entry
- */
- void AddAccess(ChanAccess *access);
-
- /** Get an entry from the channel access list by index
- *
- * @param index The index in the access list vector
- * @return A ChanAccess struct corresponding to the index given, or NULL if outside the bounds
- *
- * Retrieves an entry from the access list that matches the given index.
- */
- ChanAccess *GetAccess(unsigned index) const;
-
- /** Retrieve the access for a user or group in the form of a vector of access entries
- * (as multiple entries can affect a single user).
- */
- AccessGroup AccessFor(const User *u);
- AccessGroup AccessFor(const NickCore *nc);
-
- /** Get the size of the accss vector for this channel
- * @return The access vector size
- */
- unsigned GetAccessCount() const;
-
- /** Get the number of access entries for this channel,
- * including those that are on other channels.
- */
- unsigned GetDeepAccessCount() const;
-
- /** Erase an entry from the channel access list
- *
- * @param index The index in the access list vector
- *
- * @return The erased entry
- */
- ChanAccess *EraseAccess(unsigned index);
-
- /** Clear the entire channel access list
- *
- * Clears the entire access list by deleting every item and then clearing the vector.
- */
- void ClearAccess();
-
- /** Add an akick entry to the channel by NickCore
- * @param user The user who added the akick
- * @param akicknc The nickcore being akicked
- * @param reason The reason for the akick
- * @param t The time the akick was added, defaults to now
- * @param lu The time the akick was last used, defaults to never
- */
- AutoKick* AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
-
- /** Add an akick entry to the channel by reason
- * @param user The user who added the akick
- * @param mask The mask of the akick
- * @param reason The reason for the akick
- * @param t The time the akick was added, defaults to now
- * @param lu The time the akick was last used, defaults to never
- */
- AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
-
- /** Get an entry from the channel akick list
- * @param index The index in the akick vector
- * @return The akick structure, or NULL if not found
- */
- AutoKick* GetAkick(unsigned index) const;
-
- /** Get the size of the akick vector for this channel
- * @return The akick vector size
- */
- unsigned GetAkickCount() const;
-
- /** Erase an entry from the channel akick list
- * @param index The index of the akick
- */
- void EraseAkick(unsigned index);
-
- /** Clear the whole akick list
- */
- void ClearAkick();
-
- /** Get the level for a privilege
- * @param priv The privilege name
- * @return the level
- * @throws CoreException if priv is not a valid privilege
- */
- int16_t GetLevel(const Anope::string &priv) const;
-
- /** Set the level for a privilege
- * @param priv The privilege priv
- * @param level The new level
- */
- void SetLevel(const Anope::string &priv, int16_t level);
-
- /** Remove a privilege from the channel
- * @param priv The privilege
- */
- void RemoveLevel(const Anope::string &priv);
-
- /** Clear all privileges from the channel
- */
- void ClearLevels();
-
- /** Gets a ban mask for the given user based on the bantype
- * of the channel.
- * @param u The user
- * @return A ban mask that affects the user
- */
- Anope::string GetIdealBan(User *u) const;
-
- /** Finds a ChannelInfo
- * @param name channel name to lookup
- * @return the ChannelInfo associated with the channel
- */
- static ChannelInfo* Find(const Anope::string &name);
-
- void AddChannelReference(const Anope::string &what);
- void RemoveChannelReference(const Anope::string &what);
- void GetChannelReferences(std::deque<Anope::string> &chans);
-};
-
-/** Is the user the real founder?
- * @param user The user
- * @param ci The channel
- * @return true or false
- */
-extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci);
-
diff --git a/include/users.h b/include/users.h
index 5a0bb46a9..e89d7c8af 100644
--- a/include/users.h
+++ b/include/users.h
@@ -18,7 +18,6 @@
#include "extensible.h"
#include "serialize.h"
#include "commands.h"
-#include "account.h"
typedef Anope::hash_map<User *> user_map;
@@ -46,8 +45,8 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
bool on_access;
/* Map of user modes and the params this user has (if any) */
ModeList modes;
- /* NickCore account the user is currently loggged in as, if they are logged in */
- Serialize::Reference<NickCore> nc;
+ /* NickServ::Account account the user is currently loggged in as, if they are logged in */
+ Serialize::Reference<NickServ::Account> nc;
/* # of invalid password attempts */
unsigned short invalid_pw_count;
@@ -107,14 +106,14 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param suid The unique identifier of the user.
* @param nc The account the user is identified as, if any
*/
- User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
+ User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickServ::Account *nc);
/** Destroy a user.
*/
virtual ~User();
public:
- static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
+ static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickServ::Account *nc);
/** Update the nickname of a user record accordingly, should be
* called from ircd protocol.
@@ -189,8 +188,8 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param fmt Format of the Message
* @param ... any number of parameters
*/
- void SendMessage(BotInfo *source, const char *fmt, ...);
- void SendMessage(BotInfo *source, const Anope::string &msg) override;
+ void SendMessage(const MessageSource &, const char *fmt, ...);
+ void SendMessage(const MessageSource &, const Anope::string &msg) override;
/** Identify the user to a nick.
* updates last_seen, logs the user in,
@@ -198,12 +197,12 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param na the nick to identify to, should be the same as
* the user's current nick
*/
- void Identify(NickAlias *na);
+ void Identify(NickServ::Nick *na);
/** Login the user to an account
* @param core The account
*/
- void Login(NickCore *core);
+ void Login(NickServ::Account *core);
/** Logout the user
*/
@@ -212,7 +211,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
/** Get the account the user is logged in using
* @return The account or NULL
*/
- NickCore *Account() const;
+ NickServ::Account *Account() const;
/** Check if the user is identified for their nick
* @param check_nick True to check if the user is identified to the nickname they are on too
diff --git a/include/version.cpp b/include/version.cpp
index b0ea0423d..5432188fe 100644
--- a/include/version.cpp
+++ b/include/version.cpp
@@ -28,7 +28,7 @@ static std::string get_git_hash(const std::string &git_dir)
fd.close();
return "";
}
-
+
fd.close();
filebuf = filebuf.substr(5);