Improve storage of module description, flags, and link data.

This commit is contained in:
Sadie Powell 2020-04-09 18:57:50 +01:00
parent efe904f2f0
commit 1a800f7b3d
210 changed files with 681 additions and 1244 deletions

View File

@ -164,31 +164,6 @@ do { \
WHILE_EACH_HOOK(n); \
} while (0)
/** Holds a module's Version information.
* The members (set by the constructor only) indicate details as to the version number
* of a module. A class of type Version is returned by the GetVersion method of the Module class.
*/
class CoreExport Version
{
public:
/** Module description
*/
const std::string description;
/** Flags
*/
const int Flags;
/** Server linking description string */
const std::string link_data;
/** Simple module version */
Version(const std::string &desc, int flags = VF_NONE);
/** Complex version information, including linking compatability data */
Version(const std::string &desc, int flags, const std::string& linkdata);
};
class CoreExport DataProvider : public ServiceProvider
{
public:
@ -231,6 +206,13 @@ enum Implementation
*/
class CoreExport Module : public classbase, public usecountbase
{
protected:
/** Initializes a new instance of the Module class.
* @param mdesc A description of this module.
* @param mflags The properties of this module.
*/
Module(int mflags, const std::string& mdesc);
/** Detach an event from this module
* @param i Event type to detach
*/
@ -253,6 +235,12 @@ class CoreExport Module : public classbase, public usecountbase
*/
bool dying = false;
/** A description of this module. */
const std::string description;
/** The properties of this module. */
const int flags;
/** Module setup
* \exception ModuleException Throwing this class, or any class derived from ModuleException, causes loading of the module to abort.
*/
@ -268,21 +256,19 @@ class CoreExport Module : public classbase, public usecountbase
*/
virtual ~Module();
/** Called when the hooks provided by a module need to be prioritised. */
virtual void Prioritize() { }
/** Retrieves link compatibility data for this module.
* @param data The location to store link compatibility data.
*/
virtual void GetLinkData(std::string& data);
/** This method is called when you should reload module specific configuration:
* on boot, on a /REHASH and on module load.
* @param status The current status, can be inspected for more information;
* also used for reporting configuration errors and warnings.
* @param status The current status, can be inspected for more information.
*/
virtual void ReadConfig(ConfigStatus& status);
/** Returns the version number of a Module.
* The method should return a Version object with its version information assigned via
* Version::Version
*/
virtual Version GetVersion() = 0;
/** Called when the hooks provided by a module need to be prioritised. */
virtual void Prioritize();
/** Called when a user connects.
* The details of the connecting user are available to you in the parameter User *user

View File

@ -130,7 +130,8 @@ class CoreModChannel
public:
CoreModChannel()
: CheckExemption::EventListener(this, UINT_MAX)
: Module(VF_CORE | VF_VENDOR, "Provides the INVITE, JOIN, KICK, NAMES, and TOPIC commands")
, CheckExemption::EventListener(this, UINT_MAX)
, ISupport::EventListener(this)
, invapi(this)
, cmdinvite(this, invapi)
@ -372,11 +373,6 @@ class CoreModChannel
ServerInstance->Modules.SetPriority(this, I_OnPostJoin, PRIORITY_FIRST);
ServerInstance->Modules.SetPriority(this, I_OnUserPreJoin, PRIORITY_LAST);
}
Version GetVersion() override
{
return Version("Provides the INVITE, JOIN, KICK, NAMES, and TOPIC commands", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModChannel)

View File

@ -824,7 +824,8 @@ class ModuleDNS : public Module
public:
ModuleDNS()
: manager(this)
: Module(VF_CORE | VF_VENDOR, "Provides support for DNS lookups")
, manager(this)
{
}
@ -864,11 +865,6 @@ class ModuleDNS : public Module
}
}
}
Version GetVersion() override
{
return Version("Provides support for DNS lookups", VF_CORE|VF_VENDOR);
}
};
MODULE_INIT(ModuleDNS)

View File

@ -166,7 +166,8 @@ class ModuleHostnameLookup : public Module
public:
ModuleHostnameLookup()
: dnsLookup(this, "dnsLookup", ExtensionItem::EXT_USER)
: Module(VF_CORE | VF_VENDOR, "Provides support for DNS lookups on connecting clients")
, dnsLookup(this, "dnsLookup", ExtensionItem::EXT_USER)
, DNS(this, "DNS")
{
dl = &dnsLookup;
@ -206,11 +207,6 @@ class ModuleHostnameLookup : public Module
{
return this->dnsLookup.get(user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides support for DNS lookups on connecting clients", VF_CORE|VF_VENDOR);
}
};
MODULE_INIT(ModuleHostnameLookup)

View File

@ -66,22 +66,20 @@ CmdResult CommandModules::Handle(User* user, const Params& parameters)
for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
{
Module* m = i->second;
Version V = m->GetVersion();
if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"))
{
std::string flags("VCO");
size_t pos = 0;
for (int mult = 2; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
if (!(V.Flags & mult))
if (!(m->flags & mult))
flags[pos] = '-';
const char* srcrev = m->ModuleDLLManager->GetVersion();
user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, srcrev ? "*" : srcrev, flags, V.description);
user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, srcrev ? "*" : srcrev, flags, m->description);
}
else
{
user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, '*', '*', V.description);
user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, '*', '*', m->description);
}
}
user->WriteRemoteNumeric(RPL_ENDOFMODLIST, "End of MODULES list");

View File

@ -89,7 +89,8 @@ class CoreModInfo : public Module
}
public:
CoreModInfo()
: cmdadmin(this)
: Module(VF_CORE | VF_VENDOR, "Provides the ADMIN, COMMANDS, INFO, MODULES, MOTD, TIME, SERVLIST, and VERSION commands")
, cmdadmin(this)
, cmdcommands(this)
, cmdinfo(this)
, cmdmodules(this)
@ -188,11 +189,6 @@ class CoreModInfo : public Module
{
ServerInstance->Modules.SetPriority(this, I_OnUserConnect, PRIORITY_FIRST);
}
Version GetVersion() override
{
return Version("Provides the ADMIN, COMMANDS, INFO, MODULES, MOTD, TIME, SERVLIST, and VERSION commands", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModInfo)

View File

@ -213,7 +213,8 @@ class CoreModList
public:
CoreModList()
: ISupport::EventListener(this)
: Module(VF_CORE | VF_VENDOR, "Provides the LIST command")
, ISupport::EventListener(this)
, cmd(this)
{
}
@ -229,11 +230,6 @@ class CoreModList
tokens["ELIST"] = "CMNTU";
tokens["SAFELIST"];
}
Version GetVersion() override
{
return Version("Provides the LIST command", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModList)

View File

@ -123,14 +123,11 @@ class CoreModLoadModule : public Module
public:
CoreModLoadModule()
: cmdloadmod(this), cmdunloadmod(this)
: Module(VF_CORE | VF_VENDOR, "Provides the LOADMODULE and UNLOADMODULE commands")
, cmdloadmod(this)
, cmdunloadmod(this)
{
}
Version GetVersion() override
{
return Version("Provides the LOADMODULE and UNLOADMODULE commands", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModLoadModule)

View File

@ -146,7 +146,8 @@ class ModuleLusers : public Module
public:
ModuleLusers()
: invisiblemode(this, "invisible")
: Module(VF_CORE | VF_VENDOR, "Provides the LUSERS command")
, invisiblemode(this, "invisible")
, counters(invisiblemode)
, cmd(this, counters)
, mw(this, counters.invisible)
@ -165,11 +166,6 @@ class ModuleLusers : public Module
if (!user->server->IsULine() && user->IsModeSet(invisiblemode))
counters.invisible--;
}
Version GetVersion() override
{
return Version("Provides the LUSERS command", VF_VENDOR | VF_CORE);
}
};
MODULE_INIT(ModuleLusers)

View File

@ -391,7 +391,8 @@ class ModuleCoreMessage : public Module
public:
ModuleCoreMessage()
: cmdprivmsg(this, MSG_PRIVMSG)
: Module(VF_CORE | VF_VENDOR, "Provides the NOTICE, PRIVMSG, and SQUERY commands")
, cmdprivmsg(this, MSG_PRIVMSG)
, cmdnotice(this, MSG_NOTICE)
, cmdsquery(this)
, moderatedmode(this, "moderated")
@ -430,11 +431,6 @@ class ModuleCoreMessage : public Module
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides the NOTICE, PRIVMSG, and SQUERY commands", VF_CORE|VF_VENDOR);
}
};
MODULE_INIT(ModuleCoreMessage)

View File

@ -283,7 +283,8 @@ class CoreModMode
public:
CoreModMode()
: ISupport::EventListener(this)
: Module(VF_CORE | VF_VENDOR, "Provides the MODE command")
, ISupport::EventListener(this)
, cmdmode(this)
{
}
@ -293,11 +294,6 @@ class CoreModMode
tokens["CHANMODES"] = ServerInstance->Modes.GiveModeList(MODETYPE_CHANNEL);
tokens["USERMODES"] = ServerInstance->Modes.GiveModeList(MODETYPE_USER);
}
Version GetVersion() override
{
return Version("Provides the MODE command", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModMode)

View File

@ -32,7 +32,8 @@ class CoreModOper : public Module
public:
CoreModOper()
: cmddie(this)
: Module(VF_CORE | VF_VENDOR, "Provides the DIE, KILL, OPER, REHASH, and RESTART commands")
, cmddie(this)
, cmdkill(this)
, cmdoper(this)
, cmdrehash(this)
@ -61,11 +62,6 @@ class CoreModOper : public Module
if (!klass.empty())
luser->SetClass(klass);
}
Version GetVersion() override
{
return Version("Provides the DIE, KILL, OPER, REHASH, and RESTART commands", VF_VENDOR | VF_CORE);
}
};
MODULE_INIT(CoreModOper)

View File

@ -773,14 +773,10 @@ class CoreModReloadmodule : public Module
public:
CoreModReloadmodule()
: cmd(this)
: Module(VF_CORE | VF_VENDOR, "Provides the RELOADMODULE command")
, cmd(this)
{
}
Version GetVersion() override
{
return Version("Provides the RELOADMODULE command", VF_CORE | VF_VENDOR);
}
};
MODULE_INIT(CoreModReloadmodule)

View File

@ -229,7 +229,8 @@ class ModuleCoreRFCSerializer : public Module
public:
ModuleCoreRFCSerializer()
: rfcserializer(this)
: Module(VF_CORE | VF_VENDOR, "RFC client protocol serializer and unserializer")
, rfcserializer(this)
{
}
@ -248,11 +249,6 @@ class ModuleCoreRFCSerializer : public Module
if (!user->serializer)
user->serializer = &rfcserializer;
}
Version GetVersion() override
{
return Version("RFC client protocol serializer and unserializer", VF_CORE|VF_VENDOR);
}
};
MODULE_INIT(ModuleCoreRFCSerializer)

View File

@ -412,7 +412,8 @@ class CoreModStats : public Module
public:
CoreModStats()
: cmd(this)
: Module(VF_CORE | VF_VENDOR, "Provides the STATS command")
, cmd(this)
{
}
@ -422,10 +423,6 @@ class CoreModStats : public Module
cmd.userstats = security->getString("userstats");
}
Version GetVersion() override
{
return Version("Provides the STATS command", VF_CORE | VF_VENDOR);
}
};
MODULE_INIT(CoreModStats)

View File

@ -184,7 +184,8 @@ class CoreModStub : public Module
public:
CoreModStub()
: cmdconnect(this)
: Module(VF_CORE | VF_VENDOR, "Provides stubs for unimplemented commands")
, cmdconnect(this)
, cmdlinks(this)
, cmdserver(this)
, cmdsquit(this)
@ -192,11 +193,6 @@ class CoreModStub : public Module
, cmdusers(this)
{
}
Version GetVersion() override
{
return Version("Provides stubs for unimplemented commands", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModStub)

View File

@ -156,7 +156,8 @@ class CoreModUser : public Module
public:
CoreModUser()
: cmdaway(this)
: Module(VF_CORE | VF_VENDOR, "Provides the AWAY, ISON, NICK, PART, PASS, PING, PONG, QUIT, USERHOST, and USER commands")
, cmdaway(this)
, cmdnick(this)
, cmdpart(this)
, cmdpass(this)
@ -177,11 +178,6 @@ class CoreModUser : public Module
cmdpart.msgwrap.ReadConfig("prefixpart", "suffixpart", "fixedpart");
cmdquit.msgwrap.ReadConfig("prefixquit", "suffixquit", "fixedquit");
}
Version GetVersion() override
{
return Version("Provides the AWAY, ISON, NICK, PART, PASS, PING, PONG, QUIT, USERHOST, and USER commands", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModUser)

View File

@ -87,14 +87,10 @@ class CoreModWallops : public Module
public:
CoreModWallops()
: cmd(this)
: Module(VF_CORE | VF_VENDOR, "Provides the WALLOPS command")
, cmd(this)
{
}
Version GetVersion() override
{
return Version("Provides the WALLOPS command", VF_CORE | VF_VENDOR);
}
};
MODULE_INIT(CoreModWallops)

View File

@ -591,7 +591,8 @@ class CoreModWho
public:
CoreModWho()
: ISupport::EventListener(this)
: Module(VF_CORE | VF_VENDOR, "Provides the WHO command")
, ISupport::EventListener(this)
, cmd(this)
{
}
@ -600,11 +601,6 @@ class CoreModWho
{
tokens["WHOX"];
}
Version GetVersion() override
{
return Version("Provides the WHO command", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModWho)

View File

@ -357,7 +357,8 @@ class CoreModWhois : public Module
public:
CoreModWhois()
: cmd(this)
: Module(VF_CORE | VF_VENDOR, "Provides the WHOIS command")
, cmd(this)
{
}
@ -379,11 +380,6 @@ class CoreModWhois : public Module
cmd.genericoper = security->getBool("genericoper");
cmd.splitwhois = newsplitstate;
}
Version GetVersion() override
{
return Version("Provides the WHOIS command", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModWhois)

View File

@ -411,7 +411,8 @@ class ModuleWhoWas : public Module, public Stats::EventListener
public:
ModuleWhoWas()
: Stats::EventListener(this)
: Module(VF_CORE | VF_VENDOR, "Provides the WHOWAS command")
, Stats::EventListener(this)
, cmd(this)
{
}
@ -444,11 +445,6 @@ class ModuleWhoWas : public Module, public Stats::EventListener
cmd.manager.UpdateConfig(NewGroupSize, NewMaxGroups, NewMaxKeep);
}
Version GetVersion() override
{
return Version("Provides the WHOWAS command", VF_VENDOR);
}
};
MODULE_INIT(ModuleWhoWas)

View File

@ -64,7 +64,12 @@ class CoreModXLine : public Module
public:
CoreModXLine()
: cmdeline(this), cmdgline(this), cmdkline(this), cmdqline(this), cmdzline(this)
: Module(VF_CORE | VF_VENDOR, "Provides the ELINE, GLINE, KLINE, QLINE, and ZLINE commands")
, cmdeline(this)
, cmdgline(this)
, cmdkline(this)
, cmdqline(this)
, cmdzline(this)
{
}
@ -104,11 +109,6 @@ class CoreModXLine : public Module
// ELines in XLineManager::CheckELines() and expire them here instead.
ServerInstance->XLines->GetAll("E");
}
Version GetVersion() override
{
return Version("Provides the ELINE, GLINE, KLINE, QLINE, and ZLINE commands", VF_VENDOR|VF_CORE);
}
};
MODULE_INIT(CoreModXLine)

View File

@ -86,9 +86,8 @@ bool ModuleManager::Load(const std::string& modname, bool defer)
newmod->init();
newmod->ReadConfig(confstatus);
Version v = newmod->GetVersion();
ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)%s",
filename.c_str(), version, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
filename.c_str(), version, (!(newmod->flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
}
}
else

View File

@ -44,13 +44,9 @@ void dynamic_reference_base::reset_all()
(*i)->resolve();
}
// Version is a simple class for holding a modules version number
Version::Version(const std::string &desc, int flags) : description(desc), Flags(flags)
{
}
Version::Version(const std::string &desc, int flags, const std::string& linkdata)
: description(desc), Flags(flags), link_data(linkdata)
Module::Module(int mflags, const std::string& mdesc)
: description(mdesc)
, flags(mflags)
{
}
@ -71,6 +67,8 @@ void Module::DetachEvent(Implementation i)
ServerInstance->Modules.Detach(i, this);
}
void Module::GetLinkData(std::string& out) { }
void Module::Prioritize() { }
void Module::ReadConfig(ConfigStatus& status) { }
ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { DetachEvent(I_OnSendSnotice); return MOD_RES_PASSTHRU; }
void Module::OnUserConnect(LocalUser*) { DetachEvent(I_OnUserConnect); }

View File

@ -142,7 +142,8 @@ class ModuleGeoMaxMind : public Module
public:
ModuleGeoMaxMind()
: geoapi(this)
: Module(VF_VENDOR, "Provides Geolocation lookups using the libMaxMindDB library")
, geoapi(this)
{
memset(&geoapi.mmdb, 0, sizeof(geoapi.mmdb));
}
@ -152,11 +153,6 @@ class ModuleGeoMaxMind : public Module
MMDB_close(&geoapi.mmdb);
}
Version GetVersion() override
{
return Version("Provides Geolocation lookups using the libMaxMindDB library", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("maxmind");

View File

@ -621,6 +621,11 @@ class ModuleLDAP : public Module
}
}
ModuleLDAP()
: Module(VF_VENDOR, "Provides LDAP support")
{
}
~ModuleLDAP()
{
for (ServiceMap::iterator i = LDAPServices.begin(); i != LDAPServices.end(); ++i)
@ -631,11 +636,6 @@ class ModuleLDAP : public Module
delete conn;
}
}
Version GetVersion() override
{
return Version("Provides LDAP support", VF_VENDOR);
}
};
int LDAPBind::run()

View File

@ -139,10 +139,10 @@ class ModuleSQL : public Module
ConnMap connections; // main thread only
void init() override;
ModuleSQL();
~ModuleSQL();
void ReadConfig(ConfigStatus& status) override;
void OnUnloadModule(Module* mod) override;
Version GetVersion() override;
};
class DispatcherThread : public SocketThread
@ -442,6 +442,11 @@ void ModuleSQL::init()
Dispatcher->Start();
}
ModuleSQL::ModuleSQL()
: Module(VF_VENDOR, "Provides MySQL support")
{
}
ModuleSQL::~ModuleSQL()
{
if (Dispatcher)
@ -535,11 +540,6 @@ void ModuleSQL::OnUnloadModule(Module* mod)
Dispatcher->OnNotify();
}
Version ModuleSQL::GetVersion()
{
return Version("Provides MySQL support", VF_VENDOR);
}
void DispatcherThread::OnStart()
{
this->LockQueue();

View File

@ -537,6 +537,11 @@ class ModulePgSQL : public Module
ConnMap connections;
ReconnectTimer* retimer = nullptr;
ModulePgSQL()
: Module(VF_VENDOR, "PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API")
{
}
~ModulePgSQL()
{
delete retimer;
@ -611,11 +616,6 @@ class ModulePgSQL : public Module
}
}
}
Version GetVersion() override
{
return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR);
}
};
bool ReconnectTimer::Tick(time_t time)

View File

@ -81,15 +81,14 @@ class PCREFactory : public RegexFactory
class ModuleRegexPCRE : public Module
{
public:
private:
PCREFactory ref;
ModuleRegexPCRE() : ref(this)
{
}
Version GetVersion() override
public:
ModuleRegexPCRE()
: Module(VF_VENDOR, "Regex Provider Module for PCRE")
, ref(this)
{
return Version("Regex Provider Module for PCRE", VF_VENDOR);
}
};

View File

@ -77,18 +77,16 @@ class PosixFactory : public RegexFactory
class ModuleRegexPOSIX : public Module
{
private:
PosixFactory ref;
public:
ModuleRegexPOSIX() : ref(this)
ModuleRegexPOSIX()
: Module(VF_VENDOR, "Regex Provider Module for POSIX Regular Expressions")
, ref(this)
{
}
Version GetVersion() override
{
return Version("Regex Provider Module for POSIX Regular Expressions", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override
{
ref.extended = ServerInstance->Config->ConfValue("posix")->getBool("extended");

View File

@ -71,17 +71,15 @@ class RE2Factory : public RegexFactory
class ModuleRegexRE2 : public Module
{
private:
RE2Factory ref;
public:
ModuleRegexRE2() : ref(this)
ModuleRegexRE2()
: Module(VF_VENDOR, "Regex Provider Module for RE2")
, ref(this)
{
}
Version GetVersion() override
{
return Version("Regex Provider Module for RE2", VF_VENDOR);
}
};
MODULE_INIT(ModuleRegexRE2)

View File

@ -83,17 +83,15 @@ class TREFactory : public RegexFactory
class ModuleRegexTRE : public Module
{
private:
TREFactory trf;
public:
ModuleRegexTRE() : trf(this)
ModuleRegexTRE()
: Module(VF_VENDOR, "Regex Provider Module for TRE Regular Expressions")
, trf(this)
{
}
Version GetVersion() override
{
return Version("Regex Provider Module for TRE Regular Expressions", VF_VENDOR);
}
};
MODULE_INIT(ModuleRegexTRE)

View File

@ -228,9 +228,15 @@ class SQLConn : public SQL::Provider
class ModuleSQLite3 : public Module
{
private:
ConnMap conns;
public:
ModuleSQLite3()
: Module(VF_VENDOR, "Provides SQLite3 support")
{
}
~ModuleSQLite3()
{
ClearConns();
@ -260,11 +266,6 @@ class ModuleSQLite3 : public Module
ServerInstance->Modules.AddService(*conn);
}
}
Version GetVersion() override
{
return Version("Provides SQLite3 support", VF_VENDOR);
}
};
MODULE_INIT(ModuleSQLite3)

View File

@ -1185,6 +1185,7 @@ class ModuleSSLGnuTLS : public Module
public:
ModuleSSLGnuTLS()
: Module(VF_VENDOR, "Provides SSL support via GnuTLS")
{
thismod = this;
}
@ -1232,11 +1233,6 @@ class ModuleSSLGnuTLS : public Module
}
}
Version GetVersion() override
{
return Version("Provides SSL support via GnuTLS", VF_VENDOR);
}
ModResult OnCheckReady(LocalUser* user) override
{
const GnuTLSIOHook* const iohook = static_cast<GnuTLSIOHook*>(user->eh.GetModHook(this));

View File

@ -855,6 +855,7 @@ mbedTLS::Profile& mbedTLSIOHook::GetProfile()
class ModuleSSLmbedTLS : public Module
{
private:
typedef std::vector<reference<mbedTLSIOHookProvider> > ProfileList;
mbedTLS::Entropy entropy;
@ -926,6 +927,11 @@ class ModuleSSLmbedTLS : public Module
}
public:
ModuleSSLmbedTLS()
: Module(VF_VENDOR, "Provides SSL support via mbedTLS (PolarSSL)")
{
}
void init() override
{
char verbuf[16]; // Should be at least 9 bytes in size
@ -974,11 +980,6 @@ class ModuleSSLmbedTLS : public Module
return MOD_RES_DENY;
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides SSL support via mbedTLS (PolarSSL)", VF_VENDOR);
}
};
MODULE_INIT(ModuleSSLmbedTLS)

View File

@ -960,6 +960,7 @@ class ModuleSSLOpenSSL : public Module
public:
ModuleSSLOpenSSL()
: Module(VF_VENDOR, "Provides SSL support via OpenSSL")
{
// Initialize OpenSSL
OPENSSL_init_ssl(0, NULL);
@ -1022,11 +1023,6 @@ class ModuleSSLOpenSSL : public Module
return MOD_RES_DENY;
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides SSL support via OpenSSL", VF_VENDOR);
}
};
MODULE_INIT(ModuleSSLOpenSSL)

View File

@ -30,6 +30,11 @@ class ModuleSSLRehashSignal : public Module
}
public:
ModuleSSLRehashSignal()
: Module(VF_VENDOR, "Reloads SSL credentials on SIGUSR1")
{
}
~ModuleSSLRehashSignal()
{
signal(SIGUSR1, SIG_IGN);
@ -53,11 +58,6 @@ class ModuleSSLRehashSignal : public Module
FOREACH_MOD(OnModuleRehash, (NULL, str));
signaled = 0;
}
Version GetVersion()
{
return Version("Reloads SSL credentials on SIGUSR1", VF_VENDOR);
}
};
MODULE_INIT(ModuleSSLRehashSignal)

View File

@ -32,16 +32,16 @@ enum
class ModuleAbbreviation : public Module
{
public:
ModuleAbbreviation()
: Module(VF_VENDOR, "Provides the ability to abbreviate commands a-la BBC BASIC keywords")
{
}
void Prioritize() override
{
ServerInstance->Modules.SetPriority(this, I_OnPreCommand, PRIORITY_FIRST);
}
Version GetVersion() override
{
return Version("Provides the ability to abbreviate commands a-la BBC BASIC keywords", VF_VENDOR);
}
ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override
{
/* Command is already validated, has a length of 0, or last character is not a . */

View File

@ -115,15 +115,11 @@ class ModuleAlias : public Module
}
ModuleAlias()
: botmode(this, "bot")
: Module(VF_VENDOR, "Provides aliases of commands")
, botmode(this, "bot")
{
}
Version GetVersion() override
{
return Version("Provides aliases of commands", VF_VENDOR);
}
std::string GetVar(std::string varname, const std::string &original_line)
{
irc::spacesepstream ss(original_line);

View File

@ -35,7 +35,8 @@ class ModuleAllowInvite
public:
ModuleAllowInvite()
: ISupport::EventListener(this)
: Module(VF_VENDOR, "Provides channel mode +A to allow /INVITE freely on a channel, and extban 'A' to deny specific users it")
, ISupport::EventListener(this)
, ni(this, "allowinvite", 'A')
{
}
@ -65,11 +66,6 @@ class ModuleAllowInvite
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides channel mode +A to allow /INVITE freely on a channel, and extban 'A' to deny specific users it", VF_VENDOR);
}
};
MODULE_INIT(ModuleAllowInvite)

