diff options
author | Adam <Adam@anope.org> | 2011-04-28 22:44:34 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-05-16 04:09:32 -0400 |
commit | 583954d3a1db658281a9afb7b7dd6773726c8c11 (patch) | |
tree | 6a00865d5738c6d0bc42efb35f3f468c5876eb3e | |
parent | 8fb1604f649bec6f356770daf5df6bb8ab811bbf (diff) |
Use module type to determine what type each module is instead of its location in the configuration file.
203 files changed, 485 insertions, 885 deletions
diff --git a/data/example.conf b/data/example.conf index 24120d128..c9ffc04df 100644 --- a/data/example.conf +++ b/data/example.conf @@ -88,7 +88,7 @@ uplink * * NOTE: On some shell providers, this will not be an option. */ - host = "localhost" + host = "127.0.0.1" /* * Enable if Services should connect using IPv6. @@ -150,21 +150,6 @@ serverinfo #localhost = "nowhere." /* - * This directive instructs Anope which IRCd Protocol to speak when connecting. - * You MUST modify this to match the IRCd you run. - * - * Supported: - * - inspircd11 - * - inspircd12 - * - inspircd20 - * - ratbox - * - bahamut - * - unreal32 - * - plexus - */ - type = "inspircd12" - - /* * What Server ID to use for this connection? * Note: This should *ONLY* be used for TS6/P10 IRCds. Refer to your IRCd documentation * to see if this is needed. @@ -191,6 +176,22 @@ serverinfo } /* + * [REQUIRED] Protocol module + * This directive tells Anope which IRCd Protocol to speak when connecting. + * You MUST modify this to match the IRCd you run. + * + * Supported: + * - bahamut + * - inspircd11 + * - inspircd12 + * - inspircd20 + * - plexus + * - ratbox + * - unreal + */ +module { name = "inspircd12" } + +/* * [REQUIRED] Network Information * * This section contains information about the IRC network that Services will be @@ -234,68 +235,6 @@ networkinfo options { /* - * The encryption modules are used when dealing with passwords. This determines how - * the passwords are stored in the databases, and does not add any security as - * far as transmitting passwords over the network goes. - * - * When using enc_none, passwords will be stored without encryption in plain - * text, allowing for passwords to be recovered later but isn't secure therefore - * is not recommended. - * - * The other encryption modules use one-way encryption, so the passwords can not - * be recovered later if those are used. - * - * NOTE: enc_old is Anope's previous (broken) MD5 implementation, if your databases - * were made using that module, continue to use it and do not use enc_md5. - * - * NOTE: enc_sha1 relies on how the OS stores 2+ byte data internally, and is - * potentially broken when moving between 2 different OSes, such as moving from - * Linux to Windows. It is recommended that you use enc_sha256 instead if you want - * to use an SHA-based encryption. If you choose to do so, it is also recommended - * that you first try to get everyone's passwords converted to enc_sha256 before - * switching OSes by placing enc_sha256 at the beginning of the list. - * - * Supported: - * - enc_none (plain text, no encryption) - * - enc_old (old, broken MD5 encryption) - * - enc_md5 (working MD5 encryption) - * - enc_sha1 (SHA1 encryption) - * - enc_sha256 (SHA256 encryption with random salts) - * - * The first module in this list is the active encryption module. All new passwords are - * encrypted by this module. Old passwords stored in another encryption method are - * automatically re-encrypted by the active encryption module on next identify. - * Changing the order of the modules requires the services to restart. - */ - encryption = "enc_md5 enc_none enc_sha1 enc_sha256 enc_old" - - /* - * The database modules are used for saving and loading databases for Anope. - * - * Supported: - * - db_plain - * - db_mysql - * - db_mysql_live - * - * You may have more than one loaded at once! - * - * The db_mysql_live module is an extension to db_mysql, and should only be used if - * db_mysql is being used. This module pulls data in real time from SQL as it is - * requested by the core as a result of someone executing commands. - * - * This effectively allows you to edit your database and have it be immediately - * reflected back in Anope. - * - * For information on how to make db_mysql_live use asynchronous queries see - * m_async_commands. - * - * At this time db_mysql_live only supports pulling data in real time from the three - * main tables: anope_cs_info, anope_ns_alias, and anope_ns_core. - * - */ - database = "db_plain" - - /* * The maximum length of passwords */ passlen = 32 @@ -1888,8 +1827,10 @@ cs_set_misc /* * db_plain * - * This is the default flatfile database format + * This is the default flatfile database format. You must have at least one database + * module loaded or Anope will not save databases! */ +module { name = "db_plain" } db_plain { /* @@ -1899,6 +1840,63 @@ db_plain } /* + * db_mysql and db_mysql_live + * + * Enables (live) MySQL support. + * + * The db_mysql_live module is an extension to db_mysql, and should only be used if + * db_mysql is being used. This module pulls data in real time from SQL as it is + * requested by the core as a result of someone executing commands. + * + * This effectively allows you to edit your database and have it be immediately + * reflected back in Anope. + * + * For information on how to make db_mysql_live use asynchronous queries see + * m_async_commands. + * + * At this time db_mysql_live only supports pulling data in real time from the three + * main tables: anope_cs_info, anope_ns_alias, and anope_ns_core. + */ +#module { name = "db_mysql" } +#module { name = "db_mysql_live" } + +/* + * The encryption modules are used when dealing with passwords. This determines how + * the passwords are stored in the databases, and does not add any security as + * far as transmitting passwords over the network goes. + * + * Without any encryption modules, passwords will be stored in plain text, allowing + * for passwords to be recovered later but isn't secure therefore is not recommended. + * + * The other encryption modules use one-way encryption, so the passwords can not + * be recovered later if those are used. + * + * NOTE: enc_old is Anope's previous (broken) MD5 implementation, if your databases + * were made using that module, continue to use it and do not use enc_md5. + * + * NOTE: enc_sha1 relies on how the OS stores 2+ byte data internally, and is + * potentially broken when moving between 2 different OSes, such as moving from + * Linux to Windows. It is recommended that you use enc_sha256 instead if you want + * to use an SHA-based encryption. If you choose to do so, it is also recommended + * that you first try to get everyone's passwords converted to enc_sha256 before + * switching OSes by placing enc_sha256 at the beginning of the list. + * + * The first encryption module loaded is the primary encryption module. All new passwords are + * encrypted by this module. Old passwords stored in another encryption method are + * automatically re-encrypted by the active encryption module on next identify. + */ +module { name = "enc_md5" } +#module { name = "enc_sha1" } +#module { name = "enc_sha256" } + +/* + * enc_old is Anope's previous (broken) MD5 implementation, if your databases + * were made using that module, load it here to allow conversion to the primary + * encryption method. + */ +#module { name = "enc_old" } + +/* * hs_request * * Allows users to request vhosts which opers may then view, accept or deny diff --git a/docs/Changes.conf b/docs/Changes.conf index bf4da4ea4..650603e24 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -18,6 +18,9 @@ options:globaloncycledown options:globaloncycleup options:anonymousglobal options:socketengine +options:encryption +options:database +serverinfo:protocol Anope Version 1.9.4 ------------------- diff --git a/include/anope.h b/include/anope.h index fb201db1e..b23b68481 100644 --- a/include/anope.h +++ b/include/anope.h @@ -316,9 +316,9 @@ namespace Anope */ extern CoreExport bool Match(const Anope::string &str, const Anope::string &mask, bool case_sensitive = false); - /** Returns a list of pointers to message handlers - * @param The message name as sent by the IRCd - * @return a vector with pointers to the messagehandlers (you can bind more than one handler to a message) + /** Find a message in the message table + * @param name The name of the message were looking for + * @return NULL if we cant find it, or a pointer to the Message if we can */ extern CoreExport std::vector<Message *> FindMessage(const string &name); @@ -438,6 +438,7 @@ class CoreExport Base virtual ~Base(); void AddReference(dynamic_reference_base *r); void DelReference(dynamic_reference_base *r); + static void operator delete(void *ptr); }; class dynamic_reference_base : public Base @@ -469,7 +470,7 @@ class dynamic_reference : public dynamic_reference_base this->invalid = false; this->ref = NULL; } - else if (ref) + else if (this->operator bool()) ref->DelReference(this); } @@ -504,10 +505,10 @@ class dynamic_reference : public dynamic_reference_base this->invalid = false; this->ref = NULL; } - else if (this->ref) + else if (this->operator bool()) this->ref->DelReference(this); this->ref = newref; - if (this->ref) + if (this->operator bool()) this->ref->AddReference(this); } }; diff --git a/include/config.h b/include/config.h index 8d2455c78..8a564e8ec 100644 --- a/include/config.h +++ b/include/config.h @@ -342,9 +342,6 @@ class CoreExport ServerConfig /** Below here is a list of variables which contain the config files values */ - /* IRCd module in use */ - Anope::string IRCDModule; - /* Host to connect to **/ Anope::string LocalHost; /* List of uplink servers to try and connect to */ @@ -667,13 +664,6 @@ class CoreExport ServerConfig /* List of modules to autoload */ std::list<Anope::string> ModulesAutoLoad; - /* Encryption modules */ - std::list<Anope::string> EncModuleList; - /* Database modules */ - std::list<Anope::string> DBModuleList; - - /* The socket engine in use */ - Anope::string SocketEngine; /* User keys to use for generating random hashes for pass codes etc */ unsigned long UserKey1; diff --git a/include/extern.h b/include/extern.h index 555292712..0b319ceaf 100644 --- a/include/extern.h +++ b/include/extern.h @@ -74,8 +74,8 @@ E ConfigurationFile services_conf; E ServerConfig *Config; /**** encrypt.c ****/ -E int enc_encrypt(const Anope::string &src, Anope::string &dest); -E int enc_decrypt(const Anope::string &src, Anope::string &dest); +E void enc_encrypt(const Anope::string &src, Anope::string &dest); +E bool enc_decrypt(const Anope::string &src, Anope::string &dest); /**** hostserv.c ****/ diff --git a/include/modules.h b/include/modules.h index c3f533609..d24348b48 100644 --- a/include/modules.h +++ b/include/modules.h @@ -127,9 +127,6 @@ else \ class Message; -extern CoreExport Module *FindModule(const Anope::string &name); -int protocol_module_init(); - enum ModuleReturn { MOD_ERR_OK, @@ -137,15 +134,9 @@ enum ModuleReturn MOD_ERR_PARAMS, MOD_ERR_EXISTS, MOD_ERR_NOEXIST, - MOD_ERR_NOUSER, MOD_ERR_NOLOAD, - MOD_ERR_NOUNLOAD, - MOD_ERR_SYNTAX, - MOD_ERR_NODELETE, MOD_ERR_UNKNOWN, MOD_ERR_FILE_IO, - MOD_ERR_NOSERVICE, - MOD_ERR_NO_MOD_NAME, MOD_ERR_EXCEPTION, MOD_ERR_VERSION }; @@ -154,7 +145,7 @@ enum ModuleReturn */ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER }; /* Module types, in the order in which they are unloaded. The order these are in is IMPORTANT */ -enum MODType { MT_BEGIN, THIRD, QATESTED, SUPPORTED, CORE, DATABASE, ENCRYPTION, PROTOCOL, MT_END }; +enum ModType { MT_BEGIN, THIRD, SUPPORTED, CORE, DATABASE, ENCRYPTION, PROTOCOL, MT_END }; typedef std::multimap<Anope::string, Message *> message_map; extern CoreExport message_map MessageMap; @@ -210,6 +201,10 @@ class CoreExport Module : public Extensible */ Anope::string name; + /** What type this module is + */ + ModType type; + /** The temporary path/filename */ Anope::string filename; @@ -234,24 +229,17 @@ class CoreExport Module : public Extensible */ Anope::string author; - /** What type this module is - */ - MODType type; - /** Creates and initialises a new module. + * @param modname The module name * @param loadernick The nickname of the user loading the module. + * @param type The module type */ - Module(const Anope::string &modname, const Anope::string &loadernick); + Module(const Anope::string &modname, const Anope::string &loadernick, ModType type = THIRD); /** Destroys a module, freeing resources it has allocated. */ virtual ~Module(); - /** Sets a given type (CORE,PROTOCOL,3RD etc) on a module. - * @param type The type to set the module as. - */ - void SetType(MODType type); - /** Toggles the permanent flag on a module. If a module is permanent, * then it may not be unloaded. * @@ -1039,10 +1027,10 @@ class CoreExport Module : public Extensible */ virtual void OnPrivmsg(User *u, ChannelInfo *ci, Anope::string &msg) { } - /** Called when any object is destroyed + /** Called when any object is deleted * @param b The object */ - virtual void OnObjectDestroy(Base *b) { } + virtual void OnDeleteObject(Base *b) { } }; /** Implementation-specific flags which may be set in ModuleManager::Attach() @@ -1096,7 +1084,7 @@ enum Implementation I_OnServerQuit, I_OnTopicUpdated, I_OnEncrypt, I_OnDecrypt, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd, - I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg, I_OnObjectDestroy, + I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg, I_OnDeleteObject, I_END }; @@ -1139,6 +1127,18 @@ class CoreExport ModuleManager */ static ModuleReturn UnloadModule(Module *m, User * u); + /** Find a module + * @param name The module name + * @return The module + */ + static Module *FindModule(const Anope::string &name); + + /** Find the first module of a certain type + * @param type The module type + * @return The module + */ + static Module *FindFirstOf(ModType type); + /** Checks whether this version of Anope is at least major.minor.patch.build * Throws a ModuleException if not * @param major The major version @@ -1231,8 +1231,9 @@ class CoreExport ModuleManager private: /** Call the module_delete function to safely delete the module * @param m the module to delete + * @return MOD_ERR_OK on success, anything else on fail */ - static void DeleteModule(Module *m); + static ModuleReturn DeleteModule(Module *m); }; /** Class used for callbacks within modules diff --git a/include/servers.h b/include/servers.h index 9e3907668..f2a8ce1b5 100644 --- a/include/servers.h +++ b/include/servers.h @@ -6,8 +6,8 @@ extern CoreExport Server *Me; extern CoreExport void do_server(const Anope::string &source, const Anope::string &servername, unsigned int hops, const Anope::string &descript, const Anope::string &numeric); -extern CoreExport const char *ts6_uid_retrieve(); -extern CoreExport const char *ts6_sid_retrieve(); +extern CoreExport const Anope::string ts6_uid_retrieve(); +extern CoreExport const Anope::string ts6_sid_retrieve(); /* Types of capab */ diff --git a/modules/core/bs_act.cpp b/modules/core/bs_act.cpp index 2547ce3c1..d06fc1848 100644 --- a/modules/core/bs_act.cpp +++ b/modules/core/bs_act.cpp @@ -79,10 +79,9 @@ class BSAct : public Module CommandBSAct commandbsact; public: - BSAct(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSAct(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_assign.cpp b/modules/core/bs_assign.cpp index 5be9e6bf3..f1e2e4f69 100644 --- a/modules/core/bs_assign.cpp +++ b/modules/core/bs_assign.cpp @@ -89,10 +89,9 @@ class BSAssign : public Module CommandBSAssign commandbsassign; public: - BSAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_badwords.cpp b/modules/core/bs_badwords.cpp index 1b3b2a884..1ea8161f1 100644 --- a/modules/core/bs_badwords.cpp +++ b/modules/core/bs_badwords.cpp @@ -321,10 +321,9 @@ class BSBadwords : public Module CommandBSBadwords commandbsbadwords; public: - BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp index c7a898dc1..4d42380f3 100644 --- a/modules/core/bs_bot.cpp +++ b/modules/core/bs_bot.cpp @@ -415,10 +415,9 @@ class BSBot : public Module CommandBSBot commandbsbot; public: - BSBot(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSBot(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_botlist.cpp b/modules/core/bs_botlist.cpp index a6a56f088..aa4731189 100644 --- a/modules/core/bs_botlist.cpp +++ b/modules/core/bs_botlist.cpp @@ -79,10 +79,9 @@ class BSBotList : public Module CommandBSBotList commandbsbotlist; public: - BSBotList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSBotList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_help.cpp b/modules/core/bs_help.cpp index eafa5b44e..953c5f37e 100644 --- a/modules/core/bs_help.cpp +++ b/modules/core/bs_help.cpp @@ -58,10 +58,9 @@ class BSHelp : public Module CommandBSHelp commandbshelp; public: - BSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_info.cpp b/modules/core/bs_info.cpp index afb13c66d..9c996b247 100644 --- a/modules/core/bs_info.cpp +++ b/modules/core/bs_info.cpp @@ -243,10 +243,9 @@ class BSInfo : public Module CommandBSInfo commandbsinfo; public: - BSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_kick.cpp b/modules/core/bs_kick.cpp index 9b78d6e7b..66232f10c 100644 --- a/modules/core/bs_kick.cpp +++ b/modules/core/bs_kick.cpp @@ -627,10 +627,9 @@ class BSKick : public Module } public: - BSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_main.cpp b/modules/core/bs_main.cpp index 5bd7e5ce2..193afac21 100644 --- a/modules/core/bs_main.cpp +++ b/modules/core/bs_main.cpp @@ -155,10 +155,9 @@ class BotServCore : public Module BanDataPurger bdpurger; public: - BotServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), mybotserv(this), bdpurger(this) + BotServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), mybotserv(this), bdpurger(this) { this->SetAuthor("Anope"); - this->SetType(CORE); ModuleManager::RegisterService(&this->mybotserv); @@ -180,7 +179,7 @@ class BotServCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/bs_say.cpp b/modules/core/bs_say.cpp index 673244a6c..56176a947 100644 --- a/modules/core/bs_say.cpp +++ b/modules/core/bs_say.cpp @@ -81,10 +81,9 @@ class BSSay : public Module CommandBSSay commandbssay; public: - BSSay(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSSay(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_set.cpp b/modules/core/bs_set.cpp index daf37c199..1daf30fa4 100644 --- a/modules/core/bs_set.cpp +++ b/modules/core/bs_set.cpp @@ -304,10 +304,9 @@ class BSSet : public Module CommandBSSet commandbsset; public: - BSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/bs_unassign.cpp b/modules/core/bs_unassign.cpp index 104eded56..6fe62d838 100644 --- a/modules/core/bs_unassign.cpp +++ b/modules/core/bs_unassign.cpp @@ -71,10 +71,9 @@ class BSUnassign : public Module CommandBSUnassign commandbsunassign; public: - BSUnassign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + BSUnassign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!botserv) throw ModuleException("BotServ is not loaded!"); diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp index 5fc4e7290..243d62057 100644 --- a/modules/core/cs_access.cpp +++ b/modules/core/cs_access.cpp @@ -763,10 +763,9 @@ class CSAccess : public Module CommandCSLevels commandcslevels; public: - CSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index 3aafbc537..8650aebd4 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -575,10 +575,9 @@ class CSAKick : public Module CommandCSAKick commandcsakick; public: - CSAKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSAKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_ban.cpp b/modules/core/cs_ban.cpp index 3bccd9897..53c91314d 100644 --- a/modules/core/cs_ban.cpp +++ b/modules/core/cs_ban.cpp @@ -98,10 +98,9 @@ class CSBan : public Module CommandCSBan commandcsban; public: - CSBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandcsban("BAN") + CSBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), commandcsban("BAN") { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_clearusers.cpp b/modules/core/cs_clearusers.cpp index 7cf5055b7..b3e9d5d91 100644 --- a/modules/core/cs_clearusers.cpp +++ b/modules/core/cs_clearusers.cpp @@ -73,10 +73,9 @@ class CSClearUsers : public Module CommandCSClearUsers commandcsclearusers; public: - CSClearUsers(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSClearUsers(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_clone.cpp b/modules/core/cs_clone.cpp index 52161abf1..77bfc5387 100644 --- a/modules/core/cs_clone.cpp +++ b/modules/core/cs_clone.cpp @@ -173,10 +173,9 @@ class CSClone : public Module CommandCSClone commandcsclone; public: - CSClone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSClone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_drop.cpp b/modules/core/cs_drop.cpp index 66f1b31f6..3a1026f21 100644 --- a/modules/core/cs_drop.cpp +++ b/modules/core/cs_drop.cpp @@ -106,10 +106,9 @@ class CSDrop : public Module CommandCSDrop commandcsdrop; public: - CSDrop(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSDrop(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp index 9c0573971..e7f2b7894 100644 --- a/modules/core/cs_forbid.cpp +++ b/modules/core/cs_forbid.cpp @@ -117,10 +117,9 @@ class CSForbid : public Module CommandCSForbid commandcsforbid; public: - CSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_getkey.cpp b/modules/core/cs_getkey.cpp index b46a7df53..63a13cce4 100644 --- a/modules/core/cs_getkey.cpp +++ b/modules/core/cs_getkey.cpp @@ -68,10 +68,9 @@ class CSGetKey : public Module CommandCSGetKey commandcsgetkey; public: - CSGetKey(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSGetKey(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_help.cpp b/modules/core/cs_help.cpp index aff4c5165..b2ff5e496 100644 --- a/modules/core/cs_help.cpp +++ b/modules/core/cs_help.cpp @@ -62,10 +62,9 @@ class CSHelp : public Module CommandCSHelp commandcshelp; public: - CSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index a899c2911..71a8b132f 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -136,10 +136,9 @@ class CSInfo : public Module CommandCSInfo commandcsinfo; public: - CSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_invite.cpp b/modules/core/cs_invite.cpp index e7bcbbdab..ec0af478c 100644 --- a/modules/core/cs_invite.cpp +++ b/modules/core/cs_invite.cpp @@ -92,10 +92,9 @@ class CSInvite : public Module CommandCSInvite commandcsinvite; public: - CSInvite(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSInvite(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_kick.cpp b/modules/core/cs_kick.cpp index 2cf06e1e4..3f2988998 100644 --- a/modules/core/cs_kick.cpp +++ b/modules/core/cs_kick.cpp @@ -84,10 +84,9 @@ class CSKick : public Module CommandCSKick commandcskick; public: - CSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp index 318eea59f..e434abf80 100644 --- a/modules/core/cs_list.cpp +++ b/modules/core/cs_list.cpp @@ -142,10 +142,9 @@ class CSList : public Module CommandCSList commandcslist; public: - CSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_main.cpp b/modules/core/cs_main.cpp index 772c626d2..802528ee8 100644 --- a/modules/core/cs_main.cpp +++ b/modules/core/cs_main.cpp @@ -151,10 +151,9 @@ class ChanServCore : public Module ExpireCallback expires; public: - ChanServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), mychanserv(this), expires(this) + ChanServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), mychanserv(this), expires(this) { this->SetAuthor("Anope"); - this->SetType(CORE); ModuleManager::RegisterService(&this->mychanserv); @@ -176,7 +175,7 @@ class ChanServCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/cs_mode.cpp b/modules/core/cs_mode.cpp index fc4538033..a7938d5dd 100644 --- a/modules/core/cs_mode.cpp +++ b/modules/core/cs_mode.cpp @@ -362,10 +362,9 @@ class CSMode : public Module CommandCSMode commandcsmode; public: - CSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_modes.cpp b/modules/core/cs_modes.cpp index eeaf9f733..dbbe0e491 100644 --- a/modules/core/cs_modes.cpp +++ b/modules/core/cs_modes.cpp @@ -457,10 +457,9 @@ class CSModes : public Module CommandCSDeVoice commandcsdevoice; public: - CSModes(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSModes(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_register.cpp b/modules/core/cs_register.cpp index 0682f045a..9674ff126 100644 --- a/modules/core/cs_register.cpp +++ b/modules/core/cs_register.cpp @@ -133,10 +133,9 @@ class CSRegister : public Module CommandCSRegister commandcsregister; public: - CSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp index b262ce14a..21c1bf4d4 100644 --- a/modules/core/cs_saset.cpp +++ b/modules/core/cs_saset.cpp @@ -127,10 +127,9 @@ class CSSASet : public Module CommandCSSASet commandcssaset; public: - CSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp index 1026d8976..5f3be9624 100644 --- a/modules/core/cs_saset_noexpire.cpp +++ b/modules/core/cs_saset_noexpire.cpp @@ -64,10 +64,9 @@ class CSSetNoexpire : public Module CommandCSSASetNoexpire commandcssasetnoexpire; public: - CSSetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index d395fad32..e38d7f79f 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -131,10 +131,9 @@ class CSSet : public Module CommandCSSet commandcsset; public: - CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp index 35b8c6c14..1ae61a5ed 100644 --- a/modules/core/cs_set_bantype.cpp +++ b/modules/core/cs_set_bantype.cpp @@ -84,10 +84,9 @@ class CSSetBanType : public Module CommandCSSASetBanType commandcssasetbantype; public: - CSSetBanType(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetBanType(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index a65f4511b..493445a91 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -71,10 +71,9 @@ class CSSetDescription : public Module CommandCSSASetDescription commandcssasetdescription; public: - CSSetDescription(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetDescription(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp index 27d6f86fc..e6430eb99 100644 --- a/modules/core/cs_set_founder.cpp +++ b/modules/core/cs_set_founder.cpp @@ -107,10 +107,9 @@ class CSSetFounder : public Module CommandCSSASetFounder commandcssasetfounder; public: - CSSetFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp index 89491d418..bb121aab4 100644 --- a/modules/core/cs_set_keeptopic.cpp +++ b/modules/core/cs_set_keeptopic.cpp @@ -81,10 +81,9 @@ class CSSetKeepTopic : public Module CommandCSSASetKeepTopic commandcssasetkeeptopic; public: - CSSetKeepTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetKeepTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp index 0d71b42c4..abaecdde1 100644 --- a/modules/core/cs_set_opnotice.cpp +++ b/modules/core/cs_set_opnotice.cpp @@ -80,10 +80,9 @@ class CSSetOpNotice : public Module CommandCSSASetOpNotice commandcssasetopnotice; public: - CSSetOpNotice(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetOpNotice(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp index 51c7bc827..cae57d588 100644 --- a/modules/core/cs_set_peace.cpp +++ b/modules/core/cs_set_peace.cpp @@ -80,10 +80,9 @@ class CSSetPeace : public Module CommandCSSASetPeace commandcssasetpeace; public: - CSSetPeace(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetPeace(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index 683bd4481..692b0dc1c 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -152,10 +152,9 @@ class CSSetPersist : public Module CommandCSSASetPersist commandcssasetpeace; public: - CSSetPersist(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetPersist(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp index 42f7a2261..db7bf3b26 100644 --- a/modules/core/cs_set_private.cpp +++ b/modules/core/cs_set_private.cpp @@ -79,10 +79,9 @@ class CSSetPrivate : public Module CommandCSSASetPrivate commandcssasetprivate; public: - CSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp index 93fe0d023..f9ea3b514 100644 --- a/modules/core/cs_set_restricted.cpp +++ b/modules/core/cs_set_restricted.cpp @@ -82,10 +82,9 @@ class CSSetRestricted : public Module CommandCSSASetRestricted commandcssasetrestricted; public: - CSSetRestricted(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetRestricted(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp index 5fb8d9a7c..39d50fad2 100644 --- a/modules/core/cs_set_secure.cpp +++ b/modules/core/cs_set_secure.cpp @@ -81,10 +81,9 @@ class CSSetSecure : public Module CommandCSSASetSecure commandcssasetsecure; public: - CSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp index 3daa67924..a77df7f69 100644 --- a/modules/core/cs_set_securefounder.cpp +++ b/modules/core/cs_set_securefounder.cpp @@ -88,10 +88,9 @@ class CSSetSecureFounder : public Module CommandCSSASetSecureFounder commandcssasetsecurefounder; public: - CSSetSecureFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetSecureFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp index 773ae8ffd..7f45fdce0 100644 --- a/modules/core/cs_set_secureops.cpp +++ b/modules/core/cs_set_secureops.cpp @@ -79,10 +79,9 @@ class CSSetSecureOps : public Module CommandCSSASetSecureOps commandcssasetsecureops; public: - CSSetSecureOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetSecureOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp index 50c0d74f9..6ac081f63 100644 --- a/modules/core/cs_set_signkick.cpp +++ b/modules/core/cs_set_signkick.cpp @@ -94,10 +94,9 @@ class CSSetSignKick : public Module CommandCSSASetSignKick commandcssasetsignkick; public: - CSSetSignKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetSignKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp index 7c3b156e3..a9a1e7498 100644 --- a/modules/core/cs_set_successor.cpp +++ b/modules/core/cs_set_successor.cpp @@ -114,10 +114,9 @@ class CSSetSuccessor : public Module CommandCSSASetSuccessor commandcssasetsuccessor; public: - CSSetSuccessor(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetSuccessor(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp index add079c52..8792f9d37 100644 --- a/modules/core/cs_set_topiclock.cpp +++ b/modules/core/cs_set_topiclock.cpp @@ -80,10 +80,9 @@ class CSSetTopicLock : public Module CommandCSSASetTopicLock commandcssasettopiclock; public: - CSSetTopicLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetTopicLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_set_xop.cpp b/modules/core/cs_set_xop.cpp index 2f423e098..39cfa6bac 100644 --- a/modules/core/cs_set_xop.cpp +++ b/modules/core/cs_set_xop.cpp @@ -28,7 +28,7 @@ class CommandCSSetXOP : public Command User *u = source.u; ChannelInfo *ci = source.ci; - if (!FindModule("cs_xop")) + if (!ModuleManager::FindModule("cs_xop")) { source.Reply(_("xOP system is not available."), "XOP"); return MOD_CONT; @@ -134,10 +134,9 @@ class CSSetXOP : public Module CommandCSSASetXOP commandcssasetxop; public: - CSSetXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/core/cs_status.cpp b/modules/core/cs_status.cpp index 0ff2db90a..f9107fc8e 100644 --- a/modules/core/cs_status.cpp +++ b/modules/core/cs_status.cpp @@ -62,10 +62,9 @@ class CSStatus : public Module CommandCSStatus commandcsstatus; public: - CSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(chanserv->Bot(), &commandcsstatus); } diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp index 37fae7723..374e44bc2 100644 --- a/modules/core/cs_suspend.cpp +++ b/modules/core/cs_suspend.cpp @@ -149,10 +149,9 @@ class CSSuspend : public Module CommandCSUnSuspend commandcsunsuspend; public: - CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(chanserv->Bot(), &commandcssuspend); this->AddCommand(chanserv->Bot(), &commandcsunsuspend); diff --git a/modules/core/cs_topic.cpp b/modules/core/cs_topic.cpp index 52fecd7a4..a6c6fad74 100644 --- a/modules/core/cs_topic.cpp +++ b/modules/core/cs_topic.cpp @@ -74,10 +74,9 @@ class CSTopic : public Module CommandCSTopic commandcstopic; public: - CSTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(chanserv->Bot(), &commandcstopic); } diff --git a/modules/core/cs_unban.cpp b/modules/core/cs_unban.cpp index be567db9a..8cdb0f2fd 100644 --- a/modules/core/cs_unban.cpp +++ b/modules/core/cs_unban.cpp @@ -82,10 +82,9 @@ class CSUnban : public Module CommandCSUnban commandcsunban; public: - CSUnban(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSUnban(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(chanserv->Bot(), &commandcsunban); } diff --git a/modules/core/cs_xop.cpp b/modules/core/cs_xop.cpp index 3b65e035f..72471a868 100644 --- a/modules/core/cs_xop.cpp +++ b/modules/core/cs_xop.cpp @@ -723,10 +723,9 @@ class CSXOP : public Module CommandCSVOP commandcsvop; public: - CSXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(chanserv->Bot(), &commandcssop); this->AddCommand(chanserv->Bot(), &commandcsaop); diff --git a/modules/extra/db_mysql.cpp b/modules/core/db_mysql.cpp index 0285d2530..386e20740 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/core/db_mysql.cpp @@ -1,6 +1,6 @@ #include "module.h" #include "operserv.h" -#include "sql.h" +#include "../extra/sql.h" #include "os_session.h" static Anope::string ToString(const std::vector<Anope::string> &strings) @@ -120,11 +120,10 @@ class DBMySQL : public Module } } - DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), sqlinterface(this), SQL("mysql/main"), SessionInterface("session") + DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE), sqlinterface(this), SQL("mysql/main"), SessionInterface("session") { me = this; - this->SetType(DATABASE); this->lastwarn = 0; this->ro = false; diff --git a/modules/extra/db_mysql_live.cpp b/modules/core/db_mysql_live.cpp index f1f0b855f..04a9e53c6 100644 --- a/modules/extra/db_mysql_live.cpp +++ b/modules/core/db_mysql_live.cpp @@ -1,6 +1,6 @@ #include "module.h" -#include "async_commands.h" -#include "sql.h" +#include "../extra/async_commands.h" +#include "../extra/sql.h" class SQLCache : public Timer { @@ -161,7 +161,7 @@ class MySQLLiveModule : public Module public: MySQLLiveModule(const Anope::string &modname, const Anope::string &creator) : - Module(modname, creator), SQL("mysql/main"), ACS("asynch_commands") + Module(modname, creator, DATABASE), SQL("mysql/main"), ACS("asynch_commands") { Implementation i[] = { I_OnFindChan, I_OnFindNick, I_OnFindCore, I_OnShutdown }; ModuleManager::Attach(i, this, 4); diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 4ab248f76..a233f66f6 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -371,10 +371,9 @@ class DBPlain : public Module /* Backup file names */ std::list<Anope::string> Backups; public: - DBPlain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + DBPlain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE) { this->SetAuthor("Anope"); - this->SetType(DATABASE); Implementation i[] = { I_OnReload, I_OnDatabaseRead, I_OnLoadDatabase, I_OnDatabaseReadMetadata, I_OnSaveDatabase, I_OnModuleLoad }; ModuleManager::Attach(i, this, 6); diff --git a/modules/core/enc_md5.cpp b/modules/core/enc_md5.cpp index 0cf38e4fb..a4d528afa 100644 --- a/modules/core/enc_md5.cpp +++ b/modules/core/enc_md5.cpp @@ -315,13 +315,12 @@ void Decode(unsigned *output, const unsigned char *input, unsigned len) class EMD5 : public Module { public: - EMD5(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + EMD5(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION) { this->SetAuthor("Anope"); - this->SetType(ENCRYPTION); - Implementation i[] = { I_OnEncrypt, I_OnDecrypt, I_OnCheckAuthentication }; - ModuleManager::Attach(i, this, 3); + Implementation i[] = { I_OnEncrypt, I_OnCheckAuthentication }; + ModuleManager::Attach(i, this, 2); } EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) @@ -340,13 +339,6 @@ class EMD5 : public Module return EVENT_ALLOW; } - EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) - { - if (!hashm.equals_cs("md5")) - return EVENT_CONTINUE; - return EVENT_STOP; - } - EventReturn OnCheckAuthentication(User *u, Command *c, const std::vector<Anope::string> ¶ms, const Anope::string &account, const Anope::string &password) { NickAlias *na = findnick(account); @@ -368,7 +360,7 @@ class EMD5 : public Module /* if we are NOT the first module in the list, * we want to re-encrypt the pass with the new encryption */ - if (!this->name.equals_ci(Config->EncModuleList.front())) + if (ModuleManager::FindFirstOf(ENCRYPTION) != this) enc_encrypt(password, nc->pass); return EVENT_ALLOW; } diff --git a/modules/core/enc_none.cpp b/modules/core/enc_none.cpp index 9f6b7ff72..998ade9ab 100644 --- a/modules/core/enc_none.cpp +++ b/modules/core/enc_none.cpp @@ -12,10 +12,9 @@ class ENone : public Module { public: - ENone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ENone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION) { this->SetAuthor("Anope"); - this->SetType(ENCRYPTION); Implementation i[] = { I_OnEncrypt, I_OnDecrypt, I_OnCheckAuthentication }; ModuleManager::Attach(i, this, 3); @@ -63,7 +62,7 @@ class ENone : public Module /* if we are NOT the first module in the list, * we want to re-encrypt the pass with the new encryption */ - if (!this->name.equals_ci(Config->EncModuleList.front())) + if (ModuleManager::FindFirstOf(ENCRYPTION) != this) enc_encrypt(password, nc->pass); return EVENT_ALLOW; } diff --git a/modules/core/enc_old.cpp b/modules/core/enc_old.cpp index 5fb863110..ff1226f12 100644 --- a/modules/core/enc_old.cpp +++ b/modules/core/enc_old.cpp @@ -320,13 +320,12 @@ inline static char XTOI(char c) { return c > 9 ? c - 'A' + 10 : c - '0'; } class EOld : public Module { public: - EOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + EOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION) { this->SetAuthor("Anope"); - this->SetType(ENCRYPTION); - Implementation i[] = { I_OnEncrypt, I_OnDecrypt, I_OnCheckAuthentication }; - ModuleManager::Attach(i, this, 3); + Implementation i[] = { I_OnEncrypt, I_OnCheckAuthentication }; + ModuleManager::Attach(i, this, 2); } EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) @@ -350,13 +349,6 @@ class EOld : public Module return EVENT_ALLOW; } - EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) - { - if (!hashm.equals_cs("oldmd5")) - return EVENT_CONTINUE; - return EVENT_STOP; - } - EventReturn OnCheckAuthentication(User *u, Command *c, const std::vector<Anope::string> ¶ms, const Anope::string &account, const Anope::string &password) { NickAlias *na = findnick(account); @@ -378,7 +370,7 @@ class EOld : public Module /* if we are NOT the first module in the list, * we want to re-encrypt the pass with the new encryption */ - if (!this->name.equals_ci(Config->EncModuleList.front())) + if (ModuleManager::FindFirstOf(ENCRYPTION) != this) enc_encrypt(password, nc->pass); return EVENT_ALLOW; } diff --git a/modules/core/enc_sha1.cpp b/modules/core/enc_sha1.cpp index 8ec387d0d..84425751b 100644 --- a/modules/core/enc_sha1.cpp +++ b/modules/core/enc_sha1.cpp @@ -168,13 +168,12 @@ void SHA1Final(unsigned char digest[21], SHA1_CTX *context) class ESHA1 : public Module { public: - ESHA1(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ESHA1(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION) { this->SetAuthor("Anope"); - this->SetType(ENCRYPTION); - Implementation i[] = { I_OnEncrypt, I_OnDecrypt, I_OnCheckAuthentication }; - ModuleManager::Attach(i, this, 3); + Implementation i[] = { I_OnEncrypt, I_OnCheckAuthentication }; + ModuleManager::Attach(i, this, 2); } EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) @@ -193,13 +192,6 @@ class ESHA1 : public Module return EVENT_ALLOW; } - EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) - { - if (!hashm.equals_cs("sha1")) - return EVENT_CONTINUE; - return EVENT_STOP; - } - EventReturn OnCheckAuthentication(User *u, Command *c, const std::vector<Anope::string> ¶ms, const Anope::string &account, const Anope::string &password) { NickAlias *na = findnick(account); @@ -218,10 +210,7 @@ class ESHA1 : public Module this->OnEncrypt(password, buf); if (nc->pass.equals_cs(buf)) { - /* when we are NOT the first module in the list, - * we want to re-encrypt the pass with the new encryption - */ - if (!this->name.equals_ci(Config->EncModuleList.front())) + if (ModuleManager::FindFirstOf(ENCRYPTION) != this) enc_encrypt(password, nc->pass); return EVENT_ALLOW; } diff --git a/modules/core/enc_sha256.cpp b/modules/core/enc_sha256.cpp index 06154ada0..a04510a33 100644 --- a/modules/core/enc_sha256.cpp +++ b/modules/core/enc_sha256.cpp @@ -247,13 +247,12 @@ class ESHA256 : public Module /********** ANOPE ******/ public: - ESHA256(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ESHA256(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION) { this->SetAuthor("Anope"); - this->SetType(ENCRYPTION); - Implementation i[] = { I_OnEncrypt, I_OnDecrypt, I_OnCheckAuthentication }; - ModuleManager::Attach(i, this, 3); + Implementation i[] = { I_OnEncrypt, I_OnCheckAuthentication }; + ModuleManager::Attach(i, this, 2); use_iv = false; } @@ -279,13 +278,6 @@ class ESHA256 : public Module return EVENT_ALLOW; } - EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) - { - if (!hashm.equals_cs("sha256")) - return EVENT_CONTINUE; - return EVENT_STOP; - } - EventReturn OnCheckAuthentication(User *u, Command *c, const std::vector<Anope::string> ¶ms, const Anope::string &account, const Anope::string &password) { NickAlias *na = findnick(account); @@ -310,7 +302,7 @@ class ESHA256 : public Module /* if we are NOT the first module in the list, * we want to re-encrypt the pass with the new encryption */ - if (!this->name.equals_ci(Config->EncModuleList.front())) + if (ModuleManager::FindFirstOf(ENCRYPTION) != this) enc_encrypt(password, nc->pass); return EVENT_ALLOW; } diff --git a/modules/core/gl_global.cpp b/modules/core/gl_global.cpp index e03c3f788..9c944dd33 100644 --- a/modules/core/gl_global.cpp +++ b/modules/core/gl_global.cpp @@ -52,10 +52,9 @@ class GLGlobal : public Module CommandGLGlobal commandglglobal; public: - GLGlobal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + GLGlobal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (Config->s_Global.empty()) throw ModuleException("Global is disabled"); diff --git a/modules/core/gl_help.cpp b/modules/core/gl_help.cpp index ea67a8efc..e44c4797e 100644 --- a/modules/core/gl_help.cpp +++ b/modules/core/gl_help.cpp @@ -43,10 +43,9 @@ class GLHelp : public Module CommandGLHelp commandoshelp; public: - GLHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + GLHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!global) throw ModuleException("Global is not loaded!"); diff --git a/modules/core/gl_main.cpp b/modules/core/gl_main.cpp index 4b512ca0a..f52be0871 100644 --- a/modules/core/gl_main.cpp +++ b/modules/core/gl_main.cpp @@ -55,10 +55,9 @@ class GlobalCore : public Module MyGlobalService myglobal; public: - GlobalCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), myglobal(this) + GlobalCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), myglobal(this) { this->SetAuthor("Anope"); - this->SetType(CORE); Implementation i[] = { I_OnRestart, I_OnShutdown, I_OnNewServer }; ModuleManager::Attach(i, this, 3); @@ -80,7 +79,7 @@ class GlobalCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/hs_del.cpp b/modules/core/hs_del.cpp index bdd1bc525..b6dddf89c 100644 --- a/modules/core/hs_del.cpp +++ b/modules/core/hs_del.cpp @@ -64,10 +64,9 @@ class HSDel : public Module CommandHSDel commandhsdel; public: - HSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_delall.cpp b/modules/core/hs_delall.cpp index 905fe4ec3..c7e0d4cfd 100644 --- a/modules/core/hs_delall.cpp +++ b/modules/core/hs_delall.cpp @@ -69,10 +69,9 @@ class HSDelAll : public Module CommandHSDelAll commandhsdelall; public: - HSDelAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSDelAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_group.cpp b/modules/core/hs_group.cpp index 9525b4646..2a2f9545b 100644 --- a/modules/core/hs_group.cpp +++ b/modules/core/hs_group.cpp @@ -56,10 +56,9 @@ class HSGroup : public Module CommandHSGroup commandhsgroup; public: - HSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_help.cpp b/modules/core/hs_help.cpp index 53b40ef89..3cd221e10 100644 --- a/modules/core/hs_help.cpp +++ b/modules/core/hs_help.cpp @@ -44,10 +44,9 @@ class HSHelp : public Module CommandHSHelp commandhshelp; public: - HSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_list.cpp b/modules/core/hs_list.cpp index a85c2e8b2..d6446f4c7 100644 --- a/modules/core/hs_list.cpp +++ b/modules/core/hs_list.cpp @@ -124,10 +124,9 @@ class HSList : public Module CommandHSList commandhslist; public: - HSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_main.cpp b/modules/core/hs_main.cpp index c4b1433c8..309e235bf 100644 --- a/modules/core/hs_main.cpp +++ b/modules/core/hs_main.cpp @@ -44,12 +44,11 @@ class HostServCore : public Module MyHostServService myhostserv; public: - HostServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), myhostserv(this) + HostServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), myhostserv(this) { this->SetAuthor("Anope"); - this->SetType(CORE); - if (!ircd->vhost) + if (!ircd || !ircd->vhost) throw ModuleException("Your IRCd does not suppor vhosts"); ModuleManager::RegisterService(&this->myhostserv); @@ -72,7 +71,7 @@ class HostServCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/hs_off.cpp b/modules/core/hs_off.cpp index d06d125fa..85e96f62f 100644 --- a/modules/core/hs_off.cpp +++ b/modules/core/hs_off.cpp @@ -54,10 +54,9 @@ class HSOff : public Module CommandHSOff commandhsoff; public: - HSOff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSOff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_on.cpp b/modules/core/hs_on.cpp index 43fd06b04..09735ba83 100644 --- a/modules/core/hs_on.cpp +++ b/modules/core/hs_on.cpp @@ -64,10 +64,9 @@ class HSOn : public Module CommandHSOn commandhson; public: - HSOn(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSOn(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_set.cpp b/modules/core/hs_set.cpp index 9521bc57e..bb1be1d5b 100644 --- a/modules/core/hs_set.cpp +++ b/modules/core/hs_set.cpp @@ -118,10 +118,9 @@ class HSSet : public Module CommandHSSet commandhsset; public: - HSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/hs_setall.cpp b/modules/core/hs_setall.cpp index 52061203f..bc0d6d9cb 100644 --- a/modules/core/hs_setall.cpp +++ b/modules/core/hs_setall.cpp @@ -125,10 +125,9 @@ class HSSetAll : public Module CommandHSSetAll commandhssetall; public: - HSSetAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSSetAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!hostserv) throw ModuleException("HostServ is not loaded!"); diff --git a/modules/core/ms_cancel.cpp b/modules/core/ms_cancel.cpp index 1cfd20767..f70888d32 100644 --- a/modules/core/ms_cancel.cpp +++ b/modules/core/ms_cancel.cpp @@ -74,10 +74,9 @@ class MSCancel : public Module CommandMSCancel commandmscancel; public: - MSCancel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSCancel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_check.cpp b/modules/core/ms_check.cpp index 34adcf2c4..6b56a66c0 100644 --- a/modules/core/ms_check.cpp +++ b/modules/core/ms_check.cpp @@ -88,10 +88,9 @@ class MSCheck : public Module CommandMSCheck commandmscheck; public: - MSCheck(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSCheck(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_del.cpp b/modules/core/ms_del.cpp index 077b5bdba..630572521 100644 --- a/modules/core/ms_del.cpp +++ b/modules/core/ms_del.cpp @@ -156,10 +156,9 @@ class MSDel : public Module CommandMSDel commandmsdel; public: - MSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_help.cpp b/modules/core/ms_help.cpp index dcd5f4e03..598e8ffa1 100644 --- a/modules/core/ms_help.cpp +++ b/modules/core/ms_help.cpp @@ -54,10 +54,9 @@ class MSHelp : public Module CommandMSHelp commandmshelp; public: - MSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_ignore.cpp b/modules/core/ms_ignore.cpp index 72a286a88..f110bd345 100644 --- a/modules/core/ms_ignore.cpp +++ b/modules/core/ms_ignore.cpp @@ -107,10 +107,9 @@ class MSIgnore : public Module CommandMSIgnore commandmsignore; public: - MSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_info.cpp b/modules/core/ms_info.cpp index 1e12f97e9..95e186e29 100644 --- a/modules/core/ms_info.cpp +++ b/modules/core/ms_info.cpp @@ -220,10 +220,9 @@ class MSInfo : public Module CommandMSInfo commandmsinfo; public: - MSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_list.cpp b/modules/core/ms_list.cpp index e09fcecc2..176cd931c 100644 --- a/modules/core/ms_list.cpp +++ b/modules/core/ms_list.cpp @@ -168,10 +168,9 @@ class MSList : public Module CommandMSList commandmslist; public: - MSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_main.cpp b/modules/core/ms_main.cpp index 40cc6d6d5..39fc94b49 100644 --- a/modules/core/ms_main.cpp +++ b/modules/core/ms_main.cpp @@ -185,10 +185,9 @@ class MemoServCore : public Module MyMemoServService mymemoserv; public: - MemoServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), mymemoserv(this) + MemoServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), mymemoserv(this) { this->SetAuthor("Anope"); - this->SetType(CORE); Implementation i[] = { I_OnNickIdentify, I_OnJoinChannel, I_OnUserAway, I_OnNickUpdate }; ModuleManager::Attach(i, this, 4); @@ -210,7 +209,7 @@ class MemoServCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/ms_read.cpp b/modules/core/ms_read.cpp index 4b6e03aed..e8868abe2 100644 --- a/modules/core/ms_read.cpp +++ b/modules/core/ms_read.cpp @@ -187,10 +187,9 @@ class MSRead : public Module CommandMSRead commandmsread; public: - MSRead(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSRead(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_rsend.cpp b/modules/core/ms_rsend.cpp index 46183ec77..4aa53e17a 100644 --- a/modules/core/ms_rsend.cpp +++ b/modules/core/ms_rsend.cpp @@ -95,13 +95,12 @@ class MSRSend : public Module CommandMSRSend commandmsrsend; public: - MSRSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSRSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { if (!Config->MSMemoReceipt) throw ModuleException("Invalid value for memoreceipt"); this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_send.cpp b/modules/core/ms_send.cpp index c7bc0bb4c..9bf4b3f40 100644 --- a/modules/core/ms_send.cpp +++ b/modules/core/ms_send.cpp @@ -62,10 +62,9 @@ class MSSend : public Module CommandMSSend commandmssend; public: - MSSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_sendall.cpp b/modules/core/ms_sendall.cpp index 6fea77ae1..d7ffb0489 100644 --- a/modules/core/ms_sendall.cpp +++ b/modules/core/ms_sendall.cpp @@ -65,10 +65,9 @@ class MSSendAll : public Module CommandMSSendAll commandmssendall; public: - MSSendAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSSendAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp index 0b5dd3831..3885d37df 100644 --- a/modules/core/ms_set.cpp +++ b/modules/core/ms_set.cpp @@ -303,10 +303,9 @@ class MSSet : public Module CommandMSSet commandmsset; public: - MSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ms_staff.cpp b/modules/core/ms_staff.cpp index 1d7fbc288..828186e2c 100644 --- a/modules/core/ms_staff.cpp +++ b/modules/core/ms_staff.cpp @@ -63,10 +63,9 @@ class MSStaff : public Module CommandMSStaff commandmsstaff; public: - MSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + MSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!memoserv) throw ModuleException("MemoServ is not loaded!"); diff --git a/modules/core/ns_access.cpp b/modules/core/ns_access.cpp index 7e69dbf4e..d25520d43 100644 --- a/modules/core/ns_access.cpp +++ b/modules/core/ns_access.cpp @@ -188,10 +188,9 @@ class NSAccess : public Module CommandNSAccess commandnsaccess; public: - NSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_ajoin.cpp b/modules/core/ns_ajoin.cpp index 2d5ac146e..2cd34c8d1 100644 --- a/modules/core/ns_ajoin.cpp +++ b/modules/core/ns_ajoin.cpp @@ -113,10 +113,9 @@ class NSAJoin : public Module CommandNSAJoin commandnsajoin; public: - NSAJoin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSAJoin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_alist.cpp b/modules/core/ns_alist.cpp index 78b4cf096..5ae5d570c 100644 --- a/modules/core/ns_alist.cpp +++ b/modules/core/ns_alist.cpp @@ -171,10 +171,9 @@ class NSAList : public Module CommandNSAList commandnsalist; public: - NSAList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSAList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(nickserv->Bot(), &commandnsalist); } diff --git a/modules/core/ns_cert.cpp b/modules/core/ns_cert.cpp index 87acf7ac2..0029bfe34 100644 --- a/modules/core/ns_cert.cpp +++ b/modules/core/ns_cert.cpp @@ -206,12 +206,11 @@ class NSCert : public Module } public: - NSCert(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSCert(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); - if (!ircd->certfp) + if (!ircd || !ircd->certfp) throw ModuleException("Your IRCd does not support ssl client certificates"); if (!nickserv) diff --git a/modules/core/ns_drop.cpp b/modules/core/ns_drop.cpp index 475359002..80ae23d9e 100644 --- a/modules/core/ns_drop.cpp +++ b/modules/core/ns_drop.cpp @@ -127,10 +127,9 @@ class NSDrop : public Module CommandNSDrop commandnsdrop; public: - NSDrop(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSDrop(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_forbid.cpp b/modules/core/ns_forbid.cpp index d9c13ca67..8fd433123 100644 --- a/modules/core/ns_forbid.cpp +++ b/modules/core/ns_forbid.cpp @@ -105,10 +105,9 @@ class NSForbid : public Module CommandNSForbid commandnsforbid; public: - NSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_getemail.cpp b/modules/core/ns_getemail.cpp index 8f80a5cdf..0bd6c8fb2 100644 --- a/modules/core/ns_getemail.cpp +++ b/modules/core/ns_getemail.cpp @@ -74,10 +74,9 @@ class NSGetEMail : public Module { CommandNSGetEMail commandnsgetemail; public: - NSGetEMail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSGetEMail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_getpass.cpp b/modules/core/ns_getpass.cpp index eba380dfb..e66cf8ff7 100644 --- a/modules/core/ns_getpass.cpp +++ b/modules/core/ns_getpass.cpp @@ -70,10 +70,9 @@ class NSGetPass : public Module CommandNSGetPass commandnsgetpass; public: - NSGetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSGetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp index 955f25de7..14a89a85c 100644 --- a/modules/core/ns_ghost.cpp +++ b/modules/core/ns_ghost.cpp @@ -117,10 +117,9 @@ class NSGhost : public Module CommandNSGhost commandnsghost; public: - NSGhost(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSGhost(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp index cd3b4946d..2be6f7b6b 100644 --- a/modules/core/ns_group.cpp +++ b/modules/core/ns_group.cpp @@ -311,10 +311,9 @@ class NSGroup : public Module CommandNSGList commandnsglist; public: - NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(nickserv->Bot(), &commandnsgroup); this->AddCommand(nickserv->Bot(), &commandnsungroup); diff --git a/modules/core/ns_help.cpp b/modules/core/ns_help.cpp index 61088d979..29a6bd1cd 100644 --- a/modules/core/ns_help.cpp +++ b/modules/core/ns_help.cpp @@ -66,10 +66,9 @@ class NSHelp : public Module CommandNSHelp commandnshelp; public: - NSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_identify.cpp b/modules/core/ns_identify.cpp index 3ef47b7d7..a9d935966 100644 --- a/modules/core/ns_identify.cpp +++ b/modules/core/ns_identify.cpp @@ -88,10 +88,9 @@ class NSIdentify : public Module CommandNSIdentify commandnsidentify; public: - NSIdentify(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSIdentify(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp index 59cd60e6d..6e16099a9 100644 --- a/modules/core/ns_info.cpp +++ b/modules/core/ns_info.cpp @@ -171,10 +171,9 @@ class NSInfo : public Module CommandNSInfo commandnsinfo; public: - NSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp index 60dfa9732..7d7844def 100644 --- a/modules/core/ns_list.cpp +++ b/modules/core/ns_list.cpp @@ -214,10 +214,9 @@ class NSList : public Module CommandNSList commandnslist; public: - NSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_logout.cpp b/modules/core/ns_logout.cpp index 6675e85b4..d7e6cc4dc 100644 --- a/modules/core/ns_logout.cpp +++ b/modules/core/ns_logout.cpp @@ -98,10 +98,9 @@ class NSLogout : public Module CommandNSLogout commandnslogout; public: - NSLogout(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSLogout(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_main.cpp b/modules/core/ns_main.cpp index dbf72ca09..ecb7e1944 100644 --- a/modules/core/ns_main.cpp +++ b/modules/core/ns_main.cpp @@ -156,10 +156,9 @@ class NickServCore : public Module ExpireCallback expires; public: - NickServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), mynickserv(this), expires(this) + NickServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), mynickserv(this), expires(this) { this->SetAuthor("Anope"); - this->SetType(CORE); Implementation i[] = { I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickIdentify, I_OnNickGroup, I_OnNickUpdate }; ModuleManager::Attach(i, this, 5); @@ -181,7 +180,7 @@ class NickServCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/ns_recover.cpp b/modules/core/ns_recover.cpp index 30e1476c3..2da749296 100644 --- a/modules/core/ns_recover.cpp +++ b/modules/core/ns_recover.cpp @@ -127,10 +127,9 @@ class NSRecover : public Module CommandNSRecover commandnsrecover; public: - NSRecover(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSRecover(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp index 56c8072ca..8927a9aa2 100644 --- a/modules/core/ns_register.cpp +++ b/modules/core/ns_register.cpp @@ -325,10 +325,9 @@ class NSRegister : public Module CommandNSResend commandnsrsend; public: - NSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_release.cpp b/modules/core/ns_release.cpp index 251355b0d..98d2b4645 100644 --- a/modules/core/ns_release.cpp +++ b/modules/core/ns_release.cpp @@ -105,10 +105,9 @@ class NSRelease : public Module CommandNSRelease commandnsrelease; public: - NSRelease(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSRelease(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_resetpass.cpp b/modules/core/ns_resetpass.cpp index 3cbbe5903..983800d0a 100644 --- a/modules/core/ns_resetpass.cpp +++ b/modules/core/ns_resetpass.cpp @@ -67,10 +67,9 @@ class NSResetPass : public Module CommandNSResetPass commandnsresetpass; public: - NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp index 69fb747d6..d466af7c3 100644 --- a/modules/core/ns_saset.cpp +++ b/modules/core/ns_saset.cpp @@ -202,13 +202,7 @@ class CommandNSSASetPassword : public Command return MOD_CONT; } - if (enc_encrypt(params[1], nc->pass)) - { - Log() << "Failed to encrypt password for " << nc->display << " (saset)"; - source.Reply(_(NICK_SASET_PASSWORD_FAILED), nc->display.c_str()); - return MOD_CONT; - } - + enc_encrypt(params[1], nc->pass); Anope::string tmp_pass; if (enc_decrypt(nc->pass, tmp_pass) == 1) source.Reply(_(NICK_SASET_PASSWORD_CHANGED_TO), nc->display.c_str(), tmp_pass.c_str()); @@ -239,10 +233,9 @@ class NSSASet : public Module CommandNSSASetPassword commandnssasetpassword; public: - NSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp index e1bbaf87f..0dbee1e29 100644 --- a/modules/core/ns_saset_noexpire.cpp +++ b/modules/core/ns_saset_noexpire.cpp @@ -66,10 +66,9 @@ class NSSASetNoexpire : public Module CommandNSSASetNoexpire commandnssasetnoexpire; public: - NSSASetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSASetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_sendpass.cpp b/modules/core/ns_sendpass.cpp index 98530c236..a7501e438 100644 --- a/modules/core/ns_sendpass.cpp +++ b/modules/core/ns_sendpass.cpp @@ -78,10 +78,9 @@ class NSSendPass : public Module CommandNSSendPass commandnssendpass; public: - NSSendPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSendPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp index 895542cc7..47b70c365 100644 --- a/modules/core/ns_set.cpp +++ b/modules/core/ns_set.cpp @@ -188,13 +188,7 @@ class CommandNSSetPassword : public Command return MOD_CONT; } - if (enc_encrypt(param, u->Account()->pass) < 0) - { - Log() << "Failed to encrypt password for " << u->Account()->display << " (set)"; - source.Reply(_(NICK_SASET_PASSWORD_FAILED)); - return MOD_CONT; - } - + enc_encrypt(param, u->Account()->pass); Anope::string tmp_pass; if (enc_decrypt(u->Account()->pass, tmp_pass) == 1) source.Reply(_(NICK_SASET_PASSWORD_CHANGED_TO), u->Account()->display.c_str(), tmp_pass.c_str()); @@ -227,10 +221,9 @@ class NSSet : public Module CommandNSSetPassword commandnssetpassword; public: - NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp index 051ce22e6..68513b849 100644 --- a/modules/core/ns_set_autoop.cpp +++ b/modules/core/ns_set_autoop.cpp @@ -91,10 +91,9 @@ class NSSetAutoOp : public Module CommandNSSASetAutoOp commandnssasetautoop; public: - NSSetAutoOp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetAutoOp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp index ed49cfd89..388914733 100644 --- a/modules/core/ns_set_email.cpp +++ b/modules/core/ns_set_email.cpp @@ -135,10 +135,9 @@ class NSSetEmail : public Module CommandNSSASetEmail commandnssasetemail; public: - NSSetEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp index d36694791..9723f78b5 100644 --- a/modules/core/ns_set_greet.cpp +++ b/modules/core/ns_set_greet.cpp @@ -82,10 +82,9 @@ class NSSetGreet : public Module CommandNSSASetGreet commandnssasetgreet; public: - NSSetGreet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetGreet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp index 5d315d6fa..6c5eeff29 100644 --- a/modules/core/ns_set_hide.cpp +++ b/modules/core/ns_set_hide.cpp @@ -134,10 +134,9 @@ class NSSetHide : public Module CommandNSSASetHide commandnssasethide; public: - NSSetHide(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetHide(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp index 6b3952f37..e0a536a0a 100644 --- a/modules/core/ns_set_kill.cpp +++ b/modules/core/ns_set_kill.cpp @@ -134,10 +134,9 @@ class NSSetKill : public Module CommandNSSASetKill commandnssasetkill; public: - NSSetKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp index e73bc6f97..98f8f044a 100644 --- a/modules/core/ns_set_language.cpp +++ b/modules/core/ns_set_language.cpp @@ -109,10 +109,9 @@ class NSSetLanguage : public Module CommandNSSASetLanguage commandnssasetlanguage; public: - NSSetLanguage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetLanguage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp index e842e49bd..d3f0d896c 100644 --- a/modules/core/ns_set_message.cpp +++ b/modules/core/ns_set_message.cpp @@ -98,10 +98,9 @@ class NSSetMessage : public Module CommandNSSASetMessage commandnssasetmessage; public: - NSSetMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp index 40fe2e7c0..422cab2df 100644 --- a/modules/core/ns_set_private.cpp +++ b/modules/core/ns_set_private.cpp @@ -98,10 +98,9 @@ class NSSetPrivate : public Module CommandNSSASetPrivate commandnssasetprivate; public: - NSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp index f3e3128ac..1c78e3f1b 100644 --- a/modules/core/ns_set_secure.cpp +++ b/modules/core/ns_set_secure.cpp @@ -100,10 +100,9 @@ class NSSetSecure : public Module CommandNSSASetSecure commandnssasetsecure; public: - NSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_status.cpp b/modules/core/ns_status.cpp index a7710d326..18fbadf87 100644 --- a/modules/core/ns_status.cpp +++ b/modules/core/ns_status.cpp @@ -82,10 +82,9 @@ class NSStatus : public Module CommandNSStatus commandnsstatus; public: - NSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_suspend.cpp b/modules/core/ns_suspend.cpp index 1692e88fc..34a9165a2 100644 --- a/modules/core/ns_suspend.cpp +++ b/modules/core/ns_suspend.cpp @@ -165,10 +165,9 @@ class NSSuspend : public Module CommandNSUnSuspend commandnsunsuspend; public: - NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/ns_update.cpp b/modules/core/ns_update.cpp index 0146ec954..d5e727fa6 100644 --- a/modules/core/ns_update.cpp +++ b/modules/core/ns_update.cpp @@ -51,10 +51,9 @@ class NSUpdate : public Module CommandNSUpdate commandnsupdate; public: - NSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!nickserv) throw ModuleException("NickServ is not loaded!"); diff --git a/modules/core/os_akill.cpp b/modules/core/os_akill.cpp index 076335840..07d950d8d 100644 --- a/modules/core/os_akill.cpp +++ b/modules/core/os_akill.cpp @@ -447,10 +447,9 @@ class OSAKill : public Module CommandOSAKill commandosakill; public: - OSAKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSAKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp index 5e3fab915..6e5c8e748 100644 --- a/modules/core/os_chankill.cpp +++ b/modules/core/os_chankill.cpp @@ -107,10 +107,9 @@ class OSChanKill : public Module CommandOSChanKill commandoschankill; public: - OSChanKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSChanKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_chanlist.cpp b/modules/core/os_chanlist.cpp index b70edf35a..aebc3a035 100644 --- a/modules/core/os_chanlist.cpp +++ b/modules/core/os_chanlist.cpp @@ -95,10 +95,9 @@ class OSChanList : public Module CommandOSChanList commandoschanlist; public: - OSChanList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSChanList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_config.cpp b/modules/core/os_config.cpp index f2b87d474..c921600fb 100644 --- a/modules/core/os_config.cpp +++ b/modules/core/os_config.cpp @@ -213,10 +213,9 @@ class OSConfig : public Module CommandOSConfig commandosconfig; public: - OSConfig(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSConfig(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_help.cpp b/modules/core/os_help.cpp index 3694ad3ff..764443035 100644 --- a/modules/core/os_help.cpp +++ b/modules/core/os_help.cpp @@ -44,10 +44,9 @@ class OSHelp : public Module CommandOSHelp commandoshelp; public: - OSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_ignore.cpp b/modules/core/os_ignore.cpp index cd55677cc..90c695605 100644 --- a/modules/core/os_ignore.cpp +++ b/modules/core/os_ignore.cpp @@ -288,10 +288,9 @@ class OSIgnore : public Module CommandOSIgnore commandosignore; public: - OSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), osignoreservice(this, "operserv/ignore") + OSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), osignoreservice(this, "operserv/ignore") { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_jupe.cpp b/modules/core/os_jupe.cpp index 7eab7d009..17eb9577f 100644 --- a/modules/core/os_jupe.cpp +++ b/modules/core/os_jupe.cpp @@ -72,10 +72,9 @@ class OSJupe : public Module CommandOSJupe commandosjupe; public: - OSJupe(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSJupe(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_kick.cpp b/modules/core/os_kick.cpp index 38eda21b8..bf766deeb 100644 --- a/modules/core/os_kick.cpp +++ b/modules/core/os_kick.cpp @@ -76,10 +76,9 @@ class OSKick : public Module CommandOSKick commandoskick; public: - OSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_login.cpp b/modules/core/os_login.cpp index fd96165c2..dc9be1f37 100644 --- a/modules/core/os_login.cpp +++ b/modules/core/os_login.cpp @@ -70,10 +70,9 @@ class OSLogin : public Module CommandOSLogin commandoslogin; public: - OSLogin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSLogin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_main.cpp b/modules/core/os_main.cpp index 4659fdf57..9f340fe7b 100644 --- a/modules/core/os_main.cpp +++ b/modules/core/os_main.cpp @@ -55,10 +55,9 @@ class OperServCore : public Module MyOperServService myoperserv; public: - OperServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), myoperserv(this) + OperServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), myoperserv(this) { this->SetAuthor("Anope"); - this->SetType(CORE); this->SetPermanent(true); // Currently, /os modunload os_main explodes for obvious reasons Implementation i[] = { I_OnServerQuit, I_OnUserModeSet, I_OnUserModeUnset, I_OnUserConnect }; @@ -87,7 +86,7 @@ class OperServCore : public Module Anope::string module; while (coreModules.GetToken(module)) { - Module *m = FindModule(module); + Module *m = ModuleManager::FindModule(module); if (m != NULL) ModuleManager::UnloadModule(m, NULL); } diff --git a/modules/core/os_mode.cpp b/modules/core/os_mode.cpp index 5efed5383..961dd05b7 100644 --- a/modules/core/os_mode.cpp +++ b/modules/core/os_mode.cpp @@ -82,10 +82,9 @@ class OSMode : public Module CommandOSMode commandosmode; public: - OSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_modinfo.cpp b/modules/core/os_modinfo.cpp index 6634d2939..0533ad1a6 100644 --- a/modules/core/os_modinfo.cpp +++ b/modules/core/os_modinfo.cpp @@ -42,7 +42,7 @@ class CommandOSModInfo : public Command { const Anope::string &file = params[0]; - Module *m = FindModule(file); + Module *m = ModuleManager::FindModule(file); if (m) { source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 loaded: \002%s\002"), m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "?", do_strftime(m->created).c_str()); @@ -75,10 +75,9 @@ class OSModInfo : public Module CommandOSModInfo commandosmodinfo; public: - OSModInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSModInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_modlist.cpp b/modules/core/os_modlist.cpp index b33adaab1..70353eb5f 100644 --- a/modules/core/os_modlist.cpp +++ b/modules/core/os_modlist.cpp @@ -32,7 +32,6 @@ class CommandOSModList : public Command int showProto = 1; int showEnc = 1; int showSupported = 1; - int showQA = 1; int showDB = 1; char core[] = "Core"; @@ -40,7 +39,6 @@ class CommandOSModList : public Command char proto[] = "Protocol"; char enc[] = "Encryption"; char supported[] = "Supported"; - char qa[] = "QATested"; char db[] = "Database"; if (!param.empty()) @@ -52,7 +50,6 @@ class CommandOSModList : public Command showProto = 0; showEnc = 0; showSupported = 0; - showQA = 0; showDB = 0; } else if (param.equals_ci(third)) @@ -60,7 +57,6 @@ class CommandOSModList : public Command showCore = 0; showThird = 1; showSupported = 0; - showQA = 0; showProto = 0; showEnc = 0; showDB = 0; @@ -72,7 +68,6 @@ class CommandOSModList : public Command showProto = 1; showEnc = 0; showSupported = 0; - showQA = 0; showDB = 0; } else if (param.equals_ci(supported)) @@ -82,17 +77,6 @@ class CommandOSModList : public Command showProto = 0; showSupported = 1; showEnc = 0; - showQA = 0; - showDB = 0; - } - else if (param.equals_ci(qa)) - { - showCore = 0; - showThird = 0; - showProto = 0; - showSupported = 0; - showEnc = 0; - showQA = 1; showDB = 0; } else if (param.equals_ci(enc)) @@ -102,7 +86,6 @@ class CommandOSModList : public Command showProto = 0; showSupported = 0; showEnc = 1; - showQA = 0; showDB = 0; } else if (param.equals_ci(db)) @@ -112,7 +95,6 @@ class CommandOSModList : public Command showProto = 0; showSupported = 0; showEnc = 0; - showQA = 0; showDB = 1; } } @@ -153,13 +135,6 @@ class CommandOSModList : public Command ++count; } break; - case QATESTED: - if (showQA) - { - source.Reply(_("Module: \002%s\002 [%s] [%s]"), m->name.c_str(), m->version.c_str(), qa); - ++count; - } - break; case ENCRYPTION: if (showEnc) { @@ -188,7 +163,7 @@ class CommandOSModList : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - source.Reply(_("Syntax: \002MODLIST\002 [Core|3rd|protocol|encryption|supported|qatested]\n" + source.Reply(_("Syntax: \002MODLIST\002 [Core|3rd|protocol|encryption|supported]\n" " \n" "Lists all currently loaded modules.")); return true; @@ -200,10 +175,9 @@ class OSModList : public Module CommandOSModList commandosmodlist; public: - OSModList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSModList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_modload.cpp b/modules/core/os_modload.cpp index ff41b5235..39687eeec 100644 --- a/modules/core/os_modload.cpp +++ b/modules/core/os_modload.cpp @@ -27,13 +27,6 @@ class CommandOSModLoad : public Command User *u = source.u; const Anope::string &mname = params[0]; - Module *m = FindModule(mname); - if (m) - { - source.Reply(_("Module \002%s\002 is already loaded."), mname.c_str()); - return MOD_CONT; - } - ModuleReturn status = ModuleManager::LoadModule(mname, u); if (status == MOD_ERR_OK) { @@ -43,10 +36,12 @@ class CommandOSModLoad : public Command /* If a user is loading this module, then the core databases have already been loaded * so trigger the event manually */ - m = FindModule(mname); + Module *m = ModuleManager::FindModule(mname); if (m) m->OnPostLoadDatabases(); } + else if (status == MOD_ERR_EXISTS) + source.Reply(_("Module \002%s\002 is already loaded."), mname.c_str()); else source.Reply(_("Unable to load module \002%s\002"), mname.c_str()); @@ -73,10 +68,9 @@ class OSModLoad : public Module CommandOSModLoad commandosmodload; public: - OSModLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSModLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->SetPermanent(true); if (!operserv) diff --git a/modules/core/os_modreload.cpp b/modules/core/os_modreload.cpp index e721f76a9..4eb14348e 100644 --- a/modules/core/os_modreload.cpp +++ b/modules/core/os_modreload.cpp @@ -27,20 +27,14 @@ class CommandOSModReLoad : public Command User *u = source.u; const Anope::string &mname = params[0]; - Module *m = FindModule(mname); + Module *m = ModuleManager::FindModule(mname); if (!m) { source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str()); return MOD_CONT; } - if (!m->handle) - { - source.Reply(_("Unable to remove module \002%s\002"), m->name.c_str()); - return MOD_CONT; - } - - if (m->GetPermanent()) + if (!m->handle || m->GetPermanent()) { source.Reply(_("Unable to remove module \002%s\002"), m->name.c_str()); return MOD_CONT; @@ -65,7 +59,7 @@ class CommandOSModReLoad : public Command /* If a user is loading this module, then the core databases have already been loaded * so trigger the event manually */ - m = FindModule(mname); + m = ModuleManager::FindModule(mname); if (m) m->OnPostLoadDatabases(); } @@ -99,10 +93,9 @@ class OSModReLoad : public Module CommandOSModReLoad commandosmodreload; public: - OSModReLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSModReLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->SetPermanent(true); if (!operserv) diff --git a/modules/core/os_modunload.cpp b/modules/core/os_modunload.cpp index a2045c555..e349e9d02 100644 --- a/modules/core/os_modunload.cpp +++ b/modules/core/os_modunload.cpp @@ -27,20 +27,14 @@ class CommandOSModUnLoad : public Command User *u = source.u; const Anope::string &mname = params[0]; - Module *m = FindModule(mname); + Module *m = ModuleManager::FindModule(mname); if (!m) { source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str()); return MOD_CONT; } - if (!m->handle) - { - source.Reply(_("Unable to remove module \002%s\002"), m->name.c_str()); - return MOD_CONT; - } - - if (m->GetPermanent() || m->type == PROTOCOL) + if (!m->handle || m->GetPermanent() || m->type == PROTOCOL) { source.Reply(_("Unable to remove module \002%s\002"), m->name.c_str()); return MOD_CONT; @@ -81,10 +75,9 @@ class OSModUnLoad : public Module CommandOSModUnLoad commandosmodunload; public: - OSModUnLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSModUnLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); this->SetPermanent(true); if (!operserv) diff --git a/modules/core/os_news.cpp b/modules/core/os_news.cpp index 1cf3e0edf..ff7b5014f 100644 --- a/modules/core/os_news.cpp +++ b/modules/core/os_news.cpp @@ -403,10 +403,9 @@ class OSNews : public Module CommandOSRandomNews commandosrandomnews; public: - OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index af25b900f..a8c0f9559 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -86,10 +86,9 @@ class OSNOOP : public Module CommandOSNOOP commandosnoop; public: - OSNOOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSNOOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_oline.cpp b/modules/core/os_oline.cpp index 0e4835cff..861ea310a 100644 --- a/modules/core/os_oline.cpp +++ b/modules/core/os_oline.cpp @@ -73,16 +73,15 @@ class OSOLine : public Module CommandOSOLine commandosoline; public: - OSOLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSOLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { - if (!ircd->omode) + if (!ircd || !ircd->omode) throw ModuleException("Your IRCd does not support OMODE."); if (!operserv) throw ModuleException("OperServ is not loaded!"); this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(operserv->Bot(), &commandosoline); } diff --git a/modules/core/os_quit.cpp b/modules/core/os_quit.cpp index d21ac78be..5c73f4b8a 100644 --- a/modules/core/os_quit.cpp +++ b/modules/core/os_quit.cpp @@ -49,10 +49,9 @@ class OSQuit : public Module CommandOSQuit commandosquit; public: - OSQuit(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSQuit(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_reload.cpp b/modules/core/os_reload.cpp index 08bb78444..41d85f520 100644 --- a/modules/core/os_reload.cpp +++ b/modules/core/os_reload.cpp @@ -59,10 +59,9 @@ class OSReload : public Module CommandOSReload commandosreload; public: - OSReload(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSReload(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_restart.cpp b/modules/core/os_restart.cpp index 73c36d21e..bda2d861c 100644 --- a/modules/core/os_restart.cpp +++ b/modules/core/os_restart.cpp @@ -45,10 +45,9 @@ class OSRestart : public Module CommandOSRestart commandosrestart; public: - OSRestart(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSRestart(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp index dd93e555b..80df50391 100644 --- a/modules/core/os_session.cpp +++ b/modules/core/os_session.cpp @@ -650,10 +650,9 @@ class OSSession : public Module } public: - OSSession(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), ss(this) + OSSession(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), ss(this) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_set.cpp b/modules/core/os_set.cpp index de622537d..de82eee4b 100644 --- a/modules/core/os_set.cpp +++ b/modules/core/os_set.cpp @@ -251,10 +251,9 @@ class OSSet : public Module CommandOSSet commandosset; public: - OSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_shutdown.cpp b/modules/core/os_shutdown.cpp index 24642f244..c67d7acb2 100644 --- a/modules/core/os_shutdown.cpp +++ b/modules/core/os_shutdown.cpp @@ -44,10 +44,9 @@ class OSShutdown : public Module CommandOSShutdown commandosshutdown; public: - OSShutdown(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSShutdown(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_snline.cpp b/modules/core/os_snline.cpp index 8eea0dfb1..c2939f580 100644 --- a/modules/core/os_snline.cpp +++ b/modules/core/os_snline.cpp @@ -457,16 +457,15 @@ class OSSNLine : public Module CommandOSSNLine commandossnline; public: - OSSNLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSSNLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { - if (!ircd->snline) + if (!ircd || !ircd->snline) throw ModuleException("Your IRCd does not support SNLine"); if (!operserv) throw ModuleException("OperServ is not loaded!"); this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(operserv->Bot(), &commandossnline); } diff --git a/modules/core/os_sqline.cpp b/modules/core/os_sqline.cpp index d582945fe..504ea202c 100644 --- a/modules/core/os_sqline.cpp +++ b/modules/core/os_sqline.cpp @@ -438,16 +438,15 @@ class OSSQLine : public Module CommandOSSQLine commandossqline; public: - OSSQLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSSQLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { - if (!ircd->sqline) + if (!ircd || !ircd->sqline) throw ModuleException("Your IRCd does not support QLines."); if (!operserv) throw ModuleException("OperServ is not loaded!"); this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(operserv->Bot(), &commandossqline); } diff --git a/modules/core/os_staff.cpp b/modules/core/os_staff.cpp index 2e9dce04b..0f59d9650 100644 --- a/modules/core/os_staff.cpp +++ b/modules/core/os_staff.cpp @@ -66,10 +66,9 @@ class OSStaff : public Module CommandOSStaff commandosstaff; public: - OSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_stats.cpp b/modules/core/os_stats.cpp index acaf2e72e..80b0799dd 100644 --- a/modules/core/os_stats.cpp +++ b/modules/core/os_stats.cpp @@ -209,10 +209,9 @@ class OSStats : public Module CommandOSStats commandosstats; public: - OSStats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSStats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_svsnick.cpp b/modules/core/os_svsnick.cpp index be8a21729..444ef1e8f 100644 --- a/modules/core/os_svsnick.cpp +++ b/modules/core/os_svsnick.cpp @@ -86,16 +86,15 @@ class OSSVSNick : public Module CommandOSSVSNick commandossvsnick; public: - OSSVSNick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSSVSNick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { - if (!ircd->svsnick) + if (!ircd || !ircd->svsnick) throw ModuleException("Your IRCd does not support SVSNICK"); if (!operserv) throw ModuleException("OperServ is not loaded!"); this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(operserv->Bot(), &commandossvsnick); } diff --git a/modules/core/os_szline.cpp b/modules/core/os_szline.cpp index d8a4f6283..ac3ce61f6 100644 --- a/modules/core/os_szline.cpp +++ b/modules/core/os_szline.cpp @@ -440,16 +440,15 @@ class OSSZLine : public Module CommandOSSZLine commandosszline; public: - OSSZLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSSZLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { - if (!ircd->szline) + if (!ircd || !ircd->szline) throw ModuleException("Your IRCd does not support ZLINEs"); if (!operserv) throw ModuleException("OperServ is not loaded!"); this->SetAuthor("Anope"); - this->SetType(CORE); this->AddCommand(operserv->Bot(), &commandosszline); } diff --git a/modules/core/os_update.cpp b/modules/core/os_update.cpp index 8a1e10c68..9f85d8b64 100644 --- a/modules/core/os_update.cpp +++ b/modules/core/os_update.cpp @@ -44,10 +44,9 @@ class OSUpdate : public Module CommandOSUpdate commandosupdate; public: - OSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/core/os_userlist.cpp b/modules/core/os_userlist.cpp index 1b219214d..9986630f1 100644 --- a/modules/core/os_userlist.cpp +++ b/modules/core/os_userlist.cpp @@ -96,10 +96,9 @@ class OSUserList : public Module CommandOSUserList commandosuserlist; public: - OSUserList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSUserList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!operserv) throw ModuleException("OperServ is not loaded!"); diff --git a/modules/extra/cs_appendtopic.cpp b/modules/extra/cs_appendtopic.cpp index dc3b40288..5132d272f 100644 --- a/modules/extra/cs_appendtopic.cpp +++ b/modules/extra/cs_appendtopic.cpp @@ -107,10 +107,9 @@ class CSAppendTopic : public Module CommandCSAppendTopic commandcsappendtopic; public: - CSAppendTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSAppendTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("SGR"); - this->SetType(SUPPORTED); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp index 6e39f33f3..29914a17e 100644 --- a/modules/extra/cs_enforce.cpp +++ b/modules/extra/cs_enforce.cpp @@ -216,10 +216,9 @@ class CSEnforce : public Module CommandCSEnforce commandcsenforce; public: - CSEnforce(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSEnforce(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp index f424baede..dbfe35d35 100644 --- a/modules/extra/cs_entrymsg.cpp +++ b/modules/extra/cs_entrymsg.cpp @@ -159,10 +159,9 @@ class CSEntryMessage : public Module CommandEntryMessage commandentrymsg; public: - CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandentrymsg("ENTRYMSG") + CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), commandentrymsg("ENTRYMSG") { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index f71363795..2318d415c 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -110,10 +110,9 @@ class CSSetMisc : public Module } public: - CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(CORE); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/extra/cs_tban.cpp b/modules/extra/cs_tban.cpp index 04d608246..003f8a3d5 100644 --- a/modules/extra/cs_tban.cpp +++ b/modules/extra/cs_tban.cpp @@ -109,10 +109,9 @@ class CSTBan : public Module CommandCSTBan commandcstban; public: - CSTBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSTBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); if (!chanserv) throw ModuleException("ChanServ is not loaded!"); diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp index f208d72b3..f62e21e1a 100644 --- a/modules/extra/hs_request.cpp +++ b/modules/extra/hs_request.cpp @@ -310,7 +310,7 @@ class HSRequest : public Module CommandHSWaiting commandhswaiting; public: - HSRequest(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HSRequest(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { me = this; @@ -323,7 +323,6 @@ class HSRequest : public Module this->AddCommand(hostserv->Bot(), &commandhswaiting); this->SetAuthor("Anope"); - this->SetType(SUPPORTED); Implementation i[] = { I_OnPreCommand, I_OnDatabaseRead, I_OnDatabaseWrite, I_OnReload }; ModuleManager::Attach(i, this, 4); diff --git a/modules/extra/m_alias.cpp b/modules/extra/m_alias.cpp index 025a53df0..1f7c5a772 100644 --- a/modules/extra/m_alias.cpp +++ b/modules/extra/m_alias.cpp @@ -22,7 +22,7 @@ class ModuleAlias : public Module { std::multimap<Anope::string, CommandAlias, std::less<ci::string> > aliases; public: - ModuleAlias(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ModuleAlias(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { Implementation i[] = { I_OnReload, I_OnPreCommandRun, I_OnBotFantasy }; ModuleManager::Attach(i, this, 3); diff --git a/modules/extra/m_async_commands.cpp b/modules/extra/m_async_commands.cpp index a7153b25f..5ea7735f9 100644 --- a/modules/extra/m_async_commands.cpp +++ b/modules/extra/m_async_commands.cpp @@ -112,7 +112,7 @@ class ModuleAsynchCommands : public Module, public Pipe, public AsynchCommandsSe } public: - ModuleAsynchCommands(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), Pipe(), AsynchCommandsService(this, "asynch_commands"), reset(false) + ModuleAsynchCommands(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), Pipe(), AsynchCommandsService(this, "asynch_commands"), reset(false) { me = this; @@ -120,7 +120,7 @@ class ModuleAsynchCommands : public Module, public Pipe, public AsynchCommandsSe main_mutex.Lock(); - Implementation i[] = { I_OnObjectDestroy, I_OnPreCommand }; + Implementation i[] = { I_OnDeleteObject, I_OnPreCommand }; ModuleManager::Attach(i, this, 2); ModuleManager::SetPriority(this, PRIORITY_FIRST); @@ -128,7 +128,7 @@ class ModuleAsynchCommands : public Module, public Pipe, public AsynchCommandsSe ModuleManager::RegisterService(this); } - void OnObjectDestroy(Base *b) + void OnDeleteObject(Base *b) { for (std::list<CommandMutex *>::iterator it = commands.begin(), it_end = commands.end(); it != it_end; ++it) { diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp index f2572e694..06d55df92 100644 --- a/modules/extra/m_dnsbl.cpp +++ b/modules/extra/m_dnsbl.cpp @@ -86,10 +86,9 @@ class ModuleDNSBL : public Module bool add_to_akill; public: - ModuleDNSBL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ModuleDNSBL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); Implementation i[] = { I_OnReload, I_OnUserConnect }; ModuleManager::Attach(i, this, 2); diff --git a/modules/extra/m_helpchan.cpp b/modules/extra/m_helpchan.cpp index 90a33ca79..6e5cdd2be 100644 --- a/modules/extra/m_helpchan.cpp +++ b/modules/extra/m_helpchan.cpp @@ -13,10 +13,9 @@ class HelpChannel : public Module Anope::string HelpChan; public: - HelpChannel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + HelpChannel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); Implementation i[] = { I_OnChannelModeSet, I_OnReload }; ModuleManager::Attach(i, this, 2); diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index 188c9d02f..f4ba5646c 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -341,7 +341,7 @@ class ModuleLDAP : public Module, public Pipe std::map<Anope::string, LDAPService *> LDAPServices; public: - ModuleLDAP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ModuleLDAP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { me = this; diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index 87d082e44..59e532d50 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -177,10 +177,9 @@ class NSIdentifyLDAP : public Module Anope::string disable_reason; public: NSIdentifyLDAP(const Anope::string &modname, const Anope::string &creator) : - Module(modname, creator), ldap("ldap/main"), iinterface(this), oninterface(this), orinterface(this) + Module(modname, creator, SUPPORTED), ldap("ldap/main"), iinterface(this), oninterface(this), orinterface(this) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication, I_OnNickIdentify, I_OnNickRegister }; ModuleManager::Attach(i, this, 5); diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index 8010031cb..37029268e 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -85,10 +85,9 @@ class LDAPOper : public Module Anope::string filter; public: LDAPOper(const Anope::string &modname, const Anope::string &creator) : - Module(modname, creator), ldap("ldap/main"), iinterface(this) + Module(modname, creator, SUPPORTED), ldap("ldap/main"), iinterface(this) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); Implementation i[] = { I_OnReload, I_OnNickIdentify, I_OnDelCore }; ModuleManager::Attach(i, this, 3); diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 1ed2ae3d3..c824f0613 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -156,7 +156,7 @@ class ModuleSQL : public Module, public Pipe /* The thread used to execute queries */ DispatcherThread *DThread; - ModuleSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + ModuleSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { me = this; diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp index 21362d1e7..da6361769 100644 --- a/modules/extra/m_ssl.cpp +++ b/modules/extra/m_ssl.cpp @@ -81,12 +81,11 @@ class SSLModule : public Module public: MySSLService service; - SSLModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), service(this, "ssl") + SSLModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), service(this, "ssl") { me = this; this->SetAuthor("Anope"); - this->SetType(SUPPORTED); this->SetPermanent(true); SSL_library_init(); diff --git a/modules/extra/m_xmlrpc.cpp b/modules/extra/m_xmlrpc.cpp index 5246572ff..8c0723c42 100644 --- a/modules/extra/m_xmlrpc.cpp +++ b/modules/extra/m_xmlrpc.cpp @@ -214,7 +214,7 @@ class ModuleXMLRPC : public Module public: MyXMLRPCServiceInterface xmlrpcinterface; - ModuleXMLRPC(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), sslref("ssl"), xmlrpcinterface(this, "xmlrpc") + ModuleXMLRPC(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), sslref("ssl"), xmlrpcinterface(this, "xmlrpc") { me = this; diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp index 6f4b4b05c..6a113a14a 100644 --- a/modules/extra/m_xmlrpc_main.cpp +++ b/modules/extra/m_xmlrpc_main.cpp @@ -268,7 +268,7 @@ class ModuleXMLRPCMain : public Module MyXMLRPCEvent stats; public: - ModuleXMLRPCMain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), xmlrpc("xmlrpc") + ModuleXMLRPCMain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), xmlrpc("xmlrpc") { if (!xmlrpc) throw ModuleException("Unable to find xmlrpc reference, is m_xmlrpc loaded?"); diff --git a/modules/extra/ns_maxemail.cpp b/modules/extra/ns_maxemail.cpp index 2a0141508..e4c7ec8cc 100644 --- a/modules/extra/ns_maxemail.cpp +++ b/modules/extra/ns_maxemail.cpp @@ -54,10 +54,9 @@ class NSMaxEmail : public Module } public: - NSMaxEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSMaxEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(SUPPORTED); Implementation i[] = { I_OnReload, I_OnPreCommand }; ModuleManager::Attach(i, this, 2); diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp index 1bb1a95a1..b70a871de 100644 --- a/modules/extra/ns_set_misc.cpp +++ b/modules/extra/ns_set_misc.cpp @@ -113,10 +113,12 @@ class NSSetMisc : public Module } public: - NSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED) { this->SetAuthor("Anope"); - this->SetType(CORE); + + if (!nickserv) + throw ModuleException("NickServ is not loaded!"); Implementation i[] = { I_OnReload, I_OnNickInfo, I_OnDatabaseWriteMetadata, I_OnDatabaseReadMetadata }; ModuleManager::Attach(i, this, 4); diff --git a/modules/extra/os_defcon.cpp b/modules/extra/os_defcon.cpp index 0de1f1d33..eed8724fe 100644 --- a/modules/extra/os_defcon.cpp +++ b/modules/extra/os_defcon.cpp @@ -339,7 +339,7 @@ class OSDefcon : public Module } public: - OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), session_service("session") + OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), session_service("session") { if (!DConfig.defaultlevel) throw ModuleException("Invalid configuration settings"); @@ -347,7 +347,6 @@ class OSDefcon : public Module me = this; this->SetAuthor("Anope"); - this->SetType(CORE); Implementation i[] = { I_OnReload, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnPreCommandRun, I_OnPreCommand, I_OnUserConnect, I_OnChannelModeAdd, I_OnChannelCreate }; ModuleManager::Attach(i, this, 9); diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index efe75b7ba..59f611867 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -598,13 +598,12 @@ class ProtoBahamut : public Module } public: - ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_svsmode("SVSMODE", OnMode), message_cs("CS", event_cs), message_hs("HS", event_hs), message_ms("MS", event_ms), message_ns("NS", event_ns), message_os("OS", event_os), message_burst("BURST", event_burst) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index a1b1d8df3..d76dc27c2 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -173,7 +173,8 @@ class InspIRCdTS6Proto : public IRCDProto { SendServer(Me); send_cmd(Config->Numeric, "BURST"); - send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str()); + Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); + send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str()); } /* SVSHOLD - set */ diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 0e787b0fe..5ab55ab07 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -202,7 +202,8 @@ class InspIRCdProto : public IRCDProto inspircd_cmd_pass(uplink_server->password); SendServer(Me); send_cmd("", "BURST"); - send_cmd(Config->ServerName, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str()); + Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); + send_cmd(Config->ServerName, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str()); } /* CHGIDENT */ @@ -890,7 +891,7 @@ class ProtoInspIRCd : public Module } public: - ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_endburst("ENDBURST", event_endburst), message_rsquit("RSQUIT", event_rsquit), message_svsmode("SVSMODE", OnMode), message_chghost("CHGHOST", event_chghost), message_chgident("CHGIDENT", event_chgident), message_chgname("CHGNAME", event_chgname), @@ -900,7 +901,6 @@ class ProtoInspIRCd : public Module message_idle("IDLE", event_idle), message_fjoin("FJOIN", OnSJoin) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 4723a21af..9e81c2b3f 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -737,7 +737,7 @@ class ProtoInspIRCd : public Module Inspircd12IRCdMessage ircd_message; public: - ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_endburst("ENDBURST", event_endburst), message_time("TIME", event_time), message_rsquit("RSQUIT", event_rsquit), message_svsmode("SVSMODE", OnMode), message_fhost("FHOST", event_chghost), @@ -749,7 +749,6 @@ class ProtoInspIRCd : public Module message_metadata("METADATA", event_metadata) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); @@ -759,6 +758,9 @@ class ProtoInspIRCd : public Module Implementation i[] = { I_OnUserNickChange, I_OnServerSync }; ModuleManager::Attach(i, this, 2); + + if (Config->Numeric.empty()) + throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration."); } void OnUserNickChange(User *u, const Anope::string &) diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 3cb4979a9..3bc521a63 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -82,7 +82,8 @@ class InspIRCdProto : public InspIRCdTS6Proto send_cmd("", "CAPAB END"); SendServer(Me); send_cmd(Config->Numeric, "BURST"); - send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str()); + Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); + send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str()); } }; @@ -731,7 +732,7 @@ class ProtoInspIRCd : public Module InspIRCdProto ircd_proto; Inspircd20IRCdMessage ircd_message; public: - ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_endburst("ENDBURST", event_endburst), message_time("TIME", event_time), message_rsquit("RSQUIT", event_rsquit), message_svsmode("SVSMODE", OnMode), message_fhost("FHOST", event_chghost), @@ -743,7 +744,6 @@ class ProtoInspIRCd : public Module message_metadata("METADATA", event_metadata) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); @@ -753,6 +753,9 @@ class ProtoInspIRCd : public Module Implementation i[] = { I_OnUserNickChange, I_OnServerSync }; ModuleManager::Attach(i, this, 2); + + if (Config->Numeric.empty()) + throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration."); } void OnUserNickChange(User *u, const Anope::string &) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 84faec449..04095e5a2 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -628,14 +628,13 @@ class ProtoPlexus : public Module } public: - ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_tmode("TMODE", event_tmode), message_bmask("BMASK", event_bmask), message_pass("PASS", event_pass), message_tb("TBURST", event_tburst), message_sid("SID", event_sid), message_encap("ENCAP", event_encap), message_eob("EOB", event_eob) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); @@ -645,6 +644,9 @@ class ProtoPlexus : public Module Implementation i[] = { I_OnServerSync }; ModuleManager::Attach(i, this, 1); + + if (Config->Numeric.empty()) + throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration."); } void OnServerSync(Server *s) diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 1ca9459a8..d6cfc761f 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -563,14 +563,13 @@ class ProtoRatbox : public Module } public: - ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_kick("KICK", event_kick), message_tmode("TMODE", event_tmode), message_bmask("BMASK", event_bmask), message_pass("PASS", event_pass), message_tb("TB", event_tburst), message_sid("SID", event_sid), message_encap("ENCAP", event_encap), message_pong("PONG", event_pong) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); @@ -580,6 +579,9 @@ class ProtoRatbox : public Module Implementation i[] = { I_OnServerSync }; ModuleManager::Attach(i, this, 1); + + if (Config->Numeric.empty()) + throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration."); } void OnServerSync(Server *s) diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal.cpp index be7407af7..fa25a1049 100644 --- a/modules/protocol/unreal32.cpp +++ b/modules/protocol/unreal.cpp @@ -1096,7 +1096,7 @@ class ProtoUnreal : public Module } public: - ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), + ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), message_away("6", OnAway), message_join("C", OnJoin), message_kick("H", OnKick), message_kill(".", OnKill), @@ -1123,7 +1123,6 @@ class ProtoUnreal : public Module message_stats("2", OnStats), message_time(">", OnTime), message_version("+", OnVersion) { this->SetAuthor("Anope"); - this->SetType(PROTOCOL); pmodule_ircd_var(myIrcd); pmodule_ircd_proto(&this->ircd_proto); diff --git a/src/base.cpp b/src/base.cpp index 537770bcd..82c9ae8b4 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -11,8 +11,6 @@ Base::~Base() { (*it)->Invalidate(); } - - FOREACH_MOD(I_OnObjectDestroy, OnObjectDestroy(this)); } void Base::AddReference(dynamic_reference_base *r) @@ -25,3 +23,10 @@ void Base::DelReference(dynamic_reference_base *r) this->References.erase(r); } +void Base::operator delete(void *ptr) +{ + Base *b = static_cast<Base *>(ptr); + FOREACH_MOD(I_OnDeleteObject, OnDeleteObject(b)); + ::operator delete(b); +} + diff --git a/src/bots.cpp b/src/bots.cpp index c67456ba4..51be95db9 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -39,7 +39,7 @@ BotInfo::BotInfo(const Anope::string &nnick, const Anope::string &nuser, const A { LogInfo *l = Config->LogInfos[i]; - if (!ircd->join2msg && !l->Inhabit) + if (ircd && !ircd->join2msg && !l->Inhabit) continue; for (std::list<Anope::string>::const_iterator sit = l->Targets.begin(), sit_end = l->Targets.end(); sit != sit_end; ++sit) diff --git a/src/config.cpp b/src/config.cpp index 0ce28d34e..288e33685 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -18,8 +18,6 @@ ConfigurationFile services_conf("services.conf", false); // Services configurati ServerConfig *Config = NULL; static Anope::string Modules; -static Anope::string EncModules; -static Anope::string DBModules; static Anope::string UlineServers; static Anope::string OSNotifications; static Anope::string BSDefaults; @@ -200,8 +198,6 @@ ServerConfig::ServerConfig() : config_data(), NSDefFlags(NickCoreFlagStrings), C /* Modules Autoload building... :P */ this->ModulesAutoLoad = BuildStringList(Modules); - this->EncModuleList = BuildStringList(EncModules); - this->DBModuleList = BuildStringList(DBModules); if (this->LimitSessions) { @@ -1003,7 +999,6 @@ ConfigItems::ConfigItems(ServerConfig *conf) {"serverinfo", "name", "", new ValueContainerString(&conf->ServerName), DT_HOSTNAME | DT_NORELOAD, ValidateNotEmpty}, {"serverinfo", "description", "", new ValueContainerString(&conf->ServerDesc), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, {"serverinfo", "localhost", "", new ValueContainerString(&conf->LocalHost), DT_HOSTNAME | DT_NORELOAD, NoValidation}, - {"serverinfo", "type", "", new ValueContainerString(&conf->IRCDModule), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, {"serverinfo", "id", "", new ValueContainerString(&conf->Numeric), DT_NOSPACES | DT_NORELOAD, NoValidation}, {"serverinfo", "ident", "", new ValueContainerString(&conf->ServiceUser), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, {"serverinfo", "hostname", "", new ValueContainerString(&conf->ServiceHost), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, @@ -1013,10 +1008,7 @@ ConfigItems::ConfigItems(ServerConfig *conf) {"networkinfo", "nicklen", "31", new ValueContainerUInt(&conf->NickLen), DT_UINTEGER | DT_NORELOAD, ValidateNickLen}, {"networkinfo", "userlen", "10", new ValueContainerUInt(&conf->UserLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, {"networkinfo", "hostlen", "64", new ValueContainerUInt(&conf->HostLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, - {"options", "encryption", "", new ValueContainerString(&EncModules), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, {"options", "passlen", "32", new ValueContainerUInt(&conf->PassLen), DT_UINTEGER | DT_NORELOAD, NoValidation}, - {"options", "database", "", new ValueContainerString(&DBModules), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, - {"options", "socketengine", "", new ValueContainerString(&conf->SocketEngine), DT_STRING | DT_NORELOAD, ValidateNotEmpty}, {"options", "userkey1", "0", new ValueContainerLUInt(&conf->UserKey1), DT_LUINTEGER, NoValidation}, {"options", "userkey2", "0", new ValueContainerLUInt(&conf->UserKey2), DT_LUINTEGER, NoValidation}, {"options", "userkey3", "0", new ValueContainerLUInt(&conf->UserKey3), DT_LUINTEGER, NoValidation}, diff --git a/src/encrypt.cpp b/src/encrypt.cpp index 2414bf7bc..0f3bd3d79 100644 --- a/src/encrypt.cpp +++ b/src/encrypt.cpp @@ -14,26 +14,22 @@ /******************************************************************************/ -/** - * Encrypt string `src' of length `len', placing the result in buffer - * `dest' of size `size'. Returns 0 on success, -1 on error. - **/ -int enc_encrypt(const Anope::string &src, Anope::string &dest) +/** Encrypt the string src into dest + * @param src The source string + * @param dest The destination strnig + */ +void enc_encrypt(const Anope::string &src, Anope::string &dest) { EventReturn MOD_RESULT; FOREACH_RESULT(I_OnEncrypt, OnEncrypt(src, dest)); - if (MOD_RESULT == EVENT_ALLOW) - return 0; - return -1; } -/** - * Decrypt encrypted string `src' into buffer `dest' of length `len'. - * Returns 1 (not 0) on success, -1 if the encryption algorithm does not - * allow decryption, and -1 if another failure occurred (e.g. destination - * buffer too small). - **/ -int enc_decrypt(const Anope::string &src, Anope::string &dest) +/** Decrypt the encrypted string src into dest + * @param src The encrypted string + * @param desc The destination string + * @return true on success + */ +bool enc_decrypt(const Anope::string &src, Anope::string &dest) { size_t pos = src.find(':'); if (pos == Anope::string::npos) @@ -46,7 +42,8 @@ int enc_decrypt(const Anope::string &src, Anope::string &dest) EventReturn MOD_RESULT; FOREACH_RESULT(I_OnDecrypt, OnDecrypt(hashm, src, dest)); if (MOD_RESULT == EVENT_ALLOW) - return 1; - return -1; + return true; + + return false; } diff --git a/src/init.cpp b/src/init.cpp index 039067191..ad95e4d4b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -334,19 +334,9 @@ void Init(int ac, char **av) /* Initialize the socket engine */ SocketEngine::Init(); - /* Add IRCD Protocol Module; exit if there are errors */ - if (protocol_module_init()) - throw FatalException("Unable to load protocol module"); - /* Create me */ Me = new Server(NULL, Config->ServerName, 0, Config->ServerDesc, Config->Numeric); - /* Add Encryption Modules */ - ModuleManager::LoadModuleList(Config->EncModuleList); - - /* Add Database Modules */ - ModuleManager::LoadModuleList(Config->DBModuleList); - DNSEngine = new DNSManager(); #ifndef _WIN32 @@ -385,7 +375,7 @@ void Init(int ac, char **av) write_pidfile(); /* Announce ourselves to the logfile. */ - Log() << "Anope " << Anope::Version() << " (ircd protocol: " << ircd->name << ") starting up" << (debug || readonly ? " (options:" : "") << (debug ? " debug" : "") << (readonly ? " readonly" : "") << (debug || readonly ? ")" : ""); + Log() << "Anope " << Anope::Version() << " starting up" << (debug || readonly ? " (options:" : "") << (debug ? " debug" : "") << (readonly ? " readonly" : "") << (debug || readonly ? ")" : ""); start_time = Anope::CurTime; /* Set signal handlers. Catch certain signals to let us do things or @@ -401,14 +391,21 @@ void Init(int ac, char **av) Log(LOG_DEBUG) << "Loading Languages..."; InitLanguages(); - /* load any custom modules */ - if (!nothird) - ModuleManager::LoadModuleList(Config->ModulesAutoLoad); - /* Initialize random number generator */ rand_init(); add_entropy_userkeys(); + /* load modules */ + ModuleManager::LoadModuleList(Config->ModulesAutoLoad); + + Module *protocol = ModuleManager::FindFirstOf(PROTOCOL); + if (protocol == NULL) + throw FatalException("You must load a protocol module!"); + else if (ModuleManager::FindFirstOf(ENCRYPTION) == NULL) + throw FatalException("You must load at least one encryption module"); + + Log() << "Using IRCd protocol " << protocol->name; + /* Load up databases */ Log() << "Loading databases..."; EventReturn MOD_RESULT; diff --git a/src/messages.cpp b/src/messages.cpp index 192859e6f..f8d893eca 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -83,8 +83,8 @@ bool OnTime(const Anope::string &source, const std::vector<Anope::string> &) bool OnVersion(const Anope::string &source, const std::vector<Anope::string> &) { - if (!source.empty()) - ircdproto->SendNumeric(Config->ServerName, 351, source, "Anope-%s %s :%s -(%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str()); + Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); + ircdproto->SendNumeric(Config->ServerName, 351, source, "Anope-%s %s :%s -(%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str()); return true; } diff --git a/src/module.cpp b/src/module.cpp index eadfbf4d1..929984e2e 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -12,21 +12,19 @@ # include <libintl.h> #endif -Module::Module(const Anope::string &mname, const Anope::string &creator) +Module::Module(const Anope::string &modname, const Anope::string &, ModType modtype) : name(modname), type(modtype) { - this->name = mname; /* Our name */ - this->type = THIRD; this->handle = NULL; - this->permanent = false; - - if (FindModule(this->name)) - throw CoreException("Module already exists!"); - this->created = Anope::CurTime; - this->SetVersion(Anope::Version()); + if (ModuleManager::FindModule(this->name)) + throw CoreException("Module already exists!"); + + if (nothird && modtype == THIRD) + throw ModuleException("Third party modules may not be loaded"); + Modules.push_back(this); #if GETTEXT_FOUND @@ -37,6 +35,8 @@ Module::Module(const Anope::string &mname, const Anope::string &creator) Module::~Module() { + if (DNSEngine) + DNSEngine->Cleanup(this); /* Detach all event hooks for this module */ ModuleManager::DetachAll(this); /* Clear any active callbacks this module has */ @@ -47,11 +47,6 @@ Module::~Module() Modules.erase(it); } -void Module::SetType(MODType ntype) -{ - this->type = ntype; -} - void Module::SetPermanent(bool state) { this->permanent = state; diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index ac6316728..e2f837f0f 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -126,24 +126,6 @@ static ModuleReturn moduleCopyFile(const Anope::string &name, Anope::string &out return MOD_ERR_OK; } -static bool IsOneOfModuleTypeLoaded(MODType mt) -{ - int pmods = 0; - - for (std::list<Module *>::const_iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) - if ((*it)->type == mt) - ++pmods; - - /* - * 2, because module constructors now add modules to the hash.. so 1 (original module) - * and 2 (this module). -- w00t - */ - if (pmods == 2) - return true; - - return false; -} - /* This code was found online at http://www.linuxjournal.com/article/3687#comment-26593 * * This function will take a pointer from either dlsym or GetProcAddress and cast it in @@ -176,12 +158,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) /* Don't skip return value checking! -GD */ ModuleReturn ret = moduleCopyFile(modname, pbuf); if (ret != MOD_ERR_OK) - { - /* XXX: This used to assign filename here, but I don't think that was correct.. - * even if it was, it makes life very fucking difficult, so. - */ return ret; - } ano_modclearerr(); @@ -246,7 +223,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) else if (v.GetBuild() == Anope::VersionBuild()) Log(LOG_DEBUG) << "Module " << modname << " compiled against current version of Anope " << v.GetBuild(); - if (m->type == PROTOCOL && IsOneOfModuleTypeLoaded(PROTOCOL)) + if (m->type == PROTOCOL && ModuleManager::FindFirstOf(PROTOCOL) != m) { DeleteModule(m); Log() << "You cannot load two protocol modules"; @@ -260,13 +237,38 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) ModuleReturn ModuleManager::UnloadModule(Module *m, User *u) { + if (!m) + return MOD_ERR_PARAMS; + FOREACH_MOD(I_OnModuleUnload, OnModuleUnload(u, m)); - if (DNSEngine) - DNSEngine->Cleanup(m); + return DeleteModule(m); +} - DeleteModule(m); - return MOD_ERR_OK; +Module *ModuleManager::FindModule(const Anope::string &name) +{ + for (std::list<Module *>::const_iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) + { + Module *m = *it; + + if (m->name.equals_ci(name)) + return m; + } + + return NULL; +} + +Module *ModuleManager::FindFirstOf(ModType type) +{ + for (std::list<Module *>::const_iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) + { + Module *m = *it; + + if (m->type == type) + return m; + } + + return NULL; } void ModuleManager::RequireVersion(int major, int minor, int patch, int build) @@ -298,10 +300,10 @@ void ModuleManager::RequireVersion(int major, int minor, int patch, int build) throw ModuleException("This module requires version " + stringify(major) + "." + stringify(minor) + "." + stringify(patch) + "-" + build + " - this is " + Anope::Version()); } -void ModuleManager::DeleteModule(Module *m) +ModuleReturn ModuleManager::DeleteModule(Module *m) { if (!m || !m->handle) - return; + return MOD_ERR_PARAMS; ano_module_t handle = m->handle; Anope::string filename = m->filename; @@ -322,6 +324,8 @@ void ModuleManager::DeleteModule(Module *m) if (!filename.empty()) DeleteFile(filename.c_str()); + + return MOD_ERR_OK; } bool ModuleManager::Attach(Implementation i, Module *mod) diff --git a/src/modules.cpp b/src/modules.cpp index 3e62cd2fb..f77b28676 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -14,77 +14,6 @@ message_map MessageMap; std::list<Module *> Modules; -Anope::string ModuleGetErrStr(int status) -{ - Anope::string module_err_str[] = { - "Module, Okay - No Error", /* MOD_ERR_OK */ - "Module Error, Allocating memory", /* MOD_ERR_MEMORY */ - "Module Error, Not enough parameters", /* MOD_ERR_PARAMS */ - "Module Error, Already loaded", /* MOD_ERR_EXISTS */ - "Module Error, File does not exist", /* MOD_ERR_NOEXIST */ - "Module Error, No User", /* MOD_ERR_NOUSER */ - "Module Error, Error during load time or module returned MOD_STOP", /* MOD_ERR_NOLOAD */ - "Module Error, Unable to unload", /* MOD_ERR_NOUNLOAD */ - "Module Error, Incorrect syntax", /* MOD_ERR_SYNTAX */ - "Module Error, Unable to delete", /* MOD_ERR_NODELETE */ - "Module Error, Unknown Error occuried", /* MOD_ERR_UNKOWN */ - "Module Error, File I/O Error", /* MOD_ERR_FILE_IO */ - "Module Error, No Service found for request", /* MOD_ERR_NOSERVICE */ - "Module Error, No module name for request" /* MOD_ERR_NO_MOD_NAME */ - }; - return module_err_str[status]; -} - -/************************************************/ - -/** - * Load the ircd protocol module up - **/ -int protocol_module_init() -{ - int ret = 0; - - Log() << "Loading IRCD Protocol Module: [" << Config->IRCDModule << "]"; - ret = ModuleManager::LoadModule(Config->IRCDModule, NULL); - - if (ret == MOD_ERR_OK) - { - FindModule(Config->IRCDModule)->SetType(PROTOCOL); - /* This is really NOT the correct place to do config checks, but - * as we only have the ircd struct filled here, we have to over - * here. -GD - */ - if (ircd->ts6) - { - if (Config->Numeric.empty()) - { - Log() << "This IRCd protocol requires a server id to be set in Anope's configuration."; - ret = -1; - } - } - } - - return ret; -} - -/** - * Search the list of loaded modules for the given name. - * @param name the name of the module to find - * @return a pointer to the module found, or NULL - */ -Module *FindModule(const Anope::string &name) -{ - for (std::list<Module *>::const_iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) - { - Module *m = *it; - - if (m->name.equals_ci(name)) - return m; - } - - return NULL; -} - /** Message constructor, adds the message to Anope * @param n The message name * @param f A callback function @@ -115,10 +44,10 @@ Message::~Message() } } -/** Find message in the message table +/** Find a message in the message table * @param name The name of the message were looking for * @return NULL if we cant find it, or a pointer to the Message if we can - **/ + */ std::vector<Message *> Anope::FindMessage(const Anope::string &name) { std::vector<Message *> messages; diff --git a/src/protocol.cpp b/src/protocol.cpp index d923f914e..4724559fb 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -434,7 +434,8 @@ bool IRCdMessage::OnPrivmsg(const Anope::string &source, const std::vector<Anope } else if (message.substr(0, 9).equals_ci("\1VERSION\1")) { - ircdproto->SendCTCP(bi, u->nick, "VERSION Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str()); + Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); + ircdproto->SendCTCP(bi, u->nick, "VERSION Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str()); } } diff --git a/src/servers.cpp b/src/servers.cpp index 096be0c9c..5b4058476 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -313,132 +313,63 @@ void do_server(const Anope::string &source, const Anope::string &servername, uns FOREACH_MOD(I_OnNewServer, OnNewServer(newserver)); } -/*************************************************************************/ - -/* TS6 UID generator common code. - * - * Derived from atheme-services, uid.c (hg 2954:116d46894b4c). - * -nenolod - */ -static bool ts6_uid_initted = false; -static char ts6_new_uid[10]; - -static void ts6_uid_increment(unsigned slot) -{ - if (slot != Config->Numeric.length()) - { - if (ts6_new_uid[slot] == 'Z') - ts6_new_uid[slot] = '0'; - else if (ts6_new_uid[slot] == '9') - { - ts6_new_uid[slot] = 'A'; - ts6_uid_increment(slot - 1); - } - else - ++ts6_new_uid[slot]; - } - else - { - if (ts6_new_uid[slot] == 'Z') - for (slot = 3; slot < 9; ++slot) - ts6_new_uid[slot] = 'A'; - else - ++ts6_new_uid[slot]; - } -} - /** Recieve the next UID in our list * @return The UID */ -const char *ts6_uid_retrieve() +const Anope::string ts6_uid_retrieve() { - if (!ircd->ts6) - { + if (!ircd || !ircd->ts6) return ""; - } - if (!ts6_uid_initted) - { - snprintf(ts6_new_uid, 10, "%sAAAAAA", Config->Numeric.c_str()); - ts6_uid_initted = true; - } - - ts6_uid_increment(8); - return ts6_new_uid; -} + static Anope::string current_uid = "AAAAAA"; + static unsigned current_len = current_uid.length() - 1; -/*******************************************************************/ - -/* - * TS6 SID generator code, provided by DukePyrolator - */ - -static bool ts6_sid_initted = false; -static char ts6_new_sid[4]; - -static void ts6_sid_increment(unsigned pos) -{ - /* - * An SID must be exactly 3 characters long, starts with a digit, - * and the other two characters are A-Z or digits - * The rules for generating an SID go like this... - * --> ABCDEFGHIJKLMNOPQRSTUVWXYZ --> 0123456789 --> WRAP - */ - if (!pos) + while (finduser(Config->Numeric + current_uid) != NULL) { - /* At pos 0, if we hit '9', we've run out of available SIDs, - * reset the SID to the smallest possible value and try again. */ - if (ts6_new_sid[pos] == '9') - { - ts6_new_sid[0] = '0'; - ts6_new_sid[1] = 'A'; - ts6_new_sid[2] = 'A'; - } + char &curChar = current_uid[current_len]; + if (curChar == 'Z') + curChar = '0'; + else if (curChar != '9') + ++curChar; else - // But if we haven't, just keep incrementing merrily. - ++ts6_new_sid[0]; - } - else - { - if (ts6_new_sid[pos] == 'Z') - ts6_new_sid[pos] = '0'; - else if (ts6_new_sid[pos] == '9') { - ts6_new_sid[pos] = 'A'; - ts6_sid_increment(pos - 1); + curChar = 'A'; + if (--current_len == 0) + current_len = current_uid.length(); } - else - ++ts6_new_sid[pos]; + } + + return Config->Numeric + current_uid; } /** Return the next SID in our list * @return The SID */ -const char *ts6_sid_retrieve() +const Anope::string ts6_sid_retrieve() { - if (!ircd->ts6) - { + if (!ircd || !ircd->ts6) return ""; - } - if (!ts6_sid_initted) - { - // Initialize ts6_new_sid with the services server SID - snprintf(ts6_new_sid, 4, "%s", Config->Numeric.c_str()); - ts6_sid_initted = true; - } + static Anope::string current_sid = Config->Numeric; + static unsigned current_len = current_sid.length() - 1; - while (1) + while (Server::Find(current_sid) != NULL) { - // Check if the new SID is used by a known server - if (!Server::Find(ts6_new_sid)) - // return the new SID - return ts6_new_sid; - - // Add one to the last SID - ts6_sid_increment(2); + char &curChar = current_sid[current_len]; + if (curChar == 'Z') + curChar = '0'; + else if (curChar != '9') + ++curChar; + else + { + curChar = 'A'; + if (--current_len == 0) + current_len = current_sid.length(); + } + } - /* not reached */ - return ""; + + return current_sid; } + |