Remove a redundant method here, call the mode manager directly

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8732 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
w00t 2008-01-17 23:40:18 +00:00
parent 207af6fb2f
commit ece985ccb3
39 changed files with 41 additions and 78 deletions

View File

@ -669,24 +669,6 @@ class CoreExport InspIRCd : public classbase
*/
caller1<User*, int> FindDescriptor;
/** Add a new mode to this server's mode parser
* @param mh The modehandler to add
* @return True if the mode handler was added
*/
bool AddMode(ModeHandler* mh);
/** Add a new mode watcher to this server's mode parser
* @param mw The modewatcher to add
* @return True if the modewatcher was added
*/
bool AddModeWatcher(ModeWatcher* mw);
/** Delete a mode watcher from this server's mode parser
* @param mw The modewatcher to delete
* @return True if the modewatcher was deleted
*/
bool DelModeWatcher(ModeWatcher* mw);
/** Add a dns Resolver class to this server's active set
* @param r The resolver to add
* @param cached If this value is true, then the cache will

View File

@ -752,21 +752,6 @@ User* FindDescriptorHandler::Call(int socket)
return reinterpret_cast<User*>(Server->SE->GetRef(socket));
}
bool InspIRCd::AddMode(ModeHandler* mh)
{
return this->Modes->AddMode(mh);
}
bool InspIRCd::AddModeWatcher(ModeWatcher* mw)
{
return this->Modes->AddModeWatcher(mw);
}
bool InspIRCd::DelModeWatcher(ModeWatcher* mw)
{
return this->Modes->DelModeWatcher(mw);
}
bool InspIRCd::AddResolver(Resolver* r, bool cached)
{
if (!cached)
@ -800,10 +785,6 @@ const std::vector<std::string> ModuleManager::GetAllModuleNames(int filter)
ConfigReader::ConfigReader(InspIRCd* Instance) : ServerInstance(Instance)
{
/* Is there any reason to load the entire config file again here?
* it's needed if they specify another config file, but using the
* default one we can just use the global config data - pre-parsed!
*/
this->errorlog = new std::ostringstream(std::stringstream::in | std::stringstream::out);
this->error = CONF_NO_ERROR;
this->data = &ServerInstance->Config->config_data;

View File