View File

@ -53,18 +53,15 @@ class CommandAlltime : public Command
class Modulealltime : public Module
{
private:
CommandAlltime mycommand;
public:
Modulealltime()
: mycommand(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the ALLTIME command, displays timestamps from all servers connected to the network")
, mycommand(this)
{
}
Version GetVersion() override
{
return Version("Provides the ALLTIME command, displays timestamps from all servers connected to the network", VF_OPTCOMMON | VF_VENDOR);
}
};
MODULE_INIT(Modulealltime)

View File

@ -180,7 +180,8 @@ class ModuleAntiCaps : public Module
public:
ModuleAntiCaps()
: exemptionprov(this)
: Module(VF_VENDOR | VF_COMMON, "Provides support for punishing users that send capitalised messages")
, exemptionprov(this)
, mode(this)
{
}
@ -296,11 +297,6 @@ class ModuleAntiCaps : public Module
}
return MOD_RES_DENY;
}
Version GetVersion() override
{
return Version("Provides support for punishing users that send capitalised messages", VF_COMMON|VF_VENDOR);
}
};
MODULE_INIT(ModuleAntiCaps)

View File

@ -74,7 +74,8 @@ class ModuleAuditorium
public:
ModuleAuditorium()
: Names::EventListener(this)
: Module(VF_VENDOR, "Provides channel mode +u, auditorium channels where nobody can see others joining and parting or the nick list")
, Names::EventListener(this)
, Who::EventListener(this)
, exemptionprov(this)
, aum(this)
@ -90,11 +91,6 @@ class ModuleAuditorium
OperCanSee = tag->getBool("opercansee", true);
}
Version GetVersion() override
{
return Version("Provides channel mode +u, auditorium channels where nobody can see others joining and parting or the nick list", VF_VENDOR);
}
/* Can they be seen by everyone? */
bool IsVisible(Membership* memb)
{

View File

@ -86,7 +86,9 @@ class ModuleAutoOp : public Module
AutoOpList mh;
public:
ModuleAutoOp() : mh(this)
ModuleAutoOp()
: Module(VF_VENDOR, "Provides channel mode +w, basic channel access controls")
, mh(this)
{
}
@ -119,11 +121,6 @@ class ModuleAutoOp : public Module
{
mh.DoRehash();
}
Version GetVersion() override
{
return Version("Provides channel mode +w, basic channel access controls", VF_VENDOR);
}
};
MODULE_INIT(ModuleAutoOp)

