mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Seperate ModeReference into ChanModeReference and UserModeReference
This commit is contained in:
parent
ac55270a08
commit
5288eb1594
@ -84,10 +84,16 @@ class dynamic_reference_nocheck : public dynamic_reference_base
|
||||
};
|
||||
|
||||
class ModeHandler;
|
||||
class ModeReference : public dynamic_reference_nocheck<ModeHandler>
|
||||
class ChanModeReference : public dynamic_reference_nocheck<ModeHandler>
|
||||
{
|
||||
public:
|
||||
ModeReference(Module* mod, const std::string& modename)
|
||||
ChanModeReference(Module* mod, const std::string& modename)
|
||||
: dynamic_reference_nocheck<ModeHandler>(mod, "mode/" + modename) {}
|
||||
};
|
||||
|
||||
class UserModeReference : public dynamic_reference_nocheck<ModeHandler>
|
||||
{
|
||||
public:
|
||||
UserModeReference(Module* mod, const std::string& modename)
|
||||
: dynamic_reference_nocheck<ModeHandler>(mod, "umode/" + modename) {}
|
||||
};
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <cstdarg>
|
||||
#include "mode.h"
|
||||
|
||||
static ModeReference ban(NULL, "ban");
|
||||
static ChanModeReference ban(NULL, "ban");
|
||||
|
||||
Channel::Channel(const std::string &cname, time_t ts)
|
||||
{
|
||||
|
@ -825,7 +825,7 @@ void ConfigReaderThread::Finish()
|
||||
*/
|
||||
ServerInstance->XLines->CheckELines();
|
||||
ServerInstance->XLines->ApplyLines();
|
||||
ModeReference ban(NULL, "ban");
|
||||
ChanModeReference ban(NULL, "ban");
|
||||
static_cast<ListModeBase*>(*ban)->DoRehash();
|
||||
Config->ApplyDisabledCommands(Config->DisabledCommands);
|
||||
User* user = ServerInstance->FindNick(TheUserUID);
|
||||
|
@ -415,11 +415,14 @@ void ModuleManager::AddService(ServiceProvider& item)
|
||||
throw ModuleException("Command "+std::string(item.name)+" already exists.");
|
||||
return;
|
||||
case SERVICE_MODE:
|
||||
if (!ServerInstance->Modes->AddMode(static_cast<ModeHandler*>(&item)))
|
||||
{
|
||||
ModeHandler* mh = static_cast<ModeHandler*>(&item);
|
||||
if (!ServerInstance->Modes->AddMode(mh))
|
||||
throw ModuleException("Mode "+std::string(item.name)+" already exists.");
|
||||
DataProviders.insert(std::make_pair("mode/" + item.name, &item));
|
||||
DataProviders.insert(std::make_pair((mh->GetModeType() == MODETYPE_CHANNEL ? "mode/" : "umode/") + item.name, &item));
|
||||
dynamic_reference_base::reset_all();
|
||||
return;
|
||||
}
|
||||
case SERVICE_METADATA:
|
||||
if (!ServerInstance->Extensions.Register(static_cast<ExtensionItem*>(&item)))
|
||||
throw ModuleException("Extension " + std::string(item.name) + " already exists.");
|
||||
@ -427,8 +430,8 @@ void ModuleManager::AddService(ServiceProvider& item)
|
||||
case SERVICE_DATA:
|
||||
case SERVICE_IOHOOK:
|
||||
{
|
||||
if (item.name.substr(0, 5) == "mode/")
|
||||
throw ModuleException("The \"mode/\" service name prefix is reserved.");
|
||||
if ((item.name.substr(0, 5) == "mode/") || (item.name.substr(0, 6) == "umode/"))
|
||||
throw ModuleException("The \"mode/\" and the \"umode\" service name prefixes are reserved.");
|
||||
|
||||
DataProviders.insert(std::make_pair(item.name, &item));
|
||||
std::string::size_type slash = item.name.find('/');
|
||||
|
@ -44,7 +44,7 @@ typedef std::vector<BanRedirectEntry> BanRedirectList;
|
||||
|
||||
class BanRedirect : public ModeWatcher
|
||||
{
|
||||
ModeReference ban;
|
||||
ChanModeReference ban;
|
||||
public:
|
||||
SimpleExtItem<BanRedirectList> extItem;
|
||||
BanRedirect(Module* parent)
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
class CommandCheck : public Command
|
||||
{
|
||||
ModeReference ban;
|
||||
ChanModeReference ban;
|
||||
public:
|
||||
CommandCheck(Module* parent)
|
||||
: Command(parent,"CHECK", 1)
|
||||
|
@ -108,7 +108,7 @@ void TreeSocket::SendFJoins(Channel* c)
|
||||
}
|
||||
this->WriteLine(line);
|
||||
|
||||
ModeReference ban(NULL, "ban");
|
||||
ChanModeReference ban(NULL, "ban");
|
||||
static_cast<ListModeBase*>(*ban)->DoSyncChannel(c, Utils->Creator, this);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user