summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_banexception.cpp3
-rw-r--r--src/modules/m_blockcaps.cpp3
-rw-r--r--src/modules/m_blockcolor.cpp3
-rw-r--r--src/modules/m_botmode.cpp3
-rw-r--r--src/modules/m_censor.cpp4
-rw-r--r--src/modules/m_chanfilter.cpp3
-rw-r--r--src/modules/m_chanprotect.cpp5
-rw-r--r--src/modules/m_cloaking.cpp3
-rw-r--r--src/modules/m_deaf.cpp3
-rw-r--r--src/modules/m_helpop.cpp3
-rw-r--r--src/modules/m_hidechans.cpp3
-rw-r--r--src/modules/m_hideoper.cpp3
-rw-r--r--src/modules/m_inviteexception.cpp3
-rw-r--r--src/modules/m_joinflood.cpp3
-rw-r--r--src/modules/m_kicknorejoin.cpp3
-rw-r--r--src/modules/m_knock.cpp3
-rw-r--r--src/modules/m_messageflood.cpp3
-rw-r--r--src/modules/m_noctcp.cpp3
-rw-r--r--src/modules/m_noinvite.cpp3
-rw-r--r--src/modules/m_nokicks.cpp3
-rw-r--r--src/modules/m_nonotice.cpp3
-rw-r--r--src/modules/m_operchans.cpp3
-rw-r--r--src/modules/m_redirect.cpp3
-rw-r--r--src/modules/m_services.cpp12
-rw-r--r--src/modules/m_services_account.cpp5
-rw-r--r--src/modules/m_showwhois.cpp3
-rw-r--r--src/modules/m_sslmodes.cpp3
-rw-r--r--src/modules/m_stripcolor.cpp4
28 files changed, 62 insertions, 37 deletions
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index d8216a1f2..bc0d7f009 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -52,7 +52,8 @@ public:
: Module::Module(Me)
{
be = new BanException(ServerInstance);
- ServerInstance->AddMode(be, 'e');
+ if (!ServerInstance->AddMode(be, 'e'))
+ throw ModuleException("Could not add new modes!");
}
virtual void Implements(char* List)
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 0d76c9c84..b67c496f4 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -61,7 +61,8 @@ public:
{
OnRehash("");
bc = new BlockCaps(ServerInstance);
- ServerInstance->AddMode(bc, 'P');
+ if (!ServerInstance->AddMode(bc, 'P'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 38da18cbe..df28f1807 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -60,7 +60,8 @@ class ModuleBlockColour : public Module
{
bc = new BlockColor(ServerInstance);
- ServerInstance->AddMode(bc, 'c');
+ if (!ServerInstance->AddMode(bc, 'c'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index 1007fd4d9..9ed7ef2ee 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -65,7 +65,8 @@ class ModuleBotMode : public Module
{
bm = new BotMode(ServerInstance);
- ServerInstance->AddMode(bm, 'B');
+ if (!ServerInstance->AddMode(bm, 'B'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 49c04a946..4df2db95e 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -99,8 +99,8 @@ class ModuleCensor : public Module
OnRehash("");
cu = new CensorUser(ServerInstance);
cc = new CensorChannel(ServerInstance);
- ServerInstance->AddMode(cu, 'G');
- ServerInstance->AddMode(cc, 'G');
+ if (!ServerInstance->AddMode(cu, 'G') || !ServerInstance->AddMode(cc, 'G'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index c4a69cc10..de1f38a88 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -70,7 +70,8 @@ class ModuleChanFilter : public Module
: Module::Module(Me)
{
cf = new ChanFilter(ServerInstance);
- ServerInstance->AddMode(cf, 'g');
+ if (!ServerInstance->AddMode(cf, 'g'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 9f5a4eba3..cab686372 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -298,8 +298,8 @@ class ModuleChanProtect : public Module
cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf);
cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf);
- ServerInstance->AddMode(cp, 'a');
- ServerInstance->AddMode(cf, 'q');
+ if (!ServerInstance->AddMode(cp, 'a') || !ServerInstance->AddMode(cf, 'q'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
@@ -348,6 +348,7 @@ class ModuleChanProtect : public Module
DELETE(cf);
cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf);
cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf);
+ /* These wont fail, we already owned the mode characters before */
ServerInstance->AddMode(cp, 'a');
ServerInstance->AddMode(cf, 'q');
ServerInstance->WriteOpers("*** WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change.");
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 850a0e5f9..17e8c3405 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -238,7 +238,8 @@ class ModuleCloaking : public Module
cu = new CloakUser(ServerInstance, this, HashModule);
/* Register it with the core */
- ServerInstance->AddMode(cu, 'x');
+ if (!ServerInstance->AddMode(cu, 'x'))
+ throw ModuleException("Could not add new modes!");
OnRehash("");
}
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 9479b6b1c..2a1449bb4 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -55,7 +55,8 @@ class ModuleDeaf : public Module
: Module::Module(Me)
{
m1 = new User_d(ServerInstance);
- ServerInstance->AddMode(m1, 'd');
+ if (!ServerInstance->AddMode(m1, 'd'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index f501676c3..510e4e899 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -118,7 +118,8 @@ class ModuleHelpop : public Module
{
ReadConfig();
ho = new Helpop(ServerInstance);
- ServerInstance->AddMode(ho, 'h');
+ if (!ServerInstance->AddMode(ho, 'h'))
+ throw ModuleException("Could not add new modes!");
mycommand = new cmd_helpop(ServerInstance);
ServerInstance->AddCommand(mycommand);
}
diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp
index 2545db187..9e39e2a73 100644
--- a/src/modules/m_hidechans.cpp
+++ b/src/modules/m_hidechans.cpp
@@ -62,7 +62,8 @@ class ModuleHideChans : public Module
{
hm = new HideChans(ServerInstance);
- ServerInstance->AddMode(hm, 'I');
+ if (!ServerInstance->AddMode(hm, 'I'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index b2eee3b57..43bfef445 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -62,7 +62,8 @@ class ModuleHideOper : public Module
{
hm = new HideOper(ServerInstance);
- ServerInstance->AddMode(hm, 'H');
+ if (!ServerInstance->AddMode(hm, 'H'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp
index 26042933d..0f3581e9e 100644
--- a/src/modules/m_inviteexception.cpp
+++ b/src/modules/m_inviteexception.cpp
@@ -49,7 +49,8 @@ public:
ModuleInviteException(InspIRCd* Me) : Module(Me)
{
ie = new InviteException(ServerInstance);
- ServerInstance->AddMode(ie, 'I');
+ if (!ServerInstance->AddMode(ie, 'I'))
+ throw ModuleException("Could not add new modes!");
}
virtual void Implements(char* List)
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 9ed3b1307..1410c7d98 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -223,7 +223,8 @@ class ModuleJoinFlood : public Module
{
jf = new JoinFlood(ServerInstance);
- ServerInstance->AddMode(jf, 'j');
+ if (!ServerInstance->AddMode(jf, 'j'))
+ throw ModuleException("Could not add new modes!");
}
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs)
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 19cbc638f..68f3e53b4 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -135,7 +135,8 @@ public:
{
kr = new KickRejoin(ServerInstance);
- ServerInstance->AddMode(kr, 'J');
+ if (!ServerInstance->AddMode(kr, 'J'))
+ throw ModuleException("Could not add new modes!");
}
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs)
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 5018899d2..d850ed35b 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -111,7 +111,8 @@ class ModuleKnock : public Module
{
kn = new Knock(ServerInstance);
- ServerInstance->AddMode(kn, 'K');
+ if (!ServerInstance->AddMode(kn, 'K'))
+ throw ModuleException("Could not add new modes!");
mycommand = new cmd_knock(ServerInstance);
ServerInstance->AddCommand(mycommand);
}
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 9a9f684e5..bf071e18d 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -200,7 +200,8 @@ class ModuleMsgFlood : public Module
{
mf = new MsgFlood(ServerInstance);
- ServerInstance->AddMode(mf, 'f');
+ if (!ServerInstance->AddMode(mf, 'f'))
+ throw ModuleException("Could not add new modes!");
}
void ProcessMessages(userrec* user,chanrec* dest, const std::string &text)
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 0e9120407..622a08ac6 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -60,7 +60,8 @@ class ModuleNoCTCP : public Module
{
nc = new NoCTCP(ServerInstance);
- ServerInstance->AddMode(nc, 'C');
+ if (!ServerInstance->AddMode(nc, 'C'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp
index 64b4ecc5f..0b4e1723b 100644
--- a/src/modules/m_noinvite.cpp
+++ b/src/modules/m_noinvite.cpp
@@ -54,7 +54,8 @@ class ModuleNoInvite : public Module
ModuleNoInvite(InspIRCd* Me) : Module::Module(Me)
{
ni = new NoInvite(ServerInstance);
- ServerInstance->AddMode(ni, 'V');
+ if (!ServerInstance->AddMode(ni, 'V'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 9f8e804f0..c5ad179e8 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -61,7 +61,8 @@ class ModuleNoKicks : public Module
{
nk = new NoKicks(ServerInstance);
- ServerInstance->AddMode(nk, 'Q');
+ if (!ServerInstance->AddMode(nk, 'Q'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 5ec063e71..71e7e570b 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -57,7 +57,8 @@ class ModuleNoNotice : public Module
{
nt = new NoNotice(ServerInstance);
- ServerInstance->AddMode(nt, 'T');
+ if (!ServerInstance->AddMode(nt, 'T'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 69876cfcf..6852bc608 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -57,7 +57,8 @@ class ModuleOperChans : public Module
{
oc = new OperChans(ServerInstance);
- ServerInstance->AddMode(oc, 'O');
+ if (!ServerInstance->AddMode(oc, 'O'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index b6600da91..ae54ba137 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -108,7 +108,8 @@ class ModuleRedirect : public Module
{
re = new Redirect(ServerInstance);
- ServerInstance->AddMode(re, 'L');
+ if (!ServerInstance->AddMode(re, 'L'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index bd656b042..1eb089d0c 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -185,11 +185,13 @@ class ModuleServices : public Module
m3 = new Channel_M(ServerInstance);
m4 = new User_r(ServerInstance);
m5 = new User_R(ServerInstance);
- ServerInstance->AddMode(m1, 'r');
- ServerInstance->AddMode(m2, 'R');
- ServerInstance->AddMode(m3, 'M');
- ServerInstance->AddMode(m4, 'r');
- ServerInstance->AddMode(m5, 'R');
+
+ if (!ServerInstance->AddMode(m1, 'r') || !ServerInstance->AddMode(m2, 'R') || !ServerInstance->AddMode(m3, 'M')
+ || !ServerInstance->AddMode(m4, 'r') || !ServerInstance->AddMode(m5, 'R'))
+ {
+ throw ModuleException("Could not add user and channel modes!");
+ }
+
kludgeme = false;
}
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 47845054c..b5024e4df 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -122,9 +122,8 @@ class ModuleServicesAccount : public Module
m1 = new AChannel_R(ServerInstance);
m2 = new AChannel_M(ServerInstance);
m3 = new AUser_R(ServerInstance);
- ServerInstance->AddMode(m1, 'R');
- ServerInstance->AddMode(m2, 'M');
- ServerInstance->AddMode(m3, 'R');
+ if (!ServerInstance->AddMode(m1, 'R') || !ServerInstance->AddMode(m2, 'M') || !ServerInstance->AddMode(m3, 'R'))
+ throw ModuleException("Could not add new modes!");
}
/* <- :twisted.oscnet.org 330 w00t2 w00t2 w00t :is logged in as */
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index c4fea4e39..7dcfebdf6 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -63,7 +63,8 @@ class ModuleShowwhois : public Module
{
sw = new SeeWhois(ServerInstance);
- ServerInstance->AddMode(sw, 'W');
+ if (!ServerInstance->AddMode(sw, 'W'))
+ throw ModuleException("Could not add new modes!");
}
~ModuleShowwhois()
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index 9288f6306..1143473c3 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -78,7 +78,8 @@ class ModuleSSLModes : public Module
sslm = new SSLMode(ServerInstance);
- ServerInstance->AddMode(sslm, 'z');
+ if (!ServerInstance->AddMode(sslm, 'z'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index 97e367bb9..3639eae14 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -99,8 +99,8 @@ class ModuleStripColor : public Module
usc = new UserStripColor(ServerInstance);
csc = new ChannelStripColor(ServerInstance);
- ServerInstance->AddMode(usc, 'S');
- ServerInstance->AddMode(csc, 'S');
+ if (!ServerInstance->AddMode(usc, 'S') || !ServerInstance->AddMode(csc, 'S'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)