View File

@ -53,7 +53,8 @@ class ModuleBanException
public:
ModuleBanException()
: ISupport::EventListener(this)
: Module(VF_VENDOR, "Provides channel mode +e, ban exceptions")
, ISupport::EventListener(this)
, be(this)
{
}
@ -108,11 +109,6 @@ class ModuleBanException
{
be.DoRehash();
}
Version GetVersion() override
{
return Version("Provides channel mode +e, ban exceptions", VF_VENDOR);
}
};
MODULE_INIT(ModuleBanException)

View File

@ -247,6 +247,7 @@ class BanRedirect : public ModeWatcher
class ModuleBanRedirect : public Module
{
private:
BanRedirect re;
bool nofollow = false;
ChanModeReference limitmode;
@ -254,7 +255,8 @@ class ModuleBanRedirect : public Module
public:
ModuleBanRedirect()
: re(this)
: Module(VF_VENDOR | VF_COMMON, "Allows an extended ban (+b) syntax redirecting banned users to another channel")
, re(this)
, limitmode(this, "limit")
, redirectmode(this, "redirect")
{
@ -349,11 +351,6 @@ class ModuleBanRedirect : public Module
}
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Allows an extended ban (+b) syntax redirecting banned users to another channel", VF_COMMON|VF_VENDOR);
}
};
MODULE_INIT(ModuleBanRedirect)

