: 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)
{
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)
{
bc = new BlockColor(ServerInstance);
- ServerInstance->AddMode(bc, 'c');
+ if (!ServerInstance->AddMode(bc, 'c'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
{
bm = new BotMode(ServerInstance);
- ServerInstance->AddMode(bm, 'B');
+ if (!ServerInstance->AddMode(bm, 'B'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
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)
: 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)
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)
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.");
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("");
}
: 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)
{
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);
}
{
hm = new HideChans(ServerInstance);
- ServerInstance->AddMode(hm, 'I');
+ if (!ServerInstance->AddMode(hm, 'I'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
{
hm = new HideOper(ServerInstance);
- ServerInstance->AddMode(hm, 'H');
+ if (!ServerInstance->AddMode(hm, 'H'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
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)
{
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)
{
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)
{
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);
}
{
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)
{
nc = new NoCTCP(ServerInstance);
- ServerInstance->AddMode(nc, 'C');
+ if (!ServerInstance->AddMode(nc, 'C'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
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)
{
nk = new NoKicks(ServerInstance);
- ServerInstance->AddMode(nk, 'Q');
+ if (!ServerInstance->AddMode(nk, 'Q'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
{
nt = new NoNotice(ServerInstance);
- ServerInstance->AddMode(nt, 'T');
+ if (!ServerInstance->AddMode(nt, 'T'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
{
oc = new OperChans(ServerInstance);
- ServerInstance->AddMode(oc, 'O');
+ if (!ServerInstance->AddMode(oc, 'O'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
{
re = new Redirect(ServerInstance);
- ServerInstance->AddMode(re, 'L');
+ if (!ServerInstance->AddMode(re, 'L'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
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;
}
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 */
{
sw = new SeeWhois(ServerInstance);
- ServerInstance->AddMode(sw, 'W');
+ if (!ServerInstance->AddMode(sw, 'W'))
+ throw ModuleException("Could not add new modes!");
}
~ModuleShowwhois()
sslm = new SSLMode(ServerInstance);
- ServerInstance->AddMode(sslm, 'z');
+ if (!ServerInstance->AddMode(sslm, 'z'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
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)