summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-01-21 22:31:16 -0500
committerAdam <Adam@anope.org>2013-01-21 22:31:16 -0500
commitddaa001dafb5122e6e363e4acbbe6ce045b7b104 (patch)
tree0364a76606ac6e2881ebd663601ce260f7c1101e /include
parent51c049e1a738e9124bab3961f35b830906517421 (diff)
Merge usefulness of Flags and Extensible classes into Extensible, made most flags we have juse strings instead of defines/enums
Diffstat (limited to 'include')
-rw-r--r--include/account.h102
-rw-r--r--include/anope.h110
-rw-r--r--include/bots.h20
-rw-r--r--include/channels.h19
-rw-r--r--include/commands.h24
-rw-r--r--include/config.h6
-rw-r--r--include/extensible.h85
-rw-r--r--include/memo.h14
-rw-r--r--include/modes.h113
-rw-r--r--include/modules.h8
-rw-r--r--include/protocol.h20
-rw-r--r--include/regchannel.h142
-rw-r--r--include/serialize.h1
-rw-r--r--include/servers.h32
-rw-r--r--include/sockets.h9
-rw-r--r--include/users.h14
16 files changed, 206 insertions, 513 deletions
diff --git a/include/account.h b/include/account.h
index a44bd22d4..c3d5800b4 100644
--- a/include/account.h
+++ b/include/account.h
@@ -25,79 +25,19 @@ typedef Anope::hash_map<NickCore *> nickcore_map;
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
-/** Flags set on NickAliases
- */
-enum NickNameFlag
-{
- NS_BEGIN,
-
- /* Nick never expires */
- NS_NO_EXPIRE,
- /* This nick is being held after a kill by an enforcer client
- * or is being SVSHeld. Used by ns_release to determin if something
- * should be allowed to be released
- */
- NS_HELD,
- /* We are taking over this nick, either by SVSNICK or KILL.
- * We are waiting for the confirmation of either of these actions to
- * proceed. This is checked in NickAlias::OnCancel
- */
- NS_COLLIDED,
-
- NS_END
-};
-
-/** Flags set on NickCores
- */
-enum NickCoreFlag
-{
- NI_BEGIN,
-
- /* Kill others who take this nick */
- NI_KILLPROTECT,
- /* Dont recognize unless IDENTIFIED */
- NI_SECURE,
- /* Use PRIVMSG instead of NOTICE */
- NI_MSG,
- /* Don't allow user to change memo limit */
- NI_MEMO_HARDMAX,
- /* Notify of memos at signon and un-away */
- NI_MEMO_SIGNON,
- /* Notify of new memos when sent */
- NI_MEMO_RECEIVE,
- /* Don't show in LIST to non-servadmins */
- NI_PRIVATE,
- /* Don't show email in INFO */
- NI_HIDE_EMAIL,
- /* Don't show last seen address in INFO */
- NI_HIDE_MASK,
- /* Don't show last quit message in INFO */
- NI_HIDE_QUIT,
- /* Kill in 20 seconds instead of in 60 */
- NI_KILL_QUICK,
- /* Kill immediatly */
- NI_KILL_IMMED,
- /* User gets email on memo */
- NI_MEMO_MAIL,
- /* Don't show services access status */
- NI_HIDE_STATUS,
- /* Nickname is suspended */
- NI_SUSPENDED,
- /* Autoop nickname in channels */
- NI_AUTOOP,
- /* If set means the nick core does not have their email addrses confirmed.
- */
- NI_UNCONFIRMED,
- /* Chanstats are enabled for this user */
- NI_STATS,
-
- NI_END
-};
-
/* A registered nickname.
* It matters that Base is here before Extensible (it is inherited by Serializable)
+ *
+ * Possible flags:
+ * NO_EXPIRE - Nick never expires
+ * HELD - This nick is being held after a kill by an enforcer client
+ * or is being SVSHeld.
+ * COLLIDED - We are taking over this nick, either by SVSNICK or KILL
+ * and are waiting for the confirmation of either of these actions to
+ * proceed. This is checked in NickAlias::OnCancel
+ *
*/
-class CoreExport NickAlias : public Serializable, public Extensible, public Flags<NickNameFlag>
+class CoreExport NickAlias : public Serializable, public Extensible
{
Anope::string vhost_ident, vhost_host, vhost_creator;
time_t vhost_created;
@@ -184,8 +124,28 @@ class CoreExport NickAlias : public Serializable, public Extensible, public Flag
/* 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)
+ *
+ * Possible flags:
+ * KILLPROTECT - Kill other users who try to take this nick
+ * SECURE - Don't recognize unless identified
+ * MSG - Use PRIVMSG instead of notice
+ * MEMO_HARDMAX - Don't allow user to change memo limit
+ * MEMO_SIGNON - Notify of memos at signon and unaway
+ * MEMO_RECEIEVE - Notify of new memos when sent
+ * PRIVATE - Don't show in LIST to non-servadmins
+ * HIDE_EMAIL - Don't show email in INFO
+ * HIDE_MASK - Don't show last seen address in INFO
+ * HIDE_QUIT - Don't show last quit message in INFO
+ * KILL_QUICK - Kill quicker
+ * KILL_IMMED - Kill immediately
+ * MEMO_MAIL - User gets email on memo
+ * HIDE_STATUS - Don't show services access status
+ * SUSPEND - Nickname is suspended
+ * AUTOOP - Autoop nickname in channels
+ * UNCONFIRMED - Account has not had email address confirmed
+ * STATS - ChanStats is enabled for this user
*/
-class CoreExport NickCore : public Serializable, public Extensible, public Flags<NickCoreFlag>
+class CoreExport NickCore : public Serializable, public Extensible
{
public:
/* Name of the account. Find(display)->nc == this. */
diff --git a/include/anope.h b/include/anope.h
index 74f410e5d..1b978a8ba 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -762,114 +762,4 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
#endif
}
-/*************************************************************************/
-
-/** Class with the ability to keep flags on items, they should extend from this
- * where T is an enum.
- */
-template<typename T> class Flags
-{
- std::vector<bool> flags_values;
- static const Anope::string *flags_strings;
-
- public:
- /** Add a flag to this item
- * @param value The flag
- */
- void SetFlag(T value)
- {
- if (value < 0)
- return;
-
- if (static_cast<unsigned>(value) >= flags_values.size())
- flags_values.resize(value + 1);
- flags_values[value] = true;
- }
-
- /** Remove a flag from this item
- * @param value The flag
- */
- void UnsetFlag(T value)
- {
- if (value >= 0 && static_cast<unsigned>(value) < flags_values.size())
- flags_values[value] = false;
- }
-
- /** Check if this item has a flag
- * @param value The flag
- * @return true or false
- */
- bool HasFlag(T value) const
- {
- if (value >= 0 && static_cast<unsigned>(value) < flags_values.size())
- return flags_values[value];
- return false;
- }
-
- /** Check how many flags are set
- * @return The number of flags set
- */
- size_t FlagCount() const
- {
- size_t c = 0;
- for (unsigned i = 0; i < flags_values.size(); ++i)
- if (flags_values[i])
- ++c;
- return c;
- }
-
- /** Unset all of the flags
- */
- void ClearFlags()
- {
- flags_values.clear();
- }
-
- static const Anope::string* GetFlagStrings()
- {
- return flags_strings;
- }
-
- Anope::string ToString() const
- {
- std::vector<Anope::string> v = ToVector();
- Anope::string flag_buf;
- for (unsigned i = 0; i < v.size(); ++i)
- flag_buf += v[i] + " ";
- flag_buf.trim();
- return flag_buf;
- }
-
- void FromString(const Anope::string &str)
- {
- spacesepstream sep(str);
- Anope::string buf;
- std::vector<Anope::string> v;
-
- while (sep.GetToken(buf))
- v.push_back(buf);
-
- FromVector(v);
- }
-
- std::vector<Anope::string> ToVector() const
- {
- std::vector<Anope::string> ret;
- for (unsigned i = 0; this->flags_strings && !this->flags_strings[i].empty(); ++i)
- if (this->HasFlag(static_cast<T>(i)))
- ret.push_back(this->flags_strings[i]);
- return ret;
- }
-
- void FromVector(const std::vector<Anope::string> &strings)
- {
- this->ClearFlags();
-
- for (unsigned i = 0; this->flags_strings && !this->flags_strings[i].empty(); ++i)
- for (unsigned j = 0; j < strings.size(); ++j)
- if (this->flags_strings[i] == strings[j])
- this->SetFlag(static_cast<T>(i));
- }
-};
-
#endif // ANOPE_H
diff --git a/include/bots.h b/include/bots.h
index afffc7689..3b42424bd 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -20,22 +20,8 @@ typedef Anope::map<BotInfo *> botinfo_map;
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
-/** Flags settable on a bot
- */
-enum BotFlag
-{
- BI_BEGIN,
-
- /* This bot can only be assigned by IRCops */
- BI_PRIVATE,
- /* This bot is defined in the config */
- BI_CONF,
-
- BI_END
-};
-
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
-class CoreExport BotInfo : public User, public Flags<BotFlag>, public Serializable
+class CoreExport BotInfo : public User, public Serializable
{
public:
time_t created;
@@ -49,6 +35,10 @@ class CoreExport BotInfo : public User, public Flags<BotFlag>, public Serializab
std::vector<Anope::string> botchannels;
/* Whether or not this bot is introduced to the network */
bool introduced;
+ /* Bot can only be assigned by irc ops */
+ bool oper_only;
+ /* Bot is defined in the configuration file */
+ bool conf;
/** Create a new bot.
* @param nick The nickname to assign to the bot.
diff --git a/include/channels.h b/include/channels.h
index 298b39505..b66dc1c3d 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -40,10 +40,10 @@ enum ChannelFlag
CH_SYNCING
};
-class CoreExport Channel : public Base, public Extensible, public Flags<ChannelFlag>
+class CoreExport Channel : public Base, public Extensible
{
public:
- typedef std::multimap<ChannelModeName, Anope::string> ModeList;
+ typedef std::multimap<Anope::string, Anope::string> ModeList;
private:
/** A map of channel modes with their parameters set on this channel
*/
@@ -56,6 +56,7 @@ class CoreExport Channel : public Base, public Extensible, public Flags<ChannelF
Serialize::Reference<ChannelInfo> ci;
/* When the channel was created */
time_t creation_time;
+ std::set<ChannelFlag> flags;
/* Users in the channel */
typedef std::list<ChanUserContainer *> ChanUserList;
@@ -132,20 +133,20 @@ class CoreExport Channel : public Base, public Extensible, public Flags<ChannelF
* @param name The mode name, eg CMODE_OP, CMODE_VOICE
* @return true or false
*/
- bool HasUserStatus(const User *u, ChannelModeName name) const;
+ bool HasUserStatus(const User *u, const Anope::string &name) const;
/** See if a channel has a mode
* @param name The mode name
* @return The number of modes set
* @param param The optional mode param
*/
- size_t HasMode(ChannelModeName name, const Anope::string &param = "");
+ size_t HasMode(const Anope::string &name, const Anope::string &param = "");
/** Get a list of modes on a channel
* @param name A mode name to get the list of
* @return a pair of iterators for the beginning and end of the list
*/
- std::pair<ModeList::iterator, ModeList::iterator> GetModeList(ChannelModeName name);
+ std::pair<ModeList::iterator, ModeList::iterator> GetModeList(const Anope::string &name);
/** Set a mode internally on a channel, this is not sent out to the IRCd
* @param setter The setter
@@ -178,7 +179,7 @@ class CoreExport Channel : public Base, public Extensible, public Flags<ChannelF
* @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, ChannelModeName name, const Anope::string &param = "", bool enforce_mlock = true);
+ void SetMode(BotInfo *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
@@ -195,14 +196,14 @@ class CoreExport Channel : public Base, public Extensible, public Flags<ChannelF
* @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, ChannelModeName name, const Anope::string &param = "", bool enforce_mlock = true);
+ void RemoveMode(BotInfo *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
/** Get a modes parameter for the channel
* @param name The mode
* @param target a string to put the param into
* @return true if the parameter was fetched, false if on error (mode not set) etc.
*/
- bool GetParam(ChannelModeName name, Anope::string &target) const;
+ bool GetParam(const Anope::string &name, Anope::string &target) const;
/** Set a string of modes on the channel
* @param bi The client setting the modes
@@ -223,7 +224,7 @@ class CoreExport Channel : public Base, public Extensible, public Flags<ChannelF
* @param list The mode of the list to check (eg CMODE_BAN)
* @return true if the user matches the list
*/
- bool MatchesList(User *u, ChannelModeName list);
+ bool MatchesList(User *u, const Anope::string &list);
/** Kick a user from a channel internally
* @param source The sender of the kick
diff --git a/include/commands.h b/include/commands.h
index 9f7782102..207d2c444 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -16,15 +16,6 @@
#include "anope.h"
#include "channels.h"
-enum CommandFlag
-{
- /* Command allow unidentified users to use it */
- CFLAG_ALLOW_UNREGISTERED,
-
- /* Command requires a user to execute */
- CFLAG_REQUIRE_USER
-};
-
struct CommandGroup
{
Anope::string name, description;
@@ -98,10 +89,14 @@ class CoreExport CommandSource
/** Every services command is a class, inheriting from Command.
*/
-class CoreExport Command : public Service, public Flags<CommandFlag>
+class CoreExport Command : public Service
{
Anope::string desc;
std::vector<Anope::string> syntax;
+ /* Allow unregistered users to use this command */
+ bool allow_unregistered;
+ /* Command requires that a user is executing it */
+ bool require_user;
public:
/* Maximum paramaters accepted by this command */
@@ -112,6 +107,7 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
/* Module which owns us */
Module *module;
+ protected:
/** Create a new command.
* @param owner The owner of the command
* @param sname The command name
@@ -121,6 +117,7 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
*/
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
+ public:
virtual ~Command();
protected:
@@ -130,7 +127,14 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
void SetSyntax(const Anope::string &s);
void SendSyntax(CommandSource &);
void SendSyntax(CommandSource &, const Anope::string &syntax);
+
+ void AllowUnregistered(bool b);
+ void RequireUser(bool b);
+
public:
+ bool AllowUnregistered() const;
+ bool RequireUser() const;
+
/** Get the command description
* @return The commands description
*/
diff --git a/include/config.h b/include/config.h
index c69bc7b76..703f00b95 100644
--- a/include/config.h
+++ b/include/config.h
@@ -485,7 +485,7 @@ class CoreExport ServerConfig
/* Don't allow nicks to use /ns group to regroup nicks */
bool NSNoGroupChange;
/* Default flags for newly registered nicks */
- Flags<NickCoreFlag> NSDefFlags;
+ std::set<Anope::string> NSDefFlags;
/* All languages Anope is aware about */
Anope::string Languages;
/* Default language used by services */
@@ -546,7 +546,7 @@ class CoreExport ServerConfig
/* Core ChanServ modules */
Anope::string ChanCoreModules;
/* Default flags for newly registered channels */
- Flags<ChannelInfoFlag> CSDefFlags;
+ std::set<Anope::string> CSDefFlags;
/* Max number of channels a user can own */
unsigned CSMaxReg;
/* Time before a channel expires */
@@ -589,7 +589,7 @@ class CoreExport ServerConfig
/* Core BotServ modules */
Anope::string BotCoreModules;
/* Default BotServ flags */
- Flags<BotServFlag> BSDefFlags;
+ std::set<Anope::string> BSDefFlags;
/* How long before botserv forgets a user. This is used for flood kickers etc */
time_t BSKeepData;
/* Min number of users to have in the channel before the service bot joins */
diff --git a/include/extensible.h b/include/extensible.h
index 75ab6f5ca..d47690da6 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -11,6 +11,7 @@
#define EXTENSIBLE_H
#include "anope.h"
+#include "serialize.h"
/* All items added to Extensible must inherit from this.
*/
@@ -19,20 +20,29 @@ class CoreExport ExtensibleItem
public:
virtual ~ExtensibleItem() { }
- /* Called when this ExtensibleItem is being deleted. This should
- * clean up things (eg, delete this;) if necessary.
- */
- virtual void OnDelete() { delete this; }
+ virtual const Anope::string *Serialize() { return NULL; }
};
-/** Common class used to Extensible::Extend non-pointers from, as it doesn't delete
- * itself when removed. Eg, obj->Extend(key, new ExtensibleItemClass<Anope::string>(value));
+/** Common class used to Extensible::Extend as it inherits from both ExtensibleItem
+ * and whatever basic object you're trying to store.
+ * Eg, obj->Extend(key, new ExtensibleItemClass<Anope::string>(value));
*/
template<typename T> struct CoreExport ExtensibleItemClass : T, ExtensibleItem
{
ExtensibleItemClass(const T& t) : T(t) { }
};
+/* Used to attach metadata to this object that is automatically saved
+ * when the object is saved (assuming the object's Serialize method
+ * correcly calls Extensible::ExtensibleSerialize).
+ */
+struct CoreExport ExtensibleMetadata : ExtensibleItemClass<Anope::string>
+{
+ ExtensibleMetadata(const Anope::string &t) : ExtensibleItemClass<Anope::string>(t) { }
+
+ const Anope::string *Serialize() anope_override { return this; }
+};
+
/* Used to attach arbitrary objects to this object using unique keys */
class CoreExport Extensible
{
@@ -43,21 +53,12 @@ class CoreExport Extensible
public:
/** Default constructor
*/
- Extensible() : extension_items(NULL) { }
+ Extensible();
/** Destructor, deletes all of the extensible items in this object
* then clears the map
*/
- virtual ~Extensible()
- {
- if (extension_items)
- {
- for (extensible_map::iterator it = extension_items->begin(), it_end = extension_items->end(); it != it_end; ++it)
- if (it->second)
- it->second->OnDelete();
- delete extension_items;
- }
- }
+ virtual ~Extensible();
/** Extend an Extensible class.
*
@@ -65,18 +66,11 @@ class CoreExport Extensible
* @param p This parameter is a pointer to an ExtensibleItem or ExtensibleItemBase derived class
*
* You must provide a key to store the data as via the parameter 'key'.
- * The data will be inserted into the map. If the data already exists, you may not insert it
- * twice, Extensible::Extend will return false in this case.
- *
- * @return Returns true on success, false if otherwise
+ * The data will be inserted into the map. If the data already exists, it will be overwritten.
*/
- void Extend(const Anope::string &key, ExtensibleItem *p)
- {
- this->Shrink(key);
- if (!extension_items)
- extension_items = new extensible_map();
- (*this->extension_items)[key] = p;
- }
+ void Extend(const Anope::string &key, ExtensibleItem *p = NULL);
+
+ void ExtendMetadata(const Anope::string &key, const Anope::string &value = "");
/** Shrink an Extensible class.
*
@@ -86,25 +80,7 @@ class CoreExport Extensible
* you provide a nonexistent key (case is important) then the function will return false.
* @return Returns true on success.
*/
- bool Shrink(const Anope::string &key)
- {
- if (!extension_items)
- return false;
-
- extensible_map::iterator it = this->extension_items->find(key);
- if (it != this->extension_items->end())
- {
- if (it->second != NULL)
- it->second->OnDelete();
- /* map::size_type map::erase( const key_type& key );
- * returns the number of elements removed, std::map
- * is single-associative so this should only be 0 or 1
- */
- return this->extension_items->erase(key) > 0;
- }
-
- return false;
- }
+ bool Shrink(const Anope::string &key);
/** Get an extension item.
*
@@ -128,22 +104,17 @@ class CoreExport Extensible
* @param key The key parameter is an arbitary string which identifies the extension data
* @return True if the item was found.
*/
- bool HasExt(const Anope::string &key) const
- {
- return this->extension_items != NULL && this->extension_items->count(key) > 0;
- }
+ bool HasExt(const Anope::string &key) const;
/** Get a list of all extension items names.
* @param list A deque of strings to receive the list
* @return This function writes a list of all extension items stored
* in this object by name into the given deque and returns void.
*/
- void GetExtList(std::deque<Anope::string> &list) const
- {
- if (extension_items)
- for (extensible_map::const_iterator it = extension_items->begin(), it_end = extension_items->end(); it != it_end; ++it)
- list.push_back(it->first);
- }
+ void GetExtList(std::deque<Anope::string> &list) const;
+
+ void ExtensibleSerialize(Serialize::Data &data) const;
+ void ExtensibleUnserialize(Serialize::Data &data);
};
#endif // EXTENSIBLE_H
diff --git a/include/memo.h b/include/memo.h
index 6ea79d3c3..c8bf11f74 100644
--- a/include/memo.h
+++ b/include/memo.h
@@ -16,19 +16,11 @@
#include "anope.h"
#include "serialize.h"
-/** Memo Flags
- */
-enum MemoFlag
-{
- /* Memo is unread */
- MF_UNREAD,
- /* Sender requests a receipt */
- MF_RECEIPT
-};
-
-class CoreExport Memo : public Flags<MemoFlag>, public Serializable
+class CoreExport Memo : public Serializable
{
public:
+ bool unread;
+ bool receipt;
Memo();
void Serialize(Serialize::Data &data) const anope_override;
diff --git a/include/modes.h b/include/modes.h
index 09d1c13e4..3aaf6d1ff 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -12,46 +12,6 @@
#include "anope.h"
#include "base.h"
-/** All of the valid user mode names
- */
-enum UserModeName
-{
- UMODE_BEGIN,
-
- UMODE_SERV_ADMIN, UMODE_BOT, UMODE_CO_ADMIN, UMODE_FILTER, UMODE_HIDEOPER, UMODE_NETADMIN,
- UMODE_REGPRIV, UMODE_PROTECTED, UMODE_NOCTCP, UMODE_WEBTV, UMODE_WEBIRC, UMODE_WHOIS, UMODE_ADMIN, UMODE_DEAF,
- UMODE_GLOBOPS, UMODE_HELPOP, UMODE_INVIS, UMODE_OPER, UMODE_PRIV, UMODE_GOD, UMODE_REGISTERED,
- UMODE_SNOMASK, UMODE_VHOST, UMODE_WALLOPS, UMODE_CLOAK, UMODE_SSL, UMODE_SOFTCALLERID, UMODE_CALLERID,
- UMODE_COMMONCHANS, UMODE_HIDDEN, UMODE_STRIPCOLOR, UMODE_INVISIBLE_OPER, UMODE_RESTRICTED, UMODE_HIDEIDLE,
-
- UMODE_END
-};
-
-/** All of the valid channel mode names
- */
-enum ChannelModeName
-{
- CMODE_BEGIN,
-
- /* Channel modes */
- CMODE_BLOCKCOLOR, CMODE_FLOOD, CMODE_INVITE, CMODE_KEY, CMODE_LIMIT, CMODE_MODERATED, CMODE_NOEXTERNAL,
- CMODE_PRIVATE, CMODE_REGISTERED, CMODE_SECRET, CMODE_TOPIC, CMODE_AUDITORIUM, CMODE_SSL, CMODE_ADMINONLY,
- CMODE_NOCTCP, CMODE_FILTER, CMODE_NOKNOCK, CMODE_REDIRECT, CMODE_REGMODERATED, CMODE_NONICK, CMODE_OPERONLY,
- CMODE_NOKICK, CMODE_REGISTEREDONLY, CMODE_STRIPCOLOR, CMODE_NONOTICE, CMODE_NOINVITE, CMODE_ALLINVITE,
- CMODE_BLOCKCAPS, CMODE_PERM, CMODE_NICKFLOOD, CMODE_JOINFLOOD, CMODE_DELAYEDJOIN, CMODE_NOREJOIN,
- CMODE_BANDWIDTH,
-
- /* b/e/I */
- CMODE_BAN, CMODE_EXCEPT,
- CMODE_INVITEOVERRIDE,
-
- /* v/h/o/a/q */
- CMODE_VOICE, CMODE_HALFOP, CMODE_OP,
- CMODE_PROTECT, CMODE_OWNER,
-
- CMODE_END
-};
-
/** The different types of modes
*/
enum ModeType
@@ -79,6 +39,8 @@ enum ModeClass
class CoreExport Mode : public Base
{
public:
+ /* Mode name */
+ Anope::string name;
/* Class of mode this is (user/channel) */
ModeClass mclass;
/* Mode char for this, eg 'b' */
@@ -87,11 +49,12 @@ class CoreExport Mode : public Base
ModeType type;
/** constructor
+ * @param mname The mode name
* @param mclass The type of mode this is
* @param mc The mode char
* @param type The mode type
*/
- Mode(ModeClass mclass, char mc, ModeType type);
+ Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type);
virtual ~Mode();
};
@@ -100,19 +63,12 @@ class CoreExport Mode : public Base
class CoreExport UserMode : public Mode
{
public:
- /* Mode name */
- UserModeName name;
-
/** constructor
* @param name The mode name
* @param mc The mode char
*/
- UserMode(UserModeName name, char mc);
+ UserMode(const Anope::string &name, char mc);
virtual ~UserMode();
-
- /** Returns the mode name as a string
- */
- const Anope::string NameAsString();
};
class CoreExport UserModeParam : public UserMode
@@ -122,7 +78,7 @@ class CoreExport UserModeParam : public UserMode
* @param name The mode name
* @param mc The mode char
*/
- UserModeParam(UserModeName name, char mc);
+ UserModeParam(const Anope::string &name, char mc);
/** Check if the param is valid
* @param value The param
@@ -136,14 +92,11 @@ class CoreExport UserModeParam : public UserMode
class CoreExport ChannelMode : public Mode
{
public:
- /* Mode name */
- ChannelModeName name;
-
/** constructor
* @param name The mode name
* @param mc The mode char
*/
- ChannelMode(ChannelModeName name, char mc);
+ ChannelMode(const Anope::string &name, char mc);
virtual ~ChannelMode();
/** Can a user set this mode, used for mlock
@@ -151,10 +104,6 @@ class CoreExport ChannelMode : public Mode
* @param u The user, or NULL
*/
virtual bool CanSet(User *u) const;
-
- /** Returns the mode name as a string
- */
- const Anope::string NameAsString();
};
@@ -167,7 +116,7 @@ class CoreExport ChannelModeList : public ChannelMode
* @param name The mode name
* @param mc The mode char
*/
- ChannelModeList(ChannelModeName name, char mc);
+ ChannelModeList(const Anope::string &name, char mc);
/** destructor
*/
@@ -210,7 +159,7 @@ class CoreExport ChannelModeParam : public ChannelMode
* @param mc The mode char
* @param minus_no_arg true if this mode sends no arg when unsetting
*/
- ChannelModeParam(ChannelModeName name, char mc, bool minus_no_arg = false);
+ ChannelModeParam(const Anope::string &name, char mc, bool minus_no_arg = false);
/** destructor
*/
@@ -244,7 +193,7 @@ class CoreExport ChannelModeStatus : public ChannelMode
* @param mSymbol The symbol for the mode, eg @ %
* @param mLevel A level for the mode, which is usually determined by the PREFIX capab
*/
- ChannelModeStatus(ChannelModeName name, char mc, char mSymbol, unsigned short mLevel = 0);
+ ChannelModeStatus(const Anope::string &name, char mc, char mSymbol, unsigned short mLevel = 0);
/** destructor
*/
@@ -252,9 +201,10 @@ class CoreExport ChannelModeStatus : public ChannelMode
};
/* The status a user has on a channel (+v, +h, +o) etc */
-class CoreExport ChannelStatus : public Flags<ChannelModeName>
+class CoreExport ChannelStatus
{
public:
+ std::set<Anope::string> modes;
Anope::string BuildCharPrefixList() const;
Anope::string BuildModePrefixList() const;
};
@@ -264,7 +214,7 @@ class CoreExport ChannelStatus : public Flags<ChannelModeName>
class CoreExport ChannelModeKey : public ChannelModeParam
{
public:
- ChannelModeKey(char mc) : ChannelModeParam(CMODE_KEY, mc) { }
+ ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
bool IsValid(const Anope::string &value) const anope_override;
};
@@ -275,7 +225,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam
class CoreExport ChannelModeAdmin : public ChannelMode
{
public:
- ChannelModeAdmin(char mc) : ChannelMode(CMODE_ADMINONLY, mc) { }
+ ChannelModeAdmin(char mc) : ChannelMode("ADMINONLY", mc) { }
/* Opers only */
bool CanSet(User *u) const anope_override;
@@ -287,7 +237,7 @@ class CoreExport ChannelModeAdmin : public ChannelMode
class CoreExport ChannelModeOper : public ChannelMode
{
public:
- ChannelModeOper(char mc) : ChannelMode(CMODE_OPERONLY, mc) { }
+ ChannelModeOper(char mc) : ChannelMode("OPERONLY", mc) { }
/* Opers only */
bool CanSet(User *u) const anope_override;
@@ -299,7 +249,7 @@ class CoreExport ChannelModeOper : public ChannelMode
class CoreExport ChannelModeRegistered : public ChannelMode
{
public:
- ChannelModeRegistered(char mc) : ChannelMode(CMODE_REGISTERED, mc) { }
+ ChannelModeRegistered(char mc) : ChannelMode("REGISTERED", mc) { }
/* No one mlocks +r */
bool CanSet(User *u) const anope_override;
@@ -350,8 +300,8 @@ class CoreExport ModeManager
/* Number of generic channel and user modes we are tracking */
static unsigned GenericChannelModes, GenericUserModes;
/* Default channel mode lock */
- static std::list<std::pair<ChannelModeName, Anope::string> > ModeLockOn;
- static std::list<ChannelModeName> ModeLockOff;
+ static std::list<std::pair<Anope::string, Anope::string> > ModeLockOn;
+ static std::list<Anope::string> ModeLockOff;
/* Default modes bots have on channels */
static ChannelStatus DefaultBotModes;
@@ -393,25 +343,13 @@ class CoreExport ModeManager
* @param name The modename
* @return The mode class
*/
- static ChannelMode *FindChannelModeByName(ChannelModeName name);
+ static ChannelMode *FindChannelModeByName(const Anope::string &name);
/** Find a user mode
* @param name The modename
* @return The mode class
*/
- static UserMode *FindUserModeByName(UserModeName name);
-
- /** Find channel mode by string
- * @param name The mode name
- * @return The mode
- */
- static ChannelMode *FindChannelModeByString(const Anope::string &name);
-
- /** Find user mode by string
- * @param name The mode name
- * @return The mode
- */
- static UserMode *FindUserModeByString(const Anope::string &name);
+ static UserMode *FindUserModeByName(const Anope::string &name);
/** Gets the channel mode char for a symbol (eg + returns v)
* @param symbol The symbol
@@ -458,7 +396,6 @@ class CoreExport ModeManager
*/
enum EntryType
{
- ENTRYTYPE_NONE,
ENTRYTYPE_CIDR,
ENTRYTYPE_NICK_WILD,
ENTRYTYPE_NICK,
@@ -470,20 +407,20 @@ enum EntryType
/** Represents a mask set on a channel (b/e/I)
*/
-class CoreExport Entry : public Flags<EntryType>
+class CoreExport Entry
{
- ChannelModeName modename;
-
+ Anope::string name;
public:
+ std::set<EntryType> types;
unsigned char cidr_len;
Anope::string mask;
Anope::string nick, user, host;
/** Constructor
- * @param mode What mode this host is for - can be CMODE_BEGIN for unknown/no mode
+ * @param mode What mode this host is for, can be empty for unknown/no mode
* @param host A full nick!ident@host/cidr mask
*/
- Entry(ChannelModeName mode, const Anope::string &host);
+ Entry(const Anope::string &mode, const Anope::string &host);
/** Get the banned mask for this entry
* @return The mask
diff --git a/include/modules.h b/include/modules.h
index 3e3ceaf84..5bdce1355 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -833,7 +833,7 @@ class CoreExport Module : public Extensible
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
- virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelModeName mname, const Anope::string &param) { return EVENT_CONTINUE; }
+ virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) { return EVENT_CONTINUE; }
/** Called when a mode is unset on a channel
* @param c The channel
@@ -842,19 +842,19 @@ class CoreExport Module : public Extensible
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
- virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelModeName mname, const Anope::string &param) { return EVENT_CONTINUE; }
+ virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) { return EVENT_CONTINUE; }
/** Called when a mode is set on a user
* @param u The user
* @param mname The mode name
*/
- virtual void OnUserModeSet(User *u, UserModeName mname) { }
+ virtual void OnUserModeSet(User *u, const Anope::string &mname) { }
/** Called when a mode is unset from a user
* @param u The user
* @param mname The mode name
*/
- virtual void OnUserModeUnset(User *u, UserModeName mname) { }
+ virtual void OnUserModeUnset(User *u, const Anope::string &mname) { }
/** Called when a channel mode is introducted into Anope
* @param cm The mode
diff --git a/include/protocol.h b/include/protocol.h
index 4603e4eea..385448662 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -224,13 +224,6 @@ class CoreExport IRCDProto : public Service
virtual bool IsHostValid(const Anope::string &);
};
-enum IRCDMessageFlag
-{
- IRCDMESSAGE_SOFT_LIMIT,
- IRCDMESSAGE_REQUIRE_SERVER,
- IRCDMESSAGE_REQUIRE_USER
-};
-
class CoreExport MessageSource
{
Anope::string source;
@@ -247,14 +240,25 @@ class CoreExport MessageSource
Server *GetServer();
};
-class CoreExport IRCDMessage : public Flags<IRCDMessageFlag>, public Service
+enum IRCDMessageFlag
+{
+ IRCDMESSAGE_SOFT_LIMIT,
+ IRCDMESSAGE_REQUIRE_SERVER,
+ IRCDMESSAGE_REQUIRE_USER
+};
+
+class CoreExport IRCDMessage : public Service
{
Anope::string name;
unsigned param_count;
+ std::set<IRCDMessageFlag> flags;
public:
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
unsigned GetParamCount() const;
virtual void Run(MessageSource &, const std::vector<Anope::string> &params) = 0;
+
+ void SetFlag(IRCDMessageFlag f) { flags.insert(f); }
+ bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); }
};
extern CoreExport IRCDProto *IRCD;
diff --git a/include/regchannel.h b/include/regchannel.h
index 0803ebc8a..d98456e97 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -22,89 +22,6 @@ typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
-/** Flags used for the ChannelInfo class
- */
-enum ChannelInfoFlag
-{
- CI_BEGIN,
-
- /* Retain the topic even after the channel is emptied */
- CI_KEEPTOPIC,
- /* Don't allow non-authorized users to be opped */
- CI_SECUREOPS,
- /* Hide channel from ChanServ LIST command */
- CI_PRIVATE,
- /* Topic can only be changed by SET TOPIC */
- CI_TOPICLOCK,
- /* Only users on the access list may join */
- CI_RESTRICTED,
- /* Don't allow ChanServ and BotServ commands to do bad things to users with higher access levels */
- CI_PEACE,
- /* Don't allow any privileges unless a user is IDENTIFIED with NickServ */
- CI_SECURE,
- /* Channel does not expire */
- CI_NO_EXPIRE,
- /* Channel memo limit may not be changed */
- CI_MEMO_HARDMAX,
- /* Stricter control of channel founder status */
- CI_SECUREFOUNDER,
- /* Sign kicks with the user who did the kick */
- CI_SIGNKICK,
- /* Sign kicks if level is < than the one defined by the SIGNKIGK level */
- CI_SIGNKICK_LEVEL,
- /* Channel is suspended */
- CI_SUSPENDED,
- /* Channel still exists when emptied, this can be caused by setting a perm
- * channel mode (+P on InspIRCd) or /cs set #chan persist on.
- * This keeps the service bot in the channel regardless if a +P type mode
- * is set or not
- */
- CI_PERSIST,
- /* Chanstats are enabled */
- CI_STATS,
- /* If set users are not auto given any status on join */
- CI_NOAUTOOP,
-
- CI_END
-};
-
-/* BotServ SET flags (ChannelInfo::botflags) */
-enum BotServFlag
-{
- BS_BEGIN,
- /* BotServ won't kick ops */
- BS_DONTKICKOPS,
- /* BotServ won't kick voices */
- BS_DONTKICKVOICES,
- /* BotServ bot accepts fantasy commands */
- BS_FANTASY,
- /* BotServ should show greets */
- BS_GREET,
- /* BotServ bots are not allowed to be in this channel */
- BS_NOBOT,
- /* BotServ kicks for bolds */
- BS_KICK_BOLDS,
- /* BotServ kicks for colors */
- BS_KICK_COLORS,
- /* BOtServ kicks for reverses */
- BS_KICK_REVERSES,
- /* BotServ kicks for underlines */
- BS_KICK_UNDERLINES,
- /* BotServ kicks for badwords */
- BS_KICK_BADWORDS,
- /* BotServ kicks for caps */
- BS_KICK_CAPS,
- /* BotServ kicks for flood */
- BS_KICK_FLOOD,
- /* BotServ kicks for repeating */
- BS_KICK_REPEAT,
- /* BotServ kicks for italics */
- BS_KICK_ITALICS,
- /* BotServ kicks for amsgs */
- BS_KICK_AMSGS,
- BS_END
-};
-
/* Indices for TTB (Times To Ban) */
enum
{
@@ -148,22 +65,13 @@ struct CoreExport BadWord : Serializable
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
};
-/** Flags for auto kick
- */
-enum AutoKickFlag
-{
- /* Is by nick core, not mask */
- AK_ISNICK
-};
-
/* AutoKick data. */
-class CoreExport AutoKick : public Flags<AutoKickFlag>, public Serializable
+class CoreExport AutoKick : public Serializable
{
public:
/* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci;
- /* Only one of these can be in use. if HasFlag(AK_ISNICK) then nc is in use */
Anope::string mask;
Serialize::Reference<NickCore> nc;
@@ -183,12 +91,12 @@ struct CoreExport ModeLock : Serializable
public:
Serialize::Reference<ChannelInfo> ci;
bool set;
- ChannelModeName name;
+ Anope::string name;
Anope::string param;
Anope::string setter;
time_t created;
- ModeLock(ChannelInfo *ch, bool s, ChannelModeName n, const Anope::string &p, const Anope::string &se = "", time_t c = Anope::CurTime);
+ ModeLock(ChannelInfo *ch, bool s, const Anope::string &n, const Anope::string &p, const Anope::string &se = "", time_t c = Anope::CurTime);
~ModeLock();
void Serialize(Serialize::Data &data) const anope_override;
@@ -213,8 +121,41 @@ struct CoreExport LogSetting : Serializable
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, public Flags<ChannelInfoFlag>
+/* It matters that Base is here before Extensible (it is inherited by Serializable)
+ *
+ * Possible flags:
+ * TOPICLOCK - Topic can only be changed by TOPIC SET
+ * RESTRICTED - Only users on the access list may join
+ * PEACE - Don't allow ChanServ and BotServ commands to do bad things to users with higher access levels
+ * SECURE - Don't allow any privileges
+ * NO_EXPIRE - Channel does not expire
+ * MEMO_HARDMAX - Channel memo limit may not be changed
+ * SECUREFOUNDER - Stricter control of channel founder status
+ * SIGNKICK - Sign kicks with the user who did the kick
+ * SIGNKICK_LEVEL - Sign kicks if level is < than the one defined by the SIGNKICK level
+ * SUSPENDED - Channel is suepended
+ * PERSIST - Channel still exists when empited (perm channel mode or leaving a botserv bot).
+ * STATS - Chanstats are enabled
+ * NOAUTOOP - If set users are not auto given any status on join
+ *
+ * BotServ flags:
+ * BS_DONTKICKOPS - BotServ won't kick ops
+ * BS_DONTKICKVOICES - BotServ won't kick voices
+ * BS_FANTASY - BotServ bot accepts fantasy commands
+ * BS_GREET - BotServ should show greets
+ * BS_NOBOT - BotServ bots are not allowed to be in this channel
+ * BS_KICK_BOLDS - BotServ kicks for bolds
+ * BS_KICK_COLORS - BotServ kicks for colors
+ * BS_KICK_REVERSES - BotServ kicks for reverses
+ * BS_KICK_UNDERLINES - BotServ kicks for underlines
+ * BS_KICK_BADWORD - BotServ kicks for badwords
+ * BS_KICK_CAPS - BotServ kicks for caps
+ * BS_KICK_FLOOD - BotServ kicks for flood
+ * BS_KICK_REPEAT - BotServ kicks for repeating
+ * BS_KICK_ITALICS - BotServ kicks for italics
+ * BS_KICK_AMSGS - BotServ kicks for amsgs
+ */
+class CoreExport ChannelInfo : public Serializable, public Extensible
{
private:
Serialize::Reference<NickCore> founder; /* Channel founder */
@@ -224,7 +165,7 @@ class CoreExport ChannelInfo : public Serializable, public Extensible, public Fl
std::map<Anope::string, int16_t> levels;
public:
- typedef std::multimap<ChannelModeName, ModeLock *> ModeList;
+ typedef std::multimap<Anope::string, ModeLock *> ModeList;
Serialize::Checker<ModeList> mode_locks;
Serialize::Checker<std::vector<LogSetting *> > log_settings;
@@ -247,7 +188,6 @@ class CoreExport ChannelInfo : public Serializable, public Extensible, public Fl
/* For BotServ */
Serialize::Reference<BotInfo> bi; /* Bot used on this channel */
- Flags<BotServFlag> botflags;
int16_t ttb[TTB_SIZE]; /* Times to ban for each kicker */
int16_t capsmin, capspercent; /* For CAPS kicker */
@@ -441,14 +381,14 @@ class CoreExport ChannelInfo : public Serializable, public Extensible, public Fl
* @param Name The mode name to get a list of
* @return a pair of iterators for the beginning and end of the list
*/
- std::pair<ModeList::iterator, ModeList::iterator> GetModeList(ChannelModeName Name);
+ std::pair<ModeList::iterator, ModeList::iterator> GetModeList(const Anope::string &name);
/** Get details for a specific mlock
* @param mname The mode name
* @param An optional param to match with
* @return The MLock, if any
*/
- const ModeLock *GetMLock(ChannelModeName mname, const Anope::string &param = "");
+ const ModeLock *GetMLock(const Anope::string &mname, const Anope::string &param = "");
/** Get the current mode locks as a string
* @param complete True to show mlock parameters aswell
diff --git a/include/serialize.h b/include/serialize.h
index 973c5ba51..918944804 100644
--- a/include/serialize.h
+++ b/include/serialize.h
@@ -32,6 +32,7 @@ namespace Serialize
virtual ~Data() { }
virtual std::iostream& operator[](const Anope::string &key) = 0;
+ virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
virtual bool IsEqual(Data *other) { throw CoreException("Not supported"); }
diff --git a/include/servers.h b/include/servers.h
index 4de69d493..d8b01626f 100644
--- a/include/servers.h
+++ b/include/servers.h
@@ -37,20 +37,9 @@ namespace Servers
extern CoreExport std::set<Anope::string> Capab;
}
-/** Flags set on servers
- */
-enum ServerFlag
-{
- SERVER_NONE,
- /* Server is syncing */
- SERVER_SYNCING,
- /* This server was juped */
- SERVER_JUPED
-};
-
/** Class representing a server
*/
-class CoreExport Server : public Flags<ServerFlag>, public Extensible
+class CoreExport Server : public Extensible
{
private:
/* Server name */
@@ -65,6 +54,10 @@ class CoreExport Server : public Flags<ServerFlag>, public Extensible
std::vector<Server *> links;
/* Uplink for this server */
Server *uplink;
+ /* Server is syncing */
+ bool syncing;
+ /* The server is juped */
+ bool juped;
/* Reason this server was quit */
Anope::string quit_reason;
@@ -76,9 +69,9 @@ class CoreExport Server : public Flags<ServerFlag>, public Extensible
* @param hops Hops from services server
* @param description Server rdescription
* @param sid Server sid/numeric
- * @param flag An optional server flag
+ * @param jupe If the server is juped
*/
- Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", ServerFlag flag = SERVER_NONE);
+ Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", bool jupe = false);
private:
/** Destructor
@@ -145,7 +138,7 @@ class CoreExport Server : public Flags<ServerFlag>, public Extensible
void DelLink(Server *s);
/** Finish syncing this server and optionally all links to it
- * @param SyncLinks True to sync the links for this server too (if any)
+ * @param sync_links True to sync the links for this server too (if any)
*/
void Sync(bool sync_links);
@@ -154,11 +147,20 @@ class CoreExport Server : public Flags<ServerFlag>, public Extensible
*/
bool IsSynced() const;
+ /** Unsync the server. Only used for Me->Unsync()
+ */
+ void Unsync();
+
/** Check if this server is ULined
* @return true or false
*/
bool IsULined() const;
+ /** Check if this server is juped (a pseudoserver other than us)
+ * @return true if this server is a juped server
+ */
+ bool IsJuped() const;
+
/** Send a message to alll users on this server
* @param source The source of the message
* @param message The message
diff --git a/include/sockets.h b/include/sockets.h
index bf85d6f34..12cba7b7f 100644
--- a/include/sockets.h
+++ b/include/sockets.h
@@ -118,13 +118,14 @@ class SocketException : public CoreException
enum SocketFlag
{
- SF_DEAD,
+ SF_DEAD = 1,
SF_READABLE,
SF_WRITABLE,
SF_CONNECTING,
SF_CONNECTED,
SF_ACCEPTING,
- SF_ACCEPTED
+ SF_ACCEPTED,
+ SF_SIZE
};
class CoreExport SocketIO
@@ -185,7 +186,7 @@ class CoreExport SocketIO
virtual void Destroy() { }
};
-class CoreExport Socket : public Flags<SocketFlag>
+class CoreExport Socket
{
protected:
/* Socket FD */
@@ -194,6 +195,8 @@ class CoreExport Socket : public Flags<SocketFlag>
bool ipv6;
public:
+ std::bitset<SF_SIZE> flags;
+
/* Sockaddrs for bind() (if it's bound) */
sockaddrs bindaddr;
diff --git a/include/users.h b/include/users.h
index 436ba3bd5..4110ad211 100644
--- a/include/users.h
+++ b/include/users.h
@@ -42,10 +42,8 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
Anope::string uid;
/* If the user is on the access list of the nick theyre on */
bool on_access;
- /* Bitset of mode names the user has set on them */
- Flags<UserModeName> modes;
- /* Map of user modes and the params this user has */
- std::map<UserModeName, Anope::string> mode_params;
+ /* Map of user modes and the params this user has (if any) */
+ std::map<Anope::string, Anope::string> modes;
/* NickCore account the user is currently loggged in as, if they are logged in */
Serialize::Reference<NickCore> nc;
@@ -250,10 +248,10 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
void UpdateHost();
/** Check if the user has a mode
- * @param Name Mode name
+ * @param name Mode name
* @return true or false
*/
- bool HasMode(UserModeName Name) const;
+ bool HasMode(const Anope::string &name) const;
/** Set a mode internally on the user, the IRCd is not informed
* @param um The user mode
@@ -278,7 +276,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param name The mode name
* @param Param Optional param for the mode
*/
- void SetMode(const BotInfo *bi, UserModeName name, const Anope::string &param = "");
+ void SetMode(const BotInfo *bi, const Anope::string &name, const Anope::string &param = "");
/** Remove a mode on the user
* @param bi The client setting the mode
@@ -290,7 +288,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param bi The client setting the mode
* @param name The mode name
*/
- void RemoveMode(const BotInfo *bi, UserModeName name);
+ void RemoveMode(const BotInfo *bi, const Anope::string &name);
/** Set a string of modes on a user
* @param bi The client setting the modes