View File

@ -80,10 +80,13 @@ class BCryptProvider : public HashProvider
class ModuleBCrypt : public Module
{
private:
BCryptProvider bcrypt;
public:
ModuleBCrypt() : bcrypt(this)
ModuleBCrypt()
: Module(VF_VENDOR, "Implements bcrypt hashing")
, bcrypt(this)
{
}
@ -92,11 +95,6 @@ class ModuleBCrypt : public Module
ConfigTag* conf = ServerInstance->Config->ConfValue("bcrypt");
bcrypt.rounds = conf->getUInt("rounds", 10, 1);
}
Version GetVersion() override
{
return Version("Implements bcrypt hashing", VF_VENDOR);
}
};
MODULE_INIT(ModuleBCrypt)

View File

@ -55,15 +55,10 @@ class ModuleBlockAmsg : public Module
public:
ModuleBlockAmsg()
: blockamsg(this, "blockamsg", ExtensionItem::EXT_USER)
: Module(VF_VENDOR, "Attempt to block /amsg or /ame, at least some of the irritating client scripts")
, blockamsg(this, "blockamsg", ExtensionItem::EXT_USER)
{
}
Version GetVersion() override
{
return Version("Attempt to block /amsg or /ame, at least some of the irritating client scripts", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("blockamsg");

View File

@ -41,7 +41,8 @@ class ModuleBlockColor
public:
ModuleBlockColor()
: ISupport::EventListener(this)
: Module(VF_VENDOR, "Provides channel mode +c to block color")
, ISupport::EventListener(this)
, exemptionprov(this)
, bc(this, "blockcolor", 'c')
{
@ -81,11 +82,6 @@ class ModuleBlockColor
}
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides channel mode +c to block color",VF_VENDOR);
}
};
MODULE_INIT(ModuleBlockColor)

View File

