const std::string name;
/** Type of service (must match object type) */
const ServiceType service;
- ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type)
- : creator(Creator), name(Name), service(Type) {}
+ ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type);
virtual ~ServiceProvider();
+
+ /** If called, this ServiceProvider won't be registered automatically
+ */
+ void DisableAutoRegister();
};
{
}
- void init()
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion()
{
return Version(cmd.name, VF_VENDOR|VF_CORE);
*/
virtual void DoRehash();
- /** Populate the Implements list with the correct events for a List Mode
- */
- virtual void DoImplements(Module* m);
-
/** Handle the list mode.
* See mode.h
*/
*/
class CoreExport ModuleManager
{
+ public:
+ typedef std::vector<ServiceProvider*> ServiceList;
+
private:
/** Holds a string describing the last module error to occur
*/
/** Loads all core modules (cmd_*)
*/
- void LoadCoreModules();
+ void LoadCoreModules(std::map<std::string, ServiceList>& servicemap);
/** Calls the Prioritize() method in all loaded modules
* @return True if all went well, false if a dependency loop was detected
/** List of data services keyed by name */
std::multimap<std::string, ServiceProvider*> DataProviders;
+ /** A list of ServiceProviders waiting to be registered.
+ * Non-NULL when constructing a Module, NULL otherwise.
+ * When non-NULL ServiceProviders add themselves to this list on creation and the core
+ * automatically registers them (that is, call AddService()) after the Module is constructed,
+ * and before Module::init() is called.
+ * If a service is created after the construction of the Module (for example in init()) it
+ * has to be registered manually.
+ */
+ ServiceList* NewServices;
+
/** Simple, bog-standard, boring constructor.
*/
ModuleManager();
/** Unregister a service provided by a module */
void DelService(ServiceProvider&);
+ /** Register all services in a given ServiceList
+ * @param list The list containing the services to register
+ */
+ void AddServices(const ServiceList& list);
+
inline void AddServices(ServiceProvider** list, int count)
{
for(int i=0; i < count; i++)
const std::string cap;
GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap)
{
- ServerInstance->Modules->AddService(ext);
}
void HandleEvent(Event& ev)
{
}
- void init()
- {
- ServerInstance->Modules->AddService(this->manager);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
std::string oldserver = DNSServer;
ph = &ptrHosts;
}
- void init()
- {
- ServerInstance->Modules->AddService(this->dnsLookup);
- ServerInstance->Modules->AddService(this->ptrHosts);
- }
-
void OnUserInit(LocalUser *user)
{
if (!DNS || !user->MyClass->resolvehostnames)
void init()
{
- ServerInstance->Modules->AddService(cmd);
ServerInstance->Modes->AddModeWatcher(&mw);
}
{
}
- void init()
- {
- ServerInstance->Modules->AddService(CommandPrivmsg);
- ServerInstance->Modules->AddService(CommandNotice);
- }
-
Version GetVersion()
{
return Version("PRIVMSG, NOTICE", VF_CORE|VF_VENDOR);
{
}
- void init()
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
void OnGarbageCollect()
{
// Remove all entries older than MaxKeep
}
}
-void ListModeBase::DoImplements(Module* m)
-{
- ServerInstance->Modules->AddService(extItem);
-}
-
unsigned int ListModeBase::FindLimit(const std::string& channame)
{
for (limitlist::iterator it = chanlimits.begin(); it != chanlimits.end(); ++it)
Module* newmod = NULL;
DLLManager* newhandle = new DLLManager(moduleFile.c_str());
+ ServiceList newservices;
+ if (!defer)
+ this->NewServices = &newservices;
try
{
newmod = newhandle->CallInit();
+ this->NewServices = NULL;
if (newmod)
{
ConfigStatus confstatus;
AttachAll(newmod);
+ AddServices(newservices);
newmod->init();
newmod->ReadConfig(confstatus);
}
catch (CoreException& modexcept)
{
+ this->NewServices = NULL;
+
// failure in module constructor
if (newmod)
{
}
/* We must load the modules AFTER initializing the socket engine, now */
-void ModuleManager::LoadCoreModules()
+void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicemap)
{
std::cout << std::endl << "Loading core commands";
fflush(stdout);
std::cout << ".";
fflush(stdout);
+ this->NewServices = &servicemap[entry->d_name];
+
if (!Load(entry->d_name, true))
{
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError());
{
Command* c = (*i)(this);
cmds.push_back(c);
- ServerInstance->Modules->AddService(*c);
}
}
catch (...)
if (it == modlist->end())
return false;
Module* mod = NULL;
+
+ ServiceList newservices;
+ if (!defer)
+ this->NewServices = &newservices;
+
try
{
mod = (*it->second->init)();
mod->ModuleDLLManager = NULL;
mod->dying = false;
Modules[name] = mod;
+ this->NewServices = NULL;
if (defer)
{
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s", name.c_str());
ConfigStatus confstatus;
AttachAll(mod);
+ AddServices(newservices);
mod->init();
mod->ReadConfig(confstatus);
}
}
catch (CoreException& modexcept)
{
+ this->NewServices = NULL;
+
if (mod)
DoSafeUnload(mod);
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason());
return true;
}
-void ModuleManager::LoadCoreModules()
+void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicemap)
{
- Load("cmd_all.so", true);
- Load("cmd_whowas.so", true);
- Load("cmd_lusers.so", true);
- Load("cmd_privmsg.so", true);
+ for (modmap::const_iterator i = modlist->begin(); i != modlist->end(); ++i)
+ {
+ const std::string modname = i->first;
+ if (modname[0] == 'c')
+ {
+ this->NewServices = &servicemap[modname];
+ Load(modname, true);
+ }
+ }
+ this->NewServices = NULL;
}
#endif
void Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, std::string&) { DetachEvent(I_OnSendWhoLine); }
void Module::OnSetUserIP(LocalUser*) { DetachEvent(I_OnSetUserIP); }
+ServiceProvider::ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type)
+ : creator(Creator), name(Name), service(Type)
+{
+ if ((ServerInstance) && (ServerInstance->Modules->NewServices))
+ ServerInstance->Modules->NewServices->push_back(this);
+}
+
+void ServiceProvider::DisableAutoRegister()
+{
+ if ((ServerInstance) && (ServerInstance->Modules->NewServices))
+ {
+ ModuleManager::ServiceList& list = *ServerInstance->Modules->NewServices;
+ ModuleManager::ServiceList::iterator it = std::find(list.begin(), list.end(), this);
+ if (it != list.end())
+ list.erase(it);
+ }
+}
+
ModuleManager::ModuleManager()
{
}
void ModuleManager::LoadAll()
{
- LoadCoreModules();
+ std::map<std::string, ServiceList> servicemap;
+ LoadCoreModules(servicemap);
ConfigTagList tags = ServerInstance->Config->ConfTags("module");
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
std::string name = tag->getString("name");
+ this->NewServices = &servicemap[name];
std::cout << "[" << con_green << "*" << con_reset << "] Loading module:\t" << con_green << name << con_reset << std::endl;
if (!this->Load(name, true))
{
ServerInstance->Logs->Log("MODULE", LOG_DEBUG, "Initializing %s", i->first.c_str());
AttachAll(mod);
+ AddServices(servicemap[i->first]);
mod->init();
mod->ReadConfig(confstatus);
}
return LastModuleError;
}
+void ModuleManager::AddServices(const ServiceList& list)
+{
+ for (ServiceList::const_iterator i = list.begin(); i != list.end(); ++i)
+ {
+ ServiceProvider& s = **i;
+ AddService(s);
+ }
+}
+
void ModuleManager::AddService(ServiceProvider& item)
{
switch (item.service)
if (gi == NULL)
throw ModuleException("Unable to initialize geoip, are you missing GeoIP.dat?");
- ServerInstance->Modules->AddService(ext);
-
for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
{
LocalUser* user = *i;
conn = NULL;
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(ldapAuthed);
- ServerInstance->Modules->AddService(ldapVhost);
- }
-
~ModuleLDAPAuth()
{
if (conn)
ReadConf();
ServerInstance->Threads->Start(queryDispatcher);
-
- ServerInstance->Modules->AddService(sqlserv);
}
~ModuleMsSQL()
PCREFactory ref;
ModuleRegexPCRE() : ref(this)
{
- ServerInstance->Modules->AddService(ref);
}
Version GetVersion() CXX11_OVERRIDE
public:
ModuleRegexPOSIX() : ref(this)
{
- ServerInstance->Modules->AddService(ref);
}
Version GetVersion() CXX11_OVERRIDE
public:
ModuleRegexRE2() : ref(this)
{
- ServerInstance->Modules->AddService(ref);
}
Version GetVersion() CXX11_OVERRIDE
StdRegexFactory ref;
ModuleRegexStd() : ref(this)
{
- ServerInstance->Modules->AddService(ref);
}
Version GetVersion() CXX11_OVERRIDE
public:
ModuleRegexTRE() : trf(this)
{
- ServerInstance->Modules->AddService(trf);
}
Version GetVersion() CXX11_OVERRIDE
// Void return, guess we assume success
gnutls_certificate_set_dh_params(iohook.x509_cred, dh_params);
-
- ServerInstance->Modules->AddService(iohook);
- ServerInstance->Modules->AddService(starttls);
}
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
// Needs the flag as it ignores a plain /rehash
OnModuleRehash(NULL,"ssl");
- ServerInstance->Modules->AddService(iohook);
}
void OnHookIO(StreamSocket* user, ListenSocket* lsb) CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(ni);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('A');
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(mycommand);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Display timestamps from all servers connected to the network", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(aum);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("auditorium");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(mh);
- mh.DoImplements(this);
- }
-
void OnPostJoin(Membership *memb) CXX11_OVERRIDE
{
if (!IS_LOCAL(memb->user))
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(be);
-
- be.DoImplements(this);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXCEPTS"] = "e";
void init() CXX11_OVERRIDE
{
ServerInstance->Modes->AddModeWatcher(&re);
- ServerInstance->Modules->AddService(re.extItem);
}
void OnCleanup(int target_type, void* item) CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(blockamsg);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Attempt to block /amsg, at least some of the irritating mIRC scripts.",VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(bc);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('B');
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(bc);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('c');
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(bm);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides user mode +B to mark the user as a bot",VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(myumode);
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(cmd.extInfo);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Implementation of callerid, usermode +g, /accept", VF_COMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(cmd.reghold);
- }
-
ModResult OnCheckReady(LocalUser* user) CXX11_OVERRIDE
{
/* Users in CAP state get held until CAP END */
void init() CXX11_OVERRIDE
{
ServerInstance->XLines->RegisterFactory(&f);
-
- ServerInstance->Modules->AddService(mycommand);
}
~ModuleCBan()
public:
ModuleCensor() : cu(this), cc(this) { }
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cu);
- ServerInstance->Modules->AddService(cc);
- }
-
// format of a config entry is <badword text="shit" replace="poo">
ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE
{
{
}
- void init() CXX11_OVERRIDE
- {
- ServiceProvider* providerlist[] = { &cmd, &cmd.realhost, &cmd.realip, &cmd.webirc_hostname, &cmd.webirc_ip, &waiting };
- ServerInstance->Modules->AddServices(providerlist, sizeof(providerlist)/sizeof(ServiceProvider*));
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
cmd.Hosts.clear();
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cf);
-
- cf.DoImplements(this);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
hidemask = ServerInstance->Config->ConfValue("chanfilter")->getBool("hidemask");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(m);
- ServerInstance->Modules->AddService(m.ext);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("chanhistory");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(mycommand);
- }
-
void ProtoSendMode(void* uv, TargetTypeFlags, void*, const std::vector<std::string>& result, const std::vector<TranslateType>&)
{
User* user = (User*)uv;
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for the CHGIDENT command", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for the CHGNAME command", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cu);
- ServerInstance->Modules->AddService(ck);
- ServerInstance->Modules->AddService(cu.ext);
- }
-
/** This function takes a domain name string and returns just the last two domain parts,
* or the last domain part if only two are available. Failing that it just returns what it was given.
*
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the /CLONES command to retrieve information on clones.", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides /CLOSE functionality", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(pm);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Adds user mode +c, which if set, users must be on a common channel with you to private message you", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(ext);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("waitpong");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(cmd.ctitle);
- }
-
// :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games.
ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text) CXX11_OVERRIDE
{
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides command CYCLE, acts as a server-side HOP command to part and rejoin a channel.", VF_VENDOR);
{
ext = new SimpleExtItem<dccallowlist>("dccallow", this);
ServerInstance->Modules->AddService(*ext);
- ServerInstance->Modules->AddService(cmd);
}
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(m1);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("deaf");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(djm);
- ServerInstance->Modules->AddService(unjoined);
- }
Version GetVersion() CXX11_OVERRIDE;
void OnNamesListItem(User* issuer, Membership*, std::string &prefixes, std::string &nick) CXX11_OVERRIDE;
void OnUserJoin(Membership*, bool, bool, CUList&) CXX11_OVERRIDE;
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(djm);
- ServerInstance->Modules->AddService(djm.jointime);
- }
Version GetVersion() CXX11_OVERRIDE;
void OnUserJoin(Membership* memb, bool sync, bool created, CUList&) CXX11_OVERRIDE;
ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE;
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides voiced users with the ability to devoice themselves.", VF_VENDOR);
public:
ModuleDNSBL() : DNS(this, "DNS"), nameExt("dnsbl_match", this), countExt("dnsbl_pending", this) { }
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(nameExt);
- ServerInstance->Modules->AddService(countExt);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides handling of DNS blacklists", VF_VENDOR);
void init() CXX11_OVERRIDE
{
- ServerInstance->Modules->AddService(eh.ec);
ServerInstance->OnCheckExemption = &eh;
}
std::set<std::string> exemptfromfilter; // List of channel names excluded from filtering.
ModuleFilter();
- void init() CXX11_OVERRIDE;
CullResult cull();
ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE;
FilterResult* FilterMatch(User* user, const std::string &text, int flags);
{
}
-void ModuleFilter::init()
-{
- ServerInstance->Modules->AddService(filtcommand);
-}
-
CullResult ModuleFilter::cull()
{
FreeFilters();
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd1);
- ServerInstance->Modules->AddService(cmd2);
- ServerInstance->Modules->AddService(cmd3);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Allows global loading of a module.", VF_COMMON | VF_VENDOR);
void init() CXX11_OVERRIDE
{
- ServerInstance->Modules->AddService(cmd);
ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
}
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(ho);
- ServerInstance->Modules->AddService(cmd);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
helpop_map.clear();
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(hm);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for hiding channels with user mode +I", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(hm);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for hiding oper status with user mode +H", VF_VENDOR);
void init() CXX11_OVERRIDE
{
HttpModule = this;
- ServerInstance->Modules->AddService(APIImpl);
}
ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(ext);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for RFC1413 ident lookups", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(ie);
- ie.DoImplements(this);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["INVEX"] = "I";
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(jf);
- ServerInstance->Modules->AddService(jf.ext);
- }
-
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
if (chan)
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(js);
- }
-
ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE
{
if (js.redirect_new_users)
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(kr);
- ServerInstance->Modules->AddService(kr.ext);
- }
-
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
if (chan)
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(kn);
- ServerInstance->Modules->AddService(cmd);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
std::string knocknotify = ServerInstance->Config->ConfValue("knock")->getString("notify");
void init() CXX11_OVERRIDE
{
locked = false;
- ServerInstance->Modules->AddService(lockcommand);
- ServerInstance->Modules->AddService(unlockcommand);
}
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
public:
ModuleMD5() : md5(this)
{
- ServerInstance->Modules->AddService(md5);
}
Version GetVersion() CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(mf);
- ServerInstance->Modules->AddService(mf.ext);
- }
-
ModResult ProcessMessages(User* user,Channel* dest, const std::string &text)
{
if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf))
public:
ModuleMLock() : mlock("mlock", this) {};
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(this->mlock);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Implements the ability to have server-side MLOCK enforcement.", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(dummyZ);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the ability to manipulate modes via long names.",VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(nf);
- ServerInstance->Modules->AddService(nf.ext);
- }
-
ModResult OnUserPreNick(User* user, const std::string &newnick) CXX11_OVERRIDE
{
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd1);
- ServerInstance->Modules->AddService(cmd2);
- ServerInstance->Modules->AddService(locked);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the NICKLOCK command, allows an oper to change a users nick and lock them to it until they quit", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(nc);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides channel mode +C to block CTCPs", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(nk);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('Q');
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(nn);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for channel mode +N & extban +b N: which prevents nick changes on channel", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(nt);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('T');
mycommand.npmh = np;
ServerInstance->Modules->AddService(*np);
- ServerInstance->Modules->AddService(mycommand);
}
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(oc);
- }
-
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
if (chan && chan->IsModeSet(oc) && !user->IsOper())
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Shows a message to opers after oper-up, adds /opermotd", VF_VENDOR | VF_OPTCOMMON);
void init() CXX11_OVERRIDE
{
- ServerInstance->Modules->AddService(opm);
-
/* To give clients a chance to learn about the new prefix we don't give +y to opers
* right now. That means if the module was loaded after opers have joined channels
* they need to rejoin them in order to get the oper prefix.
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) CXX11_OVERRIDE
{
if (hashtype.substr(0,5) == "hmac-")
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(p);
- }
-
CullResult cull()
{
/*
class AntiRedirect : public SimpleUserModeHandler
{
public:
- AntiRedirect(Module* Creator) : SimpleUserModeHandler(Creator, "antiredirect", 'L') {}
+ AntiRedirect(Module* Creator) : SimpleUserModeHandler(Creator, "antiredirect", 'L')
+ {
+ if (!ServerInstance->Config->ConfValue("redirect")->getBool("antiredirect"))
+ DisableAutoRegister();
+ }
};
class ModuleRedirect : public Module
{
/* Setting this here so it isn't changable by rehasing the config later. */
UseUsermode = ServerInstance->Config->ConfValue("redirect")->getBool("antiredirect");
-
- /* Channel mode */
- ServerInstance->Modules->AddService(re);
-
- /* Check to see if the usermode is enabled in the config */
- if (UseUsermode)
- {
- /* Log noting that this breaks compatability. */
- ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "REDIRECT: Enabled usermode +L. This breaks linking with servers that do not have this enabled. This is disabled by default in the 2.0 branch but will be enabled in the next version.");
-
- /* Try to add the usermode */
- ServerInstance->Modules->AddService(re_u);
- }
}
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
GlobFactory gf;
public:
- ModuleRegexGlob() : gf(this) {
- ServerInstance->Modules->AddService(gf);
+ ModuleRegexGlob()
+ : gf(this)
+ {
}
Version GetVersion() CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd1);
- ServerInstance->Modules->AddService(cmd2);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["REMOVE"];
public:
RepeatModule() : rm(this) {}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(rm);
- ServerInstance->Modules->AddService(rm.ChanSet);
- ServerInstance->Modules->AddService(rm.MemberInfoExt);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
rm.ReadConfig();
RIProv mr;
ModuleRIPEMD160() : mr(this)
{
- ServerInstance->Modules->AddService(mr);
}
Version GetVersion() CXX11_OVERRIDE
void init() CXX11_OVERRIDE
{
- ServerInstance->Modules->AddService(r);
ServerInstance->XLines->RegisterFactory(&f);
}
public:
ModuleRMode() : cmd(this) { }
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Allows glob-based removal of list modes", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides command SAJOIN to allow opers to force-join users to channels", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides a SAKICK command", VF_OPTCOMMON|VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides command SAMODE to allow opers to change modes on channels and users", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for SANICK command", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides command SAPART to force-part users from a channel.", VF_OPTCOMMON | VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for an SAQUIT command, exits user with a reason", VF_OPTCOMMON | VF_VENDOR);
void init() CXX11_OVERRIDE
{
- ServiceProvider* providelist[] = { &auth, &sasl, &authExt };
- ServerInstance->Modules->AddServices(providelist, 3);
-
if (!ServerInstance->Modules->Find("m_services_account.so") || !ServerInstance->Modules->Find("m_cap.so"))
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!");
}
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides a SATOPIC command", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServiceProvider* providerlist[] = { &m1, &m2, &m3, &m4, &m5, &accountname };
- ServerInstance->Modules->AddServices(providerlist, sizeof(providerlist)/sizeof(ServiceProvider*));
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('R');
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(bm);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides usermode +k to protect services from kicks, kills, and mode changes.", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for the SETIDENT command", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Allows opers to set their idle time", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for the SETNAME command", VF_VENDOR);
public:
ModuleSHA256() : sha(this)
{
- ServerInstance->Modules->AddService(sha);
}
Version GetVersion() CXX11_OVERRIDE
sw = new SeeWhois(this, OpersOnly);
ServerInstance->Modules->AddService(*sw);
- ServerInstance->Modules->AddService(cmd);
}
~ModuleShowwhois()
void init() CXX11_OVERRIDE
{
ServerInstance->XLines->RegisterFactory(&f);
- ServerInstance->Modules->AddService(cmd);
}
~ModuleShun()
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmdsilence);
- ServerInstance->Modules->AddService(cmdsvssilence);
- ServerInstance->Modules->AddService(cmdsilence.ext);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
maxsilence = ServerInstance->Config->ConfValue("showwhois")->getInt("maxentries", 32);
Utils = new SpanningTreeUtilities(this);
Utils->TreeRoot = new TreeServer;
commands = new SpanningTreeCommands(this);
- ServerInstance->Modules->AddService(commands->rconnect);
- ServerInstance->Modules->AddService(commands->rsquit);
- ServerInstance->Modules->AddService(commands->map);
delete ServerInstance->PI;
ServerInstance->PI = new SpanningTreeProtocolInterface;
ServerCommand::ServerCommand(Module* Creator, const std::string& Name, unsigned int MinParams, unsigned int MaxParams)
: CommandBase(Creator, Name, MinParams, MaxParams)
{
+ this->ServiceProvider::DisableAutoRegister();
ModuleSpanningTree* st = static_cast<ModuleSpanningTree*>(Creator);
st->CmdManager.AddCommand(this);
}
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(pendingExt);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* conf = ServerInstance->Config->ConfValue("sqlauth");
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(APIImpl);
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(cmd.CertExt);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("SSL Certificate Utilities", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(sslm);
- }
-
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
if(chan && chan->IsModeSet(sslm))
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(usc);
- ServerInstance->Modules->AddService(csc);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('S');
void init() CXX11_OVERRIDE
{
ServerInstance->XLines->RegisterFactory(&s);
- ServerInstance->Modules->AddService(cmd);
}
ModResult OnStats(char symbol, User* user, string_list &out) CXX11_OVERRIDE
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(cmd.swhois);
- }
-
// :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games.
ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text) CXX11_OVERRIDE
{
{
if (!strstr(ServerInstance->Config->ServerName.c_str(), ".test"))
throw ModuleException("Don't load modules without reading their descriptions!");
- ServerInstance->Modules->AddService(cmd);
}
Version GetVersion() CXX11_OVERRIDE
void init() CXX11_OVERRIDE
{
- ServerInstance->Modules->AddService(cmd);
ServerInstance->Modes->AddModeWatcher(&banwatcher);
}
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides /tline command used to test who a mask matches", VF_VENDOR);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- ServerInstance->Modules->AddService(topiclock);
- }
-
ModResult OnPreTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE
{
// Only fired for local users currently, but added a check anyway
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the UNINVITE command which lets users un-invite other users from channels", VF_VENDOR | VF_OPTCOMMON);
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["USERIP"];
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides masking of user hostnames via traditional /VHOST command",VF_VENDOR);
whos_watching_me = new watchentries();
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(cmdw);
- ServerInstance->Modules->AddService(sw);
- ServerInstance->Modules->AddService(cmdw.ext);
- }
-
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
maxwatch = ServerInstance->Config->ConfValue("watch")->getInt("maxentries", 32);