summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/IRCD12
-rw-r--r--include/modes.h80
-rw-r--r--include/services.h2
-rw-r--r--src/channels.c14
-rw-r--r--src/modes.cpp87
-rw-r--r--src/protocol/bahamut.c52
-rw-r--r--src/protocol/inspircd11.c79
-rw-r--r--src/protocol/inspircd12.cpp118
-rw-r--r--src/protocol/ratbox.c38
-rw-r--r--src/protocol/unreal32.c120
10 files changed, 323 insertions, 279 deletions
diff --git a/docs/IRCD b/docs/IRCD
index a59e3da3b..371eb2cdb 100644
--- a/docs/IRCD
+++ b/docs/IRCD
@@ -206,11 +206,11 @@ How To Add IRCd Support
Anope is told about modes in the moduleAddModes() function.
For the most part, the syntax for adding channel and user modes are:
- ModeManager::AddUserMode('N', new UserMode(UMODE_NETADMIN));
+ ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, 'N'));
Where 'N' is the char for the mode, and UMODE_NETADMIN shows what the
mode does. Or:
- ModeManager::AddChannelMode('c', new ChannelMode(CMODE_BLOCKCOLOR));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
Where 'c' is the char for the mode and CMODE_BLOCKCOLOR shows what
the mode does
@@ -219,11 +219,11 @@ How To Add IRCd Support
If necessary, you can add additional modes to this list.
Adding simple modes with parameters is similar, instead adding a
- 'new ChannelMode', use 'new ChannelModeParam', set the second optional
+ 'new ChannelMode', use 'new ChannelModeParam', set the third optional
arg of ChannelModeParam to false if the param should NOT be sent when unsetting
it. Eg:
- ModeManager::AddChannelMode('j', new ChannelModeParam(CMODE_JOINFLOOD, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
Anope will internally track the params, and they can be retrieved through
Channel::GetParam();
@@ -235,13 +235,13 @@ How To Add IRCd Support
from mlocking (or in CMODE_REGISTERED's case, anyone) from setting them.
This should be added like:
- ModeManager::AddChannelMode('O', new ChannelModeOper());
+ ModeManager::AddChannelMode(new ChannelModeOper('O'));
The CMODE_FLOOD param also has its own class, but due to the wide range of
valid parameters accepted across IRCds, your protocol module MUST have the
IsValid function for this.
- bool ChannelModeFlood::IsValid(const char *value) { }
+ bool ChannelModeFlood::IsValid(const std::string &value) { }
5) Functions and Events
diff --git a/include/modes.h b/include/modes.h
index 3fd0fe85b..de2d761f8 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -63,24 +63,53 @@ enum ModeType
MODE_STATUS
};
+/* Classes of modes, Channel modes and User modes
+ */
+enum ModeClass
+{
+ /* Channel mode */
+ MC_CHANNEL,
+ /* User mode */
+ MC_USER
+};
+
+/** This class is the basis of all modes in Anope
+ */
+class Mode
+{
+ public:
+ /* Class of mode this is */
+ ModeClass Class;
+ /* Mode char for this */
+ char ModeChar;
+
+ /** Default constructor
+ * @param mClass The type of mode this is
+ * @param modeChar The mode char
+ */
+ Mode(ModeClass mClass, char modeChar);
+
+ /** Default destructor
+ */
+ virtual ~Mode();
+};
/** This class is a user mode, all user modes use this/inherit from this
*/
-class CoreExport UserMode
+class CoreExport UserMode : public Mode
{
public:
/* Mode name */
UserModeName Name;
- /* The mode char */
- char ModeChar;
/* Mode type, regular or param */
ModeType Type;
/** Default constructor
* @param nName The mode name
+ * @param modeChar The mode char
*/
- UserMode(UserModeName mName);
+ UserMode(UserModeName mName, char modeChar);
/** Default destructor
*/
@@ -92,8 +121,9 @@ class UserModeParam : public UserMode
public:
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
*/
- UserModeParam(UserModeName mName);
+ UserModeParam(UserModeName mName, char modeChar);
/** Check if the param is valid
* @param value The param
@@ -104,7 +134,7 @@ class UserModeParam : public UserMode
/** This class is a channel mode, all channel modes use this/inherit from this
*/
-class CoreExport ChannelMode
+class CoreExport ChannelMode : public Mode
{
public:
@@ -112,13 +142,12 @@ class CoreExport ChannelMode
ChannelModeName Name;
/* Type of mode this is */
ModeType Type;
- /* The mode char */
- char ModeChar;
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
*/
- ChannelMode(ChannelModeName mName);
+ ChannelMode(ChannelModeName mName, char modeChar);
/** Default destructor
*/
@@ -140,8 +169,9 @@ class CoreExport ChannelModeList : public ChannelMode
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
*/
- ChannelModeList(ChannelModeName mName);
+ ChannelModeList(ChannelModeName mName, char modeChar);
/** Default destructor
*/
@@ -175,9 +205,10 @@ class CoreExport ChannelModeParam : public ChannelMode
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
* @param MinusArg true if this mode sends no arg when unsetting
*/
- ChannelModeParam(ChannelModeName mName, bool MinusArg = false);
+ ChannelModeParam(ChannelModeName mName, char modeChar, bool MinusArg = false);
/** Default destructor
*/
@@ -203,9 +234,10 @@ class CoreExport ChannelModeStatus : public ChannelMode
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
* @param mSymbol The symbol for the mode, eg @ % +
*/
- ChannelModeStatus(ChannelModeName mName, char mSymbol);
+ ChannelModeStatus(ChannelModeName mName, char modeChar, char mSymbol);
/** Default destructor
*/
@@ -217,7 +249,7 @@ class CoreExport ChannelModeStatus : public ChannelMode
class CoreExport ChannelModeBan : public ChannelModeList
{
public:
- ChannelModeBan() : ChannelModeList(CMODE_BAN) { }
+ ChannelModeBan(char modeChar) : ChannelModeList(CMODE_BAN, modeChar) { }
void AddMask(Channel *chan, const char *mask);
@@ -229,7 +261,7 @@ class CoreExport ChannelModeBan : public ChannelModeList
class CoreExport ChannelModeExcept : public ChannelModeList
{
public:
- ChannelModeExcept() : ChannelModeList(CMODE_EXCEPT) { }
+ ChannelModeExcept(char modeChar) : ChannelModeList(CMODE_EXCEPT, modeChar) { }
void AddMask(Channel *chan, const char *mask);
@@ -241,7 +273,7 @@ class CoreExport ChannelModeExcept : public ChannelModeList
class CoreExport ChannelModeInvite : public ChannelModeList
{
public:
- ChannelModeInvite() : ChannelModeList(CMODE_INVITEOVERRIDE) { }
+ ChannelModeInvite(char modeChar) : ChannelModeList(CMODE_INVITEOVERRIDE, modeChar) { }
void AddMask(Channel *chan, const char *mask);
@@ -254,7 +286,7 @@ class CoreExport ChannelModeInvite : public ChannelModeList
class CoreExport ChannelModeKey : public ChannelModeParam
{
public:
- ChannelModeKey() : ChannelModeParam(CMODE_KEY) { }
+ ChannelModeKey(char modeChar) : ChannelModeParam(CMODE_KEY, modeChar) { }
bool IsValid(const std::string &value);
};
@@ -264,7 +296,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam
class ChannelModeFlood : public ChannelModeParam
{
public:
- ChannelModeFlood() : ChannelModeParam(CMODE_FLOOD) { }
+ ChannelModeFlood(char modeChar) : ChannelModeParam(CMODE_FLOOD, modeChar) { }
bool IsValid(const std::string &value);
};
@@ -275,7 +307,7 @@ class ChannelModeFlood : public ChannelModeParam
class CoreExport ChannelModeAdmin : public ChannelMode
{
public:
- ChannelModeAdmin() : ChannelMode(CMODE_ADMINONLY) { }
+ ChannelModeAdmin(char modeChar) : ChannelMode(CMODE_ADMINONLY, modeChar) { }
/* Opers only */
bool CanSet(User *u);
@@ -287,7 +319,7 @@ class CoreExport ChannelModeAdmin : public ChannelMode
class CoreExport ChannelModeOper : public ChannelMode
{
public:
- ChannelModeOper() : ChannelMode(CMODE_OPERONLY) { }
+ ChannelModeOper(char modeChar) : ChannelMode(CMODE_OPERONLY, modeChar) { }
/* Opers only */
bool CanSet(User *u);
@@ -299,7 +331,7 @@ class CoreExport ChannelModeOper : public ChannelMode
class CoreExport ChannelModeRegistered : public ChannelMode
{
public:
- ChannelModeRegistered() : ChannelMode(CMODE_REGISTERED) { }
+ ChannelModeRegistered(char modeChar) : ChannelMode(CMODE_REGISTERED, modeChar) { }
/* No one mlocks +r */
bool CanSet(User *u);
@@ -394,20 +426,20 @@ class CoreExport ModeManager
* the pointers in each are the same. This is used to increase
* efficiency.
*/
+ /* List of all modes Anope knows about */
+ static std::list<Mode *> Modes;
/** Add a user mode to Anope
- * @param Mode The mode
* @param um A UserMode or UserMode derived class
* @return true on success, false on error
*/
- static bool AddUserMode(char Mode, UserMode *um);
+ static bool AddUserMode(UserMode *um);
/** Add a channel mode to Anope
- * @param Mode The mode
* @param cm A ChannelMode or ChannelMode derived class
* @return true on success, false on error
*/
- static bool AddChannelMode(char Mode, ChannelMode *cm);
+ static bool AddChannelMode(ChannelMode *cm);
/** Find a channel mode
* @param Mode The mode
diff --git a/include/services.h b/include/services.h
index 7bfb0134c..1901e6b86 100644
--- a/include/services.h
+++ b/include/services.h
@@ -417,7 +417,7 @@ struct ircdvars_ {
* for ircd specific support (nefarious only cares about first /mask) */
const char *globaltldprefix; /* TLD prefix used for Global */
bool b_delay_auth; /* Auth for users is sent after the initial NICK/UID command */
- int maxmodes; /* Max modes to send per line */
+ unsigned maxmodes; /* Max modes to send per line */
};
/*************************************************************************/
diff --git a/src/channels.c b/src/channels.c
index 594388c2f..564989bd3 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -978,25 +978,25 @@ char *chan_get_modes(Channel * chan, int complete, int plus)
char params[BUFSIZE];
char *end = res, *value, *pend = params, *pend2 = params;
std::string param;
- ChannelMode *cm;
- ChannelModeParam *cmp;
- std::map<char, ChannelMode *>::iterator it;
if (chan->HasModes())
{
- for (it = ModeManager::ChannelModesByChar.begin(); it != ModeManager::ChannelModesByChar.end(); ++it)
+ for (std::list<Mode *>::iterator it = ModeManager::Modes.begin(); it != ModeManager::Modes.end(); ++it)
{
- cm = it->second;
+ if ((*it)->Class != MC_CHANNEL)
+ continue;
+
+ ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
if (chan->HasMode(cm->Name))
{
- *end++ = it->first;
+ *end++ = cm->ModeChar;
if (complete)
{
if (cm->Type == MODE_PARAM)
{
- cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
if (plus || !cmp->MinusNoArg)
{
diff --git a/src/modes.cpp b/src/modes.cpp
index c915ca351..fa3a3fc1b 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -25,6 +25,8 @@ std::map<ChannelModeName, ChannelMode *> ModeManager::ChannelModesByName;
* the pointers in each are the same. This is used to increase
* efficiency.
*/
+/* List of all modes Anope knows about */
+std::list<Mode *> ModeManager::Modes;
/* Default mlocked modes on */
std::bitset<128> DefMLockOn;
@@ -95,12 +97,25 @@ void SetDefaultMLock()
}
/** Default constructor
+ * @param mClass The type of mode this is
+ * @param modeChar The mode char
+ */
+Mode::Mode(ModeClass mClass, char modeChar) : Class(mClass), ModeChar(modeChar)
+{
+}
+
+/** Default destructor
+ */
+Mode::~Mode()
+{
+}
+
+/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
*/
-UserMode::UserMode(UserModeName mName)
+UserMode::UserMode(UserModeName mName, char modeChar) : Mode(MC_USER, modeChar), Name(mName), Type(MODE_REGULAR)
{
- this->Name = mName;
- this->Type = MODE_REGULAR;
}
/** Default destructor
@@ -109,18 +124,21 @@ UserMode::~UserMode()
{
}
-UserModeParam::UserModeParam(UserModeName mName) : UserMode(mName)
+/** Default constructor
+ * @param mName The mode name
+ * @param modeChar The mode char
+ */
+UserModeParam::UserModeParam(UserModeName mName, char modeChar) : UserMode(mName, modeChar)
{
this->Type = MODE_PARAM;
}
/** Default constrcutor
* @param mName The mode name
+ * @param modeChar The mode char
*/
-ChannelMode::ChannelMode(ChannelModeName mName)
+ChannelMode::ChannelMode(ChannelModeName mName, char modeChar) : Mode(MC_CHANNEL, modeChar), Name(mName), Type(MODE_REGULAR)
{
- this->Name = mName;
- this->Type = MODE_REGULAR;
}
/** Default destructor
@@ -131,8 +149,9 @@ ChannelMode::~ChannelMode()
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
*/
-ChannelModeList::ChannelModeList(ChannelModeName mName) : ChannelMode(mName)
+ChannelModeList::ChannelModeList(ChannelModeName mName, char modeChar) : ChannelMode(mName, modeChar)
{
this->Type = MODE_LIST;
}
@@ -145,12 +164,12 @@ ChannelModeList::~ChannelModeList()
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
* @param MinusArg true if the mode sends no arg when unsetting
*/
-ChannelModeParam::ChannelModeParam(ChannelModeName mName, bool MinusArg) : ChannelMode(mName)
+ChannelModeParam::ChannelModeParam(ChannelModeName mName, char modeChar, bool MinusArg) : ChannelMode(mName, modeChar), MinusNoArg(MinusArg)
{
this->Type = MODE_PARAM;
- this->MinusNoArg = MinusArg;
}
/** Default destructor
@@ -161,12 +180,12 @@ ChannelModeParam::~ChannelModeParam()
/** Default constructor
* @param mName The mode name
+ * @param modeChar The mode char
* @param mSymbol The symbol for the mode, eg @ % +
*/
-ChannelModeStatus::ChannelModeStatus(ChannelModeName mName, char mSymbol) : ChannelMode(mName)
+ChannelModeStatus::ChannelModeStatus(ChannelModeName mName, char modeChar, char mSymbol) : ChannelMode(mName, modeChar), Symbol(mSymbol)
{
this->Type = MODE_STATUS;
- this->Symbol = mSymbol;
}
/** Default destructor
@@ -479,17 +498,17 @@ std::list<std::string> ModeManager::BuildModeStrings(StackerInfo *info)
std::string buf, parambuf;
ChannelMode *cm = NULL;
UserMode *um = NULL;
- unsigned Modes = 0;
+ unsigned NModes = 0;
buf = "+";
for (it = info->AddModes.begin(); it != info->AddModes.end(); ++it)
{
- if (++Modes > ircd->maxmodes)
+ if (++NModes > ircd->maxmodes)
{
ret.push_back(buf + parambuf);
buf = "+";
parambuf.clear();
- Modes = 1;
+ NModes = 1;
}
if (info->Type == ST_CHANNEL)
@@ -513,12 +532,12 @@ std::list<std::string> ModeManager::BuildModeStrings(StackerInfo *info)
buf += "-";
for (it = info->DelModes.begin(); it != info->DelModes.end(); ++it)
{
- if (++Modes > ircd->maxmodes)
+ if (++NModes > ircd->maxmodes)
{
ret.push_back(buf + parambuf);
buf = "-";
parambuf.clear();
- Modes = 1;
+ NModes = 1;
}
if (info->Type == ST_CHANNEL)
@@ -591,46 +610,44 @@ void ModeManager::StackerAddInternal(BotInfo *bi, void *Object, void *Mode, bool
}
/** Add a user mode to Anope
- * @param Mode The mode
* @param um A UserMode or UserMode derived class
* @return true on success, false on error
*/
-bool ModeManager::AddUserMode(char Mode, UserMode *um)
+bool ModeManager::AddUserMode(UserMode *um)
{
- um->ModeChar = Mode;
- bool ret = ModeManager::UserModesByChar.insert(std::make_pair(Mode, um)).second;
- if (ret)
- ret = ModeManager::UserModesByName.insert(std::make_pair(um->Name, um)).second;
-
- if (ret)
+ if (ModeManager::UserModesByChar.insert(std::make_pair(um->ModeChar, um)).second)
{
+ ModeManager::UserModesByName.insert(std::make_pair(um->Name, um)).second;
+ ModeManager::Modes.push_back(um);
+
FOREACH_MOD(I_OnUserModeAdd, OnUserModeAdd(um));
+
+ return true;
}
- return ret;
+ return false;
}
/** Add a channel mode to Anope
- * @param Mode The mode
* @param cm A ChannelMode or ChannelMode derived class
* @return true on success, false on error
*/
-bool ModeManager::AddChannelMode(char Mode, ChannelMode *cm)
+bool ModeManager::AddChannelMode(ChannelMode *cm)
{
- cm->ModeChar = Mode;
- bool ret = ModeManager::ChannelModesByChar.insert(std::make_pair(Mode, cm)).second;
- if (ret)
- ret = ModeManager::ChannelModesByName.insert(std::make_pair(cm->Name, cm)).second;
-
- if (ret)
+ if (ModeManager::ChannelModesByChar.insert(std::make_pair(cm->ModeChar, cm)).second)
{
+ ModeManager::ChannelModesByName.insert(std::make_pair(cm->Name, cm)).second;
+ ModeManager::Modes.push_back(cm);
+
/* Apply this mode to the new default mlock if its used */
SetDefaultMLock();
FOREACH_MOD(I_OnChannelModeAdd, OnChannelModeAdd(cm));
+
+ return true;
}
- return ret;
+ return false;
}
/** Find a channel mode
* @param Mode The mode
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index 14407eb6b..34886126c 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -775,38 +775,38 @@ void moduleAddIRCDMsgs() {
void moduleAddModes()
{
/* Add user modes */
- ModeManager::AddUserMode('A', new UserMode(UMODE_SERV_ADMIN));
- ModeManager::AddUserMode('R', new UserMode(UMODE_REGPRIV));
- ModeManager::AddUserMode('a', new UserMode(UMODE_ADMIN));
- ModeManager::AddUserMode('i', new UserMode(UMODE_INVIS));
- ModeManager::AddUserMode('o', new UserMode(UMODE_OPER));
- ModeManager::AddUserMode('r', new UserMode(UMODE_REGISTERED));
- ModeManager::AddUserMode('s', new UserMode(UMODE_SNOMASK));
- ModeManager::AddUserMode('w', new UserMode(UMODE_WALLOPS));
- ModeManager::AddUserMode('d', new UserMode(UMODE_DEAF));
+ ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, 'A'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
+ ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
+ ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
+ ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
/* b/e/I */
- ModeManager::AddChannelMode('b', new ChannelModeBan());
+ ModeManager::AddChannelMode(new ChannelModeBan('b'));
/* v/h/o/a/q */
- ModeManager::AddChannelMode('v', new ChannelModeStatus(CMODE_VOICE, '+'));
- ModeManager::AddChannelMode('o', new ChannelModeStatus(CMODE_OP, '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
/* Add channel modes */
- ModeManager::AddChannelMode('c', new ChannelMode(CMODE_BLOCKCOLOR));
- ModeManager::AddChannelMode('i', new ChannelMode(CMODE_INVITE));
- ModeManager::AddChannelMode('j', new ChannelModeFlood());
- ModeManager::AddChannelMode('k', new ChannelModeKey());
- ModeManager::AddChannelMode('l', new ChannelModeParam(CMODE_LIMIT));
- ModeManager::AddChannelMode('m', new ChannelMode(CMODE_MODERATED));
- ModeManager::AddChannelMode('n', new ChannelMode(CMODE_NOEXTERNAL));
- ModeManager::AddChannelMode('p', new ChannelMode(CMODE_PRIVATE));
- ModeManager::AddChannelMode('r', new ChannelModeRegistered());
- ModeManager::AddChannelMode('s', new ChannelMode(CMODE_SECRET));
- ModeManager::AddChannelMode('t', new ChannelMode(CMODE_TOPIC));
- ModeManager::AddChannelMode('M', new ChannelMode(CMODE_REGMODERATED));
- ModeManager::AddChannelMode('O', new ChannelModeOper());
- ModeManager::AddChannelMode('R', new ChannelMode(CMODE_REGISTEREDONLY));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelModeFlood('f'));
+ ModeManager::AddChannelMode(new ChannelModeKey('k'));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
+ ModeManager::AddChannelMode(new ChannelModeOper('O'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
}
class ProtoBahamut : public Module
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index 95f93e652..59f7710a7 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -912,13 +912,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'b':
- ModeManager::AddChannelMode('b', new ChannelModeBan());
+ ModeManager::AddChannelMode(new ChannelModeBan('b'));
continue;
case 'e':
- ModeManager::AddChannelMode('e', new ChannelModeExcept());
+ ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
- ModeManager::AddChannelMode('I', new ChannelModeInvite());
+ ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
}
}
@@ -929,7 +929,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'k':
- ModeManager::AddChannelMode('k', new ChannelModeKey());
+ ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
}
}
@@ -940,12 +940,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'f':
- ModeManager::AddChannelMode('f', new ChannelModeFlood());
+ ModeManager::AddChannelMode(new ChannelModeFlood('f'));
+ continue;
case 'l':
- ModeManager::AddChannelMode('l', new ChannelModeParam(CMODE_LIMIT, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
continue;
case 'L':
- ModeManager::AddChannelMode('L', new ChannelModeParam(CMODE_REDIRECT, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
continue;
}
}
@@ -956,64 +957,64 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'i':
- ModeManager::AddChannelMode('i', new ChannelMode(CMODE_INVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
continue;
case 'm':
- ModeManager::AddChannelMode('m', new ChannelMode(CMODE_MODERATED));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode('n', new ChannelMode(CMODE_NOEXTERNAL));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
continue;
case 'p':
- ModeManager::AddChannelMode('p', new ChannelMode(CMODE_PRIVATE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
continue;
case 's':
- ModeManager::AddChannelMode('s', new ChannelMode(CMODE_SECRET));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
continue;
case 't':
- ModeManager::AddChannelMode('t', new ChannelMode(CMODE_TOPIC));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
continue;
case 'r':
- ModeManager::AddChannelMode('r', new ChannelModeRegistered());
+ ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 'c':
- ModeManager::AddChannelMode('c', new ChannelMode(CMODE_BLOCKCOLOR));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
continue;
case 'u':
- ModeManager::AddChannelMode('u', new ChannelMode(CMODE_AUDITORIUM));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode('z', new ChannelMode(CMODE_SSL));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
continue;
case 'A':
- ModeManager::AddChannelMode('A', new ChannelMode(CMODE_ALLINVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
continue;
case 'C':
- ModeManager::AddChannelMode('C', new ChannelMode(CMODE_NOCTCP));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
continue;
case 'G':
- ModeManager::AddChannelMode('G', new ChannelMode(CMODE_FILTER));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
continue;
case 'K':
- ModeManager::AddChannelMode('K', new ChannelMode(CMODE_NOKNOCK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
continue;
case 'N':
- ModeManager::AddChannelMode('N', new ChannelMode(CMODE_NONICK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
continue;
case 'O':
- ModeManager::AddChannelMode('O', new ChannelModeOper());
+ ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'Q':
- ModeManager::AddChannelMode('Q', new ChannelMode(CMODE_NOKICK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
continue;
case 'R':
- ModeManager::AddChannelMode('R', new ChannelMode(CMODE_REGISTEREDONLY));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
continue;
case 'S':
- ModeManager::AddChannelMode('S', new ChannelMode(CMODE_STRIPCOLOR));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
continue;
case 'V':
- ModeManager::AddChannelMode('V', new ChannelMode(CMODE_NOINVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
continue;
}
}
@@ -1028,19 +1029,19 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modes[t])
{
case 'q':
- ModeManager::AddChannelMode('q', new ChannelModeStatus(CMODE_OWNER, '~'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '~'));
continue;
case 'a':
- ModeManager::AddChannelMode('a', new ChannelModeStatus(CMODE_PROTECT, '&'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '&'));
continue;
case 'o':
- ModeManager::AddChannelMode('o', new ChannelModeStatus(CMODE_OP, '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
continue;
case 'h':
- ModeManager::AddChannelMode('h', new ChannelModeStatus(CMODE_HALFOP, '%'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%'));
continue;
case 'v':
- ModeManager::AddChannelMode('v', new ChannelModeStatus(CMODE_VOICE, '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
continue;
}
}
@@ -1141,13 +1142,13 @@ bool ChannelModeFlood::IsValid(const std::string &value)
static void AddModes()
{
- ModeManager::AddUserMode('g', new UserMode(UMODE_CALLERID));
- ModeManager::AddUserMode('h', new UserMode(UMODE_HELPOP));
- ModeManager::AddUserMode('i', new UserMode(UMODE_INVIS));
- ModeManager::AddUserMode('o', new UserMode(UMODE_OPER));
- ModeManager::AddUserMode('r', new UserMode(UMODE_REGISTERED));
- ModeManager::AddUserMode('w', new UserMode(UMODE_WALLOPS));
- ModeManager::AddUserMode('x', new UserMode(UMODE_CLOAK));
+ ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
+ ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
+ ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
}
class ProtoInspIRCd : public Module
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 698cc86ea..98d993eec 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -1003,16 +1003,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'b':
- ModeManager::AddChannelMode('b', new ChannelModeBan());
+ ModeManager::AddChannelMode(new ChannelModeBan('b'));
continue;
case 'e':
- ModeManager::AddChannelMode('e', new ChannelModeExcept());
+ ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
- ModeManager::AddChannelMode('I', new ChannelModeInvite());
- continue;
- case 'g':
- ModeManager::AddUserMode('g', new UserMode(UMODE_CALLERID));
+ ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
}
}
@@ -1023,7 +1020,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'k':
- ModeManager::AddChannelMode('k', new ChannelModeKey());
+ ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
}
}
@@ -1034,22 +1031,22 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'F':
- ModeManager::AddChannelMode('F', new ChannelModeParam(CMODE_NICKFLOOD, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NICKFLOOD, 'F', true));
continue;
case 'J':
- ModeManager::AddChannelMode('J', new ChannelModeParam(CMODE_JOINFLOOD, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'J', true));
continue;
case 'L':
- ModeManager::AddChannelMode('L', new ChannelModeParam(CMODE_REDIRECT, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, true));
continue;
case 'f':
- ModeManager::AddChannelMode('f', new ChannelModeFlood());
+ ModeManager::AddChannelMode(new ChannelModeFlood('f'));
continue;
case 'j':
- ModeManager::AddChannelMode('j', new ChannelModeParam(CMODE_JOINFLOOD, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
continue;
case 'l':
- ModeManager::AddChannelMode('l', new ChannelModeParam(CMODE_LIMIT, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
continue;
}
}
@@ -1060,76 +1057,73 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'A':
- ModeManager::AddChannelMode('A', new ChannelMode(CMODE_ALLINVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
continue;
case 'B':
- ModeManager::AddChannelMode('B', new ChannelMode(CMODE_BLOCKCAPS));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCAPS, 'B'));
continue;
case 'C':
- ModeManager::AddChannelMode('C', new ChannelMode(CMODE_NOCTCP));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
continue;
case 'D':
- ModeManager::AddChannelMode('D', new ChannelMode(CMODE_DELAYEDJOIN));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_DELAYEDJOIN, 'D'));
continue;
case 'G':
- ModeManager::AddChannelMode('G', new ChannelMode(CMODE_FILTER));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
continue;
case 'K':
- ModeManager::AddChannelMode('K', new ChannelMode(CMODE_NOKNOCK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
continue;
case 'M':
- ModeManager::AddChannelMode('M', new ChannelMode(CMODE_REGMODERATED));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
continue;
case 'N':
- ModeManager::AddChannelMode('N', new ChannelMode(CMODE_NONICK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
continue;
case 'O':
- ModeManager::AddChannelMode('O', new ChannelModeOper());
+ ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'P':
- ModeManager::AddChannelMode('P', new ChannelMode(CMODE_PERM));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'P'));
continue;
case 'Q':
- ModeManager::AddChannelMode('Q', new ChannelMode(CMODE_NOKICK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
continue;
case 'R':
- ModeManager::AddUserMode('R', new UserMode(UMODE_REGPRIV));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
continue;
case 'S':
- ModeManager::AddChannelMode('S', new ChannelMode(CMODE_STRIPCOLOR));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
continue;
case 'T':
- ModeManager::AddChannelMode('T', new ChannelMode(CMODE_NONOTICE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
continue;
case 'i':
- ModeManager::AddChannelMode('i', new ChannelMode(CMODE_INVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
continue;
case 'm':
- ModeManager::AddChannelMode('m', new ChannelMode(CMODE_MODERATED));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode('n', new ChannelMode(CMODE_NOEXTERNAL));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
continue;
case 'p':
- ModeManager::AddChannelMode('p', new ChannelMode(CMODE_PRIVATE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
continue;
case 'r':
- ModeManager::AddChannelMode('r', new ChannelModeRegistered());
+ ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 's':
- ModeManager::AddChannelMode('s', new ChannelMode(CMODE_SECRET));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
continue;
case 't':
- ModeManager::AddChannelMode('t', new ChannelMode(CMODE_TOPIC));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
continue;
case 'u':
- ModeManager::AddChannelMode('u', new ChannelMode(CMODE_AUDITORIUM));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode('u', new ChannelMode(CMODE_AUDITORIUM));
- continue;
- case 'h':
- ModeManager::AddUserMode('h', new UserMode(UMODE_HELPOP));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
continue;
}
}
@@ -1147,58 +1141,58 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 's':
- ModeManager::AddUserMode('S', new UserMode(UMODE_STRIPCOLOR));
+ ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'B':
- ModeManager::AddUserMode('B', new UserMode(UMODE_BOT));
+ ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
continue;
case 'G':
- ModeManager::AddUserMode('G', new UserMode(UMODE_FILTER));
+ ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G'));
continue;
case 'H':
- ModeManager::AddUserMode('H', new UserMode(UMODE_HIDEOPER));
+ ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
continue;
case 'I':
- ModeManager::AddUserMode('I', new UserMode(UMODE_PRIV));
+ ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'I'));
continue;
case 'Q':
- ModeManager::AddUserMode('Q', new UserMode(UMODE_HIDDEN));
+ ModeManager::AddUserMode(new UserMode(UMODE_HIDDEN, 'Q'));
continue;
case 'R':
- ModeManager::AddUserMode('R', new UserMode(UMODE_REGPRIV));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
continue;
case 'S':
- ModeManager::AddUserMode('S', new UserMode(UMODE_STRIPCOLOR));
+ ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'W':
- ModeManager::AddUserMode('W', new UserMode(UMODE_WHOIS));
+ ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W'));
continue;
case 'c':
- ModeManager::AddUserMode('c', new UserMode(UMODE_COMMONCHANS));
+ ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, 'c'));
continue;
case 'g':
- ModeManager::AddUserMode('g', new UserMode(UMODE_CALLERID));
+ ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
continue;
case 'i':
- ModeManager::AddUserMode('i', new UserMode(UMODE_INVIS));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
continue;
case 'k':
- ModeManager::AddUserMode('k', new UserMode(UMODE_PROTECTED));
+ ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'k'));
continue;
case 'o':
- ModeManager::AddUserMode('o', new UserMode(UMODE_OPER));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
continue;
case 'r':
- ModeManager::AddUserMode('r', new UserMode(UMODE_REGISTERED));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
continue;
case 'w':
- ModeManager::AddUserMode('w', new UserMode(UMODE_WALLOPS));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
continue;
case 'x':
- ModeManager::AddUserMode('x', new UserMode(UMODE_CLOAK));
+ ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
continue;
case 'd':
- ModeManager::AddUserMode('d', new UserMode(UMODE_DEAF));
+ ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
continue;
}
}
@@ -1214,19 +1208,19 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modes[t])
{
case 'q':
- ModeManager::AddChannelMode('q', new ChannelModeStatus(CMODE_OWNER, chars[t]));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', chars[t]));
continue;
case 'a':
- ModeManager::AddChannelMode('a', new ChannelModeStatus(CMODE_PROTECT, chars[t]));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', chars[t]));
continue;
case 'o':
- ModeManager::AddChannelMode('o', new ChannelModeStatus(CMODE_OP, chars[t]));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', chars[t]));
continue;
case 'h':
- ModeManager::AddChannelMode('h', new ChannelModeStatus(CMODE_HALFOP, chars[t]));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', chars[t]));
continue;
case 'v':
- ModeManager::AddChannelMode('v', new ChannelModeStatus(CMODE_VOICE, chars[t]));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', chars[t]));
continue;
}
}
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 3fd7315fe..61eb1518d 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -848,31 +848,31 @@ void moduleAddIRCDMsgs()
void moduleAddModes()
{
/* Add user modes */
- ModeManager::AddUserMode('a', new UserMode(UMODE_ADMIN));
- ModeManager::AddUserMode('i', new UserMode(UMODE_INVIS));
- ModeManager::AddUserMode('o', new UserMode(UMODE_OPER));
- ModeManager::AddUserMode('r', new UserMode(UMODE_REGISTERED));
- ModeManager::AddUserMode('s', new UserMode(UMODE_SNOMASK));
- ModeManager::AddUserMode('w', new UserMode(UMODE_WALLOPS));
+ ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
+ ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
/* b/e/I */
- ModeManager::AddChannelMode('b', new ChannelModeBan());
- ModeManager::AddChannelMode('e', new ChannelModeExcept());
- ModeManager::AddChannelMode('I', new ChannelModeInvite());
+ ModeManager::AddChannelMode(new ChannelModeBan('b'));
+ ModeManager::AddChannelMode(new ChannelModeExcept('e'));
+ ModeManager::AddChannelMode(new ChannelModeInvite('I'));
/* v/h/o/a/q */
- ModeManager::AddChannelMode('v', new ChannelModeStatus(CMODE_VOICE, '+'));
- ModeManager::AddChannelMode('o', new ChannelModeStatus(CMODE_OP, '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
/* Add channel modes */
- ModeManager::AddChannelMode('i', new ChannelMode(CMODE_INVITE));
- ModeManager::AddChannelMode('k', new ChannelModeKey());
- ModeManager::AddChannelMode('l', new ChannelModeParam(CMODE_LIMIT));
- ModeManager::AddChannelMode('m', new ChannelMode(CMODE_MODERATED));
- ModeManager::AddChannelMode('n', new ChannelMode(CMODE_NOEXTERNAL));
- ModeManager::AddChannelMode('p', new ChannelMode(CMODE_PRIVATE));
- ModeManager::AddChannelMode('s', new ChannelMode(CMODE_SECRET));
- ModeManager::AddChannelMode('t', new ChannelMode(CMODE_TOPIC));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelModeKey('k'));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
}
class ProtoRatbox : public Module
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 4016a5f18..35ced626c 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -457,13 +457,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'b':
- ModeManager::AddChannelMode('b', new ChannelModeBan());
+ ModeManager::AddChannelMode(new ChannelModeBan('b'));
continue;
case 'e':
- ModeManager::AddChannelMode('e', new ChannelModeExcept());
+ ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
- ModeManager::AddChannelMode('I', new ChannelModeInvite());
+ ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
}
}
@@ -474,13 +474,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'k':
- ModeManager::AddChannelMode('k', new ChannelModeKey());
+ ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
case 'f':
- ModeManager::AddChannelMode('f', new ChannelModeFlood());
+ ModeManager::AddChannelMode(new ChannelModeFlood('f'));
continue;
case 'L':
- ModeManager::AddChannelMode('L', new ChannelModeParam(CMODE_REDIRECT));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L'));
continue;
}
}
@@ -491,10 +491,10 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'l':
- ModeManager::AddChannelMode('l', new ChannelModeParam(CMODE_LIMIT, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
continue;
case 'j':
- ModeManager::AddChannelMode('j', new ChannelModeParam(CMODE_JOINFLOOD, true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
continue;
}
}
@@ -505,70 +505,70 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'p':
- ModeManager::AddChannelMode('p', new ChannelMode(CMODE_PRIVATE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
continue;
case 's':
- ModeManager::AddChannelMode('s', new ChannelMode(CMODE_SECRET));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
continue;
case 'm':
- ModeManager::AddChannelMode('m', new ChannelMode(CMODE_MODERATED));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode('n', new ChannelMode(CMODE_NOEXTERNAL));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
continue;
case 't':
- ModeManager::AddChannelMode('t', new ChannelMode(CMODE_TOPIC));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
continue;
case 'i':
- ModeManager::AddChannelMode('i', new ChannelMode(CMODE_INVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
continue;
case 'r':
- ModeManager::AddChannelMode('r', new ChannelModeRegistered());
+ ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 'R':
- ModeManager::AddChannelMode('R', new ChannelMode(CMODE_REGISTEREDONLY));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
continue;
case 'c':
- ModeManager::AddChannelMode('c', new ChannelMode(CMODE_BLOCKCOLOR));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
continue;
case 'O':
- ModeManager::AddChannelMode('O', new ChannelModeOper());
+ ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'A':
- ModeManager::AddChannelMode('A', new ChannelModeAdmin());
+ ModeManager::AddChannelMode(new ChannelModeAdmin('A'));
continue;
case 'Q':
- ModeManager::AddChannelMode('Q', new ChannelMode(CMODE_NOKICK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
continue;
case 'K':
- ModeManager::AddChannelMode('K', new ChannelMode(CMODE_NOKNOCK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
continue;
case 'V':
- ModeManager::AddChannelMode('V', new ChannelMode(CMODE_NOINVITE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
continue;
case 'C':
- ModeManager::AddChannelMode('C', new ChannelMode(CMODE_NOCTCP));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
continue;
case 'u':
- ModeManager::AddChannelMode('u', new ChannelMode(CMODE_AUDITORIUM));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode('z', new ChannelMode(CMODE_SSL));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
continue;
case 'N':
- ModeManager::AddChannelMode('N', new ChannelMode(CMODE_NONICK));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
continue;
case 'S':
- ModeManager::AddChannelMode('S', new ChannelMode(CMODE_STRIPCOLOR));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
continue;
case 'M':
- ModeManager::AddChannelMode('M', new ChannelMode(CMODE_REGMODERATED));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
continue;
case 'T':
- ModeManager::AddChannelMode('T', new ChannelMode(CMODE_NONOTICE));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
continue;
case 'G':
- ModeManager::AddChannelMode('G', new ChannelMode(CMODE_FILTER));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
continue;
}
}
@@ -1319,39 +1319,39 @@ bool ChannelModeFlood::IsValid(const std::string &value2)
static void AddModes()
{
- ModeManager::AddChannelMode('v', new ChannelModeStatus(CMODE_VOICE, '+'));
- ModeManager::AddChannelMode('h', new ChannelModeStatus(CMODE_HALFOP, '%'));
- ModeManager::AddChannelMode('o', new ChannelModeStatus(CMODE_OP, '@'));
- ModeManager::AddChannelMode('a', new ChannelModeStatus(CMODE_PROTECT, '&'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '&'));
/* Unreal sends +q as * */
- ModeManager::AddChannelMode('q', new ChannelModeStatus(CMODE_OWNER, '*'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '*'));
/* Add user modes */
- ModeManager::AddUserMode('A', new UserMode(UMODE_SERV_ADMIN));
- ModeManager::AddUserMode('B', new UserMode(UMODE_BOT));
- ModeManager::AddUserMode('C', new UserMode(UMODE_CO_ADMIN));
- ModeManager::AddUserMode('G', new UserMode(UMODE_FILTER));
- ModeManager::AddUserMode('H', new UserMode(UMODE_HIDEOPER));
- ModeManager::AddUserMode('N', new UserMode(UMODE_NETADMIN));
- ModeManager::AddUserMode('R', new UserMode(UMODE_REGPRIV));
- ModeManager::AddUserMode('S', new UserMode(UMODE_PROTECTED));
- ModeManager::AddUserMode('T', new UserMode(UMODE_NO_CTCP));
- ModeManager::AddUserMode('V', new UserMode(UMODE_WEBTV));
- ModeManager::AddUserMode('W', new UserMode(UMODE_WHOIS));
- ModeManager::AddUserMode('a', new UserMode(UMODE_ADMIN));
- ModeManager::AddUserMode('d', new UserMode(UMODE_DEAF));
- ModeManager::AddUserMode('g', new UserMode(UMODE_GLOBOPS));
- ModeManager::AddUserMode('h', new UserMode(UMODE_HELPOP));
- ModeManager::AddUserMode('i', new UserMode(UMODE_INVIS));
- ModeManager::AddUserMode('o', new UserMode(UMODE_OPER));
- ModeManager::AddUserMode('p', new UserMode(UMODE_PRIV));
- ModeManager::AddUserMode('q', new UserMode(UMODE_GOD));
- ModeManager::AddUserMode('r', new UserMode(UMODE_REGISTERED));
- ModeManager::AddUserMode('s', new UserMode(UMODE_SNOMASK));
- ModeManager::AddUserMode('t', new UserMode(UMODE_VHOST));
- ModeManager::AddUserMode('w', new UserMode(UMODE_WALLOPS));
- ModeManager::AddUserMode('x', new UserMode(UMODE_CLOAK));
- ModeManager::AddUserMode('z', new UserMode(UMODE_SSL));
+ ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, 'A'));
+ ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
+ ModeManager::AddUserMode(new UserMode(UMODE_CO_ADMIN, 'C'));
+ ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G'));
+ ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
+ ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, 'N'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
+ ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'S'));
+ ModeManager::AddUserMode(new UserMode(UMODE_NO_CTCP, 'T'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WEBTV, 'V'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W'));
+ ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
+ ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
+ ModeManager::AddUserMode(new UserMode(UMODE_GLOBOPS, 'g'));
+ ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
+ ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'p'));
+ ModeManager::AddUserMode(new UserMode(UMODE_GOD, 'q'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
+ ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
+ ModeManager::AddUserMode(new UserMode(UMODE_VHOST, 't'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
+ ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
+ ModeManager::AddUserMode(new UserMode(UMODE_SSL, 'z'));
}
class ProtoUnreal : public Module