@ -68,17 +68,13 @@ class ModuleBotMode : public Module, public Whois::EventListener
public:
ModuleBotMode()
: Whois::EventListener(this)
: Module(VF_VENDOR, "Provides user mode +B to mark the user as a bot")
, Whois::EventListener(this)
, bm(this, "bot", 'B')
, tag(this, bm)
{
}
Version GetVersion() override
{
return Version("Provides user mode +B to mark the user as a bot",VF_VENDOR);
}
void OnWhois(Whois::Context& whois) override
{
if (whois.GetTarget()->IsModeSet(bm))

View File

@ -388,7 +388,8 @@ class ModuleCallerID
public:
ModuleCallerID()
: CTCTags::EventListener(this)
: Module(VF_VENDOR | VF_COMMON, "Implementation of callerid, provides user mode +g and the ACCEPT command")
, CTCTags::EventListener(this)
, ISupport::EventListener(this)
, cmd(this)
, api(this, cmd.extInfo)
@ -396,11 +397,6 @@ public:
{
}
Version GetVersion() override
{
return Version("Implementation of callerid, provides user mode +g and the ACCEPT command", VF_COMMON | VF_VENDOR);
}
void OnBuildISupport(ISupport::TokenMap& tokens) override
{
tokens["ACCEPT"] = ConvToStr(cmd.maxaccepts);

View File

@ -493,7 +493,8 @@ class ModuleCap : public Module
public:
ModuleCap()
: cmd(this)
: Module(VF_VENDOR, "Provides support for CAP capability negotiation")
, cmd(this)
, cap(this)
{
}
@ -502,11 +503,6 @@ class ModuleCap : public Module
{
return (cmd.holdext.get(user) ? MOD_RES_DENY : MOD_RES_PASSTHRU);
}
Version GetVersion() override
{
return Version("Provides support for CAP capability negotiation", VF_VENDOR);
}
};
MODULE_INIT(ModuleCap)

View File

@ -167,7 +167,8 @@ class ModuleCBan : public Module, public Stats::EventListener
public:
ModuleCBan()
: Stats::EventListener(this)
: Module(VF_VENDOR | VF_COMMON, "Provides the CBAN command, like Q-lines, but for channels")
, Stats::EventListener(this)
, mycommand(this)
{
}
@ -207,11 +208,6 @@ class ModuleCBan : public Module, public Stats::EventListener
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides the CBAN command, like Q-lines, but for channels", VF_COMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleCBan)

View File

@ -32,6 +32,7 @@ typedef insp::flat_map<std::string, std::string, irc::insensitive_swo> censor_t;
class ModuleCensor : public Module
{
private:
CheckExemption::EventProvider exemptionprov;
censor_t censors;
SimpleUserModeHandler cu;
@ -39,7 +40,8 @@ class ModuleCensor : public Module
public:
ModuleCensor()
: exemptionprov(this)
: Module(VF_VENDOR, "Provides user and channel mode +G")
, exemptionprov(this)
, cu(this, "u_censor", 'G')
, cc(this, "censor", 'G')
{
@ -119,12 +121,6 @@ class ModuleCensor : public Module
}
censors.swap(newcensors);
}
Version GetVersion() override
{
return Version("Provides user and channel mode +G", VF_VENDOR);
}
};
MODULE_INIT(ModuleCensor)

View File

@ -268,7 +268,8 @@ class ModuleCgiIRC
public:
ModuleCgiIRC()
: WebIRC::EventListener(this)
: Module(VF_VENDOR, "Enables forwarding the real IP address of a user from a gateway to the IRC server")
, WebIRC::EventListener(this)
, Whois::EventListener(this)
, cmd(this)
{
@ -463,11 +464,6 @@ class ModuleCgiIRC
else
whois.SendLine(RPL_WHOISGATEWAY, *realhost, *realip, "is connected via an ident gateway");
}
Version GetVersion() override
{
return Version("Enables forwarding the real IP address of a user from a gateway to the IRC server", VF_VENDOR);
}
};
MODULE_INIT(ModuleCgiIRC)

View File

@ -28,16 +28,16 @@
class ModuleChanCreate : public Module
{
public:
ModuleChanCreate()
: Module(VF_VENDOR, "Provides snomasks 'j' and 'J', to which notices about newly created channels are sent")
{
}
void init() override
{
ServerInstance->SNO.EnableSnomask('j', "CHANCREATE");
}
Version GetVersion() override
{
return Version("Provides snomasks 'j' and 'J', to which notices about newly created channels are sent", VF_VENDOR);
}
void OnUserJoin(Membership* memb, bool sync, bool created, CUList& except) override
{
if ((created) && (IS_LOCAL(memb->user)))

View File

@ -86,7 +86,8 @@ class ModuleChanFilter : public Module
public:
ModuleChanFilter()
: exemptionprov(this)
: Module(VF_VENDOR, "Provides channel-specific censor lists (like mode +G but varies from channel to channel)")
, exemptionprov(this)
, cf(this)
{
}
@ -161,14 +162,11 @@ class ModuleChanFilter : public Module
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
void GetLinkData(std::string& data) override
{
// We don't send any link data if the length is 35 for compatibility with the 2.0 branch.
std::string maxfilterlen;
if (cf.maxlen != 35)
maxfilterlen.assign(ConvToStr(cf.maxlen));
return Version("Provides channel-specific censor lists (like mode +G but varies from channel to channel)", VF_VENDOR, maxfilterlen);
data.assign(ConvToStr(cf.maxlen));
}
};

View File

@ -182,7 +182,8 @@ class ModuleChanHistory
public:
ModuleChanHistory()
: ServerProtocol::BroadcastEventListener(this)
: Module(VF_VENDOR, "Provides channel mode +H, allows for the channel message history to be replayed on join")
, ServerProtocol::BroadcastEventListener(this)
, m(this)
, botmode(this, "bot")
, batchcap(this)
@ -249,11 +250,6 @@ class ModuleChanHistory
SendHistory(localuser, memb->chan, list, mintime);
}
Version GetVersion() override
{
return Version("Provides channel mode +H, allows for the channel message history to be replayed on join", VF_VENDOR);
}
};
MODULE_INIT(ModuleChanHistory)

View File

@ -35,6 +35,11 @@ class ModuleChanLog : public Module
ChanLogTargets logstreams;
public:
ModuleChanLog()
: Module(VF_VENDOR, "Logs snomask output to channel(s)")
{
}
void ReadConfig(ConfigStatus& status) override
{
std::string snomasks;
@ -83,11 +88,6 @@ class ModuleChanLog : public Module
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Logs snomask output to channel(s)", VF_VENDOR);
}
};
MODULE_INIT(ModuleChanLog)

View File

@ -55,7 +55,8 @@ class ModuleChannelNames : public Module
public:
ModuleChannelNames()
: rememberer(ServerInstance->IsChannel)
: Module(VF_VENDOR, "Implements config tags which allow changing characters allowed in channel names")
, rememberer(ServerInstance->IsChannel)
, permchannelmode(this, "permanent")
{
}
@ -149,11 +150,6 @@ class ModuleChannelNames : public Module
ValidateChans();
return Module::cull();
}
Version GetVersion() override
{
return Version("Implements config tags which allow changing characters allowed in channel names", VF_VENDOR);
}
};
MODULE_INIT(ModuleChannelNames)

View File