@ -54,7 +54,7 @@ class ModuleAuditorium : public Module
: Module(Me)
{
aum = new AuditoriumMode(ServerInstance);
if (!ServerInstance->AddMode(aum))
if (!ServerInstance->Modes->AddMode(aum))
{
delete aum;
throw ModuleException("Could not add new modes!");

View File

@ -45,7 +45,7 @@ public:
ModuleBanException(InspIRCd* Me) : Module(Me)
{
be = new BanException(ServerInstance);
if (!ServerInstance->AddMode(be))
if (!ServerInstance->Modes->AddMode(be))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->PublishInterface("ChannelBanList", this);

View File

@ -193,7 +193,7 @@ class ModuleBanRedirect : public Module
re = new BanRedirect(Me);
nofollow = false;
if(!ServerInstance->AddModeWatcher(re))
if(!ServerInstance->Modes->AddModeWatcher(re))
{
delete re;
throw ModuleException("Could not add mode watcher");

View File

@ -58,7 +58,7 @@ public:
{
OnRehash(NULL,"");
bc = new BlockCaps(ServerInstance);
if (!ServerInstance->AddMode(bc))
if (!ServerInstance->Modes->AddMode(bc))
{
delete bc;
throw ModuleException("Could not add new modes!");

View File

@ -54,7 +54,7 @@ class ModuleBlockColour : public Module
ModuleBlockColour(InspIRCd* Me) : Module(Me)
{
bc = new BlockColor(ServerInstance);
if (!ServerInstance->AddMode(bc))
if (!ServerInstance->Modes->AddMode(bc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 2);

View File

@ -55,7 +55,7 @@ class ModuleBotMode : public Module
{
bm = new BotMode(ServerInstance);
if (!ServerInstance->AddMode(bm))
if (!ServerInstance->Modes->AddMode(bm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -97,7 +97,7 @@ class ModuleCensor : public Module
OnRehash(NULL,"");
cu = new CensorUser(ServerInstance);
cc = new CensorChannel(ServerInstance);
if (!ServerInstance->AddMode(cu) || !ServerInstance->AddMode(cc))
if (!ServerInstance->Modes->AddMode(cu) || !ServerInstance->Modes->AddMode(cc))
{
delete cu;
delete cc;

View File

@ -66,7 +66,7 @@ class ModuleChanFilter : public Module
: Module(Me)
{
cf = new ChanFilter(ServerInstance);
if (!ServerInstance->AddMode(cf))
if (!ServerInstance->Modes->AddMode(cf))
throw ModuleException("Could not add new modes!");
cf->DoImplements(this);

View File

@ -308,7 +308,7 @@ class ModuleChanProtect : public Module
cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf,DeprivOthers);
cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf,DeprivOthers);
if (!ServerInstance->AddMode(cp) || !ServerInstance->AddMode(cf))
if (!ServerInstance->Modes->AddMode(cp) || !ServerInstance->Modes->AddMode(cf))
{
delete cp;
delete cf;
@ -362,8 +362,8 @@ class ModuleChanProtect : public Module
cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf,DeprivOthers);
cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf,DeprivOthers);
/* These wont fail, we already owned the mode characters before */
ServerInstance->AddMode(cp);
ServerInstance->AddMode(cf);
ServerInstance->Modes->AddMode(cp);
ServerInstance->Modes->AddMode(cf);
ServerInstance->SNO->WriteToSnoMask('A', "WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change.");
}
}

View File

@ -337,7 +337,7 @@ class ModuleCloaking : public Module
}
/* Register it with the core */
if (!ServerInstance->AddMode(cu))
if (!ServerInstance->Modes->AddMode(cu))
{
delete cu;
throw ModuleException("Could not add new modes!");

View File

@ -52,7 +52,7 @@ class ModulePrivacyMode : public Module
ModulePrivacyMode(InspIRCd* Me) : Module(Me)
{
pm = new PrivacyMode(ServerInstance);
if (!ServerInstance->AddMode(pm))
if (!ServerInstance->Modes->AddMode(pm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 2);

View File

@ -60,7 +60,7 @@ class ModuleDeaf : public Module
: Module(Me)
{
m1 = new User_d(ServerInstance);
if (!ServerInstance->AddMode(m1))
if (!ServerInstance->Modes->AddMode(m1))
throw ModuleException("Could not add new modes!");
OnRehash(NULL, "");

View File

@ -65,7 +65,7 @@ class ModuleDelayJoin : public Module
: Module(Me)
{
djm = new DelayJoinMode(ServerInstance, this);
if (!ServerInstance->AddMode(djm))
if (!ServerInstance->Modes->AddMode(djm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnUserList, I_OnText };
ServerInstance->Modules->Attach(eventlist, this, 6);

View File

@ -115,7 +115,7 @@ class ModuleHelpop : public Module
{
ReadConfig();
ho = new Helpop(ServerInstance);
if (!ServerInstance->AddMode(ho))
if (!ServerInstance->Modes->AddMode(ho))
throw ModuleException("Could not add new modes!");
mycommand = new CommandHelpop(ServerInstance);
ServerInstance->AddCommand(mycommand);

View File

@ -59,7 +59,7 @@ class ModuleHideChans : public Module
{
hm = new HideChans(ServerInstance);
if (!ServerInstance->AddMode(hm))
if (!ServerInstance->Modes->AddMode(hm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -58,7 +58,7 @@ class ModuleHideOper : public Module
{
hm = new HideOper(ServerInstance);
if (!ServerInstance->AddMode(hm))
if (!ServerInstance->Modes->AddMode(hm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -159,10 +159,10 @@ class ModuleInvisible : public Module
{
conf = new ConfigReader(ServerInstance);
qm = new InvisibleMode(ServerInstance);
if (!ServerInstance->AddMode(qm))
if (!ServerInstance->Modes->AddMode(qm))
throw ModuleException("Could not add new modes!");
ido = new InvisibleDeOper(ServerInstance);
if (!ServerInstance->AddModeWatcher(ido))
if (!ServerInstance->Modes->AddModeWatcher(ido))
throw ModuleException("Could not add new mode watcher on usermode +o!");
/* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */

View File

@ -44,7 +44,7 @@ public:
ModuleInviteException(InspIRCd* Me) : Module(Me)
{
ie = new InviteException(ServerInstance);
if (!ServerInstance->AddMode(ie))
if (!ServerInstance->Modes->AddMode(ie))
throw ModuleException("Could not add new modes!");
ServerInstance->Modules->PublishInterface("ChannelBanList", this);

View File

@ -216,7 +216,7 @@ class ModuleJoinFlood : public Module
{
jf = new JoinFlood(ServerInstance);
if (!ServerInstance->AddMode(jf))
if (!ServerInstance->Modes->AddMode(jf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreJoin, I_OnUserJoin };
ServerInstance->Modules->Attach(eventlist, this, 3);

View File

@ -124,7 +124,7 @@ public:
{
kr = new KickRejoin(ServerInstance);
if (!ServerInstance->AddMode(kr))
if (!ServerInstance->Modes->AddMode(kr))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnUserPreJoin, I_OnUserKick };
ServerInstance->Modules->Attach(eventlist, this, 4);

View File

@ -102,7 +102,7 @@ class ModuleKnock : public Module
{
kn = new Knock(ServerInstance);
if (!ServerInstance->AddMode(kn))
if (!ServerInstance->Modes->AddMode(kn))
throw ModuleException("Could not add new modes!");
mycommand = new CommandKnock(ServerInstance);

View File

@ -209,7 +209,7 @@ class ModuleMsgFlood : public Module
{
mf = new MsgFlood(ServerInstance);
if (!ServerInstance->AddMode(mf))
if (!ServerInstance->Modes->AddMode(mf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNotice, I_OnUserPreMessage };
ServerInstance->Modules->Attach(eventlist, this, 3);

View File

@ -215,7 +215,7 @@ class ModuleNickFlood : public Module
{
jf = new NickFlood(ServerInstance);
if (!ServerInstance->AddMode(jf))
if (!ServerInstance->Modes->AddMode(jf))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNick };
ServerInstance->Modules->Attach(eventlist, this, 2);

View File

@ -55,7 +55,7 @@ class ModuleNoCTCP : public Module
{
nc = new NoCTCP(ServerInstance);
if (!ServerInstance->AddMode(nc))
if (!ServerInstance->Modes->AddMode(nc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 2);

View File

@ -51,7 +51,7 @@ class ModuleNoInvite : public Module
ModuleNoInvite(InspIRCd* Me) : Module(Me)
{
ni = new NoInvite(ServerInstance);
if (!ServerInstance->AddMode(ni))
if (!ServerInstance->Modes->AddMode(ni))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreInvite };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -55,7 +55,7 @@ class ModuleNoKicks : public Module
{
nk = new NoKicks(ServerInstance);
if (!ServerInstance->AddMode(nk))
if (!ServerInstance->Modes->AddMode(nk))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnAccessCheck };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -52,7 +52,7 @@ class ModuleNoNickChange : public Module
{
nn = new NoNicks(ServerInstance);
ServerInstance->AddMode(nn);
ServerInstance->Modes->AddMode(nn);
Implementation eventlist[] = { I_OnUserPreNick };
ServerInstance->Modules->Attach(eventlist, this, 1);
}

View File

@ -54,7 +54,7 @@ class ModuleNoNotice : public Module
{
nt = new NoNotice(ServerInstance);
if (!ServerInstance->AddMode(nt))
if (!ServerInstance->Modes->AddMode(nt))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -54,7 +54,7 @@ class ModuleOperChans : public Module
{
oc = new OperChans(ServerInstance);
if (!ServerInstance->AddMode(oc))
if (!ServerInstance->Modes->AddMode(oc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -54,7 +54,7 @@ public:
ModulePermanentChannels(InspIRCd* Me) : Module(Me)
{
p = new PermChannel(ServerInstance);
if (!ServerInstance->AddMode(p))
if (!ServerInstance->Modes->AddMode(p))
{
delete p;
throw ModuleException("Could not add new modes!");

View File

@ -105,7 +105,7 @@ class ModuleRedirect : public Module
{
re = new Redirect(ServerInstance);
if (!ServerInstance->AddMode(re))
if (!ServerInstance->Modes->AddMode(re))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -179,8 +179,8 @@ class ModuleServices : public Module
m4 = new User_r(ServerInstance);
m5 = new User_R(ServerInstance);
if (!ServerInstance->AddMode(m1) || !ServerInstance->AddMode(m2) || !ServerInstance->AddMode(m3)
|| !ServerInstance->AddMode(m4) || !ServerInstance->AddMode(m5))
if (!ServerInstance->Modes->AddMode(m1) || !ServerInstance->Modes->AddMode(m2) || !ServerInstance->Modes->AddMode(m3)
|| !ServerInstance->Modes->AddMode(m4) || !ServerInstance->Modes->AddMode(m5))
{
throw ModuleException("Could not add user and channel modes!");
}

View File

@ -118,7 +118,7 @@ class ModuleServicesAccount : public Module
m1 = new AChannel_R(ServerInstance);
m2 = new AChannel_M(ServerInstance);
m3 = new AUser_R(ServerInstance);
if (!ServerInstance->AddMode(m1) || !ServerInstance->AddMode(m2) || !ServerInstance->AddMode(m3))
if (!ServerInstance->Modes->AddMode(m1) || !ServerInstance->Modes->AddMode(m2) || !ServerInstance->Modes->AddMode(m3))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin,

View File

@ -46,7 +46,7 @@ class ModuleServProtectMode : public Module
{
bm = new ServProtectMode(ServerInstance);
if (!ServerInstance->AddMode(bm))
if (!ServerInstance->Modes->AddMode(bm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine };
ServerInstance->Modules->Attach(eventlist, this, 3);

View File

@ -60,7 +60,7 @@ class ModuleShowwhois : public Module
{
sw = new SeeWhois(ServerInstance);
if (!ServerInstance->AddMode(sw))
if (!ServerInstance->Modes->AddMode(sw))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhois };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -75,7 +75,7 @@ class ModuleSSLModes : public Module
sslm = new SSLMode(ServerInstance);
if (!ServerInstance->AddMode(sslm))
if (!ServerInstance->Modes->AddMode(sslm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreJoin };
ServerInstance->Modules->Attach(eventlist, this, 1);

View File

@ -92,7 +92,7 @@ class ModuleStripColor : public Module
usc = new UserStripColor(ServerInstance);
csc = new ChannelStripColor(ServerInstance);
if (!ServerInstance->AddMode(usc) || !ServerInstance->AddMode(csc))
if (!ServerInstance->Modes->AddMode(usc) || !ServerInstance->Modes->AddMode(csc))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 2);