@ -32,15 +32,11 @@ class ModuleBadChannelExtban
{
public:
ModuleBadChannelExtban()
: ISupport::EventListener(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides extban 'j', ban users that are present in another channel, and optionally on their status there")
, ISupport::EventListener(this)
{
}
Version GetVersion() override
{
return Version("Provides extban 'j', ban users that are present in another channel, and optionally on their status there", VF_OPTCOMMON|VF_VENDOR);
}
ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) override
{
if ((mask.length() > 2) && (mask[0] == 'j') && (mask[1] == ':'))

View File

@ -319,15 +319,14 @@ class CommandCheck : public Command
class ModuleCheck : public Module
{
CommandCheck mycommand;
public:
ModuleCheck() : mycommand(this)
{
}
private:
CommandCheck cmd;
Version GetVersion() override
public:
ModuleCheck()
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the CHECK command to view user, channel, IP address or hostname information")
, cmd(this)
{
return Version("Provides the CHECK command to view user, channel, IP address or hostname information", VF_VENDOR|VF_OPTCOMMON);
}
};

View File

@ -88,11 +88,13 @@ class CommandChghost : public Command
class ModuleChgHost : public Module
{
private:
CommandChghost cmd;
public:
ModuleChgHost()
: cmd(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the CHGHOST command")
, cmd(this)
{
}
@ -105,11 +107,6 @@ class ModuleChgHost : public Module
for (std::string::const_iterator n = hmap.begin(); n != hmap.end(); n++)
cmd.hostmap.set(static_cast<unsigned char>(*n));
}
Version GetVersion() override
{
return Version("Provides the CHGHOST command", VF_OPTCOMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleChgHost)

View File

@ -81,17 +81,15 @@ class CommandChgident : public Command
class ModuleChgIdent : public Module
{
private:
CommandChgident cmd;
public:
ModuleChgIdent() : cmd(this)
public:
ModuleChgIdent()
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the CHGIDENT command")
, cmd(this)
{
}
Version GetVersion() override
{
return Version("Provides the CHGIDENT command", VF_OPTCOMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleChgIdent)

View File

@ -78,17 +78,15 @@ class CommandChgname : public Command
class ModuleChgName : public Module
{
private:
CommandChgname cmd;
public:
ModuleChgName() : cmd(this)
public:
ModuleChgName()
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the CHGNAME command")
, cmd(this)
{
}
Version GetVersion() override
{
return Version("Provides the CHGNAME command", VF_OPTCOMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleChgName)

View File

@ -27,7 +27,8 @@ class ModuleClassBan
{
public:
ModuleClassBan()
: ISupport::EventListener(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides extban 'n', connection class bans")
, ISupport::EventListener(this)
{
}
@ -46,11 +47,6 @@ class ModuleClassBan
{
tokens["EXTBAN"].push_back('n');
}
Version GetVersion() override
{
return Version("Provides extban 'n', connection class bans", VF_VENDOR | VF_OPTCOMMON);
}
};
MODULE_INIT(ModuleClassBan)

View File

@ -144,11 +144,13 @@ class CommandClearChan : public Command
class ModuleClearChan : public Module
{
private:
CommandClearChan cmd;
public:
ModuleClearChan()
: cmd(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the CLEARCHAN command that allows opers to masskick, masskill or mass G/Z-line users on a channel")
, cmd(this)
{
}
@ -210,11 +212,6 @@ class ModuleClearChan : public Module
excepts.insert(curr);
}
}
Version GetVersion() override
{
return Version("Provides the CLEARCHAN command that allows opers to masskick, masskill or mass G/Z-line users on a channel", VF_VENDOR|VF_OPTCOMMON);
}
};
MODULE_INIT(ModuleClearChan)

View File

@ -190,7 +190,8 @@ class ModuleCloaking : public Module
dynamic_reference<HashProvider> Hash;
ModuleCloaking()
: cu(this)
: Module(VF_VENDOR | VF_COMMON, "Provides masking of user hostnames")
, cu(this)
, ck(this)
, Hash(this, "hash/md5")
{
@ -390,9 +391,9 @@ class ModuleCloaking : public Module
cu.active = false;
}
Version GetVersion() override
void GetLinkData(std::string& data) override
{
std::string testcloak = "broken";
data = "broken";
if (Hash && !cloaks.empty())
{
const CloakInfo& info = cloaks.front();
@ -402,18 +403,17 @@ class ModuleCloaking : public Module
// Use old cloaking verification to stay compatible with 2.0
// But verify domainparts and ignorecase when use 3.0-only features
if (info.domainparts == 3 && !info.ignorecase)
testcloak = info.prefix + SegmentCloak(info, "*", 3, 8) + info.suffix;
data = info.prefix + SegmentCloak(info, "*", 3, 8) + info.suffix;
else
{
irc::sockets::sockaddrs sa;
testcloak = GenCloak(info, sa, "", testcloak + ConvToStr(info.domainparts)) + (info.ignorecase ? "-ci" : "");
data = GenCloak(info, sa, "", data + ConvToStr(info.domainparts)) + (info.ignorecase ? "-ci" : "");
}
break;
case MODE_OPAQUE:
testcloak = info.prefix + SegmentCloak(info, "*", 4, 8) + info.suffix + (info.ignorecase ? "-ci" : "");
data = info.prefix + SegmentCloak(info, "*", 4, 8) + info.suffix + (info.ignorecase ? "-ci" : "");
}
}
return Version("Provides masking of user hostnames", VF_COMMON|VF_VENDOR, testcloak);
}
void ReadConfig(ConfigStatus& status) override

View File

@ -89,19 +89,15 @@ class CommandClones : public SplitCommand
class ModuleClones : public Module
{
public:
private:
CommandClones cmd;
public:
ModuleClones()
: cmd(this)
: Module(VF_VENDOR, "Provides the CLONES command to retrieve information on clones")
, cmd(this)
{
}
Version GetVersion() override
{
return Version("Provides the CLONES command to retrieve information on clones", VF_VENDOR);
}
};
MODULE_INIT(ModuleClones)

View File

@ -99,7 +99,8 @@ class ModuleCodepage
public:
ModuleCodepage()
: origcasemap(national_case_insensitive_map)
: Module(VF_VENDOR | VF_COMMON, "Provides support for custom 8-bit codepages")
, origcasemap(national_case_insensitive_map)
, origcasemapname(ServerInstance->Config->CaseMapping)
, origisnick(ServerInstance->IsNick)
{
@ -191,7 +192,7 @@ class ModuleCodepage
CheckRehash(newcasemap);
}
Version GetVersion() override
void GetLinkData(std::string& data) override
{
std::stringstream linkdata;
@ -210,7 +211,7 @@ class ModuleCodepage
if (casemap[i] != i)
linkdata << static_cast<unsigned char>(i) << casemap[i] << ',';
return Version("Provides support for custom 8-bit codepages", VF_COMMON | VF_VENDOR, linkdata.str());
data = linkdata.str();
}
};
MODULE_INIT(ModuleCodepage)

View File

@ -25,8 +25,8 @@
#include "modules/ctctags.h"
class ModuleCommonChans
: public CTCTags::EventListener
, public Module
: public Module
, public CTCTags::EventListener
{
private:
SimpleUserModeHandler mode;
@ -49,16 +49,12 @@ class ModuleCommonChans
public:
ModuleCommonChans()
: CTCTags::EventListener(this)
: Module(VF_VENDOR, "Provides user mode +c, requires users to share a common channel with you to private message you")
, CTCTags::EventListener(this)
, mode(this, "deaf_commonchan", 'c')
{
}
Version GetVersion() override
{
return Version("Provides user mode +c, requires users to share a common channel with you to private message you", VF_VENDOR);
}
ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) override
{
return HandleMessage(user, target);

View File

@ -66,13 +66,15 @@ class JoinTimer : public Timer
class ModuleConnJoin : public Module
{
private:
SimpleExtItem<JoinTimer> ext;
std::string defchans;
unsigned int defdelay;
public:
ModuleConnJoin()
: ext(this, "join_timer", ExtensionItem::EXT_USER)
: Module(VF_VENDOR, "Forces users to join the specified channel(s) on connect")
, ext(this, "join_timer", ExtensionItem::EXT_USER)
{
}
@ -88,11 +90,6 @@ class ModuleConnJoin : public Module
ServerInstance->Modules.SetPriority(this, I_OnPostConnect, PRIORITY_LAST);
}
Version GetVersion() override
{
return Version("Forces users to join the specified channel(s) on connect", VF_VENDOR);
}
void OnPostConnect(User* user) override
{
LocalUser* localuser = IS_LOCAL(user);

View File

@ -26,9 +26,9 @@
class ModuleModesOnConnect : public Module
{
public:
Version GetVersion() override
ModuleModesOnConnect()
: Module(VF_VENDOR, "Sets (and unsets) modes on users when they connect")
{
return Version("Sets (and unsets) modes on users when they connect", VF_VENDOR);
}
void OnUserConnect(LocalUser* user) override

View File

@ -33,7 +33,8 @@ class ModuleWaitPong : public Module
public:
ModuleWaitPong()
: ext(this, "waitpong_pingstr", ExtensionItem::EXT_USER)
: Module(VF_VENDOR, "Require pong prior to registration")
, ext(this, "waitpong_pingstr", ExtensionItem::EXT_USER)
{
}
@ -87,11 +88,6 @@ class ModuleWaitPong : public Module
{
return ext.get(user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Require pong prior to registration", VF_VENDOR);
}
};
MODULE_INIT(ModuleWaitPong)

View File

@ -63,15 +63,11 @@ class ModuleConnectBan
public:
ModuleConnectBan()
: WebIRC::EventListener(this)
: Module(VF_VENDOR, "Throttles the connections of IP ranges who try to connect flood")
, WebIRC::EventListener(this)
{
}
Version GetVersion() override
{
return Version("Throttles the connections of IP ranges who try to connect flood", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("connectban");

View File

@ -27,6 +27,7 @@
class ModuleConnFlood : public Module
{
private:
unsigned int seconds;
unsigned int timeout;
unsigned int boot_wait;
@ -36,10 +37,10 @@ class ModuleConnFlood : public Module
time_t first;
std::string quitmsg;
public:
Version GetVersion() override
public:
ModuleConnFlood()
: Module(VF_VENDOR, "Connection throttle")
{
return Version("Connection throttle", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override

View File

@ -44,8 +44,15 @@ class CustomPrefixMode : public PrefixMode
class ModuleCustomPrefix : public Module
{
private:
std::vector<CustomPrefixMode*> modes;
public:
ModuleCustomPrefix()
: Module(VF_VENDOR, "Provides custom prefix channel modes")
{
}
void init() override
{
ConfigTagList tags = ServerInstance->Config->ConfTags("customprefix");
@ -103,11 +110,6 @@ class ModuleCustomPrefix : public Module
{
stdalgo::delete_all(modes);
}
Version GetVersion() override
{
return Version("Provides custom prefix channel modes", VF_VENDOR);
}
};
MODULE_INIT(ModuleCustomPrefix)

View File

@ -113,11 +113,13 @@ class CommandTitle : public Command
class ModuleCustomTitle : public Module, public Whois::LineEventListener
{
private:
CommandTitle cmd;
public:
ModuleCustomTitle()
: Whois::LineEventListener(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides the TITLE command, custom titles for users")
, Whois::LineEventListener(this)
, cmd(this)
{
}
@ -169,11 +171,6 @@ class ModuleCustomTitle : public Module, public Whois::LineEventListener
/* Don't block anything */
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides the TITLE command, custom titles for users", VF_OPTCOMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleCustomTitle)

View File

@ -83,18 +83,15 @@ class CommandCycle : public SplitCommand
class ModuleCycle : public Module
{
private:
CommandCycle cmd;
public:
ModuleCycle()
: cmd(this)
: Module(VF_VENDOR, "Provides the CYCLE command, acts as a server-side HOP command to part and rejoin a channel")
, cmd(this)
{
}
Version GetVersion() override
{
return Version("Provides the CYCLE command, acts as a server-side HOP command to part and rejoin a channel", VF_VENDOR);
}
};
MODULE_INIT(ModuleCycle)

View File

@ -371,6 +371,7 @@ class CommandDccallow : public Command
class ModuleDCCAllow : public Module
{
private:
DCCAllowExt ext;
CommandDccallow cmd;
bool blockchat = false;
@ -378,7 +379,8 @@ class ModuleDCCAllow : public Module
public:
ModuleDCCAllow()
: ext(this)
: Module(VF_VENDOR | VF_COMMON, "Provides the DCCALLOW command")
, ext(this)
, cmd(this, ext)
{
}
@ -603,11 +605,6 @@ class ModuleDCCAllow : public Module
blockchat = tag->getBool("blockchat");
defaultaction = tag->getString("action");
}
Version GetVersion() override
{
return Version("Provides the DCCALLOW command", VF_COMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleDCCAllow)

View File

@ -69,6 +69,7 @@ class PrivDeafMode : public ModeHandler
class ModuleDeaf : public Module
{
private:
DeafMode deafmode;
PrivDeafMode privdeafmode;
std::string deaf_bypasschars;
@ -77,7 +78,8 @@ class ModuleDeaf : public Module
public:
ModuleDeaf()
: deafmode(this)
: Module(VF_VENDOR, "Provides user modes +d and +D to block channel and user messages/notices")
, deafmode(this)
, privdeafmode(this)
{
}
@ -148,11 +150,6 @@ class ModuleDeaf : public Module
return MOD_RES_PASSTHRU;
}
Version GetVersion() override
{
return Version("Provides user modes +d and +D to block channel and user messages/notices", VF_VENDOR);
}
};
MODULE_INIT(ModuleDeaf)

View File

@ -89,7 +89,8 @@ class ModuleDelayJoin
DelayJoinMode djm;
ModuleDelayJoin()
: CTCTags::EventListener(this)
: Module(VF_VENDOR, "Provides channel mode +D, delay-join, users don't appear as joined to others until they speak")
, CTCTags::EventListener(this)
, Names::EventListener(this)
, unjoined(this, "delayjoin", ExtensionItem::EXT_MEMBERSHIP)
, joinhook(this, unjoined)
@ -97,7 +98,6 @@ class ModuleDelayJoin
{
}
Version GetVersion() override;
ModResult OnNamesListItem(LocalUser* issuer, Membership*, std::string& prefixes, std::string& nick) override;
void OnUserJoin(Membership*, bool, bool, CUList&) override;
void CleanUser(User* user);
@ -129,11 +129,6 @@ ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channe
return MODEACTION_ALLOW;
}
Version ModuleDelayJoin::GetVersion()
{
return Version("Provides channel mode +D, delay-join, users don't appear as joined to others until they speak", VF_VENDOR);
}
ModResult ModuleDelayJoin::OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick)
{
/* don't prevent the user from seeing themself */

View File

@ -60,12 +60,12 @@ class ModuleDelayMsg
public:
ModuleDelayMsg()
: CTCTags::EventListener(this)
: Module(VF_VENDOR, "Provides channel mode +d <int>, to deny messages to a channel until <int> seconds have passed")
, CTCTags::EventListener(this)
, djm(this)
{
}
Version GetVersion() override;
void OnUserJoin(Membership* memb, bool sync, bool created, CUList&) override;
ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) override;
ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) override;
@ -93,11 +93,6 @@ void DelayMsgMode::OnUnset(User* source, Channel* chan)
jointime.set(n->second, 0);
}
Version ModuleDelayMsg::GetVersion()
{
return Version("Provides channel mode +d <int>, to deny messages to a channel until <int> seconds have passed", VF_VENDOR);
}
void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)
{
if ((IS_LOCAL(memb->user)) && (memb->chan->IsModeSet(djm)))

View File

@ -62,7 +62,8 @@ class ModuleDenyChannels : public Module
public:
ModuleDenyChannels()
: antiredirectmode(this, "antiredirect")
: Module(VF_VENDOR, "Implements config tags which allow blocking of joins to channels")
, antiredirectmode(this, "antiredirect")
, redirectmode(this, "redirect")
{
}
@ -148,12 +149,6 @@ class ModuleDenyChannels : public Module
goodchannels.swap(goodchans);
}
Version GetVersion() override
{
return Version("Implements config tags which allow blocking of joins to channels", VF_VENDOR);
}
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) override
{
for (BadChannels::const_iterator j = badchannels.begin(); j != badchannels.end(); ++j)

View File

@ -78,6 +78,11 @@ class ModuleDisable : public Module
}
public:
ModuleDisable()
: Module(VF_VENDOR, "Provides support for disabling commands and modes")
{
}
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("disabled");
@ -181,11 +186,6 @@ class ModuleDisable : public Module
what, mh->GetModeChar(), mh->name.c_str()));
return MOD_RES_DENY;
}
Version GetVersion() override
{
return Version("Provides support for disabling commands and modes", VF_VENDOR);
}
};
MODULE_INIT(ModuleDisable)

View File

@ -268,7 +268,8 @@ class ModuleDNSBL : public Module, public Stats::EventListener
}
public:
ModuleDNSBL()
: Stats::EventListener(this)
: Module(VF_VENDOR, "Provides handling of DNS blacklists")
, Stats::EventListener(this)
, DNS(this, "DNS")
, nameExt(this, "dnsbl_match", ExtensionItem::EXT_USER)
, countExt(this, "dnsbl_pending", ExtensionItem::EXT_USER)
@ -280,13 +281,6 @@ class ModuleDNSBL : public Module, public Stats::EventListener
ServerInstance->SNO.EnableSnomask('d', "DNSBL");
}
Version GetVersion() override
{
return Version("Provides handling of DNS blacklists", VF_VENDOR);
}
/** Fill our conf vector with data
*/
void ReadConfig(ConfigStatus& status) override
{
DNSBLConfList newentries;

View File

@ -153,18 +153,16 @@ class ExemptHandler : public CheckExemption::EventListener
class ModuleExemptChanOps : public Module
{
private:
ExemptHandler eh;
public:
ModuleExemptChanOps() : eh(this)
ModuleExemptChanOps()
: Module(VF_VENDOR, "Provides the ability to allow channel operators to be exempt from certain modes")
, eh(this)
{
}
Version GetVersion() override
{
return Version("Provides the ability to allow channel operators to be exempt from certain modes", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override
{
eh.ec.DoRehash();

View File

@ -218,7 +218,7 @@ class ModuleFilter
bool DeleteFilter(const std::string& freeform, std::string& reason);
std::pair<bool, std::string> AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flags, bool config = false);
void ReadConfig(ConfigStatus& status) override;
Version GetVersion() override;
void GetLinkData(std::string& data) override;
std::string EncodeFilter(FilterResult* filter);
FilterResult DecodeFilter(const std::string &data);
void OnSyncNetwork(ProtocolInterface::Server& server) override;
@ -346,7 +346,8 @@ bool ModuleFilter::AppliesToMe(User* user, FilterResult* filter, int iflags)
}
ModuleFilter::ModuleFilter()
: ServerProtocol::SyncEventListener(this)
: Module(VF_VENDOR | VF_COMMON, "Provides text (spam) filtering")
, ServerProtocol::SyncEventListener(this)
, Stats::EventListener(this)
, filtcommand(this)
, RegexEngine(this, "regex")
@ -666,9 +667,10 @@ void ModuleFilter::ReadConfig(ConfigStatus& status)
ReadFilters();
}
Version ModuleFilter::GetVersion()
void ModuleFilter::GetLinkData(std::string& data)
{
return Version("Provides text (spam) filtering", VF_VENDOR | VF_COMMON, RegexEngine ? RegexEngine->name : "");
if (RegexEngine)
data = RegexEngine->name;
}
std::string ModuleFilter::EncodeFilter(FilterResult* filter)

View File

@ -32,15 +32,11 @@ class ModuleGecosBan
{
public:
ModuleGecosBan()
: ISupport::EventListener(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides a way to ban users by their real name with the 'a' and 'r' extbans")
, ISupport::EventListener(this)
{
}
Version GetVersion() override
{
return Version("Provides a way to ban users by their real name with the 'a' and 'r' extbans", VF_OPTCOMMON|VF_VENDOR);
}
ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) override
{
if ((mask.length() > 2) && (mask[1] == ':'))

View File

@ -38,17 +38,13 @@ class ModuleGeoBan
public:
ModuleGeoBan()
: ISupport::EventListener(this)
: Module(VF_VENDOR | VF_OPTCOMMON, "Provides a way to ban users by country")
, ISupport::EventListener(this)
, Whois::EventListener(this)
, geoapi(this)
{
}
Version GetVersion() override
{
return Version("Provides a way to ban users by country", VF_OPTCOMMON|VF_VENDOR);
}
void OnBuildISupport(ISupport::TokenMap& tokens) override
{
tokens["EXTBAN"].push_back('G');

View File

@ -36,16 +36,12 @@ class ModuleGeoClass
public:
ModuleGeoClass()
: Stats::EventListener(this)
: Module(VF_VENDOR, "Provides a way to assign users to connect classes by country")
, Stats::EventListener(this)
, geoapi(this)
{
}
Version GetVersion() override
{
return Version("Provides a way to assign users to connect classes by country", VF_VENDOR);
}
ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass) override
{
const std::string country = myclass->config->getString("country");

View File

@ -159,20 +159,19 @@ class CommandGreloadmodule : public Command
class ModuleGlobalLoad : public Module
{
private:
CommandGloadmodule cmd1;
CommandGunloadmodule cmd2;
CommandGreloadmodule cmd3;
public:
ModuleGlobalLoad()
: cmd1(this), cmd2(this), cmd3(this)
: Module(VF_VENDOR | VF_COMMON, "Allows global loading of a module")
, cmd1(this)
, cmd2(this)
, cmd3(this)
{
}
Version GetVersion() override
{
return Version("Allows global loading of a module", VF_COMMON | VF_VENDOR);
}
};
MODULE_INIT(ModuleGlobalLoad)

View File

@ -54,19 +54,21 @@ class CommandGlobops : public Command
class ModuleGlobops : public Module
{
private:
CommandGlobops cmd;
public:
ModuleGlobops() : cmd(this) {}
ModuleGlobops()
: Module(VF_VENDOR, "Provides the GLOBOPS command and snomask 'g'")
, cmd(this)
{
}
void init() override
{
ServerInstance->SNO.EnableSnomask('g',"GLOBOPS");
}
Version GetVersion() override
{
return Version("Provides the GLOBOPS command and snomask 'g'", VF_VENDOR);
}
};
MODULE_INIT(ModuleGlobops)

View File

@ -427,14 +427,10 @@ class ModuleHAProxy : public Module
public:
ModuleHAProxy()
: hookprov(new HAProxyHookProvider(this))
: Module(VF_VENDOR, "Provides support for the HAProxy PROXY protocol")
, hookprov(new HAProxyHookProvider(this))
{
}
Version GetVersion() override
{
return Version("Provides support for the HAProxy PROXY protocol", VF_VENDOR);
}
};
MODULE_INIT(ModuleHAProxy)

View File

@ -103,7 +103,8 @@ class ModuleHelpop
public:
ModuleHelpop()
: Whois::EventListener(this)
: Module(VF_VENDOR, "Provides help to users via the HELPOP command")
, Whois::EventListener(this)
, cmd(this)
, ho(this, "helpop", 'h', true)
{
@ -182,11 +183,6 @@ class ModuleHelpop
if (whois.GetTarget()->IsModeSet(ho))
whois.SendLine(RPL_WHOISHELPOP, "is available for help.");
}
Version GetVersion() override
{
return Version("Provides help to users via the HELPOP command", VF_VENDOR);
}
};
MODULE_INIT(ModuleHelpop)

View File

@ -36,20 +36,18 @@ class HideChans : public SimpleUserModeHandler
class ModuleHideChans : public Module, public Whois::LineEventListener
{
private:
bool AffectsOpers;
HideChans hm;
public:
ModuleHideChans()
: Whois::LineEventListener(this)
: Module(VF_VENDOR, "Provides support for hiding channels with user mode +I")
, Whois::LineEventListener(this)
, hm(this)
{
}
Version GetVersion() override
{
return Version("Provides support for hiding channels with user mode +I", VF_VENDOR);
}
void ReadConfig(ConfigStatus& status) override
{
AffectsOpers = ServerInstance->Config->ConfValue("hidechans")->getBool("affectsopers");

View File

@ -82,15 +82,15 @@ class ModuleHideList : public Module
watchers.push_back(new ListWatcher(this, i->first, i->second));
}
ModuleHideList()
: Module(VF_VENDOR, "Provides support for hiding the list of listmodes")
{
}
~ModuleHideList()
{
stdalgo::delete_all(watchers);
}
Version GetVersion() override
{
return Version("Provides support for hiding the list of listmodes", VF_VENDOR);
}
};
MODULE_INIT(ModuleHideList)

View File

@ -190,7 +190,8 @@ class ModuleHideMode : public Module
public:
ModuleHideMode()
: modehook(this)
: Module(VF_VENDOR, "Provides support for hiding mode changes")
, modehook(this)
{
}
@ -198,11 +199,6 @@ class ModuleHideMode : public Module
{
modehook.settings.Load();
}
Version GetVersion() override
{
return Version("Provides support for hiding mode changes", VF_VENDOR);
}
};
MODULE_INIT(ModuleHideMode)

View File

@ -70,18 +70,14 @@ class ModuleHideOper
public:
ModuleHideOper()
: Stats::EventListener(this)
: Module(VF_VENDOR, "Provides support for hiding oper status with user mode +H")
, Stats::EventListener(this)
, Who::EventListener(this)
, Whois::LineEventListener(this)
, hm(this)
{
}
Version GetVersion() override
{
return Version("Provides support for hiding oper status with user mode +H", VF_VENDOR);
}
void OnUserQuit(User* user, const std::string&, const std::string&) override
{
if (user->IsModeSet(hm))

View File

@ -124,6 +124,11 @@ private:
}
public:
ModuleHostChange()
: Module(VF_VENDOR, "Provides rule-based masking of user hostnames")
{
}
void ReadConfig(ConfigStatus& status) override
{
HostRules rules;
@ -185,11 +190,6 @@ private:
hostrules.swap(rules);
}
Version GetVersion() override
{
return Version("Provides rule-based masking of user hostnames", VF_VENDOR);
}
void OnUserConnect(LocalUser* user) override
{
for (HostRules::const_iterator iter = hostrules.begin(); iter != hostrules.end(); ++iter)

Some files were not shown because too many files have changed in this diff Show More