diff options
Diffstat (limited to 'modules')
189 files changed, 1753 insertions, 5728 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 4b0fd6eec..28fab4171 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,21 +1,21 @@ # If using Windows, add the MODULE_COMPILE define if(WIN32) add_definitions(-DMODULE_COMPILE) -endif(WIN32) +endif() macro(build_modules SRC) if(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt") add_subdirectory("${SRC}") - else(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt") + else() file(GLOB MODULES_SRCS "${SRC}/*") foreach(MODULE_SRC ${MODULES_SRCS}) if(IS_DIRECTORY "${MODULE_SRC}") build_modules("${MODULE_SRC}") - else(IS_DIRECTORY "${MODULE_SRC}") + else() string(REGEX MATCH "\\.c$" ANOPE18MODULE ${MODULE_SRC}) if(ANOPE18MODULE) message(FATAL_ERROR "Anope 1 modules are not compatible with Anope 2!\nOffending module: ${MODULE_SRC}") - endif(ANOPE18MODULE) + endif() string(REGEX MATCH "\\.cpp$" CPP ${MODULE_SRC}) if(CPP) set_source_files_properties(${MODULE_SRC} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") @@ -29,8 +29,8 @@ macro(build_modules SRC) calculate_depends(${MODULE_SRC} TEMP_INCLUDES) # If there were some extra include directories, add them to the list if(TEMP_INCLUDES) - append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES}) - endif(TEMP_INCLUDES) + list(APPEND EXTRA_INCLUDES ${TEMP_INCLUDES}) + endif() # Reset linker flags set(TEMP_LDFLAGS) @@ -47,44 +47,42 @@ macro(build_modules SRC) # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators if(MSVC) set(WIN32_MEMORY win32_memory) - else(MSVC) + else() set(WIN32_MEMORY) - endif(MSVC) + endif() # Generate the module and set its linker flags, also set it to depend on the main Anope executable to be built beforehand add_library(${SO} MODULE ${MODULE_SRC}) # Windows requires this because it's weird if(WIN32) set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\" /OPT:NOREF") - else(WIN32) + else() set(WIN32_NO_LIBS) - endif(WIN32) + endif() set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}" INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON) add_dependencies(${SO} ${PROGRAM_NAME}) if(GETTEXT_FOUND) add_dependencies(${SO} module_language) - endif(GETTEXT_FOUND) + endif() target_link_libraries(${SO} ${TEMP_DEPENDENCIES}) # For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set its version if(WIN32) target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") - else(WIN32) - if(APPLE) - target_link_libraries(${SO} ${PROGRAM_NAME}) - endif(APPLE) - endif(WIN32) + elseif(APPLE) + target_link_libraries(${SO} ${PROGRAM_NAME}) + endif() # Set the module to be installed to the module directory under the data directory install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules) - endif(HAS_FUNCTION) - endif(CPP) - endif(IS_DIRECTORY "${MODULE_SRC}") - endforeach(MODULE_SRC ${MODULES_SRCS}) - endif(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt") -endmacro(build_modules) + endif() + endif() + endif() + endforeach() + endif() +endmacro() macro(build_subdir) file(GLOB_RECURSE MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") - sort_list(MODULES_SUBDIR_SRCS) + list(SORT MODULES_SUBDIR_SRCS) GET_FILENAME_COMPONENT(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) set(SO "${FOLDER_NAME}.so") @@ -104,7 +102,7 @@ macro(build_subdir) # If there were some extra include directories, add them to the list if(TEMP_INCLUDES) include_directories(${TEMP_INCLUDES}) - endif(TEMP_INCLUDES) + endif() # Reset linker flags set(TEMP_LDFLAGS) @@ -117,29 +115,29 @@ macro(build_subdir) # Append this source file's linker flags to the subdirectoy's linker flags, if there are any to append if(TEMP_DEPENDENCIES) - append_to_list(SUBDIR_EXTRA_DEPENDS ${TEMP_DEPENDENCIES}) - endif(TEMP_DEPENDENCIES) - endif(HAS_FUNCTION) - endforeach(SRC ${MODULES_SUBDIR_SRCS}) + list(APPEND SUBDIR_EXTRA_DEPENDS ${TEMP_DEPENDENCIES}) + endif() + endif() + endforeach() # Continue if library and function requirements are met if(HAS_FUNCTION) # Remove duplicates from the linker flags if(SUBDIR_LDFLAGS) - remove_list_duplicates(SUBDIR_LDFLAGS) - endif(SUBDIR_LDFLAGS) + list(REMOVE_DUPLICATES SUBDIR_LDFLAGS) + endif() # Remove duplicates from the extra dependencies if(SUBDIR_EXTRA_DEPENDS) - remove_list_duplicates(SUBDIR_EXTRA_DEPENDS) - endif(SUBDIR_EXTRA_DEPENDS) + list(REMOVE_DUPLICATES SUBDIR_EXTRA_DEPENDS) + endif() # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators if(MSVC) set(WIN32_MEMORY win32_memory) - else(MSVC) + else() set(WIN32_MEMORY) - endif(MSVC) + endif() # Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS}) @@ -147,23 +145,21 @@ macro(build_subdir) add_dependencies(${SO} ${PROGRAM_NAME}) if(GETTEXT_FOUND) add_dependencies(${SO} module_language) - endif(GETTEXT_FOUND) + endif() target_link_libraries(${SO} ${SUBDIR_EXTRA_DEPENDS}) # For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set it's version if(WIN32) target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") - else(WIN32) - if(APPLE) - target_link_libraries(${SO} ${PROGRAM_NAME}) - endif(APPLE) - endif(WIN32) + elseif(APPLE) + target_link_libraries(${SO} ${PROGRAM_NAME}) + endif() # Set the module to be installed to the module directory under the data directory install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules) - endif(HAS_FUNCTION) -endmacro(build_subdir) + endif() +endmacro() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) build_modules(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/modules/bs_autoassign.cpp b/modules/bs_autoassign.cpp index 27dc0097d..3686b1a2e 100644 --- a/modules/bs_autoassign.cpp +++ b/modules/bs_autoassign.cpp @@ -16,7 +16,7 @@ class BSAutoAssign : public Module { } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) override { const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string>("bot"); if (bot.empty()) diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp index 2c8404aff..2cb580b5b 100644 --- a/modules/commands/bs_assign.cpp +++ b/modules/commands/bs_assign.cpp @@ -20,7 +20,7 @@ class CommandBSAssign : public Command this->SetSyntax(_("\037channel\037 \037nick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; const Anope::string &nick = params[1]; @@ -71,7 +71,7 @@ class CommandBSAssign : public Command source.Reply(_("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), ci->name.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -91,7 +91,7 @@ class CommandBSUnassign : public Command this->SetSyntax(_("\037channel\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -132,7 +132,7 @@ class CommandBSUnassign : public Command source.Reply(_("There is no bot assigned to %s anymore."), ci->name.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -154,7 +154,7 @@ class CommandBSSetNoBot : public Command this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); const Anope::string &value = params[1]; @@ -191,7 +191,7 @@ class CommandBSSetNoBot : public Command this->OnSyntaxError(source, source.command); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -217,7 +217,7 @@ class BSAssign : public Module { } - void OnInvite(User *source, Channel *c, User *targ) anope_override + void OnInvite(User *source, Channel *c, User *targ) override { BotInfo *bi; if (Anope::ReadOnly || !c->ci || targ->server != Me || !(bi = dynamic_cast<BotInfo *>(targ))) @@ -246,7 +246,7 @@ class BSAssign : public Module targ->SendMessage(bi, _("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), c->name.c_str()); } - void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) anope_override + void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override { if (nobot.HasExt(ci)) info.AddOption(_("No bot")); diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index 31ebebf27..3e397786e 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -17,7 +17,7 @@ struct BadWordImpl : BadWord, Serializable BadWordImpl() : Serializable("BadWord") { } ~BadWordImpl(); - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["ci"] << this->chan; data["word"] << this->word; @@ -37,7 +37,7 @@ struct BadWordsImpl : BadWords ~BadWordsImpl(); - BadWord* AddBadWord(const Anope::string &word, BadWordType type) anope_override + BadWord* AddBadWord(const Anope::string &word, BadWordType type) override { BadWordImpl *bw = new BadWordImpl(); bw->chan = ci->name; @@ -51,7 +51,7 @@ struct BadWordsImpl : BadWords return bw; } - BadWord* GetBadWord(unsigned index) const anope_override + BadWord* GetBadWord(unsigned index) const override { if (this->badwords->empty() || index >= this->badwords->size()) return NULL; @@ -61,12 +61,12 @@ struct BadWordsImpl : BadWords return bw; } - unsigned GetBadWordCount() const anope_override + unsigned GetBadWordCount() const override { return this->badwords->size(); } - void EraseBadWord(unsigned index) anope_override + void EraseBadWord(unsigned index) override { if (this->badwords->empty() || index >= this->badwords->size()) return; @@ -76,13 +76,13 @@ struct BadWordsImpl : BadWords delete this->badwords->at(index); } - void ClearBadWords() anope_override + void ClearBadWords() override { while (!this->badwords->empty()) delete this->badwords->back(); } - void Check() anope_override + void Check() override { if (this->badwords->empty()) ci->Shrink<BadWords>("badwords"); @@ -150,10 +150,10 @@ class BadwordsDelCallback : public NumberList ChannelInfo *ci; BadWords *bw; Command *c; - unsigned deleted; - bool override; + unsigned deleted = 0; + bool override = false; public: - BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false) + BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c) { if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration")) this->override = true; @@ -170,7 +170,7 @@ class BadwordsDelCallback : public NumberList source.Reply(_("Deleted %d entries from %s bad words list."), deleted, ci->name.c_str()); } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned Number) override { if (!bw || !Number || Number > bw->GetBadWordCount()) return; @@ -209,7 +209,7 @@ class CommandBSBadwords : public Command { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned Number) override { if (!Number || Number > bw->GetBadWordCount()) return; @@ -374,7 +374,7 @@ class CommandBSBadwords : public Command this->SetSyntax(_("\037channel\037 CLEAR")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[1]; const Anope::string &word = params.size() > 2 ? params[2] : ""; @@ -417,7 +417,7 @@ class CommandBSBadwords : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index 4f347f6dc..78f3aa931 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -272,7 +272,7 @@ class CommandBSBot : public Command this->SetSyntax(_("\002DEL \037nick\037\002")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; @@ -345,7 +345,7 @@ class CommandBSBot : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp index e8f979cde..ceb3bb3fc 100644 --- a/modules/commands/bs_botlist.cpp +++ b/modules/commands/bs_botlist.cpp @@ -19,7 +19,7 @@ class CommandBSBotList : public Command this->SetDesc(_("Lists available bots")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { unsigned count = 0; ListFormatter list(source.GetAccount()); @@ -57,7 +57,7 @@ class CommandBSBotList : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp index 1f4eaa48f..407912baa 100644 --- a/modules/commands/bs_control.cpp +++ b/modules/commands/bs_control.cpp @@ -20,7 +20,7 @@ class CommandBSSay : public Command this->SetSyntax(_("\037channel\037 \037text\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &text = params[1]; @@ -62,7 +62,7 @@ class CommandBSSay : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to say: " << text; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -80,7 +80,7 @@ class CommandBSAct : public Command this->SetSyntax(_("\037channel\037 \037text\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string message = params[1]; @@ -120,7 +120,7 @@ class CommandBSAct : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to say: " << message; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp index 475a54003..dd72a973a 100644 --- a/modules/commands/bs_info.cpp +++ b/modules/commands/bs_info.cpp @@ -41,7 +41,7 @@ class CommandBSInfo : public Command this->SetSyntax(_("{\037channel\037 | \037nickname\037}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &query = params[0]; @@ -101,7 +101,7 @@ class CommandBSInfo : public Command source.Reply(_("\002%s\002 is not a valid bot or registered channel."), query.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -113,7 +113,7 @@ class CommandBSInfo : public Command return true; } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { return Anope::printf(Language::Translate(source.GetAccount(), _("Allows you to see %s information about a channel or a bot")), source.service->nick.c_str()); } diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index 1a0ec73df..265864704 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -29,7 +29,7 @@ struct KickerDataImpl : KickerData dontkickops = dontkickvoices = false; } - void Check(ChannelInfo *ci) anope_override + void Check(ChannelInfo *ci) override { if (amsgs || badwords || bolds || caps || colors || flood || italics || repeat || reverses || underlines) return; @@ -41,7 +41,7 @@ struct KickerDataImpl : KickerData { ExtensibleItem(Module *m, const Anope::string &ename) : ::ExtensibleItem<KickerDataImpl>(m, ename) { } - void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override + void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override { if (s->GetSerializableType()->GetName() != "ChannelInfo") return; @@ -71,7 +71,7 @@ struct KickerDataImpl : KickerData data["ttb"] << kd->ttb[i] << " "; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { if (s->GetSerializableType()->GetName() != "ChannelInfo") return; @@ -120,12 +120,12 @@ class CommandBSKick : public Command this->SetSyntax(_("\037option\037 \037channel\037 {\037ON|OFF\037} [\037settings\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -165,9 +165,9 @@ class CommandBSKickBase : public Command { } - virtual void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override = 0; + virtual void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override = 0; - virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override = 0; + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override = 0; protected: bool CheckArguments(CommandSource &source, const std::vector<Anope::string> ¶ms, ChannelInfo* &ci) @@ -252,7 +252,7 @@ class CommandBSKickAMSG : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -263,7 +263,7 @@ class CommandBSKickAMSG : public CommandBSKickBase } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -288,7 +288,7 @@ class CommandBSKickBadwords : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -300,7 +300,7 @@ class CommandBSKickBadwords : public CommandBSKickBase } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -327,7 +327,7 @@ class CommandBSKickBolds : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -338,7 +338,7 @@ class CommandBSKickBolds : public CommandBSKickBase } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -361,7 +361,7 @@ class CommandBSKickCaps : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037 [\037min\037 [\037percent\037]]]\002")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (!CheckArguments(source, params, ci)) @@ -429,7 +429,7 @@ class CommandBSKickCaps : public CommandBSKickBase kd->Check(ci); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -457,7 +457,7 @@ class CommandBSKickColors : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -468,7 +468,7 @@ class CommandBSKickColors : public CommandBSKickBase } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -491,7 +491,7 @@ class CommandBSKickFlood : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037 [\037ln\037 [\037secs\037]]]\002")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (!CheckArguments(source, params, ci)) @@ -564,7 +564,7 @@ class CommandBSKickFlood : public CommandBSKickBase kd->Check(ci); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -589,7 +589,7 @@ class CommandBSKickItalics : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -600,7 +600,7 @@ class CommandBSKickItalics : public CommandBSKickBase } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -623,7 +623,7 @@ class CommandBSKickRepeat : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037 [\037num\037]]\002")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (!CheckArguments(source, params, ci)) @@ -699,7 +699,7 @@ class CommandBSKickRepeat : public CommandBSKickBase kd->Check(ci); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -724,7 +724,7 @@ class CommandBSKickReverses : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -735,7 +735,7 @@ class CommandBSKickReverses : public CommandBSKickBase } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -758,7 +758,7 @@ class CommandBSKickUnderlines : public CommandBSKickBase this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci; if (CheckArguments(source, params, ci)) @@ -769,7 +769,7 @@ class CommandBSKickUnderlines : public CommandBSKickBase } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -792,7 +792,7 @@ class CommandBSSetDontKickOps : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) @@ -837,7 +837,7 @@ class CommandBSSetDontKickOps : public Command kd->Check(ci); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -857,7 +857,7 @@ class CommandBSSetDontKickVoices : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) @@ -902,7 +902,7 @@ class CommandBSSetDontKickVoices : public Command kd->Check(ci); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -989,7 +989,7 @@ class BanDataPurger : public Timer public: BanDataPurger(Module *o) : Timer(o, 300, Anope::CurTime, true) { } - void Tick(time_t) anope_override + void Tick(time_t) override { Log(LOG_DEBUG) << "bs_main: Running bandata purger"; @@ -1106,7 +1106,7 @@ class BSKick : public Module } - void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) anope_override + void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override { if (!ci) return; @@ -1221,7 +1221,7 @@ class BSKick : public Module info.AddOption(_("Voices protection")); } - void OnPrivmsg(User *u, Channel *c, Anope::string &msg) anope_override + void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override { /* Now we can make kicker stuff. We try to order the checks * from the fastest one to the slowest one, since there's diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index a14706c9d..b54543e00 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp @@ -20,12 +20,12 @@ class CommandBSSet : public Command this->SetSyntax(_("\037option\037 \037(channel | bot)\037 \037settings\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -77,7 +77,7 @@ class CommandBSSetBanExpire : public Command public: UnbanTimer(Module *creator, const Anope::string &ch, const Anope::string &bmask, time_t t) : Timer(creator, t), chname(ch), mask(bmask) { } - void Tick(time_t) anope_override + void Tick(time_t) override { Channel *c = Channel::Find(chname); if (c) @@ -91,7 +91,7 @@ class CommandBSSetBanExpire : public Command this->SetSyntax(_("\037channel\037 \037time\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; const Anope::string &arg = params[1]; @@ -141,7 +141,7 @@ class CommandBSSetBanExpire : public Command source.Reply(_("Bot bans will automatically expire after %s."), Anope::Duration(ci->banexpire, source.GetAccount()).c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -162,7 +162,7 @@ class CommandBSSetPrivate : public Command this->SetSyntax(_("\037botname\037 {\037ON|OFF\037}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { BotInfo *bi = BotInfo::Find(params[0], true); const Anope::string &value = params[1]; @@ -193,7 +193,7 @@ class CommandBSSetPrivate : public Command this->OnSyntaxError(source, source.command); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -216,7 +216,7 @@ class BSSet : public Module { } - void OnBotBan(User *u, ChannelInfo *ci, const Anope::string &mask) anope_override + void OnBotBan(User *u, ChannelInfo *ci, const Anope::string &mask) override { if (!ci->banexpire) return; diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 386978340..ee6d324c7 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -23,23 +23,23 @@ static inline void reset_levels(ChannelInfo *ci) class AccessChanAccess : public ChanAccess { public: - int level; + int level = 0; - AccessChanAccess(AccessProvider *p) : ChanAccess(p), level(0) + AccessChanAccess(AccessProvider *p) : ChanAccess(p) { } - bool HasPriv(const Anope::string &name) const anope_override + bool HasPriv(const Anope::string &name) const override { return this->ci->GetLevel(name) != ACCESS_INVALID && this->level >= this->ci->GetLevel(name); } - Anope::string AccessSerialize() const anope_override + Anope::string AccessSerialize() const override { return stringify(this->level); } - void AccessUnserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) override { try { @@ -50,7 +50,7 @@ class AccessChanAccess : public ChanAccess } } - bool operator>(const ChanAccess &other) const anope_override + bool operator>(const ChanAccess &other) const override { if (this->provider != other.provider) return ChanAccess::operator>(other); @@ -58,7 +58,7 @@ class AccessChanAccess : public ChanAccess return this->level > anope_dynamic_static_cast<const AccessChanAccess *>(&other)->level; } - bool operator<(const ChanAccess &other) const anope_override + bool operator<(const ChanAccess &other) const override { if (this->provider != other.provider) return ChanAccess::operator<(other); @@ -77,7 +77,7 @@ class AccessAccessProvider : public AccessProvider me = this; } - ChanAccess *Create() anope_override + ChanAccess *Create() override { return new AccessChanAccess(this); } @@ -250,12 +250,12 @@ class CommandCSAccess : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; Anope::string Nicks; - bool denied; - bool override; + bool denied = false; + bool override = false; public: - AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false) + AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c) { if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify")) this->override = true; @@ -278,7 +278,7 @@ class CommandCSAccess : public Command } } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned Number) override { if (!Number || Number > ci->GetAccessCount()) return; @@ -359,7 +359,7 @@ class CommandCSAccess : public Command { } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > ci->GetAccessCount()) return; @@ -503,7 +503,7 @@ class CommandCSAccess : public Command this->SetSyntax(_("\037channel\037 CLEAR")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[1]; const Anope::string &nick = params.size() > 2 ? params[2] : ""; @@ -561,7 +561,7 @@ class CommandCSAccess : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -745,7 +745,7 @@ class CommandCSLevels : public Command this->SetSyntax(_("\037channel\037 RESET")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[1]; const Anope::string &what = params.size() > 2 ? params[2] : ""; @@ -789,7 +789,7 @@ class CommandCSLevels : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (subcommand.equals_ci("DESC")) { @@ -856,7 +856,7 @@ class CSAccess : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { defaultLevels.clear(); @@ -882,12 +882,12 @@ class CSAccess : public Module } } - void OnCreateChan(ChannelInfo *ci) anope_override + void OnCreateChan(ChannelInfo *ci) override { reset_levels(ci); } - EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) anope_override + EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) override { if (group->ci == NULL) return EVENT_CONTINUE; diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index d10f223cd..94e1955ff 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -211,10 +211,10 @@ class CommandCSAKick : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; AccessGroup ag; public: - AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), ag(source.AccessFor(ci)) + AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), ag(source.AccessFor(ci)) { } @@ -228,7 +228,7 @@ class CommandCSAKick : public Command source.Reply(_("Deleted %d entries from %s autokick list."), deleted, ci->name.c_str()); } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > ci->GetAkickCount()) return; @@ -293,7 +293,7 @@ class CommandCSAKick : public Command { } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > ci->GetAkickCount()) return; @@ -440,7 +440,7 @@ class CommandCSAKick : public Command this->SetSyntax(_("\037channel\037 CLEAR")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string chan = params[0]; Anope::string cmd = params[1]; @@ -485,7 +485,7 @@ class CommandCSAKick : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { BotInfo *bi = Config->GetClient("NickServ"); this->SendSyntax(source); @@ -538,7 +538,7 @@ class CSAKick : public Module { } - EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override + EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override { if (!c->ci || c->MatchesList(u, "EXCEPT")) return EVENT_CONTINUE; diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 648651dfa..d35932bba 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -23,7 +23,7 @@ class TempBan : public Timer public: TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod) : Timer(me, seconds), channel(c->name), mask(banmask), mode(mod) { } - void Tick(time_t ctime) anope_override + void Tick(time_t ctime) override { Channel *c = Channel::Find(this->channel); if (c) @@ -40,7 +40,7 @@ class CommandCSBan : public Command this->SetSyntax(_("\037channel\037 [+\037expiry\037] {\037nick\037 | \037mask\037} [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Configuration::Block *block = Config->GetCommand(source); const Anope::string &mode = block->Get<Anope::string>("mode", "BAN"); @@ -223,7 +223,7 @@ class CommandCSBan : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index 4bfe8b639..70e2a7425 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -115,7 +115,7 @@ public: this->SetSyntax(_("\037channel\037 \037target\037 [\037what\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &channel = params[0]; const Anope::string &target = params[1]; @@ -235,7 +235,7 @@ public: Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clone " << (what.empty() ? "everything from it" : what) << " to " << target_ci->name; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp index d5fea7e1a..30db66c71 100644 --- a/modules/commands/cs_drop.cpp +++ b/modules/commands/cs_drop.cpp @@ -20,7 +20,7 @@ class CommandCSDrop : public Command this->SetSyntax(_("\037channel\037 \037channel\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; @@ -66,7 +66,7 @@ class CommandCSDrop : public Command c->CheckModes(); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp index 8f21c8c35..6b34b4741 100644 --- a/modules/commands/cs_enforce.cpp +++ b/modules/commands/cs_enforce.cpp @@ -119,7 +119,7 @@ class CommandCSEnforce : public Command if (user->IsProtected()) continue; - if (!user->HasMode("SSL") && !user->HasExt("ssl")) + if (!user->IsSecurelyConnected()) users.push_back(user); } @@ -228,7 +228,7 @@ class CommandCSEnforce : public Command this->SetSyntax(_("\037channel\037 \037what\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &what = params.size() > 1 ? params[1] : ""; @@ -256,7 +256,7 @@ class CommandCSEnforce : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_entrymsg.cpp b/modules/commands/cs_entrymsg.cpp index 8e4bd9b15..f29581936 100644 --- a/modules/commands/cs_entrymsg.cpp +++ b/modules/commands/cs_entrymsg.cpp @@ -28,7 +28,7 @@ struct EntryMsgImpl : EntryMsg, Serializable ~EntryMsgImpl(); - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["ci"] << this->chan; data["creator"] << this->creator; @@ -43,7 +43,7 @@ struct EntryMessageListImpl : EntryMessageList { EntryMessageListImpl(Extensible *) { } - EntryMsg* Create() anope_override + EntryMsg* Create() override { return new EntryMsgImpl(); } @@ -197,7 +197,7 @@ class CommandEntryMessage : public Command this->SetSyntax(_("\037channel\037 CLEAR")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) @@ -232,7 +232,7 @@ class CommandEntryMessage : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -273,7 +273,7 @@ class CSEntryMessage : public Module { } - void OnJoinChannel(User *u, Channel *c) anope_override + void OnJoinChannel(User *u, Channel *c) override { if (u && c && c->ci && u->server->IsSynced()) { diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index 5fca415de..e891335ef 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -22,7 +22,7 @@ class FlagsChanAccess : public ChanAccess { } - bool HasPriv(const Anope::string &priv) const anope_override + bool HasPriv(const Anope::string &priv) const override { std::map<Anope::string, char>::iterator it = defaultFlags.find(priv); if (it != defaultFlags.end() && this->flags.count(it->second) > 0) @@ -30,12 +30,12 @@ class FlagsChanAccess : public ChanAccess return false; } - Anope::string AccessSerialize() const anope_override + Anope::string AccessSerialize() const override { return Anope::string(this->flags.begin(), this->flags.end()); } - void AccessUnserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) override { for (unsigned i = data.length(); i > 0; --i) this->flags.insert(data[i - 1]); @@ -69,7 +69,7 @@ class FlagsAccessProvider : public AccessProvider ap = this; } - ChanAccess *Create() anope_override + ChanAccess *Create() override { return new FlagsChanAccess(this); } @@ -376,7 +376,7 @@ class CommandCSFlags : public Command this->SetSyntax(_("\037channel\037 CLEAR")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; const Anope::string &cmd = params.size() > 1 ? params[1] : ""; @@ -425,7 +425,7 @@ class CommandCSFlags : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -478,7 +478,7 @@ class CSFlags : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { defaultFlags.clear(); diff --git a/modules/commands/cs_getkey.cpp b/modules/commands/cs_getkey.cpp index 421d7e513..fe12cb8a5 100644 --- a/modules/commands/cs_getkey.cpp +++ b/modules/commands/cs_getkey.cpp @@ -20,7 +20,7 @@ class CommandCSGetKey : public Command this->SetSyntax(_("\037channel\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; @@ -50,7 +50,7 @@ class CommandCSGetKey : public Command source.Reply(_("Key for channel \002%s\002 is \002%s\002."), chan.c_str(), key.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp index 781df0205..03c72563d 100644 --- a/modules/commands/cs_info.cpp +++ b/modules/commands/cs_info.cpp @@ -21,7 +21,7 @@ class CommandCSInfo : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; @@ -69,7 +69,7 @@ class CommandCSInfo : public Command source.Reply(replies[i]); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp index 6526db23c..3b4753da3 100644 --- a/modules/commands/cs_invite.cpp +++ b/modules/commands/cs_invite.cpp @@ -20,7 +20,7 @@ class CommandCSInvite : public Command this->SetSyntax(_("\037channel\037 [\037nick\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; @@ -84,7 +84,7 @@ class CommandCSInvite : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp index 4ba3d2c8a..0589d5e05 100644 --- a/modules/commands/cs_kick.cpp +++ b/modules/commands/cs_kick.cpp @@ -21,7 +21,7 @@ class CommandCSKick : public Command this->SetSyntax(_("\037channel\037 \037mask\037 [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; const Anope::string &target = params[1]; @@ -121,7 +121,7 @@ class CommandCSKick : public Command source.Reply(NICK_X_NOT_IN_USE, target.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp index c64b96957..d25e0b1eb 100644 --- a/modules/commands/cs_list.cpp +++ b/modules/commands/cs_list.cpp @@ -21,7 +21,7 @@ class CommandCSList : public Command this->SetSyntax(_("\037pattern\037 [SUSPENDED] [NOEXPIRE]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string pattern = params[0]; unsigned nchans; @@ -130,7 +130,7 @@ class CommandCSList : public Command source.Reply(_("End of list - %d/%d matches shown."), nchans > listmax ? listmax : nchans, nchans); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -181,7 +181,7 @@ class CommandCSSetPrivate : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -225,7 +225,7 @@ class CommandCSSetPrivate : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -253,7 +253,7 @@ class CSList : public Module { } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override { if (!show_all) return; diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp index b4ea75d3c..157d3692e 100644 --- a/modules/commands/cs_log.cpp +++ b/modules/commands/cs_log.cpp @@ -33,7 +33,7 @@ struct LogSettingImpl : LogSetting, Serializable } } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["ci"] << chan; data["service_name"] << service_name; @@ -91,7 +91,7 @@ struct LogSettingsImpl : LogSettings } } - LogSetting *Create() anope_override + LogSetting *Create() override { return new LogSettingImpl(); } @@ -107,7 +107,7 @@ public: this->SetSyntax(_("\037channel\037 \037command\037 \037method\037 [\037status\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &channel = params[0]; @@ -251,7 +251,7 @@ public: this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -301,7 +301,7 @@ class CSLog : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); defaults.clear(); @@ -320,7 +320,7 @@ class CSLog : public Module } } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) override { if (defaults.empty()) return; @@ -353,7 +353,7 @@ class CSLog : public Module } } - void OnLog(Log *l) anope_override + void OnLog(Log *l) override { if (l->type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) return; diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 0f6378036..17ecc566c 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -29,7 +29,7 @@ struct ModeLockImpl : ModeLock, Serializable } } - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; @@ -53,7 +53,7 @@ struct ModeLocksImpl : ModeLocks } } - bool HasMLock(ChannelMode *mode, const Anope::string ¶m, bool status) const anope_override + bool HasMLock(ChannelMode *mode, const Anope::string ¶m, bool status) const override { if (!mode) return false; @@ -69,7 +69,7 @@ struct ModeLocksImpl : ModeLocks return false; } - bool SetMLock(ChannelMode *mode, bool status, const Anope::string ¶m, Anope::string setter, time_t created = Anope::CurTime) anope_override + bool SetMLock(ChannelMode *mode, bool status, const Anope::string ¶m, Anope::string setter, time_t created = Anope::CurTime) override { if (!mode) return false; @@ -99,7 +99,7 @@ struct ModeLocksImpl : ModeLocks return true; } - bool RemoveMLock(ChannelMode *mode, bool status, const Anope::string ¶m = "") anope_override + bool RemoveMLock(ChannelMode *mode, bool status, const Anope::string ¶m = "") override { if (!mode) return false; @@ -128,14 +128,14 @@ struct ModeLocksImpl : ModeLocks return false; } - void RemoveMLock(ModeLock *mlock) anope_override + void RemoveMLock(ModeLock *mlock) override { ModeList::iterator it = std::find(this->mlocks->begin(), this->mlocks->end(), mlock); if (it != this->mlocks->end()) this->mlocks->erase(it); } - void ClearMLock() anope_override + void ClearMLock() override { ModeList ml; this->mlocks->swap(ml); @@ -143,12 +143,12 @@ struct ModeLocksImpl : ModeLocks delete ml[i]; } - const ModeList &GetMLock() const anope_override + const ModeList &GetMLock() const override { return this->mlocks; } - std::list<ModeLock *> GetModeLockList(const Anope::string &name) anope_override + std::list<ModeLock *> GetModeLockList(const Anope::string &name) override { std::list<ModeLock *> mlist; for (ModeList::const_iterator it = this->mlocks->begin(); it != this->mlocks->end(); ++it) @@ -160,7 +160,7 @@ struct ModeLocksImpl : ModeLocks return mlist; } - const ModeLock *GetMLock(const Anope::string &mname, const Anope::string ¶m = "") anope_override + const ModeLock *GetMLock(const Anope::string &mname, const Anope::string ¶m = "") override { for (ModeList::const_iterator it = this->mlocks->begin(); it != this->mlocks->end(); ++it) { @@ -173,7 +173,7 @@ struct ModeLocksImpl : ModeLocks return NULL; } - Anope::string GetMLockAsString(bool complete) const anope_override + Anope::string GetMLockAsString(bool complete) const override { Anope::string pos = "+", neg = "-", params; @@ -202,7 +202,7 @@ struct ModeLocksImpl : ModeLocks return pos + neg + params; } - void Check() anope_override + void Check() override { if (this->mlocks->empty()) ci->Shrink<ModeLocks>("modelocks"); @@ -736,7 +736,7 @@ class CommandCSMode : public Command this->SetSyntax(_("\037channel\037 CLEAR [\037what\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &subcommand = params[1]; @@ -766,7 +766,7 @@ class CommandCSMode : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -807,7 +807,7 @@ class CommandCSModes : public Command this->SetSyntax(_("\037channel\037 [\037user\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *u = source.GetUser(), *targ = params.size() > 1 ? User::Find(params[1], true) : u; @@ -879,7 +879,7 @@ class CommandCSModes : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "on " << targ->nick; } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { const std::pair<bool, Anope::string> &m = modes[source.command]; if (!m.second.empty()) @@ -893,7 +893,7 @@ class CommandCSModes : public Command return ""; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { const std::pair<bool, Anope::string> &m = modes[source.command]; if (m.second.empty()) @@ -932,7 +932,7 @@ class CSMode : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { modes.clear(); @@ -956,7 +956,7 @@ class CSMode : public Module } } - void OnCheckModes(Reference<Channel> &c) anope_override + void OnCheckModes(Reference<Channel> &c) override { if (!c || !c->ci) return; @@ -1005,7 +1005,7 @@ class CSMode : public Module } } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) override { ModeLocks *ml = modelocks.Require(ci); Anope::string mlock; @@ -1055,7 +1055,7 @@ class CSMode : public Module ml->Check(); } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override { if (!show_hidden) return; diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp index 58702bb67..c85ac8ff8 100644 --- a/modules/commands/cs_register.cpp +++ b/modules/commands/cs_register.cpp @@ -20,7 +20,7 @@ class CommandCSRegister : public Command this->SetSyntax(_("\037channel\037 [\037description\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; const Anope::string &chdesc = params.size() > 1 ? params[1] : ""; @@ -79,7 +79,7 @@ class CommandCSRegister : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index b36b4faf9..913b2d408 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -43,7 +43,7 @@ struct SeenInfo : Serializable database.erase(iter); } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["nick"] << nick; data["vhost"] << vhost; @@ -119,7 +119,7 @@ class CommandOSSeen : public Command this->SetSyntax(_("CLEAR \037time\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (params[0].equals_ci("STATS")) { @@ -165,7 +165,7 @@ class CommandOSSeen : public Command this->SendSyntax(source); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -263,7 +263,7 @@ class CommandSeen : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &target = params[0]; @@ -360,7 +360,7 @@ class CommandSeen : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -381,12 +381,12 @@ class CSSeen : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { simple = conf->GetModule(this)->Get<bool>("simple"); } - void OnExpireTick() anope_override + void OnExpireTick() override { size_t previous_size = database.size(); time_t purgetime = Config->GetModule(this)->Get<time_t>("purgetime"); @@ -406,34 +406,34 @@ class CSSeen : public Module Log(LOG_DEBUG) << "cs_seen: Purged database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries."; } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (!u->Quitting()) UpdateUser(u, NEW, u->nick, "", "", ""); } - void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override + void OnUserNickChange(User *u, const Anope::string &oldnick) override { UpdateUser(u, NICK_TO, oldnick, u->nick, "", ""); UpdateUser(u, NICK_FROM, u->nick, oldnick, "", ""); } - void OnUserQuit(User *u, const Anope::string &msg) anope_override + void OnUserQuit(User *u, const Anope::string &msg) override { UpdateUser(u, QUIT, u->nick, "", "", msg); } - void OnJoinChannel(User *u, Channel *c) anope_override + void OnJoinChannel(User *u, Channel *c) override { UpdateUser(u, JOIN, u->nick, "", c->name, ""); } - void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg) anope_override + void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg) override { UpdateUser(u, PART, u->nick, "", channel, msg); } - void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &msg) anope_override + void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &msg) override { UpdateUser(cu->user, KICK, cu->user->nick, source.GetSource(), cu->chan->name, msg); } diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index bac64612a..80b750c98 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -21,12 +21,12 @@ class CommandCSSet : public Command this->SetSyntax(_("\037option\037 \037channel\037 \037parameters\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -75,7 +75,7 @@ class CommandCSSetAutoOp : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -117,7 +117,7 @@ class CommandCSSetAutoOp : public Command this->OnSyntaxError(source, "AUTOOP"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -138,7 +138,7 @@ class CommandCSSetBanType : public Command this->SetSyntax(_("\037channel\037 \037bantype\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -179,7 +179,7 @@ class CommandCSSetBanType : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -205,7 +205,7 @@ class CommandCSSetDescription : public Command this->SetSyntax(_("\037channel\037 [\037description\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -248,7 +248,7 @@ class CommandCSSetDescription : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -267,7 +267,7 @@ class CommandCSSetFounder : public Command this->SetSyntax(_("\037channel\037 \037nick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -317,7 +317,7 @@ class CommandCSSetFounder : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -336,7 +336,7 @@ class CommandCSSetKeepModes : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -381,7 +381,7 @@ class CommandCSSetKeepModes : public Command this->OnSyntaxError(source, "KEEPMODES"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -401,7 +401,7 @@ class CommandCSSetPeace : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -445,7 +445,7 @@ class CommandCSSetPeace : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -473,7 +473,7 @@ class CommandCSSetPersist : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -583,7 +583,7 @@ class CommandCSSetPersist : public Command this->OnSyntaxError(source, "PERSIST"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { BotInfo *BotServ = Config->GetClient("BotServ"); BotInfo *ChanServ = Config->GetClient("ChanServ"); @@ -622,7 +622,7 @@ class CommandCSSetRestricted : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -664,7 +664,7 @@ class CommandCSSetRestricted : public Command this->OnSyntaxError(source, "RESTRICTED"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -684,7 +684,7 @@ class CommandCSSetSecure : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -726,7 +726,7 @@ class CommandCSSetSecure : public Command this->OnSyntaxError(source, "SECURE"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -747,7 +747,7 @@ class CommandCSSetSecureFounder : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -789,7 +789,7 @@ class CommandCSSetSecureFounder : public Command this->OnSyntaxError(source, "SECUREFOUNDER"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -811,7 +811,7 @@ class CommandCSSetSecureOps : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -853,7 +853,7 @@ class CommandCSSetSecureOps : public Command this->OnSyntaxError(source, "SECUREOPS"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -873,7 +873,7 @@ class CommandCSSetSignKick : public Command this->SetSyntax(_("\037channel\037 {ON | LEVEL | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -925,7 +925,7 @@ class CommandCSSetSignKick : public Command this->OnSyntaxError(source, "SIGNKICK"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -950,7 +950,7 @@ class CommandCSSetSuccessor : public Command this->SetSyntax(_("\037channel\037 [\037nick\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -1010,7 +1010,7 @@ class CommandCSSetSuccessor : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -1044,7 +1044,7 @@ class CommandCSSetNoexpire : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -1083,7 +1083,7 @@ class CommandCSSetNoexpire : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -1103,7 +1103,7 @@ class CSSet : public Module { KeepModes(Module *m, const Anope::string &n) : SerializableExtensibleItem<bool>(m, n) { } - void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override + void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override { SerializableExtensibleItem<bool>::ExtensibleSerialize(e, s, data); @@ -1123,7 +1123,7 @@ class CSSet : public Module data["last_modes"] << modes; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { SerializableExtensibleItem<bool>::ExtensibleUnserialize(e, s, data); @@ -1184,17 +1184,17 @@ class CSSet : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { persist_lower_ts = conf->GetModule(this)->Get<bool>("persist_lower_ts"); } - void OnCreateChan(ChannelInfo *ci) anope_override + void OnCreateChan(ChannelInfo *ci) override { ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2"); } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { if (c->ci && keep_modes.HasExt(c->ci)) { @@ -1204,7 +1204,7 @@ class CSSet : public Module } } - EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override + EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override { if (!c->ci || !restricted.HasExt(c->ci) || c->MatchesList(u, "EXCEPT")) return EVENT_CONTINUE; @@ -1215,14 +1215,14 @@ class CSSet : public Module return EVENT_CONTINUE; } - void OnDelChan(ChannelInfo *ci) anope_override + void OnDelChan(ChannelInfo *ci) override { if (ci->c && persist.HasExt(ci)) ci->c->RemoveMode(ci->WhoSends(), "PERM", "", false); persist.Unset(ci); } - EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) override { if (c->ci) { @@ -1237,7 +1237,7 @@ class CSSet : public Module return EVENT_CONTINUE; } - EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) override { if (mode->name == "PERM") { @@ -1251,7 +1251,7 @@ class CSSet : public Module return EVENT_CONTINUE; } - void OnJoinChannel(User *u, Channel *c) anope_override + void OnJoinChannel(User *u, Channel *c) override { if (u->server != Me && persist_lower_ts && c->ci && persist.HasExt(c->ci) && c->creation_time > c->ci->time_registered) { @@ -1262,7 +1262,7 @@ class CSSet : public Module } } - void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override + void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) override { if (chan->ci) { @@ -1274,13 +1274,13 @@ class CSSet : public Module } } - void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override + void OnPreChanExpire(ChannelInfo *ci, bool &expire) override { if (noexpire.HasExt(ci)) expire = false; } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override { if (!show_all) return; diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index 49cd99e16..765cea7ba 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -42,7 +42,7 @@ struct CSMiscData : MiscData, Serializable data = d; } - void Serialize(Serialize::Data &sdata) const anope_override + void Serialize(Serialize::Data &sdata) const override { sdata["ci"] << this->object; sdata["name"] << this->name; @@ -96,7 +96,7 @@ class CommandCSSetMisc : public Command this->SetSyntax(_("\037channel\037 [\037parameters\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -143,7 +143,7 @@ class CommandCSSetMisc : public Command } } - void OnServHelp(CommandSource &source) anope_override + void OnServHelp(CommandSource &source) override { if (descriptions.count(source.command)) { @@ -152,7 +152,7 @@ class CommandCSSetMisc : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (descriptions.count(source.command)) { @@ -182,7 +182,7 @@ class CSSetMisc : public Module delete it->second; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { descriptions.clear(); @@ -203,7 +203,7 @@ class CSSetMisc : public Module } } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool) override { for (Anope::map<ExtensibleItem<CSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it) { diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp index c34a259eb..b297b8224 100644 --- a/modules/commands/cs_status.cpp +++ b/modules/commands/cs_status.cpp @@ -20,7 +20,7 @@ public: this->SetSyntax(_("\037channel\037 [\037user\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &channel = params[0]; @@ -99,7 +99,7 @@ public: } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp index 4d0ba3091..7bd5f1a2e 100644 --- a/modules/commands/cs_suspend.cpp +++ b/modules/commands/cs_suspend.cpp @@ -16,7 +16,7 @@ struct CSSuspendInfo : SuspendInfo, Serializable { CSSuspendInfo(Extensible *) : Serializable("CSSuspendInfo") { } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["chan"] << what; data["by"] << by; @@ -59,7 +59,7 @@ class CommandCSSuspend : public Command this->SetSyntax(_("\037channel\037 [+\037expiry\037] [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; Anope::string expiry = params[1]; @@ -127,7 +127,7 @@ class CommandCSSuspend : public Command FOREACH_MOD(OnChanSuspend, (ci)); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -152,7 +152,7 @@ class CommandCSUnSuspend : public Command this->SetSyntax(_("\037channel\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) @@ -184,7 +184,7 @@ class CommandCSUnSuspend : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -222,7 +222,7 @@ class CSSuspend : public Module { } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override { CSSuspendInfo *si = suspend.Get(ci); if (!si) @@ -240,7 +240,7 @@ class CSSuspend : public Module info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount()); } - void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override + void OnPreChanExpire(ChannelInfo *ci, bool &expire) override { CSSuspendInfo *si = suspend.Get(ci); if (!si) @@ -260,7 +260,7 @@ class CSSuspend : public Module } } - EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override + EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override { if (u->HasMode("OPER") || !c->ci || !suspend.HasExt(c->ci)) return EVENT_CONTINUE; @@ -269,7 +269,7 @@ class CSSuspend : public Module return EVENT_STOP; } - EventReturn OnChanDrop(CommandSource &source, ChannelInfo *ci) anope_override + EventReturn OnChanDrop(CommandSource &source, ChannelInfo *ci) override { CSSuspendInfo *si = suspend.Get(ci); if (si && !source.HasCommand("chanserv/drop")) diff --git a/modules/commands/cs_sync.cpp b/modules/commands/cs_sync.cpp index 5209f4df1..a0268bf03 100644 --- a/modules/commands/cs_sync.cpp +++ b/modules/commands/cs_sync.cpp @@ -20,7 +20,7 @@ class CommandCSSync : public Command this->SetSyntax(_("\037channel\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); @@ -42,7 +42,7 @@ class CommandCSSync : public Command } } - bool OnHelp(CommandSource &source, const Anope::string ¶ms) anope_override + bool OnHelp(CommandSource &source, const Anope::string ¶ms) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp index 92098dcc9..95b67e832 100644 --- a/modules/commands/cs_topic.cpp +++ b/modules/commands/cs_topic.cpp @@ -21,7 +21,7 @@ class CommandCSSetKeepTopic : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -63,7 +63,7 @@ class CommandCSSetKeepTopic : public Command this->OnSyntaxError(source, "KEEPTOPIC"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -152,7 +152,7 @@ class CommandCSTopic : public Command this->SetSyntax(_("\037channel\037 [UNLOCK|LOCK]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &subcmd = params[1]; @@ -186,7 +186,7 @@ class CommandCSTopic : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -216,7 +216,7 @@ class CSTopic : public Module } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { if (c->ci) { @@ -228,7 +228,7 @@ class CSTopic : public Module } } - void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override + void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) override { if (!c->ci) return; @@ -250,7 +250,7 @@ class CSTopic : public Module } } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override { if (keeptopic.HasExt(ci)) info.AddOption(_("Topic retention")); diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp index 101032807..897ad468f 100644 --- a/modules/commands/cs_unban.cpp +++ b/modules/commands/cs_unban.cpp @@ -20,7 +20,7 @@ class CommandCSUnban : public Command this->SetSyntax(_("\037channel\037 [\037nick\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelMode *cm = ModeManager::FindChannelModeByName("BAN"); if (!cm) @@ -96,7 +96,7 @@ class CommandCSUnban : public Command source.Reply(_("\002%s\002 has been unbanned from \002%s\002."), u2->nick.c_str(), ci->c->name.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp index 0203c9e5b..9bc40e218 100644 --- a/modules/commands/cs_updown.cpp +++ b/modules/commands/cs_updown.cpp @@ -49,7 +49,7 @@ class CommandCSUp : public Command this->SetSyntax(_("[\037channel\037 [\037nick\037]]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (params.empty()) { @@ -119,7 +119,7 @@ class CommandCSUp : public Command } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -147,7 +147,7 @@ class CommandCSDown : public Command this->SetSyntax(_("[\037channel\037 [\037nick\037]]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (params.empty()) { @@ -216,7 +216,7 @@ class CommandCSDown : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 2b0cf413f..423bdd552 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -26,7 +26,7 @@ class XOPChanAccess : public ChanAccess { } - bool HasPriv(const Anope::string &priv) const anope_override + bool HasPriv(const Anope::string &priv) const override { for (std::vector<Anope::string>::iterator it = std::find(order.begin(), order.end(), this->type); it != order.end(); ++it) { @@ -37,12 +37,12 @@ class XOPChanAccess : public ChanAccess return false; } - Anope::string AccessSerialize() const anope_override + Anope::string AccessSerialize() const override { return this->type; } - void AccessUnserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) override { this->type = data; } @@ -88,7 +88,7 @@ class XOPAccessProvider : public AccessProvider { } - ChanAccess *Create() anope_override + ChanAccess *Create() override { return new XOPChanAccess(this); } @@ -280,11 +280,11 @@ class CommandCSXOP : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; Anope::string nicks; bool override; public: - XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), override(_override) + XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), override(_override) { } @@ -303,7 +303,7 @@ class CommandCSXOP : public Command } } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > ci->GetAccessCount()) return; @@ -388,7 +388,7 @@ class CommandCSXOP : public Command { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned Number) override { if (!Number || Number > ci->GetAccessCount()) return; @@ -484,12 +484,12 @@ class CommandCSXOP : public Command this->SetSyntax(_("\037channel\037 CLEAR")); } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { return Anope::printf(Language::Translate(source.GetAccount(), _("Modify the list of %s users")), source.command.upper().c_str()); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) @@ -513,7 +513,7 @@ class CommandCSXOP : public Command } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { const Anope::string &cmd = source.command.upper(); @@ -590,7 +590,7 @@ class CSXOP : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { order.clear(); permissions.clear(); diff --git a/modules/commands/gl_global.cpp b/modules/commands/gl_global.cpp index 3cd707b38..d8a414fde 100644 --- a/modules/commands/gl_global.cpp +++ b/modules/commands/gl_global.cpp @@ -22,7 +22,7 @@ class CommandGLGlobal : public Command this->SetSyntax(_("\037message\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &msg = params[0]; @@ -35,7 +35,7 @@ class CommandGLGlobal : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { Reference<BotInfo> sender; if (GService) diff --git a/modules/commands/greet.cpp b/modules/commands/greet.cpp index 0fa66fe5d..a75c6538e 100644 --- a/modules/commands/greet.cpp +++ b/modules/commands/greet.cpp @@ -20,7 +20,7 @@ class CommandBSSetGreet : public Command this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); const Anope::string &value = params[1]; @@ -63,7 +63,7 @@ class CommandBSSetGreet : public Command this->OnSyntaxError(source, source.command); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -119,12 +119,12 @@ class CommandNSSetGreet : public Command } } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params.size() > 0 ? params[0] : ""); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -145,12 +145,12 @@ class CommandNSSASetGreet : public CommandNSSetGreet this->SetSyntax(_("\037nickname\037 \037message\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params.size() > 1 ? params[1] : ""); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -182,7 +182,7 @@ class Greet : public Module { } - void OnJoinChannel(User *user, Channel *c) anope_override + void OnJoinChannel(User *user, Channel *c) override { /* Only display the greet if the main uplink we're connected * to has synced, or we'll get greet-floods when the net @@ -199,14 +199,14 @@ class Greet : public Module } } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { Anope::string *greet = ns_greet.Get(na->nc); if (greet != NULL) info[_("Greet")] = *greet; } - void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) anope_override + void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override { if (bs_greet.HasExt(ci)) info.AddOption(_("Greet")); diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp index e7ab37ff0..c2ed216de 100644 --- a/modules/commands/help.cpp +++ b/modules/commands/help.cpp @@ -34,7 +34,7 @@ class CommandHelp : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { EventReturn MOD_RESULT; FOREACH_RESULT(OnPreHelp, MOD_RESULT, (source, params)); diff --git a/modules/commands/hs_del.cpp b/modules/commands/hs_del.cpp index c07f4bd79..b19a85c4a 100644 --- a/modules/commands/hs_del.cpp +++ b/modules/commands/hs_del.cpp @@ -20,7 +20,7 @@ class CommandHSDel : public Command this->SetSyntax(_("\037nick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -41,7 +41,7 @@ class CommandHSDel : public Command source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -60,7 +60,7 @@ class CommandHSDelAll : public Command this->SetSyntax(_("\037nick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -86,7 +86,7 @@ class CommandHSDelAll : public Command source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp index 88ec20568..17dc2dad0 100644 --- a/modules/commands/hs_group.cpp +++ b/modules/commands/hs_group.cpp @@ -13,7 +13,7 @@ class CommandHSGroup : public Command { - bool setting; + bool setting = false; public: void Sync(const NickAlias *na) @@ -37,12 +37,12 @@ class CommandHSGroup : public Command setting = false; } - CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0), setting(false) + CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0) { this->SetDesc(_("Syncs the vhost for all nicks in a group")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -65,7 +65,7 @@ class CommandHSGroup : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -90,7 +90,7 @@ class HSGroup : public Module throw ModuleException("Your IRCd does not support vhosts"); } - void OnSetVhost(NickAlias *na) anope_override + void OnSetVhost(NickAlias *na) override { if (!synconset) return; @@ -98,7 +98,7 @@ class HSGroup : public Module commandhsgroup.Sync(na); } - void OnNickGroup(User *u, NickAlias *na) anope_override + void OnNickGroup(User *u, NickAlias *na) override { if (!syncongroup) return; @@ -106,7 +106,7 @@ class HSGroup : public Module commandhsgroup.Sync(na); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); syncongroup = block->Get<bool>("syncongroup"); diff --git a/modules/commands/hs_list.cpp b/modules/commands/hs_list.cpp index f5de3d9dd..ef4b37402 100644 --- a/modules/commands/hs_list.cpp +++ b/modules/commands/hs_list.cpp @@ -20,7 +20,7 @@ class CommandHSList : public Command this->SetSyntax(_("[\037key\037|\037#X-Y\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &key = !params.empty() ? params[0] : ""; int from = 0, to = 0, counter = 1; @@ -129,7 +129,7 @@ class CommandHSList : public Command source.Reply(replies[i]); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp index 7c93143ed..f7bf81f6b 100644 --- a/modules/commands/hs_off.cpp +++ b/modules/commands/hs_off.cpp @@ -20,7 +20,7 @@ class CommandHSOff : public Command this->RequireUser(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *u = source.GetUser(); @@ -42,7 +42,7 @@ class CommandHSOff : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp index 8eb1b1d00..44291fffe 100644 --- a/modules/commands/hs_on.cpp +++ b/modules/commands/hs_on.cpp @@ -20,7 +20,7 @@ class CommandHSOn : public Command this->RequireUser(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!IRCD->CanSetVHost) return; // HostServ wouldn't even be loaded at this point @@ -48,7 +48,7 @@ class CommandHSOn : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp index 5bf10eb7f..8a02ea7d1 100644 --- a/modules/commands/hs_request.cpp +++ b/modules/commands/hs_request.cpp @@ -29,7 +29,7 @@ struct HostRequest : Serializable HostRequest(Extensible *) : Serializable("HostRequest") { } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["nick"] << this->nick; data["ident"] << this->ident; @@ -79,7 +79,7 @@ class CommandHSRequest : public Command this->SetSyntax(_("vhost")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -172,7 +172,7 @@ class CommandHSRequest : public Command Log(LOG_COMMAND, source, this) << "to request new vhost " << (!user.empty() ? user + "@" : "") << host; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -192,7 +192,7 @@ class CommandHSActivate : public Command this->SetSyntax(_("\037nick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -220,7 +220,7 @@ class CommandHSActivate : public Command source.Reply(_("No request for nick %s found."), nick.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -241,7 +241,7 @@ class CommandHSReject : public Command this->SetSyntax(_("\037nick\037 [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -276,7 +276,7 @@ class CommandHSReject : public Command source.Reply(_("No request for nick %s found."), nick.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -296,7 +296,7 @@ class CommandHSWaiting : public Command this->SetDesc(_("Retrieves the vhost requests")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { unsigned counter = 0; unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax"); @@ -337,7 +337,7 @@ class CommandHSWaiting : public Command source.Reply(_("Displayed \002%d\002 records (\002%d\002 total)."), display_counter, counter); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/hs_set.cpp b/modules/commands/hs_set.cpp index 090b5e2e5..8f56333c4 100644 --- a/modules/commands/hs_set.cpp +++ b/modules/commands/hs_set.cpp @@ -20,7 +20,7 @@ class CommandHSSet : public Command this->SetSyntax(_("\037nick\037 \037hostmask\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -92,7 +92,7 @@ class CommandHSSet : public Command source.Reply(_("VHost for \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -126,7 +126,7 @@ class CommandHSSetAll : public Command this->SetSyntax(_("\037nick\037 \037hostmask\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -199,7 +199,7 @@ class CommandHSSetAll : public Command source.Reply(_("VHost for group \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp index e5d217bf9..ceba02aa8 100644 --- a/modules/commands/ms_cancel.cpp +++ b/modules/commands/ms_cancel.cpp @@ -20,7 +20,7 @@ class CommandMSCancel : public Command this->SetSyntax(_("{\037nick\037 | \037channel\037}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -77,7 +77,7 @@ class CommandMSCancel : public Command source.Reply(_("No memo was cancelable.")); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp index c90b8c2f0..dafc0af03 100644 --- a/modules/commands/ms_check.cpp +++ b/modules/commands/ms_check.cpp @@ -20,7 +20,7 @@ class CommandMSCheck : public Command this->SetSyntax(_("\037nick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &recipient = params[0]; @@ -62,7 +62,7 @@ class CommandMSCheck : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp index 4ca12b159..ff9596c30 100644 --- a/modules/commands/ms_del.cpp +++ b/modules/commands/ms_del.cpp @@ -22,7 +22,7 @@ class MemoDelCallback : public NumberList { } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > mi->memos->size()) return; @@ -45,7 +45,7 @@ class CommandMSDel : public Command this->SetSyntax(_("[\037channel\037] {\037num\037 | \037list\037 | LAST | ALL}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -122,7 +122,7 @@ class CommandMSDel : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp index 9a9796fe1..8e0f1de9e 100644 --- a/modules/commands/ms_ignore.cpp +++ b/modules/commands/ms_ignore.cpp @@ -22,7 +22,7 @@ class CommandMSIgnore : public Command this->SetSyntax(_("[\037channel\037] LIST")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -106,7 +106,7 @@ class CommandMSIgnore : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp index 2df0f2c5d..eb9b785d1 100644 --- a/modules/commands/ms_info.cpp +++ b/modules/commands/ms_info.cpp @@ -20,7 +20,7 @@ class CommandMSInfo : public Command this->SetSyntax(_("[\037nick\037 | \037channel\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { NickCore *nc = source.nc; const MemoInfo *mi; @@ -197,7 +197,7 @@ class CommandMSInfo : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_list.cpp b/modules/commands/ms_list.cpp index 87dc6a81f..b09c579dd 100644 --- a/modules/commands/ms_list.cpp +++ b/modules/commands/ms_list.cpp @@ -20,7 +20,7 @@ class CommandMSList : public Command this->SetSyntax(_("[\037channel\037] [\037list\037 | NEW]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string param = !params.empty() ? params[0] : "", chan; @@ -75,7 +75,7 @@ class CommandMSList : public Command { } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > mi->memos->size()) return; @@ -135,7 +135,7 @@ class CommandMSList : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp index 9ba49684d..7f0cba722 100644 --- a/modules/commands/ms_read.cpp +++ b/modules/commands/ms_read.cpp @@ -65,7 +65,7 @@ class MemoListCallback : public NumberList source.Reply(_("No memos to display.")); } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > mi->memos->size()) return; @@ -113,7 +113,7 @@ class CommandMSRead : public Command this->SetSyntax(_("[\037channel\037] {\037num\037 | \037list\037 | LAST | NEW | ALL}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { MemoInfo *mi; @@ -192,7 +192,7 @@ class CommandMSRead : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp index 68b7bebc5..eaeea00bd 100644 --- a/modules/commands/ms_rsend.cpp +++ b/modules/commands/ms_rsend.cpp @@ -25,7 +25,7 @@ class CommandMSRSend : public Command this->SetSyntax(_("{\037nick\037 | \037channel\037} \037memo-text\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!memoserv) return; @@ -73,7 +73,7 @@ class CommandMSRSend : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp index 83e8494f4..0e20af065 100644 --- a/modules/commands/ms_send.cpp +++ b/modules/commands/ms_send.cpp @@ -25,7 +25,7 @@ class CommandMSSend : public Command this->SetSyntax(_("{\037nick\037 | \037channel\037} \037memo-text\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!memoserv) return; @@ -59,7 +59,7 @@ class CommandMSSend : public Command source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp index a5b575321..efe9c7689 100644 --- a/modules/commands/ms_sendall.cpp +++ b/modules/commands/ms_sendall.cpp @@ -25,7 +25,7 @@ class CommandMSSendAll : public Command this->SetSyntax(_("\037memo-text\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!memoserv) return; @@ -45,7 +45,7 @@ class CommandMSSendAll : public Command source.Reply(_("A massmemo has been sent to all registered users.")); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp index 1c020817f..56a8da09a 100644 --- a/modules/commands/ms_set.cpp +++ b/modules/commands/ms_set.cpp @@ -207,7 +207,7 @@ class CommandMSSet : public Command this->SetSyntax(_("\037option\037 \037parameters\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; MemoInfo *mi = &source.nc->memos; @@ -226,7 +226,7 @@ class CommandMSSet : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (subcommand.empty()) { diff --git a/modules/commands/ms_staff.cpp b/modules/commands/ms_staff.cpp index bdf504ba3..774971c69 100644 --- a/modules/commands/ms_staff.cpp +++ b/modules/commands/ms_staff.cpp @@ -25,7 +25,7 @@ class CommandMSStaff : public Command this->SetSyntax(_("\037memo-text\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!memoserv) return; @@ -41,7 +41,7 @@ class CommandMSStaff : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp index c04e359a4..743616d9f 100644 --- a/modules/commands/ns_access.cpp +++ b/modules/commands/ns_access.cpp @@ -104,7 +104,7 @@ class CommandNSAccess : public Command this->SetSyntax(_("LIST [\037nickname\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; Anope::string nick, mask; @@ -159,7 +159,7 @@ class CommandNSAccess : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -196,7 +196,7 @@ class NSAccess : public Module { } - void OnNickRegister(User *u, NickAlias *na, const Anope::string &) anope_override + void OnNickRegister(User *u, NickAlias *na, const Anope::string &) override { if (u && Config->GetModule(this)->Get<bool>("addaccessonreg")) na->nc->AddAccess(u->Mask()); diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp index 4f4c75e1a..1f48dfb68 100644 --- a/modules/commands/ns_ajoin.cpp +++ b/modules/commands/ns_ajoin.cpp @@ -38,7 +38,7 @@ struct AJoinEntry : Serializable } } - void Serialize(Serialize::Data &sd) const anope_override + void Serialize(Serialize::Data &sd) const override { if (!this->owner) return; @@ -233,7 +233,7 @@ class CommandNSAJoin : public Command this->SetSyntax(_("LIST [\037nickname\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; Anope::string nick, param, param2; @@ -285,7 +285,7 @@ class CommandNSAJoin : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -314,7 +314,7 @@ class NSAJoin : public Module } - void OnUserLogin(User *u) anope_override + void OnUserLogin(User *u) override { BotInfo *NickServ = Config->GetClient("NickServ"); if (!NickServ) @@ -356,7 +356,7 @@ class NSAJoin : public Module continue; else if (c->HasMode("ADMINONLY") && !u->HasMode("ADMIN")) continue; - else if (c->HasMode("SSL") && !(u->HasMode("SSL") || u->HasExt("ssl"))) + else if (c->HasMode("SSL") && !u->IsSecurelyConnected()) continue; else if (c->MatchesList(u, "BAN") == true && c->MatchesList(u, "EXCEPT") == false) need_invite = true; diff --git a/modules/commands/ns_alist.cpp b/modules/commands/ns_alist.cpp index 35c4d5579..c6e485d2c 100644 --- a/modules/commands/ns_alist.cpp +++ b/modules/commands/ns_alist.cpp @@ -25,7 +25,7 @@ class CommandNSAList : public Command this->SetSyntax(_("[\037nickname\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string nick = source.GetNick(); NickCore *nc = source.nc; @@ -120,7 +120,7 @@ class CommandNSAList : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index fec857109..328216de6 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -18,7 +18,7 @@ struct CertServiceImpl : CertService { CertServiceImpl(Module *o) : CertService(o) { } - NickCore* FindAccountFromCert(const Anope::string &cert) anope_override + NickCore* FindAccountFromCert(const Anope::string &cert) override { Anope::hash_map<NickCore *>::iterator it = certmap.find(cert); if (it != certmap.end()) @@ -46,7 +46,7 @@ struct NSCertListImpl : NSCertList * * Adds a new entry into the cert list. */ - void AddCert(const Anope::string &entry) anope_override + void AddCert(const Anope::string &entry) override { this->certs.push_back(entry); certmap[entry] = nc; @@ -60,14 +60,14 @@ struct NSCertListImpl : NSCertList * * Retrieves an entry from the certificate list corresponding to the given index. */ - Anope::string GetCert(unsigned entry) const anope_override + Anope::string GetCert(unsigned entry) const override { if (entry >= this->certs.size()) return ""; return this->certs[entry]; } - unsigned GetCertCount() const anope_override + unsigned GetCertCount() const override { return this->certs.size(); } @@ -79,7 +79,7 @@ struct NSCertListImpl : NSCertList * * Search for an fingerprint within the cert list. */ - bool FindCert(const Anope::string &entry) const anope_override + bool FindCert(const Anope::string &entry) const override { return std::find(this->certs.begin(), this->certs.end(), entry) != this->certs.end(); } @@ -90,7 +90,7 @@ struct NSCertListImpl : NSCertList * * Removes the specified fingerprint from the cert list. */ - void EraseCert(const Anope::string &entry) anope_override + void EraseCert(const Anope::string &entry) override { std::vector<Anope::string>::iterator it = std::find(this->certs.begin(), this->certs.end(), entry); if (it != this->certs.end()) @@ -105,7 +105,7 @@ struct NSCertListImpl : NSCertList * * Deletes all the memory allocated in the certificate list vector and then clears the vector. */ - void ClearCert() anope_override + void ClearCert() override { FOREACH_MOD(OnNickClearCert, (this->nc)); for (unsigned i = 0; i < certs.size(); ++i) @@ -113,7 +113,7 @@ struct NSCertListImpl : NSCertList this->certs.clear(); } - void Check() anope_override + void Check() override { if (this->certs.empty()) nc->Shrink<NSCertList>("certificates"); @@ -123,7 +123,7 @@ struct NSCertListImpl : NSCertList { ExtensibleItem(Module *m, const Anope::string &ename) : ::ExtensibleItem<NSCertListImpl>(m, ename) { } - void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override + void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override { if (s->GetSerializableType()->GetName() != "NickCore") return; @@ -137,7 +137,7 @@ struct NSCertListImpl : NSCertList data["cert"] << c->GetCert(i) << " "; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { if (s->GetSerializableType()->GetName() != "NickCore") return; @@ -260,7 +260,7 @@ class CommandNSCert : public Command this->SetSyntax(_("LIST [\037nickname\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; Anope::string nick, certfp; @@ -312,7 +312,7 @@ class CommandNSCert : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -352,7 +352,7 @@ class NSCert : public Module throw ModuleException("Your IRCd does not support ssl client certificates"); } - void OnFingerprint(User *u) anope_override + void OnFingerprint(User *u) override { BotInfo *NickServ = Config->GetClient("NickServ"); if (!NickServ || u->IsIdentified()) @@ -379,7 +379,7 @@ class NSCert : public Module Log(NickServ) << u->GetMask() << " automatically identified for account " << nc->display << " via SSL certificate fingerprint"; } - EventReturn OnNickValidate(User *u, NickAlias *na) anope_override + EventReturn OnNickValidate(User *u, NickAlias *na) override { NSCertList *cl = certs.Get(na->nc); if (!u->fingerprint.empty() && cl && cl->FindCert(u->fingerprint)) diff --git a/modules/commands/ns_drop.cpp b/modules/commands/ns_drop.cpp index cb71d973d..4ee558ba0 100644 --- a/modules/commands/ns_drop.cpp +++ b/modules/commands/ns_drop.cpp @@ -20,7 +20,7 @@ class CommandNSDrop : public Command this->SetDesc(_("Cancel the registration of a nickname")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params[0]; @@ -54,7 +54,7 @@ class CommandNSDrop : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_getemail.cpp b/modules/commands/ns_getemail.cpp index 23f9561f2..85e977d6d 100644 --- a/modules/commands/ns_getemail.cpp +++ b/modules/commands/ns_getemail.cpp @@ -24,7 +24,7 @@ class CommandNSGetEMail : public Command this->SetSyntax(_("\037email\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &email = params[0]; int j = 0; @@ -51,7 +51,7 @@ class CommandNSGetEMail : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_getpass.cpp b/modules/commands/ns_getpass.cpp deleted file mode 100644 index 48db02853..000000000 --- a/modules/commands/ns_getpass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* NickServ core functions - * - * (C) 2003-2021 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "module.h" - -class CommandNSGetPass : public Command -{ - public: - CommandNSGetPass(Module *creator) : Command(creator, "nickserv/getpass", 1, 1) - { - this->SetDesc(_("Retrieve the password for a nickname")); - this->SetSyntax(_("\037nickname\037")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - const Anope::string &nick = params[0]; - Anope::string tmp_pass; - const NickAlias *na; - - if (!(na = NickAlias::Find(nick))) - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); - else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper()) - source.Reply(_("You may not get the password of other Services Operators.")); - else - { - if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) - { - Log(LOG_ADMIN, source, this) << "for " << nick; - source.Reply(_("Password for %s is \002%s\002."), nick.c_str(), tmp_pass.c_str()); - } - else - source.Reply(_("GETPASS command unavailable because encryption is in use.")); - } - return; - } - - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override - { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Returns the password for the given nickname. \002Note\002 that\n" - "whenever this command is used, a message including the\n" - "person who issued the command and the nickname it was used\n" - "on will be logged and sent out as a WALLOPS/GLOBOPS.")); - return true; - } -}; - -class NSGetPass : public Module -{ - CommandNSGetPass commandnsgetpass; - - public: - NSGetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - commandnsgetpass(this) - { - - Anope::string tmp_pass = "plain:tmp"; - if (!Anope::Decrypt(tmp_pass, tmp_pass)) - throw ModuleException("Incompatible with the encryption module being used"); - - } -}; - -MODULE_INIT(NSGetPass) diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index aa2865776..bd26f5a36 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -22,7 +22,7 @@ class NSGroupRequest : public IdentifyRequest public: NSGroupRequest(Module *o, CommandSource &src, Command *c, const Anope::string &n, NickAlias *targ, const Anope::string &pass) : IdentifyRequest(o, targ->nc->display, pass), source(src), cmd(c), nick(n), target(targ) { } - void OnSuccess() anope_override + void OnSuccess() override { User *u = source.GetUser(); @@ -67,7 +67,7 @@ class NSGroupRequest : public IdentifyRequest u->lastnickreg = Anope::CurTime; } - void OnFail() anope_override + void OnFail() override { User *u = source.GetUser(); @@ -93,7 +93,7 @@ class CommandNSGroup : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *user = source.GetUser(); @@ -194,7 +194,7 @@ class CommandNSGroup : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -237,7 +237,7 @@ class CommandNSUngroup : public Command this->SetSyntax(_("[\037nick\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string nick = !params.empty() ? params[0] : ""; NickAlias *na = NickAlias::Find(!nick.empty() ? nick : source.GetNick()); @@ -278,7 +278,7 @@ class CommandNSUngroup : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -299,7 +299,7 @@ class CommandNSGList : public Command this->SetDesc(_("Lists all nicknames in your group")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = !params.empty() ? params[0] : ""; const NickCore *nc; @@ -325,7 +325,7 @@ class CommandNSGList : public Command ListFormatter list(source.GetAccount()); list.AddColumn(_("Nick")).AddColumn(_("Expires")); - time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "21d"), + time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "90d"), unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d"); for (unsigned i = 0; i < nc->aliases->size(); ++i) { @@ -357,7 +357,7 @@ class CommandNSGList : public Command source.Reply(_("%d nickname(s) in the group."), nc->aliases->size()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (source.IsServicesOper()) source.Reply(_("Syntax: \002%s [\037nickname\037]\002\n" diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp index b0adf6388..61da680fa 100644 --- a/modules/commands/ns_identify.cpp +++ b/modules/commands/ns_identify.cpp @@ -19,7 +19,7 @@ class NSIdentifyRequest : public IdentifyRequest public: NSIdentifyRequest(Module *o, CommandSource &s, Command *c, const Anope::string &acc, const Anope::string &pass) : IdentifyRequest(o, acc, pass), source(s), cmd(c) { } - void OnSuccess() anope_override + void OnSuccess() override { if (!source.GetUser()) return; @@ -40,7 +40,7 @@ class NSIdentifyRequest : public IdentifyRequest } } - void OnFail() anope_override + void OnFail() override { if (source.GetUser()) { @@ -68,7 +68,7 @@ class CommandNSIdentify : public Command this->RequireUser(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *u = source.GetUser(); @@ -100,7 +100,7 @@ class CommandNSIdentify : public Command req->Dispatch(); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp index 018872b7d..a4ea5a3c1 100644 --- a/modules/commands/ns_info.cpp +++ b/modules/commands/ns_info.cpp @@ -21,7 +21,7 @@ class CommandNSInfo : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params.size() ? params[0] : (source.nc ? source.nc->display : source.GetNick()); @@ -119,7 +119,7 @@ class CommandNSInfo : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -212,12 +212,12 @@ class CommandNSSetHide : public Command this->OnSyntaxError(source, "HIDE"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -240,13 +240,13 @@ class CommandNSSASetHide : public CommandNSSetHide this->SetSyntax(_("\037nickname\037 {EMAIL | STATUS | USERMASK | QUIT} {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->ClearSyntax(); this->Run(source, params[0], params[1], params[2]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_list.cpp b/modules/commands/ns_list.cpp index e08b217f9..407d15d8e 100644 --- a/modules/commands/ns_list.cpp +++ b/modules/commands/ns_list.cpp @@ -20,7 +20,7 @@ class CommandNSList : public Command this->SetSyntax(_("\037pattern\037 [SUSPENDED] [NOEXPIRE] [UNCONFIRMED]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string pattern = params[0]; @@ -132,7 +132,7 @@ class CommandNSList : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -224,12 +224,12 @@ class CommandNSSetPrivate : public Command this->OnSyntaxError(source, "PRIVATE"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -252,12 +252,12 @@ class CommandNSSASetPrivate : public CommandNSSetPrivate this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -288,7 +288,7 @@ class NSList : public Module { } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_all) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_all) override { if (!show_all) return; diff --git a/modules/commands/ns_logout.cpp b/modules/commands/ns_logout.cpp index f9a0f2d03..dc441cfec 100644 --- a/modules/commands/ns_logout.cpp +++ b/modules/commands/ns_logout.cpp @@ -22,7 +22,7 @@ class CommandNSLogout : public Command this->SetSyntax(_("[\037nickname\037 [REVALIDATE]]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = !params.empty() ? params[0] : ""; @@ -59,7 +59,7 @@ class CommandNSLogout : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp index aa4f0de94..e6600506f 100644 --- a/modules/commands/ns_recover.cpp +++ b/modules/commands/ns_recover.cpp @@ -32,7 +32,7 @@ class NSRecoverRequest : public IdentifyRequest public: NSRecoverRequest(Module *o, CommandSource &src, Command *c, const Anope::string &nick, const Anope::string &pass) : IdentifyRequest(o, nick, pass), source(src), cmd(c), user(nick) { } - void OnSuccess() anope_override + void OnSuccess() override { User *u = User::Find(user, true); if (!source.GetUser() || !source.service) @@ -124,7 +124,7 @@ class NSRecoverRequest : public IdentifyRequest } } - void OnFail() anope_override + void OnFail() override { if (NickAlias::Find(GetAccount()) != NULL) { @@ -151,7 +151,7 @@ class CommandNSRecover : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params[0]; const Anope::string &pass = params.size() > 1 ? params[1] : ""; @@ -207,7 +207,7 @@ class CommandNSRecover : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -237,7 +237,7 @@ class NSRecover : public Module } - void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override + void OnUserNickChange(User *u, const Anope::string &oldnick) override { if (Config->GetModule(this)->Get<bool>("restoreonrecover")) { @@ -272,7 +272,7 @@ class NSRecover : public Module } } - void OnJoinChannel(User *u, Channel *c) anope_override + void OnJoinChannel(User *u, Channel *c) override { if (Config->GetModule(this)->Get<bool>("restoreonrecover")) { diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 4ff4cca44..2e9f08aeb 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -23,7 +23,7 @@ class CommandNSConfirm : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &passcode = params[0]; @@ -88,7 +88,7 @@ class CommandNSConfirm : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -106,7 +106,7 @@ class CommandNSConfirm : public Command return true; } - void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) anope_override + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) override { source.Reply(NICK_CONFIRM_INVALID); } @@ -125,7 +125,7 @@ class CommandNSRegister : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *u = source.GetUser(); Anope::string u_nick = source.GetNick(); @@ -192,7 +192,8 @@ class CommandNSRegister : public Command } } - unsigned int passlen = Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"); + unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "8"); + unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "32"); if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty()) this->OnSyntaxError(source, ""); @@ -200,10 +201,12 @@ class CommandNSRegister : public Command source.Reply(_("Please wait %d seconds before using the REGISTER command again."), (u->lastnickreg + reg_delay) - Anope::CurTime); else if (NickAlias::Find(u_nick) != NULL) source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str()); - else if (pass.equals_ci(u_nick) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && pass.length() < 5)) + else if (pass.equals_ci(u_nick)) source.Reply(MORE_OBSCURE_PASSWORD); - else if (pass.length() > passlen) - source.Reply(PASSWORD_TOO_LONG, passlen); + else if (pass.length() < minpasslen) + source.Reply(PASSWORD_TOO_SHORT, minpasslen); + else if (pass.length() > maxpasslen) + source.Reply(PASSWORD_TOO_LONG, maxpasslen); else if (!email.empty() && !Mail::Validate(email)) source.Reply(MAIL_X_INVALID, email.c_str()); else @@ -229,10 +232,6 @@ class CommandNSRegister : public Command else source.Reply(_("Nickname \002%s\002 registered."), u_nick.c_str()); - Anope::string tmp_pass; - if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) - source.Reply(_("Your password is \002%s\002 - remember this for later use."), tmp_pass.c_str()); - if (nsregister.equals_ci("admin")) { nc->Extend<bool>("UNCONFIRMED"); @@ -264,7 +263,7 @@ class CommandNSRegister : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -314,7 +313,7 @@ class CommandNSResend : public Command this->SetDesc(_("Resend registration confirmation email")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) { @@ -345,7 +344,7 @@ class CommandNSResend : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) return false; @@ -356,7 +355,7 @@ class CommandNSResend : public Command return true; } - void OnServHelp(CommandSource &source) anope_override + void OnServHelp(CommandSource &source) override { if (Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) Command::OnServHelp(source); @@ -381,7 +380,7 @@ class NSRegister : public Module throw ModuleException("Module " + this->name + " will not load with registration disabled."); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { BotInfo *NickServ; if (unconfirmed.HasExt(u->Account()) && (NickServ = Config->GetClient("NickServ"))) @@ -399,7 +398,7 @@ class NSRegister : public Module } } - void OnPreNickExpire(NickAlias *na, bool &expire) anope_override + void OnPreNickExpire(NickAlias *na, bool &expire) override { if (unconfirmed.HasExt(na->nc)) { diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index f6cd211fa..6ca5e55fb 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -23,7 +23,7 @@ class CommandNSResetPass : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const NickAlias *na; @@ -43,7 +43,7 @@ class CommandNSResetPass : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -73,7 +73,7 @@ class NSResetPass : public Module throw ModuleException("Not using mail."); } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (command->name == "nickserv/confirm" && params.size() > 1) { diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index d2ff6dece..e96a0e06c 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -20,13 +20,13 @@ class CommandNSSet : public Command this->SetSyntax(_("\037option\037 \037parameters\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->OnSyntaxError(source, ""); return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -75,13 +75,13 @@ class CommandNSSASet : public Command this->SetSyntax(_("\037option\037 \037nickname\037 \037parameters\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->OnSyntaxError(source, ""); return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -120,7 +120,7 @@ class CommandNSSetPassword : public Command this->SetSyntax(_("\037new-password\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string ¶m = params[0]; unsigned len = param.length(); @@ -131,30 +131,33 @@ class CommandNSSetPassword : public Command return; } - if (source.GetNick().equals_ci(param) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5)) + if (source.GetNick().equals_ci(param)) { source.Reply(MORE_OBSCURE_PASSWORD); return; } - unsigned int passlen = Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"); - if (len > passlen) + unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "8"); + if (len < minpasslen) { - source.Reply(PASSWORD_TOO_LONG, passlen); + source.Reply(PASSWORD_TOO_SHORT, minpasslen); + return; + } + + unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "32"); + if (len > maxpasslen) + { + source.Reply(PASSWORD_TOO_LONG, maxpasslen); return; } Log(LOG_COMMAND, source, this) << "to change their password"; Anope::Encrypt(param, source.nc->pass); - Anope::string tmp_pass; - if (Anope::Decrypt(source.nc->pass, tmp_pass) == 1) - source.Reply(_("Password for \002%s\002 changed to \002%s\002."), source.nc->display.c_str(), tmp_pass.c_str()); - else - source.Reply(_("Password for \002%s\002 changed."), source.nc->display.c_str()); + source.Reply(_("Password for \002%s\002 changed."), source.nc->display.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -173,7 +176,7 @@ class CommandNSSASetPassword : public Command this->SetSyntax(_("\037nickname\037 \037new-password\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -197,16 +200,23 @@ class CommandNSSASetPassword : public Command return; } - if (nc->display.equals_ci(params[1]) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5)) + if (nc->display.equals_ci(params[1])) { source.Reply(MORE_OBSCURE_PASSWORD); return; } - unsigned int passlen = Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"); - if (len > passlen) + unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "8"); + if (len < minpasslen) { - source.Reply(PASSWORD_TOO_LONG, passlen); + source.Reply(PASSWORD_TOO_SHORT, minpasslen); + return; + } + + unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "32"); + if (len > maxpasslen) + { + source.Reply(PASSWORD_TOO_LONG, maxpasslen); return; } @@ -214,13 +224,10 @@ class CommandNSSASetPassword : public Command Anope::Encrypt(params[1], nc->pass); Anope::string tmp_pass; - if (Anope::Decrypt(nc->pass, tmp_pass) == 1) - source.Reply(_("Password for \002%s\002 changed to \002%s\002."), nc->display.c_str(), tmp_pass.c_str()); - else - source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str()); + source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -275,12 +282,12 @@ class CommandNSSetAutoOp : public Command this->OnSyntaxError(source, "AUTOOP"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { BotInfo *bi = Config->GetClient("ChanServ"); this->SendSyntax(source); @@ -302,12 +309,12 @@ class CommandNSSASetAutoOp : public CommandNSSetAutoOp this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { BotInfo *bi = Config->GetClient("ChanServ"); this->SendSyntax(source); @@ -375,12 +382,12 @@ class CommandNSSetDisplay : public Command source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str()); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -399,12 +406,12 @@ class CommandNSSASetDisplay : public CommandNSSetDisplay this->SetSyntax(_("\037nickname\037 \037new-display\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -521,12 +528,12 @@ class CommandNSSetEmail : public Command } } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params.size() ? params[0] : ""); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -546,12 +553,12 @@ class CommandNSSASetEmail : public CommandNSSetEmail this->SetSyntax(_("\037nickname\037 \037address\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params.size() > 1 ? params[1] : ""); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -606,12 +613,12 @@ class CommandNSSetKeepModes : public Command this->OnSyntaxError(source, ""); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -631,12 +638,12 @@ class CommandNSSASetKeepModes : public CommandNSSetKeepModes this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -726,12 +733,12 @@ class CommandNSSetKill : public Command return; } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -760,12 +767,12 @@ class CommandNSSASetKill : public CommandNSSetKill this->SetSyntax(_("\037nickname\037 {ON | QUICK | IMMED | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -836,12 +843,12 @@ class CommandNSSetLanguage : public Command source.Reply(_("Language for \002%s\002 changed to \002%s\002."), nc->display.c_str(), Language::Translate(param.c_str(), _("English"))); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶m) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶m) override { this->Run(source, source.nc->display, param[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -872,12 +879,12 @@ class CommandNSSASetLanguage : public CommandNSSetLanguage this->SetSyntax(_("\037nickname\037 \037language\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -949,12 +956,12 @@ class CommandNSSetMessage : public Command this->OnSyntaxError(source, "MSG"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { Anope::string cmd = source.command; size_t i = cmd.find_last_of(' '); @@ -969,7 +976,7 @@ class CommandNSSetMessage : public Command return true; } - void OnServHelp(CommandSource &source) anope_override + void OnServHelp(CommandSource &source) override { if (Config->GetBlock("options")->Get<bool>("useprivmsg")) Command::OnServHelp(source); @@ -985,7 +992,7 @@ class CommandNSSASetMessage : public CommandNSSetMessage this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -995,7 +1002,7 @@ class CommandNSSASetMessage : public CommandNSSetMessage return true; } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } @@ -1047,12 +1054,12 @@ class CommandNSSetSecure : public Command this->OnSyntaxError(source, "SECURE"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -1076,12 +1083,12 @@ class CommandNSSASetSecure : public CommandNSSetSecure this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -1105,7 +1112,7 @@ class CommandNSSASetNoexpire : public Command this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { @@ -1138,7 +1145,7 @@ class CommandNSSASetNoexpire : public Command this->OnSyntaxError(source, "NOEXPIRE"); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -1189,7 +1196,7 @@ class NSSet : public Module { KeepModes(Module *m, const Anope::string &n) : SerializableExtensibleItem<bool>(m, n) { } - void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override + void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override { SerializableExtensibleItem<bool>::ExtensibleSerialize(e, s, data); @@ -1209,7 +1216,7 @@ class NSSet : public Module data["last_modes"] << modes; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { SerializableExtensibleItem<bool>::ExtensibleUnserialize(e, s, data); @@ -1258,7 +1265,7 @@ class NSSet : public Module } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { NickCore *uac = source.nc; @@ -1281,7 +1288,7 @@ class NSSet : public Module return EVENT_CONTINUE; } - void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override + void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) override { if (chan->ci) { @@ -1290,13 +1297,13 @@ class NSSet : public Module } } - void OnPreNickExpire(NickAlias *na, bool &expire) anope_override + void OnPreNickExpire(NickAlias *na, bool &expire) override { if (noexpire.HasExt(na)) expire = false; } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { if (!show_hidden) return; @@ -1319,19 +1326,19 @@ class NSSet : public Module info.AddOption(_("Keep modes")); } - void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override { if (u->Account() && setter.GetUser() == u) u->Account()->last_modes = u->GetModeList(); } - void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override + void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override { if (u->Account() && setter.GetUser() == u) u->Account()->last_modes = u->GetModeList(); } - void OnUserLogin(User *u) anope_override + void OnUserLogin(User *u) override { if (keep_modes.HasExt(u->Account())) { diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index a67b6c793..cec4e2e35 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -42,7 +42,7 @@ struct NSMiscData : MiscData, Serializable data = d; } - void Serialize(Serialize::Data &sdata) const anope_override + void Serialize(Serialize::Data &sdata) const override { sdata["nc"] << this->object; sdata["name"] << this->name; @@ -135,12 +135,12 @@ class CommandNSSetMisc : public Command } } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, !params.empty() ? params[0] : ""); } - void OnServHelp(CommandSource &source) anope_override + void OnServHelp(CommandSource &source) override { if (descriptions.count(source.command)) { @@ -149,7 +149,7 @@ class CommandNSSetMisc : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (descriptions.count(source.command)) { @@ -170,7 +170,7 @@ class CommandNSSASetMisc : public CommandNSSetMisc this->SetSyntax(_("\037nickname\037 [\037parameter\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params.size() > 1 ? params[1] : ""); } @@ -195,7 +195,7 @@ class NSSetMisc : public Module delete it->second; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { descriptions.clear(); @@ -218,7 +218,7 @@ class NSSetMisc : public Module } } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool) override { for (Anope::map<ExtensibleItem<NSMiscData> *>::iterator it = items.begin(); it != items.end(); ++it) { diff --git a/modules/commands/ns_status.cpp b/modules/commands/ns_status.cpp index a64932cca..a819c0013 100644 --- a/modules/commands/ns_status.cpp +++ b/modules/commands/ns_status.cpp @@ -21,7 +21,7 @@ class CommandNSStatus : public Command this->AllowUnregistered(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = !params.empty() ? params[0] : source.GetNick(); const NickAlias *na = NickAlias::Find(nick); @@ -48,7 +48,7 @@ class CommandNSStatus : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp index 99a9c03a3..f8d03d7c3 100644 --- a/modules/commands/ns_suspend.cpp +++ b/modules/commands/ns_suspend.cpp @@ -18,7 +18,7 @@ struct NSSuspendInfo : SuspendInfo, Serializable { NSSuspendInfo(Extensible *) : Serializable("NSSuspendInfo") { } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["nick"] << what; data["by"] << by; @@ -61,7 +61,7 @@ class CommandNSSuspend : public Command this->SetSyntax(_("\037nickname\037 [+\037expiry\037] [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params[0]; @@ -140,7 +140,7 @@ class CommandNSSuspend : public Command FOREACH_MOD(OnNickSuspend, (na)); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -161,7 +161,7 @@ class CommandNSUnSuspend : public Command this->SetSyntax(_("\037nickname\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params[0]; @@ -192,7 +192,7 @@ class CommandNSUnSuspend : public Command FOREACH_MOD(OnNickUnsuspended, (na)); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -229,14 +229,14 @@ class NSSuspend : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Anope::string s = conf->GetModule(this)->Get<Anope::string>("show"); commasepstream(s).GetTokens(show); std::transform(show.begin(), show.end(), show.begin(), trim()); } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { NSSuspendInfo *s = suspend.Get(na->nc); if (!s) @@ -254,7 +254,7 @@ class NSSuspend : public Module info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount()); } - void OnPreNickExpire(NickAlias *na, bool &expire) anope_override + void OnPreNickExpire(NickAlias *na, bool &expire) override { NSSuspendInfo *s = suspend.Get(na->nc); if (!s) @@ -274,7 +274,7 @@ class NSSuspend : public Module } } - EventReturn OnNickValidate(User *u, NickAlias *na) anope_override + EventReturn OnNickValidate(User *u, NickAlias *na) override { NSSuspendInfo *s = suspend.Get(na->nc); if (!s) diff --git a/modules/commands/ns_update.cpp b/modules/commands/ns_update.cpp index dbad339cd..ba16dd0ce 100644 --- a/modules/commands/ns_update.cpp +++ b/modules/commands/ns_update.cpp @@ -20,7 +20,7 @@ class CommandNSUpdate : public Command this->RequireUser(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *u = source.GetUser(); NickAlias *na = NickAlias::Find(u->nick); @@ -36,7 +36,7 @@ class CommandNSUpdate : public Command source.Reply(_("Status updated (memos, vhost, chmodes, flags).")); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index e5e22220e..8c82cb55c 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -16,10 +16,10 @@ static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sglin class AkillDelCallback : public NumberList { CommandSource &source; - unsigned deleted; + unsigned deleted = 0; Command *cmd; public: - AkillDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), deleted(0), cmd(c) + AkillDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), cmd(c) { } @@ -33,7 +33,7 @@ class AkillDelCallback : public NumberList source.Reply(_("Deleted %d entries from the AKILL list."), deleted); } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number) return; @@ -271,7 +271,7 @@ class CommandOSAKill : public Command { } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number) return; @@ -390,7 +390,7 @@ class CommandOSAKill : public Command this->SetSyntax("CLEAR"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; @@ -413,7 +413,7 @@ class CommandOSAKill : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_chankill.cpp b/modules/commands/os_chankill.cpp index 7795691aa..8c1457f38 100644 --- a/modules/commands/os_chankill.cpp +++ b/modules/commands/os_chankill.cpp @@ -22,7 +22,7 @@ class CommandOSChanKill : public Command this->SetSyntax(_("[+\037expiry\037] \037channel\037 \037reason\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!akills) return; @@ -93,7 +93,7 @@ class CommandOSChanKill : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_config.cpp b/modules/commands/os_config.cpp index 7d4f47f6a..2d3bbf268 100644 --- a/modules/commands/os_config.cpp +++ b/modules/commands/os_config.cpp @@ -20,7 +20,7 @@ class CommandOSConfig : public Command this->SetSyntax(_("{\037MODIFY\037|\037VIEW\037} [\037block name\037 \037item name\037 \037item value\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &what = params[0]; @@ -57,15 +57,12 @@ class CommandOSConfig : public Command for (unsigned i = 0; !show_blocks[i].empty(); ++i) { Configuration::Block *block = Config->GetBlock(show_blocks[i]); - const Configuration::Block::item_map *items = block->GetItems(); - - if (!items) - continue; + const Configuration::Block::item_map &items = block->GetItems(); ListFormatter lflist(source.GetAccount()); lflist.AddColumn(_("Name")).AddColumn(_("Value")); - for (Configuration::Block::item_map::const_iterator it = items->begin(), it_end = items->end(); it != it_end; ++it) + for (Configuration::Block::item_map::const_iterator it = items.begin(), it_end = items.end(); it != it_end; ++it) { ListFormatter::ListEntry entry; entry["Name"] = it->first; @@ -90,15 +87,15 @@ class CommandOSConfig : public Command for (int i = 0; i < Config->CountBlock("module"); ++i) { Configuration::Block *block = Config->GetBlock("module", i); - const Configuration::Block::item_map *items = block->GetItems(); + const Configuration::Block::item_map &items = block->GetItems(); - if (!items || items->size() <= 1) + if (items.size() <= 1) continue; ListFormatter::ListEntry entry; entry["Module Name"] = block->Get<Anope::string>("name"); - for (Configuration::Block::item_map::const_iterator it = items->begin(), it_end = items->end(); it != it_end; ++it) + for (Configuration::Block::item_map::const_iterator it = items.begin(), it_end = items.end(); it != it_end; ++it) { entry["Name"] = it->first; entry["Value"] = it->second; @@ -120,7 +117,7 @@ class CommandOSConfig : public Command this->OnSyntaxError(source, what); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 9ed2deb74..cebb979b4 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -120,7 +120,7 @@ class DefConTimeout : public Timer timeout = NULL; } - void Tick(time_t) anope_override + void Tick(time_t) override { if (DConfig.defaultlevel != level) { @@ -177,7 +177,7 @@ class CommandOSDefcon : public Command this->SetSyntax(_("[\0021\002|\0022\002|\0023\002|\0024\002|\0025\002]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &lvl = params[0]; @@ -233,7 +233,7 @@ class CommandOSDefcon : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -335,7 +335,7 @@ class OSDefcon : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); DefconConfig dconfig; @@ -406,7 +406,7 @@ class OSDefcon : public Module this->ParseModeString(); } - EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string ¶m) override { if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && DConfig.DefConModesOff.count(mode->name) && source.GetUser() && !source.GetBot()) { @@ -418,7 +418,7 @@ class OSDefcon : public Module return EVENT_CONTINUE; } - EventReturn OnChannelModeUnset(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string &) anope_override + EventReturn OnChannelModeUnset(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string &) override { if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && DConfig.DefConModesOn.count(mode->name) && source.GetUser() && !source.GetBot()) { @@ -436,7 +436,7 @@ class OSDefcon : public Module return EVENT_CONTINUE; } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (DConfig.Check(DEFCON_OPER_ONLY) && !source.IsOper()) { @@ -483,7 +483,7 @@ class OSDefcon : public Module return EVENT_CONTINUE; } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (exempt || u->Quitting() || !u->server->IsSynced() || u->server->IsULined()) return; @@ -535,13 +535,13 @@ class OSDefcon : public Module } } - void OnChannelModeAdd(ChannelMode *cm) anope_override + void OnChannelModeAdd(ChannelMode *cm) override { if (DConfig.chanmodes.find(cm->mchar) != Anope::string::npos) this->ParseModeString(); } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { if (DConfig.Check(DEFCON_FORCE_CHAN_MODES)) c->SetModes(Config->GetClient("OperServ"), false, "%s", DConfig.chanmodes.c_str()); diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index d46e5d972..1a3189d6b 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -36,7 +36,7 @@ struct DNSZone : Serializable zones->erase(it); } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["name"] << name; unsigned count = 0; @@ -89,17 +89,17 @@ class DNSServer : public Serializable { Anope::string server_name; std::vector<Anope::string> ips; - unsigned limit; + unsigned limit = 0; /* wants to be in the pool */ - bool pooled; + bool pooled = false; /* is actually in the pool */ - bool active; + bool active = false; public: std::set<Anope::string, ci::less> zones; - time_t repool; + time_t repool = 0; - DNSServer(const Anope::string &sn) : Serializable("DNSServer"), server_name(sn), limit(0), pooled(false), active(false), repool(0) + DNSServer(const Anope::string &sn) : Serializable("DNSServer"), server_name(sn) { dns_servers->push_back(this); } @@ -139,7 +139,7 @@ class DNSServer : public Serializable } } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["server_name"] << server_name; for (unsigned i = 0; i < ips.size(); ++i) @@ -669,7 +669,7 @@ class CommandOSDNS : public Command this->SetSyntax(_("DEPOOL \037server.name\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (params.empty()) this->DisplayPoolState(source); @@ -695,7 +695,7 @@ class CommandOSDNS : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -729,15 +729,12 @@ class ModuleDNS : public Module bool remove_split_servers; bool readd_connected_servers; - time_t last_warn; + time_t last_warn = 0; public: ModuleDNS(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), - zone_type("DNSZone", DNSZone::Unserialize), dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this), - last_warn(0) + zone_type("DNSZone", DNSZone::Unserialize), dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this) { - - for (unsigned j = 0; j < dns_servers->size(); ++j) { DNSServer *s = dns_servers->at(j); @@ -754,7 +751,7 @@ class ModuleDNS : public Module delete dns_servers->at(i - 1); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); this->ttl = block->Get<time_t>("ttl"); @@ -765,7 +762,7 @@ class ModuleDNS : public Module this->readd_connected_servers = block->Get<bool>("readd_connected_servers"); } - void OnNewServer(Server *s) anope_override + void OnNewServer(Server *s) override { if (s == Me || s->IsJuped()) return; @@ -780,7 +777,7 @@ class ModuleDNS : public Module } } - void OnServerQuit(Server *s) anope_override + void OnServerQuit(Server *s) override { DNSServer *dns = DNSServer::Find(s->GetName()); if (remove_split_servers && dns && dns->Pooled() && dns->Active()) @@ -793,7 +790,7 @@ class ModuleDNS : public Module } } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (!u->Quitting() && u->server) { @@ -807,7 +804,7 @@ class ModuleDNS : public Module } } - void OnPreUserLogoff(User *u) anope_override + void OnPreUserLogoff(User *u) override { if (u && u->server) { @@ -852,7 +849,7 @@ class ModuleDNS : public Module } } - void OnDnsRequest(DNS::Query &req, DNS::Query *packet) anope_override + void OnDnsRequest(DNS::Query &req, DNS::Query *packet) override { if (req.questions.empty()) return; diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 98182c5c6..a86ba79d8 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -17,7 +17,7 @@ static ServiceReference<NickServService> nickserv("NickServService", "NickServ") struct ForbidDataImpl : ForbidData, Serializable { ForbidDataImpl() : Serializable("ForbidData") { } - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; @@ -75,12 +75,12 @@ class MyForbidService : public ForbidService delete f[i]; } - void AddForbid(ForbidData *d) anope_override + void AddForbid(ForbidData *d) override { this->forbids(d->type).push_back(d); } - void RemoveForbid(ForbidData *d) anope_override + void RemoveForbid(ForbidData *d) override { std::vector<ForbidData *>::iterator it = std::find(this->forbids(d->type).begin(), this->forbids(d->type).end(), d); if (it != this->forbids(d->type).end()) @@ -88,12 +88,12 @@ class MyForbidService : public ForbidService delete d; } - ForbidData *CreateForbid() anope_override + ForbidData *CreateForbid() override { return new ForbidDataImpl(); } - ForbidData *FindForbid(const Anope::string &mask, ForbidType ftype) anope_override + ForbidData *FindForbid(const Anope::string &mask, ForbidType ftype) override { for (unsigned i = this->forbids(ftype).size(); i > 0; --i) { @@ -105,7 +105,7 @@ class MyForbidService : public ForbidService return NULL; } - ForbidData *FindForbidExact(const Anope::string &mask, ForbidType ftype) anope_override + ForbidData *FindForbidExact(const Anope::string &mask, ForbidType ftype) override { for (unsigned i = this->forbids(ftype).size(); i > 0; --i) { @@ -117,7 +117,7 @@ class MyForbidService : public ForbidService return NULL; } - std::vector<ForbidData *> GetForbids() anope_override + std::vector<ForbidData *> GetForbids() override { std::vector<ForbidData *> f; for (unsigned j = FT_NICK; j < FT_SIZE; ++j) @@ -159,7 +159,7 @@ class CommandOSForbid : public Command this->SetSyntax("LIST [NICK|CHAN|EMAIL|REGISTER]"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!this->fs) return; @@ -414,7 +414,7 @@ class CommandOSForbid : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -446,7 +446,7 @@ class OSForbid : public Module } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (u->Quitting() || exempt) return; @@ -454,7 +454,7 @@ class OSForbid : public Module this->OnUserNickChange(u, ""); } - void OnUserNickChange(User *u, const Anope::string &) anope_override + void OnUserNickChange(User *u, const Anope::string &) override { if (u->HasMode("OPER")) return; @@ -472,7 +472,7 @@ class OSForbid : public Module } } - EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override + EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override { BotInfo *OperServ = Config->GetClient("OperServ"); if (u->HasMode("OPER") || !OperServ) @@ -501,7 +501,7 @@ class OSForbid : public Module return EVENT_CONTINUE; } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (command->name == "nickserv/info" && params.size() > 0) { diff --git a/modules/commands/os_ignore.cpp b/modules/commands/os_ignore.cpp index 0887c92b6..0f993c851 100644 --- a/modules/commands/os_ignore.cpp +++ b/modules/commands/os_ignore.cpp @@ -16,7 +16,7 @@ struct IgnoreDataImpl : IgnoreData, Serializable { IgnoreDataImpl() : Serializable("IgnoreData") { } ~IgnoreDataImpl(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; @@ -64,19 +64,19 @@ class OSIgnoreService : public IgnoreService public: OSIgnoreService(Module *o) : IgnoreService(o), ignores("IgnoreData") { } - void AddIgnore(IgnoreData *ign) anope_override + void AddIgnore(IgnoreData *ign) override { ignores->push_back(ign); } - void DelIgnore(IgnoreData *ign) anope_override + void DelIgnore(IgnoreData *ign) override { std::vector<IgnoreData *>::iterator it = std::find(ignores->begin(), ignores->end(), ign); if (it != ignores->end()) ignores->erase(it); } - void ClearIgnores() anope_override + void ClearIgnores() override { for (unsigned i = ignores->size(); i > 0; --i) { @@ -85,12 +85,12 @@ class OSIgnoreService : public IgnoreService } } - IgnoreData *Create() anope_override + IgnoreData *Create() override { return new IgnoreDataImpl(); } - IgnoreData *Find(const Anope::string &mask) anope_override + IgnoreData *Find(const Anope::string &mask) override { User *u = User::Find(mask, true); std::vector<IgnoreData *>::iterator ign = this->ignores->begin(), ign_end = this->ignores->end(); @@ -148,7 +148,7 @@ class OSIgnoreService : public IgnoreService return NULL; } - std::vector<IgnoreData *> &GetIgnores() anope_override + std::vector<IgnoreData *> &GetIgnores() override { return *ignores; } @@ -345,7 +345,7 @@ class CommandOSIgnore : public Command this->SetSyntax("CLEAR"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; @@ -363,7 +363,7 @@ class CommandOSIgnore : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -404,7 +404,7 @@ class OSIgnore : public Module } - EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override { if (!u->HasMode("OPER") && this->osignoreservice.Find(u->nick)) return EVENT_STOP; diff --git a/modules/commands/os_info.cpp b/modules/commands/os_info.cpp index 50eba850c..652d51593 100644 --- a/modules/commands/os_info.cpp +++ b/modules/commands/os_info.cpp @@ -13,15 +13,15 @@ struct OperInfo : Serializable Anope::string target; Anope::string info; Anope::string adder; - time_t created; + time_t created = 0; - OperInfo() : Serializable("OperInfo"), created(0) { } + OperInfo() : Serializable("OperInfo") { } OperInfo(const Anope::string &t, const Anope::string &i, const Anope::string &a, time_t c) : Serializable("OperInfo"), target(t), info(i), adder(a), created(c) { } ~OperInfo(); - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["target"] << target; data["info"] << info; @@ -104,7 +104,7 @@ class CommandOSInfo : public Command this->SetSyntax(_("CLEAR \037target\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0], target = params[1], info = params.size() > 2 ? params[2] : ""; @@ -236,7 +236,7 @@ class CommandOSInfo : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -276,12 +276,12 @@ class OSInfo : public Module } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { OnInfo(source, na->nc, info); } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override { OnInfo(source, ci, info); } diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp index 760341389..03ee24424 100644 --- a/modules/commands/os_jupe.cpp +++ b/modules/commands/os_jupe.cpp @@ -20,7 +20,7 @@ class CommandOSJupe : public Command this->SetSyntax(_("\037server\037 [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &jserver = params[0]; const Anope::string &reason = params.size() > 1 ? params[1] : ""; @@ -49,7 +49,7 @@ class CommandOSJupe : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_kick.cpp b/modules/commands/os_kick.cpp index bcb8162bb..79dd0df8f 100644 --- a/modules/commands/os_kick.cpp +++ b/modules/commands/os_kick.cpp @@ -20,7 +20,7 @@ class CommandOSKick : public Command this->SetSyntax(_("\037channel\037 \037user\037 \037reason\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; const Anope::string &nick = params[1]; @@ -55,7 +55,7 @@ class CommandOSKick : public Command Log(LOG_ADMIN, source, this) << "on " << u2->nick << " in " << c->name << " (" << s << ")"; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_kill.cpp b/modules/commands/os_kill.cpp index b8b44dc61..91606d944 100644 --- a/modules/commands/os_kill.cpp +++ b/modules/commands/os_kill.cpp @@ -20,7 +20,7 @@ class CommandOSKill : public Command this->SetSyntax(_("\037user\037 [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params[0]; Anope::string reason = params.size() > 1 ? params[1] : ""; @@ -41,7 +41,7 @@ class CommandOSKill : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp index ec9d35cec..015cbebdc 100644 --- a/modules/commands/os_list.cpp +++ b/modules/commands/os_list.cpp @@ -20,7 +20,7 @@ class CommandOSChanList : public Command this->SetSyntax(_("[{\037pattern\037 | \037nick\037} [\037SECRET\037]]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &pattern = !params.empty() ? params[0] : ""; const Anope::string &opt = params.size() > 1 ? params[1] : ""; @@ -100,7 +100,7 @@ class CommandOSChanList : public Command source.Reply(_("End of channel list. \002%u\002 channels shown."), count); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -133,7 +133,7 @@ class CommandOSUserList : public Command this->SetSyntax(_("[{\037pattern\037 | \037channel\037} [\037INVISIBLE\037]]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &pattern = !params.empty() ? params[0] : ""; const Anope::string &opt = params.size() > 1 ? params[1] : ""; @@ -236,7 +236,7 @@ class CommandOSUserList : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp index 3b8f46f83..2d72cd01c 100644 --- a/modules/commands/os_login.cpp +++ b/modules/commands/os_login.cpp @@ -20,7 +20,7 @@ class CommandOSLogin : public Command this->RequireUser(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &password = params[0]; @@ -45,7 +45,7 @@ class CommandOSLogin : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -55,7 +55,7 @@ class CommandOSLogin : public Command return true; } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { return Anope::printf(Language::Translate(source.GetAccount(), _("Login to %s")), source.service->nick.c_str()); } @@ -69,7 +69,7 @@ class CommandOSLogout : public Command this->RequireUser(true); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { User *u = source.GetUser(); Oper *o = source.nc->o; @@ -87,7 +87,7 @@ class CommandOSLogout : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -97,7 +97,7 @@ class CommandOSLogout : public Command return true; } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { return Anope::printf(Language::Translate(source.GetAccount(), _("Logout from %s")), source.service->nick.c_str()); } @@ -116,7 +116,7 @@ class OSLogin : public Module } - EventReturn IsServicesOper(User *u) anope_override + EventReturn IsServicesOper(User *u) override { if (!u->Account()->o->password.empty()) { diff --git a/modules/commands/os_logsearch.cpp b/modules/commands/os_logsearch.cpp index fa958ad08..a4c4829a2 100644 --- a/modules/commands/os_logsearch.cpp +++ b/modules/commands/os_logsearch.cpp @@ -33,7 +33,7 @@ class CommandOSLogSearch : public Command this->SetSyntax(_("[+\037days\037d] [+\037limit\037l] \037pattern\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { int days = 7, replies = 50; @@ -152,7 +152,7 @@ class CommandOSLogSearch : public Command source.Reply(_("Showed %d/%d matches for \002%s\002."), matches.size(), found, search_string.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_mode.cpp b/modules/commands/os_mode.cpp index 2fa46e0ad..3ae3d2f50 100644 --- a/modules/commands/os_mode.cpp +++ b/modules/commands/os_mode.cpp @@ -21,7 +21,7 @@ class CommandOSMode : public Command this->SetSyntax(_("\037channel\037 CLEAR [ALL]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &target = params[0]; const Anope::string &modes = params[1]; @@ -126,7 +126,7 @@ class CommandOSMode : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -147,7 +147,7 @@ class CommandOSUMode : public Command this->SetSyntax(_("\037user\037 \037modes\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &target = params[0]; const Anope::string &modes = params[1]; @@ -166,7 +166,7 @@ class CommandOSUMode : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp index 9d7ac563b..85650cb2e 100644 --- a/modules/commands/os_modinfo.cpp +++ b/modules/commands/os_modinfo.cpp @@ -20,7 +20,7 @@ class CommandOSModInfo : public Command this->SetSyntax(_("\037modname\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &file = params[0]; @@ -63,7 +63,7 @@ class CommandOSModInfo : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -81,7 +81,7 @@ class CommandOSModList : public Command this->SetSyntax("[all|third|vendor|extra|database|encryption|pseudoclient|protocol]"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string ¶m = !params.empty() ? params[0] : ""; @@ -189,7 +189,7 @@ class CommandOSModList : public Command source.Reply(_("%d modules loaded."), count); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_module.cpp b/modules/commands/os_module.cpp index f2bd636a4..d878cd1a1 100644 --- a/modules/commands/os_module.cpp +++ b/modules/commands/os_module.cpp @@ -20,7 +20,7 @@ class CommandOSModLoad : public Command this->SetSyntax(_("\037modname\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &mname = params[0]; @@ -38,7 +38,7 @@ class CommandOSModLoad : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -57,7 +57,7 @@ class CommandOSModReLoad : public Command this->SetSyntax(_("\037modname\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &mname = params[0]; @@ -111,7 +111,7 @@ class CommandOSModReLoad : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -129,7 +129,7 @@ class CommandOSModUnLoad : public Command this->SetSyntax(_("\037modname\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &mname = params[0]; @@ -161,7 +161,7 @@ class CommandOSModUnLoad : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp index f199cdad5..6f8adb078 100644 --- a/modules/commands/os_news.cpp +++ b/modules/commands/os_news.cpp @@ -61,7 +61,7 @@ struct NewsMessages msgarray[] = { struct MyNewsItem : NewsItem { - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["type"] << this->type; data["text"] << this->text; @@ -106,17 +106,17 @@ class MyNewsService : public NewsService delete newsItems[i][j]; } - NewsItem *CreateNewsItem() anope_override + NewsItem *CreateNewsItem() override { return new MyNewsItem(); } - void AddNewsItem(NewsItem *n) anope_override + void AddNewsItem(NewsItem *n) override { this->newsItems[n->type].push_back(n); } - void DelNewsItem(NewsItem *n) anope_override + void DelNewsItem(NewsItem *n) override { std::vector<NewsItem *> &list = this->GetNewsList(n->type); std::vector<NewsItem *>::iterator it = std::find(list.begin(), list.end(), n); @@ -125,7 +125,7 @@ class MyNewsService : public NewsService delete n; } - std::vector<NewsItem *> &GetNewsList(NewsType t) anope_override + std::vector<NewsItem *> &GetNewsList(NewsType t) override { return this->newsItems[t]; } @@ -297,12 +297,12 @@ class CommandOSLogonNews : public NewsBase this->SetDesc(_("Define messages to be shown to users at logon")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { return this->DoNews(source, params, NEWS_LOGON); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -324,12 +324,12 @@ class CommandOSOperNews : public NewsBase this->SetDesc(_("Define messages to be shown to users who oper")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { return this->DoNews(source, params, NEWS_OPER); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -351,12 +351,12 @@ class CommandOSRandomNews : public NewsBase this->SetDesc(_("Define messages to be randomly shown to users at logon")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { return this->DoNews(source, params, NEWS_RANDOM); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -438,20 +438,20 @@ class OSNews : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { oper_announcer = conf->GetModule(this)->Get<const Anope::string>("oper_announcer", "OperServ"); announcer = conf->GetModule(this)->Get<const Anope::string>("announcer", "Global"); news_count = conf->GetModule(this)->Get<unsigned>("newscount", "3"); } - void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override { if (mname == "OPER") DisplayNews(u, NEWS_OPER); } - void OnUserConnect(User *user, bool &) anope_override + void OnUserConnect(User *user, bool &) override { if (user->Quitting() || !user->server->IsSynced()) return; diff --git a/modules/commands/os_noop.cpp b/modules/commands/os_noop.cpp index bff3fda8b..4a14a6528 100644 --- a/modules/commands/os_noop.cpp +++ b/modules/commands/os_noop.cpp @@ -21,7 +21,7 @@ class CommandOSNOOP : public Command this->SetSyntax(_("REVOKE \037server\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; const Anope::string &server = params[1]; @@ -61,7 +61,7 @@ class CommandOSNOOP : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -85,7 +85,7 @@ class OSNOOP : public Module } - void OnUserModeSet(const MessageSource &, User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &, User *u, const Anope::string &mname) override { Anope::string *setter; if (mname == "OPER" && (setter = noop.Get(u->server))) diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp deleted file mode 100644 index c40338b9f..000000000 --- a/modules/commands/os_oline.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* OperServ core functions - * - * (C) 2003-2021 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "module.h" - -class CommandOSOLine : public Command -{ - public: - CommandOSOLine(Module *creator) : Command(creator, "operserv/oline", 2, 2) - { - this->SetDesc(_("Give Operflags to a certain user")); - this->SetSyntax(_("\037nick\037 \037flags\037")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - const Anope::string &nick = params[0]; - const Anope::string &flag = params[1]; - User *u2 = NULL; - - /* let's check whether the user is online */ - if (!(u2 = User::Find(nick, true))) - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); - else if (u2 && flag[0] == '+') - { - IRCD->SendSVSO(source.service, nick, flag); - u2->SetMode(source.service, "OPER"); - u2->SendMessage(source.service, _("You are now an IRC Operator.")); - source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str()); - Log(LOG_ADMIN, source, this) << "for " << nick; - } - else if (u2 && flag[0] == '-') - { - IRCD->SendSVSO(source.service, nick, flag); - source.Reply(_("Operflags \002%s\002 have been removed from \002%s\002."), flag.c_str(), nick.c_str()); - Log(LOG_ADMIN, source, this) << "for " << nick; - } - else - this->OnSyntaxError(source, ""); - - return; - } - - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override - { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to give Operflags to any user.\n" - "Flags have to be prefixed with a \"+\" or a \"-\". To\n" - "remove all flags simply type a \"-\" instead of any flags.")); - return true; - } -}; - -class OSOLine : public Module -{ - CommandOSOLine commandosoline; - - public: - OSOLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - commandosoline(this) - { - - if (!IRCD || !IRCD->CanSVSO) - throw ModuleException("Your IRCd does not support OMODE."); - - } -}; - -MODULE_INIT(OSOLine) diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp index 386394d07..ee7c87028 100644 --- a/modules/commands/os_oper.cpp +++ b/modules/commands/os_oper.cpp @@ -15,7 +15,7 @@ struct MyOper : Oper, Serializable { MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["name"] << this->name; data["type"] << this->ot->GetName(); @@ -73,7 +73,7 @@ class CommandOSOper : public Command this->SetSyntax("LIST"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &subcommand = params[0]; @@ -243,7 +243,7 @@ class CommandOSOper : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -279,7 +279,7 @@ class OSOper : public Module } } - void OnDelCore(NickCore *nc) anope_override + void OnDelCore(NickCore *nc) override { if (nc->o && dynamic_cast<MyOper *>(nc->o)) { diff --git a/modules/commands/os_reload.cpp b/modules/commands/os_reload.cpp index 36a52f5f2..f3a801db8 100644 --- a/modules/commands/os_reload.cpp +++ b/modules/commands/os_reload.cpp @@ -19,7 +19,7 @@ class CommandOSReload : public Command this->SetDesc(_("Reload services' configuration file")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { try { @@ -40,7 +40,7 @@ class CommandOSReload : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index b6e4761f4..a667cac10 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -42,24 +42,24 @@ class MySessionService : public SessionService public: MySessionService(Module *m) : SessionService(m), Exceptions("Exception") { } - Exception *CreateException() anope_override + Exception *CreateException() override { return new Exception(); } - void AddException(Exception *e) anope_override + void AddException(Exception *e) override { this->Exceptions->push_back(e); } - void DelException(Exception *e) anope_override + void DelException(Exception *e) override { ExceptionVector::iterator it = std::find(this->Exceptions->begin(), this->Exceptions->end(), e); if (it != this->Exceptions->end()) this->Exceptions->erase(it); } - Exception *FindException(User *u) anope_override + Exception *FindException(User *u) override { for (std::vector<Exception *>::const_iterator it = this->Exceptions->begin(), it_end = this->Exceptions->end(); it != it_end; ++it) { @@ -73,7 +73,7 @@ class MySessionService : public SessionService return NULL; } - Exception *FindException(const Anope::string &host) anope_override + Exception *FindException(const Anope::string &host) override { for (std::vector<Exception *>::const_iterator it = this->Exceptions->begin(), it_end = this->Exceptions->end(); it != it_end; ++it) { @@ -88,7 +88,7 @@ class MySessionService : public SessionService return NULL; } - ExceptionVector &GetExceptions() anope_override + ExceptionVector &GetExceptions() override { return this->Exceptions; } @@ -98,7 +98,7 @@ class MySessionService : public SessionService this->Sessions.erase(s->addr); } - Session *FindSession(const Anope::string &ip) anope_override + Session *FindSession(const Anope::string &ip) override { cidr c(ip, ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr); if (!c.valid()) @@ -122,7 +122,7 @@ class MySessionService : public SessionService return this->Sessions[ip]; } - SessionMap &GetSessions() anope_override + SessionMap &GetSessions() override { return this->Sessions; } @@ -132,10 +132,10 @@ class ExceptionDelCallback : public NumberList { protected: CommandSource &source; - unsigned deleted; + unsigned deleted = 0; Command *cmd; public: - ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), deleted(0), cmd(c) + ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), cmd(c) { } @@ -149,7 +149,7 @@ class ExceptionDelCallback : public NumberList source.Reply(_("Deleted %d entries from session-limit exception list."), deleted); } - virtual void HandleNumber(unsigned number) anope_override + virtual void HandleNumber(unsigned number) override { if (!number || number > session_service->GetExceptions().size()) return; @@ -247,7 +247,7 @@ class CommandOSSession : public Command this->SetSyntax(_("VIEW \037host\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; @@ -263,7 +263,7 @@ class CommandOSSession : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -445,7 +445,7 @@ class CommandOSException : public Command { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned Number) override { if (!Number || Number > session_service->GetExceptions().size()) return; @@ -526,7 +526,7 @@ class CommandOSException : public Command this->SetSyntax(_("VIEW [\037mask\037 | \037list\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; @@ -544,7 +544,7 @@ class CommandOSException : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -597,12 +597,12 @@ class OSSession : public Module this->SetPermanent(true); } - void Prioritize() anope_override + void Prioritize() override { ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = Config->GetModule(this); @@ -622,7 +622,7 @@ class OSSession : public Module throw ConfigException(this->name + ": session CIDR value out of range"); } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (u->Quitting() || !session_limit || exempt || !u->server || u->server->IsULined()) return; @@ -693,7 +693,7 @@ class OSSession : public Module } } - void OnUserQuit(User *u, const Anope::string &msg) anope_override + void OnUserQuit(User *u, const Anope::string &msg) override { if (!session_limit || !u->server || u->server->IsULined()) return; @@ -716,7 +716,7 @@ class OSSession : public Module sessions.erase(sit); } - void OnExpireTick() anope_override + void OnExpireTick() override { if (Anope::NoExpire) return; diff --git a/modules/commands/os_set.cpp b/modules/commands/os_set.cpp index 46051dcdc..b03bab01f 100644 --- a/modules/commands/os_set.cpp +++ b/modules/commands/os_set.cpp @@ -170,7 +170,7 @@ class CommandOSSet : public Command this->SetSyntax(_("\037option\037 \037setting\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &option = params[0]; @@ -190,7 +190,7 @@ class CommandOSSet : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (subcommand.empty()) { diff --git a/modules/commands/os_shutdown.cpp b/modules/commands/os_shutdown.cpp index 57fc62a67..a6bb5252b 100644 --- a/modules/commands/os_shutdown.cpp +++ b/modules/commands/os_shutdown.cpp @@ -19,7 +19,7 @@ class CommandOSQuit : public Command this->SetDesc(_("Terminate Services WITHOUT saving")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Log(LOG_ADMIN, source, this); Anope::QuitReason = source.command + " command received from " + source.GetNick(); @@ -27,7 +27,7 @@ class CommandOSQuit : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -47,7 +47,7 @@ class CommandOSRestart : public Command this->SetDesc(_("Save databases and restart Services")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Log(LOG_ADMIN, source, this); Anope::QuitReason = source.command + " command received from " + source.GetNick(); @@ -56,7 +56,7 @@ class CommandOSRestart : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(_("Causes Services to save all databases and then restart\n" @@ -73,7 +73,7 @@ class CommandOSShutdown : public Command this->SetDesc(_("Terminate services with save")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Log(LOG_ADMIN, source, this); Anope::QuitReason = source.command + " command received from " + source.GetNick(); @@ -82,7 +82,7 @@ class CommandOSShutdown : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index 7e53af8ca..42d727fa2 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -21,7 +21,7 @@ struct Stats : Serializable me = this; } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["maxusercnt"] << MaxUserCount; data["maxusertime"] << MaxUserTime; @@ -204,7 +204,7 @@ class CommandOSStats : public Command this->SetSyntax("[AKILL | HASH | UPLINK | UPTIME | ALL | RESET]"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Anope::string extra = !params.empty() ? params[0] : ""; @@ -229,7 +229,7 @@ class CommandOSStats : public Command source.Reply(_("Unknown STATS option: \002%s\002"), extra.c_str()); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -266,7 +266,7 @@ class OSStats : public Module } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (UserListByNick.size() == MaxUserCount && Anope::CurTime == MaxUserTime) stats_saver.QueueUpdate(); diff --git a/modules/commands/os_svs.cpp b/modules/commands/os_svs.cpp index ae1431dbd..14d94d436 100644 --- a/modules/commands/os_svs.cpp +++ b/modules/commands/os_svs.cpp @@ -20,7 +20,7 @@ class CommandOSSVSNick : public Command this->SetSyntax(_("\037nick\037 \037newnick\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &nick = params[0]; Anope::string newnick = params[1]; @@ -61,7 +61,7 @@ class CommandOSSVSNick : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -79,7 +79,7 @@ class CommandOSSVSJoin : public Command this->SetSyntax(_("\037nick\037 \037channel\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!IRCD->CanSVSJoin) { @@ -105,7 +105,7 @@ class CommandOSSVSJoin : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -123,7 +123,7 @@ class CommandOSSVSPart : public Command this->SetSyntax(_("\037nick\037 \037channel\037 [\037reason\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!IRCD->CanSVSJoin) { @@ -153,7 +153,7 @@ class CommandOSSVSPart : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp index 167115194..eedf1d02c 100644 --- a/modules/commands/os_sxline.cpp +++ b/modules/commands/os_sxline.cpp @@ -16,9 +16,9 @@ class SXLineDelCallback : public NumberList XLineManager *xlm; Command *command; CommandSource &source; - unsigned deleted; + unsigned deleted = 0; public: - SXLineDelCallback(XLineManager *x, Command *c, CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), xlm(x), command(c), source(_source), deleted(0) + SXLineDelCallback(XLineManager *x, Command *c, CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), xlm(x), command(c), source(_source) { } @@ -32,7 +32,7 @@ class SXLineDelCallback : public NumberList source.Reply(_("Deleted %d entries from the %s list."), deleted, source.command.c_str()); } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number) return; @@ -128,7 +128,7 @@ class CommandOSSXLineBase : public Command { } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number) return; @@ -228,12 +228,12 @@ class CommandOSSXLineBase : public Command { } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { return Anope::printf(Language::Translate(source.GetAccount(), _("Manipulate the %s list")), source.command.upper().c_str()); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0]; @@ -253,17 +253,17 @@ class CommandOSSXLineBase : public Command return; } - virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override = 0; + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override = 0; }; class CommandOSSNLine : public CommandOSSXLineBase { - XLineManager *xlm() anope_override + XLineManager *xlm() override { return this->snlines; } - void OnAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void OnAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!this->xlm()) return; @@ -429,7 +429,7 @@ class CommandOSSNLine : public CommandOSSXLineBase this->SetSyntax("CLEAR"); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -484,12 +484,12 @@ class CommandOSSNLine : public CommandOSSXLineBase class CommandOSSQLine : public CommandOSSXLineBase { - XLineManager *xlm() anope_override + XLineManager *xlm() override { return this->sqlines; } - void OnAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void OnAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!this->xlm()) return; @@ -663,7 +663,7 @@ class CommandOSSQLine : public CommandOSSXLineBase this->SetSyntax("CLEAR"); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/commands/os_update.cpp b/modules/commands/os_update.cpp index d81dbb12e..849485181 100644 --- a/modules/commands/os_update.cpp +++ b/modules/commands/os_update.cpp @@ -19,7 +19,7 @@ class CommandOSUpdate : public Command this->SetDesc(_("Force the Services databases to be updated immediately")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { Log(LOG_ADMIN, source, this); source.Reply(_("Updating databases.")); @@ -27,7 +27,7 @@ class CommandOSUpdate : public Command return; } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); diff --git a/modules/cs_statusupdate.cpp b/modules/cs_statusupdate.cpp index 535f3356c..cbfd3dc84 100644 --- a/modules/cs_statusupdate.cpp +++ b/modules/cs_statusupdate.cpp @@ -16,7 +16,7 @@ class StatusUpdate : public Module } - void OnAccessAdd(ChannelInfo *ci, CommandSource &, ChanAccess *access) anope_override + void OnAccessAdd(ChannelInfo *ci, CommandSource &, ChanAccess *access) override { if (ci->c) for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) @@ -39,7 +39,7 @@ class StatusUpdate : public Module } } - void OnAccessDel(ChannelInfo *ci, CommandSource &, ChanAccess *access) anope_override + void OnAccessDel(ChannelInfo *ci, CommandSource &, ChanAccess *access) override { if (ci->c) for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index 005e4906c..21cb7cc22 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -19,11 +19,9 @@ class SaveData : public Serialize::Data { public: Anope::string last; - std::fstream *fs; + std::fstream *fs = nullptr; - SaveData() : fs(NULL) { } - - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { if (key != last) { @@ -38,15 +36,13 @@ class SaveData : public Serialize::Data class LoadData : public Serialize::Data { public: - std::fstream *fs; - unsigned int id; + std::fstream *fs = nullptr; + unsigned int id = 0; std::map<Anope::string, Anope::string> data; std::stringstream ss; - bool read; - - LoadData() : fs(NULL), id(0), read(false) { } + bool read = false; - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { if (!read) { @@ -78,7 +74,7 @@ class LoadData : public Serialize::Data return this->ss; } - std::set<Anope::string> KeySet() const anope_override + std::set<Anope::string> KeySet() const override { std::set<Anope::string> keys; for (std::map<Anope::string, Anope::string>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -86,7 +82,7 @@ class LoadData : public Serialize::Data return keys; } - size_t Hash() const anope_override + size_t Hash() const override { size_t hash = 0; for (std::map<Anope::string, Anope::string>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -106,12 +102,12 @@ class LoadData : public Serialize::Data class DBFlatFile : public Module, public Pipe { /* Day the last backup was on */ - int last_day; + int last_day = 0; /* Backup file names */ std::map<Anope::string, std::list<Anope::string> > backups; - bool loaded; + bool loaded = false; - int child_pid; + int child_pid = -1; void BackupDatabase() { @@ -172,18 +168,18 @@ class DBFlatFile : public Module, public Pipe } public: - DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), last_day(0), loaded(false), child_pid(-1) + DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR) { } #ifndef _WIN32 - void OnRestart() anope_override + void OnRestart() override { OnShutdown(); } - void OnShutdown() anope_override + void OnShutdown() override { if (child_pid > -1) { @@ -197,7 +193,7 @@ class DBFlatFile : public Module, public Pipe } #endif - void OnNotify() anope_override + void OnNotify() override { char buf[512]; int i = this->Read(buf, sizeof(buf) - 1); @@ -219,7 +215,7 @@ class DBFlatFile : public Module, public Pipe Anope::Quitting = true; } - EventReturn OnLoadDatabase() anope_override + EventReturn OnLoadDatabase() override { const std::vector<Anope::string> &type_order = Serialize::Type::GetTypeOrder(); std::set<Anope::string> tried_dbs; @@ -269,7 +265,7 @@ class DBFlatFile : public Module, public Pipe } - void OnSaveDatabase() anope_override + void OnSaveDatabase() override { if (child_pid > -1) { @@ -376,7 +372,7 @@ class DBFlatFile : public Module, public Pipe } /* Load just one type. Done if a module is reloaded during runtime */ - void OnSerializeTypeCreate(Serialize::Type *stype) anope_override + void OnSerializeTypeCreate(Serialize::Type *stype) override { if (!loaded) return; diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index bf756678a..da562d233 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -1313,7 +1313,7 @@ class DBOld : public Module throw ModuleException("Invalid hash method"); } - EventReturn OnLoadDatabase() anope_override + EventReturn OnLoadDatabase() override { LoadNicks(); LoadVHosts(); @@ -1326,7 +1326,7 @@ class DBOld : public Module return EVENT_STOP; } - void OnUplinkSync(Server *s) anope_override + void OnUplinkSync(Server *s) override { for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it) { diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp index 039bd956b..bbde70b10 100644 --- a/modules/database/db_redis.cpp +++ b/modules/database/db_redis.cpp @@ -25,7 +25,7 @@ class Data : public Serialize::Data delete it->second; } - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { std::stringstream* &stream = data[key]; if (!stream) @@ -33,7 +33,7 @@ class Data : public Serialize::Data return *stream; } - std::set<Anope::string> KeySet() const anope_override + std::set<Anope::string> KeySet() const override { std::set<Anope::string> keys; for (std::map<Anope::string, std::stringstream *>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -41,7 +41,7 @@ class Data : public Serialize::Data return keys; } - size_t Hash() const anope_override + size_t Hash() const override { size_t hash = 0; for (std::map<Anope::string, std::stringstream *>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -57,7 +57,7 @@ class TypeLoader : public Interface public: TypeLoader(Module *creator, const Anope::string &t) : Interface(creator), type(t) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class ObjectLoader : public Interface @@ -68,7 +68,7 @@ class ObjectLoader : public Interface public: ObjectLoader(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class IDInterface : public Interface @@ -77,7 +77,7 @@ class IDInterface : public Interface public: IDInterface(Module *creator, Serializable *obj) : Interface(creator), o(obj) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class Deleter : public Interface @@ -87,7 +87,7 @@ class Deleter : public Interface public: Deleter(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class Updater : public Interface @@ -97,7 +97,7 @@ class Updater : public Interface public: Updater(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class ModifiedObject : public Interface @@ -107,7 +107,7 @@ class ModifiedObject : public Interface public: ModifiedObject(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class SubscriptionListener : public Interface @@ -115,7 +115,7 @@ class SubscriptionListener : public Interface public: SubscriptionListener(Module *creator) : Interface(creator) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class DatabaseRedis : public Module, public Pipe @@ -159,7 +159,7 @@ class DatabaseRedis : public Module, public Pipe } } - void OnNotify() anope_override + void OnNotify() override { for (std::set<Serializable *>::iterator it = this->updated_items.begin(), it_end = this->updated_items.end(); it != it_end; ++it) { @@ -171,13 +171,13 @@ class DatabaseRedis : public Module, public Pipe this->updated_items.clear(); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); this->redis = ServiceReference<Provider>("Redis::Provider", block->Get<const Anope::string>("engine", "redis/main")); } - EventReturn OnLoadDatabase() anope_override + EventReturn OnLoadDatabase() override { if (!redis) { @@ -205,7 +205,7 @@ class DatabaseRedis : public Module, public Pipe return EVENT_STOP; } - void OnSerializeTypeCreate(Serialize::Type *sb) anope_override + void OnSerializeTypeCreate(Serialize::Type *sb) override { if (!redis) return; @@ -217,13 +217,13 @@ class DatabaseRedis : public Module, public Pipe redis->SendCommand(new TypeLoader(this, sb->GetName()), args); } - void OnSerializableConstruct(Serializable *obj) anope_override + void OnSerializableConstruct(Serializable *obj) override { this->updated_items.insert(obj); this->Notify(); } - void OnSerializableDestruct(Serializable *obj) anope_override + void OnSerializableDestruct(Serializable *obj) override { Serialize::Type *t = obj->GetSerializableType(); @@ -251,7 +251,7 @@ class DatabaseRedis : public Module, public Pipe this->Notify(); } - void OnSerializableUpdate(Serializable *obj) anope_override + void OnSerializableUpdate(Serializable *obj) override { this->updated_items.insert(obj); this->Notify(); diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index a137d17c8..0c32310f3 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -19,12 +19,12 @@ class SQLSQLInterface : public Interface public: SQLSQLInterface(Module *o) : Interface(o) { } - void OnResult(const Result &r) anope_override + void OnResult(const Result &r) override { Log(LOG_DEBUG) << "SQL successfully executed query: " << r.finished_query; } - void OnError(const Result &r) anope_override + void OnError(const Result &r) override { if (!r.GetQuery().query.empty()) Log(LOG_DEBUG) << "Error executing query " << r.finished_query << ": " << r.GetError(); @@ -40,7 +40,7 @@ class ResultSQLSQLInterface : public SQLSQLInterface public: ResultSQLSQLInterface(Module *o, Serializable *ob) : SQLSQLInterface(o), obj(ob) { } - void OnResult(const Result &r) anope_override + void OnResult(const Result &r) override { SQLSQLInterface::OnResult(r); if (r.GetID() > 0 && this->obj) @@ -48,7 +48,7 @@ public: delete this; } - void OnError(const Result &r) anope_override + void OnError(const Result &r) override { SQLSQLInterface::OnError(r); delete this; @@ -63,10 +63,10 @@ class DBSQL : public Module, public Pipe bool import; std::set<Serializable *> updated_items; - bool shutting_down; - bool loading_databases; - bool loaded; - bool imported; + bool shutting_down = false; + bool loading_databases = false; + bool loaded = false; + bool imported = false; void RunBackground(const Query &q, Interface *iface = NULL) { @@ -90,7 +90,7 @@ class DBSQL : public Module, public Pipe } public: - DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this), shutting_down(false), loading_databases(false), loaded(false), imported(false) + DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this) { @@ -98,7 +98,7 @@ class DBSQL : public Module, public Pipe throw ModuleException("db_sql can not be loaded after db_sql_live"); } - void OnNotify() anope_override + void OnNotify() override { for (std::set<Serializable *>::iterator it = this->updated_items.begin(), it_end = this->updated_items.end(); it != it_end; ++it) { @@ -151,7 +151,7 @@ class DBSQL : public Module, public Pipe this->imported = true; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); this->sql = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine")); @@ -159,18 +159,18 @@ class DBSQL : public Module, public Pipe this->import = block->Get<bool>("import"); } - void OnShutdown() anope_override + void OnShutdown() override { this->shutting_down = true; this->OnNotify(); } - void OnRestart() anope_override + void OnRestart() override { this->OnShutdown(); } - EventReturn OnLoadDatabase() anope_override + EventReturn OnLoadDatabase() override { if (!this->sql) { @@ -193,7 +193,7 @@ class DBSQL : public Module, public Pipe return EVENT_STOP; } - void OnSerializableConstruct(Serializable *obj) anope_override + void OnSerializableConstruct(Serializable *obj) override { if (this->shutting_down || this->loading_databases) return; @@ -202,7 +202,7 @@ class DBSQL : public Module, public Pipe this->Notify(); } - void OnSerializableDestruct(Serializable *obj) anope_override + void OnSerializableDestruct(Serializable *obj) override { if (this->shutting_down) return; @@ -212,7 +212,7 @@ class DBSQL : public Module, public Pipe this->updated_items.erase(obj); } - void OnSerializableUpdate(Serializable *obj) anope_override + void OnSerializableUpdate(Serializable *obj) override { if (this->shutting_down || obj->IsTSCached()) return; @@ -223,7 +223,7 @@ class DBSQL : public Module, public Pipe this->Notify(); } - void OnSerializeTypeCreate(Serialize::Type *sb) anope_override + void OnSerializeTypeCreate(Serialize::Type *sb) override { if (!this->loading_databases && !this->loaded) return; diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp index 34620535f..8cedfe579 100644 --- a/modules/database/db_sql_live.cpp +++ b/modules/database/db_sql_live.cpp @@ -83,7 +83,7 @@ class DBMySQL : public Module, public Pipe throw ModuleException("If db_sql_live is loaded it must be the first database module loaded."); } - void OnNotify() anope_override + void OnNotify() override { if (!this->CheckInit()) return; @@ -123,30 +123,30 @@ class DBMySQL : public Module, public Pipe this->updated_items.clear(); } - EventReturn OnLoadDatabase() anope_override + EventReturn OnLoadDatabase() override { init = true; return EVENT_STOP; } - void OnShutdown() anope_override + void OnShutdown() override { init = false; } - void OnRestart() anope_override + void OnRestart() override { init = false; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); this->SQL = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine")); this->prefix = block->Get<const Anope::string>("prefix", "anope_db_"); } - void OnSerializableConstruct(Serializable *obj) anope_override + void OnSerializableConstruct(Serializable *obj) override { if (!this->CheckInit()) return; @@ -155,7 +155,7 @@ class DBMySQL : public Module, public Pipe this->Notify(); } - void OnSerializableDestruct(Serializable *obj) anope_override + void OnSerializableDestruct(Serializable *obj) override { if (!this->CheckInit()) return; @@ -169,7 +169,7 @@ class DBMySQL : public Module, public Pipe this->updated_items.erase(obj); } - void OnSerializeCheck(Serialize::Type *obj) anope_override + void OnSerializeCheck(Serialize::Type *obj) override { if (!this->CheckInit() || obj->GetTimestamp() == Anope::CurTime) return; @@ -251,7 +251,7 @@ class DBMySQL : public Module, public Pipe } } - void OnSerializableUpdate(Serializable *obj) anope_override + void OnSerializableUpdate(Serializable *obj) override { if (!this->CheckInit() || obj->IsTSCached()) return; diff --git a/modules/encryption/enc_bcrypt.cpp b/modules/encryption/enc_bcrypt.cpp index 07bd7d949..b5e65648e 100644 --- a/modules/encryption/enc_bcrypt.cpp +++ b/modules/encryption/enc_bcrypt.cpp @@ -888,14 +888,14 @@ class EBCRYPT : public Module throw ModuleException("BCrypt could not load!"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { dest = "bcrypt:" + Generate(src, Salt()); Log(LOG_DEBUG_2) << "(enc_bcrypt) hashed password from [" << src << "] to [" << dest << "]"; return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) @@ -935,7 +935,7 @@ class EBCRYPT : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); rounds = block->Get<unsigned int>("rounds", "10"); diff --git a/modules/encryption/enc_md5.cpp b/modules/encryption/enc_md5.cpp index 2e5225c2c..1b19316e5 100644 --- a/modules/encryption/enc_md5.cpp +++ b/modules/encryption/enc_md5.cpp @@ -250,7 +250,7 @@ class MD5Context : public Encryption::Context * operation, processing another message block, and updating the * context. */ - void Update(const unsigned char *input, size_t len) anope_override + void Update(const unsigned char *input, size_t len) override { unsigned i, index, partLen; @@ -285,7 +285,7 @@ class MD5Context : public Encryption::Context /* MD5 finalization. Ends an MD5 message-digest opera * the message digest and zeroizing the context. */ - void Finalize() anope_override + void Finalize() override { unsigned char bits[8]; unsigned index, padLen; @@ -309,7 +309,7 @@ class MD5Context : public Encryption::Context memset(this->buffer, 0, sizeof(this->buffer)); } - Encryption::Hash GetFinalizedHash() anope_override + Encryption::Hash GetFinalizedHash() override { Encryption::Hash hash; hash.first = this->digest; @@ -323,12 +323,12 @@ class MD5Provider : public Encryption::Provider public: MD5Provider(Module *creator) : Encryption::Provider(creator, "md5") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { return new MD5Context(iv); } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { Encryption::IV iv; iv.first = md5_iv; @@ -345,10 +345,11 @@ class EMD5 : public Module EMD5(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR), md5provider(this) { - + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_md5 is deprecated and can not be used as a primary encryption method"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { MD5Context context; @@ -364,7 +365,7 @@ class EMD5 : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_none.cpp b/modules/encryption/enc_none.cpp index b1e2c738a..970530c9b 100644 --- a/modules/encryption/enc_none.cpp +++ b/modules/encryption/enc_none.cpp @@ -14,10 +14,11 @@ class ENone : public Module public: ENone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR) { - + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_none is deprecated and can not be used as a primary encryption method"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { Anope::string buf = "plain:"; Anope::string cpass; @@ -28,17 +29,7 @@ class ENone : public Module return EVENT_ALLOW; } - EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) anope_override - { - if (!hashm.equals_cs("plain")) - return EVENT_CONTINUE; - size_t pos = src.find(':'); - Anope::string buf = src.substr(pos + 1); - Anope::B64Decode(buf, dest); - return EVENT_ALLOW; - } - - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_old.cpp b/modules/encryption/enc_old.cpp index beab76d15..9f051cf91 100644 --- a/modules/encryption/enc_old.cpp +++ b/modules/encryption/enc_old.cpp @@ -19,14 +19,14 @@ class OldMD5Provider : public Encryption::Provider public: OldMD5Provider(Module *creator) : Encryption::Provider(creator, "oldmd5") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { if (md5) return md5->CreateContext(iv); return NULL; } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { if (md5) return md5->GetDefaultIV(); @@ -44,6 +44,8 @@ class EOld : public Module EOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR), oldmd5provider(this) { + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_old is deprecated and can not be used as a primary encryption method"); ModuleManager::LoadModule("enc_md5", User::Find(creator, true)); if (!md5) @@ -51,7 +53,7 @@ class EOld : public Module } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { if (!md5) return EVENT_CONTINUE; @@ -79,7 +81,7 @@ class EOld : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_sha1.cpp b/modules/encryption/enc_sha1.cpp index 9bad4a790..c59794aa2 100644 --- a/modules/encryption/enc_sha1.cpp +++ b/modules/encryption/enc_sha1.cpp @@ -125,7 +125,7 @@ class SHA1Context : public Encryption::Context memset(this->digest, 0, sizeof(this->digest)); } - void Update(const unsigned char *data, size_t len) anope_override + void Update(const unsigned char *data, size_t len) override { uint32_t i, j; @@ -146,7 +146,7 @@ class SHA1Context : public Encryption::Context memcpy(&this->buffer[j], &data[i], len - i); } - void Finalize() anope_override + void Finalize() override { uint32_t i; unsigned char finalcount[8]; @@ -169,7 +169,7 @@ class SHA1Context : public Encryption::Context this->Transform(this->buffer); } - Encryption::Hash GetFinalizedHash() anope_override + Encryption::Hash GetFinalizedHash() override { Encryption::Hash hash; hash.first = this->digest; @@ -183,12 +183,12 @@ class SHA1Provider : public Encryption::Provider public: SHA1Provider(Module *creator) : Encryption::Provider(creator, "sha1") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { return new SHA1Context(iv); } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { Encryption::IV iv; iv.first = sha1_iv; @@ -205,10 +205,11 @@ class ESHA1 : public Module ESHA1(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR), sha1provider(this) { - + if (ModuleManager::FindFirstOf(ENCRYPTION) == this) + throw ModuleException("enc_sha1 is deprecated and can not be used as a primary encryption method"); } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { SHA1Context context; @@ -224,7 +225,7 @@ class ESHA1 : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp index da3822602..384da515e 100644 --- a/modules/encryption/enc_sha256.cpp +++ b/modules/encryption/enc_sha256.cpp @@ -172,7 +172,7 @@ class SHA256Context : public Encryption::Context memset(this->digest, 0, sizeof(this->digest)); } - void Update(const unsigned char *message, size_t mlen) anope_override + void Update(const unsigned char *message, size_t mlen) override { unsigned tmp_len = SHA256_BLOCK_SIZE - this->len, rem_len = mlen < tmp_len ? mlen : tmp_len; @@ -194,7 +194,7 @@ class SHA256Context : public Encryption::Context this->tot_len += (block_nb + 1) << 6; } - void Finalize() anope_override + void Finalize() override { unsigned block_nb = 1 + ((SHA256_BLOCK_SIZE - 9) < (this->len % SHA256_BLOCK_SIZE)); unsigned len_b = (this->tot_len + this->len) << 3; @@ -207,7 +207,7 @@ class SHA256Context : public Encryption::Context UNPACK32(this->h[i], &this->digest[i << 2]); } - Encryption::Hash GetFinalizedHash() anope_override + Encryption::Hash GetFinalizedHash() override { Encryption::Hash hash; hash.first = this->digest; @@ -221,12 +221,12 @@ class SHA256Provider : public Encryption::Provider public: SHA256Provider(Module *creator) : Encryption::Provider(creator, "sha256") { } - Encryption::Context *CreateContext(Encryption::IV *iv) anope_override + Encryption::Context *CreateContext(Encryption::IV *iv) override { return new SHA256Context(iv); } - Encryption::IV GetDefaultIV() anope_override + Encryption::IV GetDefaultIV() override { Encryption::IV iv; iv.first = sha256_h0; @@ -280,7 +280,7 @@ class ESHA256 : public Module use_iv = false; } - EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override + EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { if (!use_iv) NewRandomIV(); @@ -301,7 +301,7 @@ class ESHA256 : public Module return EVENT_ALLOW; } - void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *, IdentifyRequest *req) override { const NickAlias *na = NickAlias::Find(req->GetAccount()); if (na == NULL) diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index 1005d2efe..b72c9af56 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -29,18 +29,15 @@ class LDAPRequest public: LDAPService *service; LDAPInterface *inter; - LDAPMessage *message; /* message returned by ldap_ */ - LDAPResult *result; /* final result */ + LDAPMessage *message = nullptr; /* message returned by ldap_ */ + LDAPResult *result = nullptr; /* final result */ struct timeval tv; - QueryType type; + QueryType type = QUERY_UNKNOWN; LDAPRequest(LDAPService *s, LDAPInterface *i) : service(s) , inter(i) - , message(NULL) - , result(NULL) { - type = QUERY_UNKNOWN; tv.tv_sec = 0; tv.tv_usec = 100000; } @@ -70,7 +67,7 @@ class LDAPBind : public LDAPRequest type = QUERY_BIND; } - int run() anope_override; + int run() override; }; class LDAPSearch : public LDAPRequest @@ -87,7 +84,7 @@ class LDAPSearch : public LDAPRequest type = QUERY_SEARCH; } - int run() anope_override; + int run() override; }; class LDAPAdd : public LDAPRequest @@ -104,7 +101,7 @@ class LDAPAdd : public LDAPRequest type = QUERY_ADD; } - int run() anope_override; + int run() override; }; class LDAPDel : public LDAPRequest @@ -119,7 +116,7 @@ class LDAPDel : public LDAPRequest type = QUERY_DELETE; } - int run() anope_override; + int run() override; }; class LDAPModify : public LDAPRequest @@ -136,7 +133,7 @@ class LDAPModify : public LDAPRequest type = QUERY_MODIFY; } - int run() anope_override; + int run() override; }; class LDAPService : public LDAPProvider, public Thread, public Condition @@ -147,7 +144,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition LDAP *con; - time_t last_connect; + time_t last_connect = 0; public: static LDAPMod **BuildMods(const LDAPMods &attributes) @@ -232,7 +229,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition query_queue queries, results; Mutex process_mutex; /* held when processing requests not in either queue */ - LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p), last_connect(0) + LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p) { Connect(); } @@ -275,18 +272,18 @@ class LDAPService : public LDAPProvider, public Thread, public Condition ldap_unbind_ext(this->con, NULL, NULL); } - void BindAsAdmin(LDAPInterface *i) anope_override + void BindAsAdmin(LDAPInterface *i) override { this->Bind(i, this->admin_binddn, this->admin_pass); } - void Bind(LDAPInterface *i, const Anope::string &who, const Anope::string &pass) anope_override + void Bind(LDAPInterface *i, const Anope::string &who, const Anope::string &pass) override { LDAPBind *b = new LDAPBind(this, i, who, pass); QueueRequest(b); } - void Search(LDAPInterface *i, const Anope::string &base, const Anope::string &filter) anope_override + void Search(LDAPInterface *i, const Anope::string &base, const Anope::string &filter) override { if (i == NULL) throw LDAPException("No interface"); @@ -295,19 +292,19 @@ class LDAPService : public LDAPProvider, public Thread, public Condition QueueRequest(s); } - void Add(LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) anope_override + void Add(LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) override { LDAPAdd *add = new LDAPAdd(this, i, dn, attributes); QueueRequest(add); } - void Del(LDAPInterface *i, const Anope::string &dn) anope_override + void Del(LDAPInterface *i, const Anope::string &dn) override { LDAPDel *del = new LDAPDel(this, i, dn); QueueRequest(del); } - void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) anope_override + void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) override { LDAPModify *mod = new LDAPModify(this, i, base, attributes); QueueRequest(mod); @@ -414,7 +411,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition } public: - void Run() anope_override + void Run() override { while (!this->GetExitState()) { @@ -457,7 +454,7 @@ class ModuleLDAP : public Module, public Pipe LDAPServices.clear(); } - void OnReload(Configuration::Conf *config) anope_override + void OnReload(Configuration::Conf *config) override { Configuration::Block *conf = config->GetModule(this); @@ -513,7 +510,7 @@ class ModuleLDAP : public Module, public Pipe } } - void OnModuleUnload(User *, Module *m) anope_override + void OnModuleUnload(User *, Module *m) override { for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end(); ++it) { @@ -550,7 +547,7 @@ class ModuleLDAP : public Module, public Pipe } } - void OnNotify() anope_override + void OnNotify() override { for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end(); ++it) { diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index d3ee026d1..ab67bd919 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -22,10 +22,10 @@ struct IdentifyInfo Reference<User> user; IdentifyRequest *req; ServiceReference<LDAPProvider> lprov; - bool admin_bind; + bool admin_bind = true; Anope::string dn; - IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true) + IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp) { req->Hold(me); } @@ -48,12 +48,12 @@ class IdentifyInterface : public LDAPInterface delete ii; } - void OnDelete() anope_override + void OnDelete() override { delete this; } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { if (!ii->lprov) return; @@ -122,7 +122,7 @@ class IdentifyInterface : public LDAPInterface } } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { } }; @@ -134,12 +134,12 @@ class OnIdentifyInterface : public LDAPInterface public: OnIdentifyInterface(Module *m, const Anope::string &i) : LDAPInterface(m), uid(i) { } - void OnDelete() anope_override + void OnDelete() override { delete this; } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { User *u = User::Find(uid); @@ -166,7 +166,7 @@ class OnIdentifyInterface : public LDAPInterface } } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { Log(this->owner) << r.error; } @@ -177,12 +177,12 @@ class OnRegisterInterface : public LDAPInterface public: OnRegisterInterface(Module *m) : LDAPInterface(m) { } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { Log(this->owner) << "Successfully added newly created account to LDAP"; } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { Log(this->owner) << "Error adding newly created account to LDAP: " << r.getError(); } @@ -206,12 +206,12 @@ class ModuleLDAPAuthentication : public Module me = this; } - void Prioritize() anope_override + void Prioritize() override { ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnReload(Configuration::Conf *config) anope_override + void OnReload(Configuration::Conf *config) override { Configuration::Block *conf = Config->GetModule(this); @@ -229,7 +229,7 @@ class ModuleLDAPAuthentication : public Module config->GetModule("nickserv")->Set("forceemail", "false"); } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (!this->disable_register_reason.empty()) { @@ -249,7 +249,7 @@ class ModuleLDAPAuthentication : public Module return EVENT_CONTINUE; } - void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *u, IdentifyRequest *req) override { if (!this->ldap) return; @@ -258,7 +258,7 @@ class ModuleLDAPAuthentication : public Module this->ldap->BindAsAdmin(new IdentifyInterface(this, ii)); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { if (email_attribute.empty() || !this->ldap) return; @@ -270,7 +270,7 @@ class ModuleLDAPAuthentication : public Module this->ldap->Search(new OnIdentifyInterface(this, u->GetUID()), *d, "(" + email_attribute + "=*)"); } - void OnNickRegister(User *, NickAlias *na, const Anope::string &pass) anope_override + void OnNickRegister(User *, NickAlias *na, const Anope::string &pass) override { if (!this->disable_register_reason.empty() || !this->ldap) return; diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index ad369ca1d..ce60401da 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -21,7 +21,7 @@ class IdentifyInterface : public LDAPInterface { } - void OnResult(const LDAPResult &r) anope_override + void OnResult(const LDAPResult &r) override { if (!u || !u->Account()) return; @@ -65,11 +65,11 @@ class IdentifyInterface : public LDAPInterface } } - void OnError(const LDAPResult &r) anope_override + void OnError(const LDAPResult &r) override { } - void OnDelete() anope_override + void OnDelete() override { delete this; } @@ -90,7 +90,7 @@ class LDAPOper : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = Config->GetModule(this); @@ -105,7 +105,7 @@ class LDAPOper : public Module my_opers.clear(); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { try { @@ -124,7 +124,7 @@ class LDAPOper : public Module } } - void OnDelCore(NickCore *nc) anope_override + void OnDelCore(NickCore *nc) override { if (nc->o != NULL && my_opers.count(nc->o) > 0) { diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index dcac30ebd..96f346b53 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -61,7 +61,7 @@ struct QueryResult */ class MySQLResult : public Result { - MYSQL_RES *res; + MYSQL_RES *res = nullptr; public: MySQLResult(unsigned int i, const Query &q, const Anope::string &fq, MYSQL_RES *r) : Result(i, q, fq), res(r) @@ -94,7 +94,7 @@ class MySQLResult : public Result } } - MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err), res(NULL) + MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err) { } @@ -117,7 +117,7 @@ class MySQLService : public Provider Anope::string password; int port; - MYSQL *sql; + MYSQL *sql = nullptr; /** Escape a query. * Note the mutex must be held! @@ -135,15 +135,15 @@ class MySQLService : public Provider ~MySQLService(); - void Run(Interface *i, const Query &query) anope_override; + void Run(Interface *i, const Query &query) override; - Result RunQuery(const Query &query) anope_override; + Result RunQuery(const Query &query) override; - std::vector<Query> CreateTable(const Anope::string &table, const Data &data) anope_override; + std::vector<Query> CreateTable(const Anope::string &table, const Data &data) override; - Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) anope_override; + Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) override; - Query GetTables(const Anope::string &prefix) anope_override; + Query GetTables(const Anope::string &prefix) override; void Connect(); @@ -151,7 +151,7 @@ class MySQLService : public Provider Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; /** The SQL thread used to execute queries @@ -161,7 +161,7 @@ class DispatcherThread : public Thread, public Condition public: DispatcherThread() : Thread() { } - void Run() anope_override; + void Run() override; }; class ModuleSQL; @@ -199,7 +199,7 @@ class ModuleSQL : public Module, public Pipe delete DThread; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -252,7 +252,7 @@ class ModuleSQL : public Module, public Pipe } } - void OnModuleUnload(User *, Module *m) anope_override + void OnModuleUnload(User *, Module *m) override { this->DThread->Lock(); @@ -277,7 +277,7 @@ class ModuleSQL : public Module, public Pipe this->OnNotify(); } - void OnNotify() anope_override + void OnNotify() override { this->DThread->Lock(); std::deque<QueryResult> finishedRequests = this->FinishedRequests; @@ -300,7 +300,7 @@ class ModuleSQL : public Module, public Pipe }; MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, int po) -: Provider(o, n), database(d), server(s), user(u), password(p), port(po), sql(NULL) +: Provider(o, n), database(d), server(s), user(u), password(p), port(po) { Connect(); } diff --git a/modules/extra/m_regex_pcre.cpp b/modules/extra/m_regex_pcre.cpp index 7248888d4..e2d939691 100644 --- a/modules/extra/m_regex_pcre.cpp +++ b/modules/extra/m_regex_pcre.cpp @@ -42,7 +42,7 @@ class PCRERegexProvider : public RegexProvider public: PCRERegexProvider(Module *creator) : RegexProvider(creator, "regex/pcre") { } - Regex *Compile(const Anope::string &expression) anope_override + Regex *Compile(const Anope::string &expression) override { return new PCRERegex(expression); } diff --git a/modules/extra/m_regex_posix.cpp b/modules/extra/m_regex_posix.cpp index 0f0e15c7c..afaf0c71f 100644 --- a/modules/extra/m_regex_posix.cpp +++ b/modules/extra/m_regex_posix.cpp @@ -43,7 +43,7 @@ class POSIXRegexProvider : public RegexProvider public: POSIXRegexProvider(Module *creator) : RegexProvider(creator, "regex/posix") { } - Regex *Compile(const Anope::string &expression) anope_override + Regex *Compile(const Anope::string &expression) override { return new POSIXRegex(expression); } diff --git a/modules/extra/m_regex_tre.cpp b/modules/extra/m_regex_tre.cpp index 8e633b1ad..fb8c29921 100644 --- a/modules/extra/m_regex_tre.cpp +++ b/modules/extra/m_regex_tre.cpp @@ -44,7 +44,7 @@ class TRERegexProvider : public RegexProvider public: TRERegexProvider(Module *creator) : RegexProvider(creator, "regex/tre") { } - Regex *Compile(const Anope::string &expression) anope_override + Regex *Compile(const Anope::string &expression) override { return new TRERegex(expression); } diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp index 7569219e7..e78dd0594 100644 --- a/modules/extra/m_sql_authentication.cpp +++ b/modules/extra/m_sql_authentication.cpp @@ -27,7 +27,7 @@ class SQLAuthenticationResult : public SQL::Interface req->Release(me); } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { if (r.Rows() == 0) { @@ -66,7 +66,7 @@ class SQLAuthenticationResult : public SQL::Interface delete this; } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { Log(this->owner) << "m_sql_authentication: Error executing query " << r.GetQuery().query << ": " << r.GetError(); delete this; @@ -88,7 +88,7 @@ class ModuleSQLAuthentication : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); this->engine = config->Get<const Anope::string>("engine"); @@ -99,7 +99,7 @@ class ModuleSQLAuthentication : public Module this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine); } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (!this->disable_reason.empty() && (command->name == "nickserv/register" || command->name == "nickserv/group")) { @@ -116,7 +116,7 @@ class ModuleSQLAuthentication : public Module return EVENT_CONTINUE; } - void OnCheckAuthentication(User *u, IdentifyRequest *req) anope_override + void OnCheckAuthentication(User *u, IdentifyRequest *req) override { if (!this->SQL) { diff --git a/modules/extra/m_sql_log.cpp b/modules/extra/m_sql_log.cpp index b3003703b..735fb6ba6 100644 --- a/modules/extra/m_sql_log.cpp +++ b/modules/extra/m_sql_log.cpp @@ -19,13 +19,13 @@ class SQLLog : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); this->table = config->Get<const Anope::string>("table", "logs"); } - void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) anope_override + void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) override { Anope::string ref_name; ServiceReference<SQL::Provider> SQL; diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp index df14da8e4..87b268dd9 100644 --- a/modules/extra/m_sql_oper.cpp +++ b/modules/extra/m_sql_oper.cpp @@ -42,7 +42,7 @@ class SQLOperResult : public SQL::Interface public: SQLOperResult(Module *m, User *u) : SQL::Interface(m), user(u) { } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { SQLOperResultDeleter d(this); @@ -116,7 +116,7 @@ class SQLOperResult : public SQL::Interface } } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { SQLOperResultDeleter d(this); Log(this->owner) << "m_sql_oper: Error executing query " << r.GetQuery().query << ": " << r.GetError(); @@ -149,7 +149,7 @@ class ModuleSQLOper : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -159,7 +159,7 @@ class ModuleSQLOper : public Module this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine); } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { if (!this->SQL) { diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index c1cf2b9cb..ad74c435b 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -44,7 +44,7 @@ class SQLiteService : public Provider Anope::string database; - sqlite3 *sql; + sqlite3 *sql = nullptr; Anope::string Escape(const Anope::string &query); @@ -53,19 +53,19 @@ class SQLiteService : public Provider ~SQLiteService(); - void Run(Interface *i, const Query &query) anope_override; + void Run(Interface *i, const Query &query) override; - Result RunQuery(const Query &query); + Result RunQuery(const Query &query) override; - std::vector<Query> CreateTable(const Anope::string &table, const Data &data) anope_override; + std::vector<Query> CreateTable(const Anope::string &table, const Data &data) override; - Query BuildInsert(const Anope::string &table, unsigned int id, Data &data); + Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) override; - Query GetTables(const Anope::string &prefix); + Query GetTables(const Anope::string &prefix) override; Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; class ModuleSQLite : public Module @@ -84,7 +84,7 @@ class ModuleSQLite : public Module SQLiteServices.clear(); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -134,7 +134,7 @@ class ModuleSQLite : public Module }; SQLiteService::SQLiteService(Module *o, const Anope::string &n, const Anope::string &d) -: Provider(o, n), database(d), sql(NULL) +: Provider(o, n), database(d) { int db = sqlite3_open_v2(database.c_str(), &this->sql, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); if (db != SQLITE_OK) @@ -200,7 +200,7 @@ Result SQLiteService::RunQuery(const Query &query) if (err != SQLITE_DONE) return SQLiteResult(query, real_query, sqlite3_errmsg(this->sql)); - return result; + return std::move(result); } std::vector<Query> SQLiteService::CreateTable(const Anope::string &table, const Data &data) diff --git a/modules/extra/m_ssl_gnutls.cpp b/modules/extra/m_ssl_gnutls.cpp index f01d92a3b..c6b532269 100644 --- a/modules/extra/m_ssl_gnutls.cpp +++ b/modules/extra/m_ssl_gnutls.cpp @@ -30,13 +30,13 @@ class MySSLService : public SSLService /** Initialize a socket to use SSL * @param s The socket */ - void Init(Socket *s) anope_override; + void Init(Socket *s) override; }; class SSLSocketIO : public SocketIO { public: - gnutls_session_t sess; + gnutls_session_t sess = nullptr; GnuTLS::X509CertCredentials* mycreds; /** Constructor @@ -49,43 +49,43 @@ class SSLSocketIO : public SocketIO * @param sz How much to read * @return Number of bytes received */ - int Recv(Socket *s, char *buf, size_t sz) anope_override; + int Recv(Socket *s, char *buf, size_t sz) override; /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - int Send(Socket *s, const char *buf, size_t sz) anope_override; + int Send(Socket *s, const char *buf, size_t sz) override; /** Accept a connection from a socket * @param s The socket * @return The new socket */ - ClientSocket *Accept(ListenSocket *s) anope_override; + ClientSocket *Accept(ListenSocket *s) override; /** Finished accepting a connection from a socket * @param s The socket * @return SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error */ - SocketFlag FinishAccept(ClientSocket *cs) anope_override; + SocketFlag FinishAccept(ClientSocket *cs) override; /** Connect the socket * @param s THe socket * @param target IP to connect to * @param port to connect to */ - void Connect(ConnectionSocket *s, const Anope::string &target, int port) anope_override; + void Connect(ConnectionSocket *s, const Anope::string &target, int port) override; /** Called to potentially finish a pending connection * @param s The socket * @return SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error. */ - SocketFlag FinishConnect(ConnectionSocket *s) anope_override; + SocketFlag FinishConnect(ConnectionSocket *s) override; /** Called when the socket is destructing */ - void Destroy() anope_override; + void Destroy() override; }; namespace GnuTLS @@ -115,11 +115,9 @@ namespace GnuTLS class DHParams { - gnutls_dh_params_t dh_params; + gnutls_dh_params_t dh_params = nullptr; public: - DHParams() : dh_params(NULL) { } - void Import(const Anope::string &dhstr) { if (dh_params != NULL) @@ -225,7 +223,7 @@ namespace GnuTLS class X509CertCredentials { - unsigned int refcount; + unsigned int refcount = 0; gnutls_certificate_credentials_t cred; DHParams dh; @@ -247,7 +245,7 @@ namespace GnuTLS X509Key key; X509CertCredentials(const Anope::string &certfile, const Anope::string &keyfile) - : refcount(0), certs(LoadFile(certfile)), key(LoadFile(keyfile)) + : certs(LoadFile(certfile)), key(LoadFile(keyfile)) { if (gnutls_certificate_allocate_credentials(&cred) < 0) throw ConfigException("Cannot allocate certificate credentials"); @@ -299,10 +297,10 @@ class GnuTLSModule : public Module GnuTLS::Init libinit; public: - GnuTLS::X509CertCredentials *cred; + GnuTLS::X509CertCredentials *cred = nullptr; MySSLService service; - GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), cred(NULL), service(this, "ssl") + GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), service(this, "ssl") { me = this; this->SetPermanent(true); @@ -332,7 +330,7 @@ class GnuTLSModule : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -368,7 +366,7 @@ class GnuTLSModule : public Module Log(LOG_DEBUG) << "m_ssl_gnutls: Successfully loaded certificate " << certfile << " and private key " << keyfile; } - void OnPreServerConnect() anope_override + void OnPreServerConnect() override { Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink); @@ -630,7 +628,7 @@ void SSLSocketIO::Destroy() delete this; } -SSLSocketIO::SSLSocketIO() : sess(NULL), mycreds(me->cred) +SSLSocketIO::SSLSocketIO() : mycreds(me->cred) { mycreds->incrref(); } diff --git a/modules/extra/m_ssl_openssl.cpp b/modules/extra/m_ssl_openssl.cpp index c457c82af..4245d3c09 100644 --- a/modules/extra/m_ssl_openssl.cpp +++ b/modules/extra/m_ssl_openssl.cpp @@ -29,7 +29,7 @@ class MySSLService : public SSLService /** Initialize a socket to use SSL * @param s The socket */ - void Init(Socket *s) anope_override; + void Init(Socket *s) override; }; class SSLSocketIO : public SocketIO @@ -48,43 +48,43 @@ class SSLSocketIO : public SocketIO * @param sz How much to read * @return Number of bytes received */ - int Recv(Socket *s, char *buf, size_t sz) anope_override; + int Recv(Socket *s, char *buf, size_t sz) override; /** Write something to the socket * @param s The socket * @param buf The data to write * @param size The length of the data */ - int Send(Socket *s, const char *buf, size_t sz) anope_override; + int Send(Socket *s, const char *buf, size_t sz) override; /** Accept a connection from a socket * @param s The socket * @return The new socket */ - ClientSocket *Accept(ListenSocket *s) anope_override; + ClientSocket *Accept(ListenSocket *s) override; /** Finished accepting a connection from a socket * @param s The socket * @return SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error */ - SocketFlag FinishAccept(ClientSocket *cs) anope_override; + SocketFlag FinishAccept(ClientSocket *cs) override; /** Connect the socket * @param s THe socket * @param target IP to connect to * @param port to connect to */ - void Connect(ConnectionSocket *s, const Anope::string &target, int port) anope_override; + void Connect(ConnectionSocket *s, const Anope::string &target, int port) override; /** Called to potentially finish a pending connection * @param s The socket * @return SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error. */ - SocketFlag FinishConnect(ConnectionSocket *s) anope_override; + SocketFlag FinishConnect(ConnectionSocket *s) override; /** Called when the socket is destructing */ - void Destroy() anope_override; + void Destroy() override; }; class SSLModule; @@ -138,7 +138,7 @@ class SSLModule : public Module SSL_CTX_free(server_ctx); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -186,7 +186,7 @@ class SSLModule : public Module } } - void OnPreServerConnect() anope_override + void OnPreServerConnect() override { Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink); diff --git a/modules/extra/stats/cs_fantasy_stats.cpp b/modules/extra/stats/cs_fantasy_stats.cpp index 4c6ad95ff..ba0d216cb 100644 --- a/modules/extra/stats/cs_fantasy_stats.cpp +++ b/modules/extra/stats/cs_fantasy_stats.cpp @@ -17,11 +17,11 @@ class MySQLInterface : public SQL::Interface public: MySQLInterface(Module *o) : SQL::Interface(o) { } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) Log(LOG_DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); @@ -73,7 +73,7 @@ class CSStats : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { prefix = conf->GetModule("m_chanstats")->Get<const Anope::string>("prefix", "anope_"); this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("m_chanstats")->Get<const Anope::string>("engine")); diff --git a/modules/extra/stats/cs_fantasy_top.cpp b/modules/extra/stats/cs_fantasy_top.cpp index b629cb132..3d4d75241 100644 --- a/modules/extra/stats/cs_fantasy_top.cpp +++ b/modules/extra/stats/cs_fantasy_top.cpp @@ -17,11 +17,11 @@ class MySQLInterface : public SQL::Interface public: MySQLInterface(Module *o) : SQL::Interface(o) { } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) Log(LOG_DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); @@ -98,7 +98,7 @@ class CSTop : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { prefix = conf->GetModule("m_chanstats")->Get<const Anope::string>("prefix", "anope_"); this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("m_chanstats")->Get<const Anope::string>("engine")); diff --git a/modules/extra/stats/irc2sql/irc2sql.cpp b/modules/extra/stats/irc2sql/irc2sql.cpp index 0d2d48d25..f0667e2e4 100644 --- a/modules/extra/stats/irc2sql/irc2sql.cpp +++ b/modules/extra/stats/irc2sql/irc2sql.cpp @@ -107,7 +107,7 @@ void IRC2SQL::OnUserConnect(User *u, bool &exempt) query.SetValue("ip", u->ip.addr()); query.SetValue("ident", u->GetIdent()); query.SetValue("vident", u->GetVIdent()); - query.SetValue("secure", u->HasMode("SSL") || u->HasExt("ssl") ? "Y" : "N"); + query.SetValue("secure", u->IsSecurelyConnected() ? "Y" : "N"); query.SetValue("account", u->Account() ? u->Account()->display : ""); query.SetValue("fingerprint", u->fingerprint); query.SetValue("signon", u->signon); @@ -152,7 +152,7 @@ void IRC2SQL::OnUserAway(User *u, const Anope::string &message) void IRC2SQL::OnFingerprint(User *u) { query = "UPDATE `" + prefix + "user` SET secure=@secure@, fingerprint=@fingerprint@ WHERE nick=@nick@"; - query.SetValue("secure", u->HasMode("SSL") || u->HasExt("ssl") ? "Y" : "N"); + query.SetValue("secure", u->IsSecurelyConnected() ? "Y" : "N"); query.SetValue("fingerprint", u->fingerprint); query.SetValue("nick", u->nick); this->RunQuery(query); diff --git a/modules/extra/stats/irc2sql/irc2sql.h b/modules/extra/stats/irc2sql/irc2sql.h index 3caec03ba..63acd4adc 100644 --- a/modules/extra/stats/irc2sql/irc2sql.h +++ b/modules/extra/stats/irc2sql/irc2sql.h @@ -14,11 +14,11 @@ class MySQLInterface : public SQL::Interface public: MySQLInterface(Module *o) : SQL::Interface(o) { } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) Log(LOG_DEBUG) << "m_irc2sql: Error executing query " << r.finished_query << ": " << r.GetError(); @@ -56,29 +56,29 @@ class IRC2SQL : public Module introduced_myself = false; } - void OnShutdown() anope_override; - void OnReload(Configuration::Conf *config) anope_override; - void OnNewServer(Server *server) anope_override; - void OnServerQuit(Server *server) anope_override; - void OnUserConnect(User *u, bool &exempt) anope_override; - void OnUserQuit(User *u, const Anope::string &msg) anope_override; - void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override; - void OnUserAway(User *u, const Anope::string &message) anope_override; - void OnFingerprint(User *u) anope_override; - void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override; - void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override; - void OnUserLogin(User *u) anope_override; - void OnNickLogout(User *u) anope_override; - void OnSetDisplayedHost(User *u) anope_override; + void OnShutdown() override; + void OnReload(Configuration::Conf *config) override; + void OnNewServer(Server *server) override; + void OnServerQuit(Server *server) override; + void OnUserConnect(User *u, bool &exempt) override; + void OnUserQuit(User *u, const Anope::string &msg) override; + void OnUserNickChange(User *u, const Anope::string &oldnick) override; + void OnUserAway(User *u, const Anope::string &message) override; + void OnFingerprint(User *u) override; + void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override; + void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override; + void OnUserLogin(User *u) override; + void OnNickLogout(User *u) override; + void OnSetDisplayedHost(User *u) override; - void OnChannelCreate(Channel *c) anope_override; - void OnChannelDelete(Channel *c) anope_override; - void OnLeaveChannel(User *u, Channel *c) anope_override; - void OnJoinChannel(User *u, Channel *c) anope_override; - EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override; - EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override; + void OnChannelCreate(Channel *c) override; + void OnChannelDelete(Channel *c) override; + void OnLeaveChannel(User *u, Channel *c) override; + void OnJoinChannel(User *u, Channel *c) override; + EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) override; + EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) override; - void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override; + void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) override; - void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) anope_override; + void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) override; }; diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp index 403174e6a..92f361f64 100644 --- a/modules/extra/stats/m_chanstats.cpp +++ b/modules/extra/stats/m_chanstats.cpp @@ -18,7 +18,7 @@ class CommandCSSetChanstats : public Command this->SetSyntax(_("\037channel\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); if (!ci) @@ -54,7 +54,7 @@ class CommandCSSetChanstats : public Command this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -107,12 +107,12 @@ class CommandNSSetChanstats : public Command this->OnSyntaxError(source, "CHANSTATS"); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, source.nc->display, params[0]); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -130,12 +130,12 @@ class CommandNSSASetChanstats : public CommandNSSetChanstats this->SetSyntax(_("\037nickname\037 {ON | OFF}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { this->Run(source, params[0], params[1], true); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(" "); @@ -149,11 +149,11 @@ class MySQLInterface : public SQL::Interface public: MySQLInterface(Module *o) : SQL::Interface(o) { } - void OnResult(const SQL::Result &r) anope_override + void OnResult(const SQL::Result &r) override { } - void OnError(const SQL::Result &r) anope_override + void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) Log(LOG_DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); @@ -492,7 +492,7 @@ class MChanstats : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); prefix = block->Get<const Anope::string>("prefix", "anope_"); @@ -509,7 +509,7 @@ class MChanstats : public Module Log(this) << "no database connection to " << engine; } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override { if (!show_all) return; @@ -517,7 +517,7 @@ class MChanstats : public Module info.AddOption(_("Chanstats")); } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { if (!show_hidden) return; @@ -525,7 +525,7 @@ class MChanstats : public Module info.AddOption(_("Chanstats")); } - void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) anope_override + void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) override { if (!source || !source->Account() || !c->ci || !cs_stats.HasExt(c->ci)) return; @@ -535,13 +535,13 @@ class MChanstats : public Module this->RunQuery(query); } - EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) override { this->OnModeChange(c, setter.GetUser()); return EVENT_CONTINUE; } - EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *, const Anope::string ¶m) anope_override + EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *, const Anope::string ¶m) override { this->OnModeChange(c, setter.GetUser()); return EVENT_CONTINUE; @@ -560,7 +560,7 @@ class MChanstats : public Module } public: - void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) anope_override + void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) override { if (!cu->chan->ci || !cs_stats.HasExt(cu->chan->ci)) return; @@ -576,7 +576,7 @@ class MChanstats : public Module this->RunQuery(query); } - void OnPrivmsg(User *u, Channel *c, Anope::string &msg) anope_override + void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override { if (!c->ci || !cs_stats.HasExt(c->ci)) return; @@ -617,14 +617,14 @@ class MChanstats : public Module this->RunQuery(query); } - void OnDelCore(NickCore *nc) anope_override + void OnDelCore(NickCore *nc) override { query = "DELETE FROM `" + prefix + "chanstats` WHERE `nick` = @nick@;"; query.SetValue("nick", nc->display); this->RunQuery(query); } - void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) anope_override + void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) override { query = "CALL " + prefix + "chanstats_proc_chgdisplay(@old_display@, @new_display@);"; query.SetValue("old_display", nc->display); @@ -632,20 +632,20 @@ class MChanstats : public Module this->RunQuery(query); } - void OnDelChan(ChannelInfo *ci) anope_override + void OnDelChan(ChannelInfo *ci) override { query = "DELETE FROM `" + prefix + "chanstats` WHERE `chan` = @channel@;"; query.SetValue("channel", ci->name); this->RunQuery(query); } - void OnChanRegistered(ChannelInfo *ci) + void OnChanRegistered(ChannelInfo *ci) override { if (CSDefChanstats) ci->Extend<bool>("CS_STATS"); } - void OnNickRegister(User *user, NickAlias *na, const Anope::string &) + void OnNickRegister(User *user, NickAlias *na, const Anope::string &) override { if (NSDefChanstats) na->nc->Extend<bool>("NS_STATS"); diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index f5e544544..40457f32c 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -20,7 +20,7 @@ class CommandBSSetFantasy : public Command this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); const Anope::string &value = params[1]; @@ -63,7 +63,7 @@ class CommandBSSetFantasy : public Command this->OnSyntaxError(source, source.command); } - bool OnHelp(CommandSource &source, const Anope::string &) anope_override + bool OnHelp(CommandSource &source, const Anope::string &) override { this->SendSyntax(source); source.Reply(_(" \n" @@ -92,7 +92,7 @@ class Fantasy : public Module { } - void OnPrivmsg(User *u, Channel *c, Anope::string &msg) anope_override + void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override { if (!u || !c || !c->ci || !c->ci->bi || msg.empty() || msg[0] == '\1') return; @@ -208,7 +208,7 @@ class Fantasy : public Module FOREACH_MOD(OnPostCommand, (source, cmd, params)); } - void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) anope_override + void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) override { if (fantasy.HasExt(ci)) info.AddOption(_("Fantasy")); diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp index 3c52a75b9..8b39b75b8 100644 --- a/modules/m_dns.cpp +++ b/modules/m_dns.cpp @@ -209,11 +209,11 @@ class Packet : public Query /* Source or destination of the packet */ sockaddrs addr; /* ID for this packet */ - unsigned short id; + unsigned short id = 0; /* Flags on the packet */ - unsigned short flags; + unsigned short flags = 0; - Packet(Manager *m, sockaddrs *a) : manager(m), id(0), flags(0) + Packet(Manager *m, sockaddrs *a) : manager(m) { if (a) addr = *a; @@ -453,7 +453,7 @@ namespace DNS class ReplySocket : public virtual Socket { public: - virtual ~ReplySocket() { } + virtual ~ReplySocket() = default; virtual void Reply(Packet *p) = 0; }; } @@ -468,13 +468,13 @@ class TCPSocket : public ListenSocket class Client : public ClientSocket, public Timer, public ReplySocket { Manager *manager; - Packet *packet; + Packet *packet = nullptr; unsigned char packet_buffer[524]; - int length; + int length = 0; public: Client(Manager *m, TCPSocket *l, int fd, const sockaddrs &addr) : Socket(fd, l->IsIPv6()), ClientSocket(l, addr), Timer(5), - manager(m), packet(NULL), length(0) + manager(m) { Log(LOG_DEBUG_2) << "Resolver: New client from " << addr.addr(); } @@ -486,16 +486,16 @@ class TCPSocket : public ListenSocket } /* Times out after a few seconds */ - void Tick(time_t) anope_override { } + void Tick(time_t) override { } - void Reply(Packet *p) anope_override + void Reply(Packet *p) override { delete packet; packet = p; SocketEngine::Change(this, true, SF_WRITABLE); } - bool ProcessRead() anope_override + bool ProcessRead() override { Log(LOG_DEBUG_2) << "Resolver: Reading from DNS TCP socket"; @@ -515,7 +515,7 @@ class TCPSocket : public ListenSocket return true; } - bool ProcessWrite() anope_override + bool ProcessWrite() override { Log(LOG_DEBUG_2) << "Resolver: Writing to DNS TCP socket"; @@ -545,7 +545,7 @@ class TCPSocket : public ListenSocket TCPSocket(Manager *m, const Anope::string &ip, int port) : Socket(-1, ip.find(':') != Anope::string::npos), ListenSocket(ip, port, ip.find(':') != Anope::string::npos), manager(m) { } - ClientSocket *OnAccept(int fd, const sockaddrs &addr) anope_override + ClientSocket *OnAccept(int fd, const sockaddrs &addr) override { return new Client(this->manager, this, fd, addr); } @@ -566,7 +566,7 @@ class UDPSocket : public ReplySocket delete packets[i]; } - void Reply(Packet *p) anope_override + void Reply(Packet *p) override { packets.push_back(p); SocketEngine::Change(this, true, SF_WRITABLE); @@ -574,7 +574,7 @@ class UDPSocket : public ReplySocket std::deque<Packet *>& GetPackets() { return packets; } - bool ProcessRead() anope_override + bool ProcessRead() override { Log(LOG_DEBUG_2) << "Resolver: Reading from DNS UDP socket"; @@ -585,7 +585,7 @@ class UDPSocket : public ReplySocket return this->manager->HandlePacket(this, packet_buffer, length, &from_server); } - bool ProcessWrite() anope_override + bool ProcessWrite() override { Log(LOG_DEBUG_2) << "Resolver: Writing to DNS UDP socket"; @@ -622,7 +622,7 @@ class NotifySocket : public Socket SocketEngine::Change(this, true, SF_WRITABLE); } - bool ProcessWrite() anope_override + bool ProcessWrite() override { if (!packet) return false; @@ -652,18 +652,17 @@ class MyManager : public Manager, public Timer typedef TR1NS::unordered_map<Question, Query, Question::hash> cache_map; cache_map cache; - TCPSocket *tcpsock; - UDPSocket *udpsock; + TCPSocket *tcpsock = nullptr; + UDPSocket *udpsock = nullptr; - bool listen; + bool listen = false; sockaddrs addrs; std::vector<std::pair<Anope::string, short> > notify; public: std::map<unsigned short, Request *> requests; - MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), tcpsock(NULL), udpsock(NULL), - listen(false), cur_id(rand()) + MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), cur_id(rand()) { } @@ -733,7 +732,7 @@ class MyManager : public Manager, public Timer } public: - void Process(Request *req) anope_override + void Process(Request *req) override { Log(LOG_DEBUG_2) << "Resolver: Processing request to lookup " << req->name << ", of type " << req->type; @@ -760,12 +759,12 @@ class MyManager : public Manager, public Timer this->udpsock->Reply(p); } - void RemoveRequest(Request *req) anope_override + void RemoveRequest(Request *req) override { this->requests.erase(req->id); } - bool HandlePacket(ReplySocket *s, const unsigned char *const packet_buffer, int length, sockaddrs *from) anope_override + bool HandlePacket(ReplySocket *s, const unsigned char *const packet_buffer, int length, sockaddrs *from) override { if (length < Packet::HEADER_LENGTH) return true; @@ -920,12 +919,12 @@ class MyManager : public Manager, public Timer return true; } - void UpdateSerial() anope_override + void UpdateSerial() override { serial = Anope::CurTime; } - void Notify(const Anope::string &zone) anope_override + void Notify(const Anope::string &zone) override { /* notify slaves of the update */ for (unsigned i = 0; i < notify.size(); ++i) @@ -956,12 +955,12 @@ class MyManager : public Manager, public Timer } } - uint32_t GetSerial() const anope_override + uint32_t GetSerial() const override { return serial; } - void Tick(time_t now) anope_override + void Tick(time_t now) override { Log(LOG_DEBUG_2) << "Resolver: Purging DNS cache"; @@ -1035,7 +1034,7 @@ class ModuleDNS : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); @@ -1101,7 +1100,7 @@ class ModuleDNS : public Module } } - void OnModuleUnload(User *u, Module *m) anope_override + void OnModuleUnload(User *u, Module *m) override { for (std::map<unsigned short, Request *>::iterator it = this->manager.requests.begin(), it_end = this->manager.requests.end(); it != it_end;) { diff --git a/modules/m_dnsbl.cpp b/modules/m_dnsbl.cpp index d6a3f6524..79fa92a73 100644 --- a/modules/m_dnsbl.cpp +++ b/modules/m_dnsbl.cpp @@ -18,20 +18,18 @@ struct Blacklist { struct Reply { - int code; + int code = 0; Anope::string reason; - bool allow_account; + bool allow_account = false; - Reply() : code(0), allow_account(false) { } + Reply() = default; }; Anope::string name; - time_t bantime; + time_t bantime = 0; Anope::string reason; std::vector<Reply> replies; - Blacklist() : bantime(0) { } - Reply *Find(int code) { for (unsigned int i = 0; i < replies.size(); ++i) @@ -50,7 +48,7 @@ class DNSBLResolver : public Request public: DNSBLResolver(Module *c, User *u, const Blacklist &b, const Anope::string &host, bool add_akill) : Request(dnsmanager, c, host, QUERY_A, true), user(u), blacklist(b), add_to_akill(add_akill) { } - void OnLookupComplete(const Query *record) anope_override + void OnLookupComplete(const Query *record) override { if (!user || user->Quitting()) return; @@ -110,7 +108,7 @@ class ModuleDNSBL : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); this->check_on_connect = block->Get<bool>("check_on_connect"); @@ -152,7 +150,7 @@ class ModuleDNSBL : public Module } } - void OnUserConnect(User *user, bool &exempt) anope_override + void OnUserConnect(User *user, bool &exempt) override { if (exempt || user->Quitting() || (!this->check_on_connect && !Me->IsSynced()) || !dnsmanager) return; diff --git a/modules/m_helpchan.cpp b/modules/m_helpchan.cpp index 3ff142138..719796542 100644 --- a/modules/m_helpchan.cpp +++ b/modules/m_helpchan.cpp @@ -15,7 +15,7 @@ class HelpChannel : public Module { } - EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelMode *mode, const Anope::string ¶m) override { if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this)->Get<const Anope::string>("helpchannel"))) { diff --git a/modules/m_httpd.cpp b/modules/m_httpd.cpp index a3f2b0110..ad2a28b99 100644 --- a/modules/m_httpd.cpp +++ b/modules/m_httpd.cpp @@ -41,19 +41,19 @@ class MyHTTPClient : public HTTPClient { HTTPProvider *provider; HTTPMessage message; - bool header_done, served; + bool header_done = false, served = false; Anope::string page_name; Reference<HTTPPage> page; Anope::string ip; - unsigned content_length; + unsigned content_length = 0; enum { ACTION_NONE, ACTION_GET, ACTION_POST - } action; + } action = ACTION_NONE; void Serve() { @@ -94,7 +94,7 @@ class MyHTTPClient : public HTTPClient public: time_t created; - MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), header_done(false), served(false), ip(a.addr()), content_length(0), action(ACTION_NONE), created(Anope::CurTime) + MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), ip(a.addr()), created(Anope::CurTime) { Log(LOG_DEBUG, "httpd") << "Accepted connection " << f << " from " << a.addr(); } @@ -105,17 +105,17 @@ class MyHTTPClient : public HTTPClient } /* Close connection once all data is written */ - bool ProcessWrite() anope_override + bool ProcessWrite() override { return !BinarySocket::ProcessWrite() || this->write_buffer.empty() ? false : true; } - const Anope::string GetIP() anope_override + const Anope::string GetIP() override { return this->ip; } - bool Read(const char *buffer, size_t l) anope_override + bool Read(const char *buffer, size_t l) override { message.content.append(buffer, l); @@ -233,7 +233,7 @@ class MyHTTPClient : public HTTPClient return true; } - void SendError(HTTPError err, const Anope::string &msg) anope_override + void SendError(HTTPError err, const Anope::string &msg) override { HTTPReply h; @@ -244,7 +244,7 @@ class MyHTTPClient : public HTTPClient this->SendReply(&h); } - void SendReply(HTTPReply *msg) anope_override + void SendReply(HTTPReply *msg) override { this->WriteClient("HTTP/1.1 " + GetStatusFromCode(msg->error)); this->WriteClient("Date: " + BuildDate()); @@ -296,7 +296,7 @@ class MyHTTPProvider : public HTTPProvider, public Timer public: MyHTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, const int t, bool s) : Socket(-1, i.find(':') != Anope::string::npos), HTTPProvider(c, n, i, p, s), Timer(c, 10, Anope::CurTime, true), timeout(t) { } - void Tick(time_t) anope_override + void Tick(time_t) override { while (!this->clients.empty()) { @@ -309,24 +309,24 @@ class MyHTTPProvider : public HTTPProvider, public Timer } } - ClientSocket* OnAccept(int fd, const sockaddrs &addr) anope_override + ClientSocket* OnAccept(int fd, const sockaddrs &addr) override { MyHTTPClient *c = new MyHTTPClient(this, fd, addr); this->clients.push_back(c); return c; } - bool RegisterPage(HTTPPage *page) anope_override + bool RegisterPage(HTTPPage *page) override { return this->pages.insert(std::make_pair(page->GetURL(), page)).second; } - void UnregisterPage(HTTPPage *page) anope_override + void UnregisterPage(HTTPPage *page) override { this->pages.erase(page->GetURL()); } - HTTPPage* FindPage(const Anope::string &pname) anope_override + HTTPPage* FindPage(const Anope::string &pname) override { if (this->pages.count(pname) == 0) return NULL; @@ -358,7 +358,7 @@ class HTTPD : public Module this->providers.clear(); } - void OnReload(Configuration::Conf *config) anope_override + void OnReload(Configuration::Conf *config) override { Configuration::Block *conf = config->GetModule(this); std::set<Anope::string> existing; @@ -453,7 +453,7 @@ class HTTPD : public Module } } - void OnModuleLoad(User *u, Module *m) anope_override + void OnModuleLoad(User *u, Module *m) override { for (std::map<Anope::string, MyHTTPProvider *>::iterator it = this->providers.begin(), it_end = this->providers.end(); it != it_end; ++it) { diff --git a/modules/m_proxyscan.cpp b/modules/m_proxyscan.cpp index 9b1842689..990eee620 100644 --- a/modules/m_proxyscan.cpp +++ b/modules/m_proxyscan.cpp @@ -30,12 +30,12 @@ class ProxyCallbackListener : public ListenSocket { } - void OnAccept() anope_override + void OnAccept() override { this->Write(ProxyCheckString); } - bool ProcessWrite() anope_override + bool ProcessWrite() override { return !BufferedSocket::ProcessWrite() || this->write_buffer.empty() ? false : true; } @@ -46,7 +46,7 @@ class ProxyCallbackListener : public ListenSocket { } - ClientSocket *OnAccept(int fd, const sockaddrs &addr) anope_override + ClientSocket *OnAccept(int fd, const sockaddrs &addr) override { return new ProxyCallbackClient(this, fd, addr); } @@ -74,7 +74,7 @@ class ProxyConnect : public ConnectionSocket proxies.erase(this); } - virtual void OnConnect() anope_override = 0; + virtual void OnConnect() override = 0; virtual const Anope::string GetType() const = 0; protected: @@ -114,7 +114,7 @@ class HTTPProxyConnect : public ProxyConnect, public BufferedSocket { } - void OnConnect() anope_override + void OnConnect() override { this->Write("CONNECT %s:%d HTTP/1.0", target_ip.c_str(), target_port); this->Write("Content-Length: 0"); @@ -122,12 +122,12 @@ class HTTPProxyConnect : public ProxyConnect, public BufferedSocket this->Write(""); } - const Anope::string GetType() const anope_override + const Anope::string GetType() const override { return "HTTP"; } - bool ProcessRead() anope_override + bool ProcessRead() override { bool b = BufferedSocket::ProcessRead(); if (this->GetLine() == ProxyCheckString) @@ -146,7 +146,7 @@ class SOCKS5ProxyConnect : public ProxyConnect, public BinarySocket { } - void OnConnect() anope_override + void OnConnect() override { sockaddrs target_addr; char buf[4 + sizeof(target_addr.sa4.sin_addr.s_addr) + sizeof(target_addr.sa4.sin_port)]; @@ -173,12 +173,12 @@ class SOCKS5ProxyConnect : public ProxyConnect, public BinarySocket this->Write(buf, ptr); } - const Anope::string GetType() const anope_override + const Anope::string GetType() const override { return "SOCKS5"; } - bool Read(const char *buffer, size_t l) anope_override + bool Read(const char *buffer, size_t l) override { if (l >= ProxyCheckString.length() && !strncmp(buffer, ProxyCheckString.c_str(), ProxyCheckString.length())) { @@ -205,7 +205,7 @@ class ModuleProxyScan : public Module { } - void Tick(time_t) anope_override + void Tick(time_t) override { for (std::set<ProxyConnect *>::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;) { @@ -249,7 +249,7 @@ class ModuleProxyScan : public Module delete this->listener; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = Config->GetModule(this); @@ -329,7 +329,7 @@ class ModuleProxyScan : public Module } } - void OnUserConnect(User *user, bool &exempt) anope_override + void OnUserConnect(User *user, bool &exempt) override { if (exempt || user->Quitting() || !Me->IsSynced() || !user->server->IsSynced()) return; diff --git a/modules/m_redis.cpp b/modules/m_redis.cpp index 8b91a15ef..62c831a44 100644 --- a/modules/m_redis.cpp +++ b/modules/m_redis.cpp @@ -25,10 +25,10 @@ class RedisSocket : public BinarySocket, public ConnectionSocket ~RedisSocket(); - void OnConnect() anope_override; - void OnError(const Anope::string &error) anope_override; + void OnConnect() override; + void OnError(const Anope::string &error) override; - bool Read(const char *buffer, size_t l) anope_override; + bool Read(const char *buffer, size_t l) override; }; class Transaction : public Interface @@ -51,7 +51,7 @@ class Transaction : public Interface } } - void OnResult(const Reply &r) anope_override + void OnResult(const Reply &r) override { /* This is a multi bulk reply of the results of the queued commands * in this transaction @@ -82,13 +82,12 @@ class MyRedisService : public Provider int port; unsigned db; - RedisSocket *sock, *sub; + RedisSocket *sock = nullptr, *sub = nullptr; Transaction ti; - bool in_transaction; + bool in_transaction = false; - MyRedisService(Module *c, const Anope::string &n, const Anope::string &h, int p, unsigned d) : Provider(c, n), host(h), port(p), db(d), sock(NULL), sub(NULL), - ti(c), in_transaction(false) + MyRedisService(Module *c, const Anope::string &n, const Anope::string &h, int p, unsigned d) : Provider(c, n), host(h), port(p), db(d), ti(c) { sock = new RedisSocket(this, host.find(':') != Anope::string::npos); sock->Connect(host, port); @@ -157,7 +156,7 @@ class MyRedisService : public Provider } public: - bool IsSocketDead() anope_override + bool IsSocketDead() override { return this->sock && this->sock->flags[SF_DEAD]; } @@ -188,7 +187,7 @@ class MyRedisService : public Provider this->Send(sock, i, args); } - void SendCommand(Interface *i, const std::vector<Anope::string> &cmds) anope_override + void SendCommand(Interface *i, const std::vector<Anope::string> &cmds) override { std::vector<std::pair<const char *, size_t> > args; for (unsigned j = 0; j < cmds.size(); ++j) @@ -196,7 +195,7 @@ class MyRedisService : public Provider this->Send(i, args); } - void SendCommand(Interface *i, const Anope::string &str) anope_override + void SendCommand(Interface *i, const Anope::string &str) override { std::vector<Anope::string> args; spacesepstream(str).GetTokens(args); @@ -204,7 +203,7 @@ class MyRedisService : public Provider } public: - bool BlockAndProcess() anope_override + bool BlockAndProcess() override { if (!this->sock->ProcessWrite()) this->sock->flags[SF_DEAD] = true; @@ -215,7 +214,7 @@ class MyRedisService : public Provider return !this->sock->interfaces.empty(); } - void Subscribe(Interface *i, const Anope::string &pattern) anope_override + void Subscribe(Interface *i, const Anope::string &pattern) override { if (sub == NULL) { @@ -231,13 +230,13 @@ class MyRedisService : public Provider sub->subinterfaces[pattern] = i; } - void Unsubscribe(const Anope::string &pattern) anope_override + void Unsubscribe(const Anope::string &pattern) override { if (sub) sub->subinterfaces.erase(pattern); } - void StartTransaction() anope_override + void StartTransaction() override { if (in_transaction) throw CoreException(); @@ -246,7 +245,7 @@ class MyRedisService : public Provider in_transaction = true; } - void CommitTransaction() anope_override + void CommitTransaction() override { /* The result of the transaction comes back to the reply of EXEC as a multi bulk. * The reply to the individual commands that make up the transaction when executed @@ -549,7 +548,7 @@ class ModuleRedis : public Module } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); std::vector<Anope::string> new_services; @@ -578,7 +577,7 @@ class ModuleRedis : public Module } } - void OnModuleUnload(User *, Module *m) anope_override + void OnModuleUnload(User *, Module *m) override { for (std::map<Anope::string, MyRedisService *>::iterator it = services.begin(); it != services.end(); ++it) { diff --git a/modules/m_rewrite.cpp b/modules/m_rewrite.cpp index 9405e55a7..3da55bb5f 100644 --- a/modules/m_rewrite.cpp +++ b/modules/m_rewrite.cpp @@ -106,7 +106,7 @@ class RewriteCommand : public Command public: RewriteCommand(Module *creator) : Command(creator, "rewrite", 0, 0) { } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { std::vector<Anope::string> full_params = params; full_params.insert(full_params.begin(), source.command); @@ -125,7 +125,7 @@ class RewriteCommand : public Command Log() << "m_rewrite: Unable to rewrite '" << source.command << (!params.empty() ? " " + params[0] : "") << "'"; } - void OnServHelp(CommandSource &source) anope_override + void OnServHelp(CommandSource &source) override { Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command); if (r != NULL && !r->desc.empty()) @@ -135,7 +135,7 @@ class RewriteCommand : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command); if (r != NULL && !r->desc.empty()) @@ -158,7 +158,7 @@ class ModuleRewrite : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Rewrite::rewrites.clear(); diff --git a/modules/m_sasl.cpp b/modules/m_sasl.cpp index 7a803469e..db0ec3d17 100644 --- a/modules/m_sasl.cpp +++ b/modules/m_sasl.cpp @@ -17,7 +17,7 @@ class Plain : public Mechanism public: Plain(Module *o) : Mechanism(o, "PLAIN") { } - void ProcessMessage(Session *sess, const SASL::Message &m) anope_override + void ProcessMessage(Session *sess, const SASL::Message &m) override { if (m.type == "S") { @@ -80,12 +80,12 @@ class External : public Mechanism throw ModuleException("No CertFP"); } - Session* CreateSession(const Anope::string &uid) anope_override + Session* CreateSession(const Anope::string &uid) override { return new Session(this, uid); } - void ProcessMessage(SASL::Session *sess, const SASL::Message &m) anope_override + void ProcessMessage(SASL::Session *sess, const SASL::Message &m) override { Session *mysess = anope_dynamic_static_cast<Session *>(sess); @@ -137,7 +137,7 @@ class SASLService : public SASL::Service, public Timer delete it->second; } - void ProcessMessage(const SASL::Message &m) anope_override + void ProcessMessage(const SASL::Message &m) override { if (m.target != "*") { @@ -202,7 +202,7 @@ class SASLService : public SASL::Service, public Timer session->mech->ProcessMessage(session, m); } - Anope::string GetAgent() anope_override + Anope::string GetAgent() override { Anope::string agent = Config->GetModule(Service::owner)->Get<Anope::string>("agent", "NickServ"); BotInfo *bi = Config->GetClient(agent); @@ -211,7 +211,7 @@ class SASLService : public SASL::Service, public Timer return agent; } - Session* GetSession(const Anope::string &uid) anope_override + Session* GetSession(const Anope::string &uid) override { std::map<Anope::string, Session *>::iterator it = sessions.find(uid); if (it != sessions.end()) @@ -219,12 +219,12 @@ class SASLService : public SASL::Service, public Timer return NULL; } - void RemoveSession(Session *sess) anope_override + void RemoveSession(Session *sess) override { sessions.erase(sess->uid); } - void DeleteSessions(Mechanism *mech, bool da) anope_override + void DeleteSessions(Mechanism *mech, bool da) override { for (std::map<Anope::string, Session *>::iterator it = sessions.begin(); it != sessions.end();) { @@ -238,7 +238,7 @@ class SASLService : public SASL::Service, public Timer } } - void SendMessage(Session *session, const Anope::string &mtype, const Anope::string &data) anope_override + void SendMessage(Session *session, const Anope::string &mtype, const Anope::string &data) override { SASL::Message msg; msg.source = this->GetAgent(); @@ -249,7 +249,7 @@ class SASLService : public SASL::Service, public Timer IRCD->SendSASLMessage(msg); } - void Succeed(Session *session, NickCore *nc) anope_override + void Succeed(Session *session, NickCore *nc) override { // If the user is already introduced then we log them in now. // Otherwise, we send an SVSLOGIN to log them in later. @@ -261,17 +261,17 @@ class SASLService : public SASL::Service, public Timer } else { - IRCD->SendSVSLogin(session->uid, nc->display, na->GetVhostIdent(), na->GetVhostHost()); + IRCD->SendSVSLogin(session->uid, na); } this->SendMessage(session, "D", "S"); } - void Fail(Session *session) anope_override + void Fail(Session *session) override { this->SendMessage(session, "D", "F"); } - void SendMechs(Session *session) anope_override + void SendMechs(Session *session) override { std::vector<Anope::string> mechs = Service::GetServiceKeys("SASL::Mechanism"); Anope::string buf; @@ -281,7 +281,7 @@ class SASLService : public SASL::Service, public Timer this->SendMessage(session, "M", buf.empty() ? "" : buf.substr(1)); } - void Tick(time_t) anope_override + void Tick(time_t) override { for (std::map<Anope::string, Session *>::iterator it = sessions.begin(); it != sessions.end();) { @@ -303,7 +303,7 @@ class ModuleSASL : public Module SASLService sasl; Plain plain; - External *external; + External *external = nullptr; std::vector<Anope::string> mechs; @@ -322,7 +322,7 @@ class ModuleSASL : public Module public: ModuleSASL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - sasl(this), plain(this), external(NULL) + sasl(this), plain(this) { try { @@ -337,17 +337,17 @@ class ModuleSASL : public Module delete external; } - void OnModuleLoad(User *, Module *) anope_override + void OnModuleLoad(User *, Module *) override { CheckMechs(); } - void OnModuleUnload(User *, Module *) anope_override + void OnModuleUnload(User *, Module *) override { CheckMechs(); } - void OnPreUplinkSync(Server *) anope_override + void OnPreUplinkSync(Server *) override { // We have not yet sent a mechanism list so always do it here. IRCD->SendSASLMechanisms(mechs); diff --git a/modules/m_xmlrpc.cpp b/modules/m_xmlrpc.cpp index 867ae217d..bb929e954 100644 --- a/modules/m_xmlrpc.cpp +++ b/modules/m_xmlrpc.cpp @@ -39,12 +39,12 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage public: MyXMLRPCServiceInterface(Module *creator, const Anope::string &sname) : XMLRPCServiceInterface(creator, sname), HTTPPage("/xmlrpc", "text/xml") { } - void Register(XMLRPCEvent *event) anope_override + void Register(XMLRPCEvent *event) override { this->events.push_back(event); } - void Unregister(XMLRPCEvent *event) anope_override + void Unregister(XMLRPCEvent *event) override { std::deque<XMLRPCEvent *>::iterator it = std::find(this->events.begin(), this->events.end(), event); @@ -52,7 +52,7 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage this->events.erase(it); } - Anope::string Sanitize(const Anope::string &string) anope_override + Anope::string Sanitize(const Anope::string &string) override { Anope::string ret = string; for (int i = 0; special[i].character.empty() == false; ++i) @@ -145,7 +145,7 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage } public: - bool OnRequest(HTTPProvider *provider, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) anope_override + bool OnRequest(HTTPProvider *provider, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) override { Anope::string content = message.content, tname, data; XMLRPCRequest request(reply); @@ -182,7 +182,7 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage return true; } - void Reply(XMLRPCRequest &request) anope_override + void Reply(XMLRPCRequest &request) override { if (!request.id.empty()) request.reply("id", request.id); @@ -214,7 +214,7 @@ class ModuleXMLRPC : public Module httpref->UnregisterPage(&xmlrpcinterface); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { if (httpref) httpref->UnregisterPage(&xmlrpcinterface); diff --git a/modules/m_xmlrpc_main.cpp b/modules/m_xmlrpc_main.cpp index 6259a14b8..2a71c13b7 100644 --- a/modules/m_xmlrpc_main.cpp +++ b/modules/m_xmlrpc_main.cpp @@ -22,7 +22,7 @@ class XMLRPCIdentifyRequest : public IdentifyRequest public: XMLRPCIdentifyRequest(Module *m, XMLRPCRequest& req, HTTPClient *c, XMLRPCServiceInterface* iface, const Anope::string &acc, const Anope::string &pass) : IdentifyRequest(m, acc, pass), request(req), repl(request.r), client(c), xinterface(iface) { } - void OnSuccess() anope_override + void OnSuccess() override { if (!xinterface || !client) return; @@ -36,7 +36,7 @@ class XMLRPCIdentifyRequest : public IdentifyRequest client->SendReply(&request.r); } - void OnFail() anope_override + void OnFail() override { if (!xinterface || !client) return; @@ -53,7 +53,7 @@ class XMLRPCIdentifyRequest : public IdentifyRequest class MyXMLRPCEvent : public XMLRPCEvent { public: - bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) anope_override + bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) override { if (request.name == "command") this->DoCommand(iface, client, request); @@ -101,7 +101,7 @@ class MyXMLRPCEvent : public XMLRPCEvent XMLRPCommandReply(Anope::string &s) : str(s) { } - void SendMessage(BotInfo *, const Anope::string &msg) anope_override + void SendMessage(BotInfo *, const Anope::string &msg) override { str += msg + "\n"; }; diff --git a/modules/ns_maxemail.cpp b/modules/ns_maxemail.cpp index 2220224f0..3d5dec0c7 100644 --- a/modules/ns_maxemail.cpp +++ b/modules/ns_maxemail.cpp @@ -14,7 +14,7 @@ class NSMaxEmail : public Module { - bool clean; + bool clean = false; /* strip dots from username, and remove anything after the first + */ Anope::string CleanMail(const Anope::string &email) @@ -77,16 +77,15 @@ class NSMaxEmail : public Module public: NSMaxEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) - , clean(false) { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { clean = conf->GetModule(this)->Get<bool>("remove_aliases", "true"); } - EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (source.IsOper()) return EVENT_CONTINUE; diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index c16fbb482..7f86e9e0c 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -16,7 +16,7 @@ class ChannelModeFlood : public ChannelModeParam public: ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { try { @@ -45,7 +45,7 @@ class BahamutIRCdProto : public IRCDProto MaxModes = 60; } - void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) override { if (Servers::Capab.count("TSMODE") > 0) { @@ -55,47 +55,47 @@ class BahamutIRCdProto : public IRCDProto IRCDProto::SendModeInternal(source, dest, buf); } - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { UplinkSocket::Message(source) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick, time_t time) anope_override + void SendSVSHold(const Anope::string &nick, time_t time) override { UplinkSocket::Message(Me) << "SVSHOLD " << nick << " " << time << " :Being held for registered user"; } /* SVSHOLD - release */ - void SendSVSHoldDel(const Anope::string &nick) anope_override + void SendSVSHoldDel(const Anope::string &nick) override { UplinkSocket::Message(Me) << "SVSHOLD " << nick << " 0"; } /* SQLINE */ - void SendSQLine(User *, const XLine *x) anope_override + void SendSQLine(User *, const XLine *x) override { UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason(); } /* UNSLINE */ - void SendSGLineDel(const XLine *x) anope_override + void SendSGLineDel(const XLine *x) override { UplinkSocket::Message() << "UNSGLINE 0 :" << x->mask; } /* UNSZLINE */ - void SendSZLineDel(const XLine *x) anope_override + void SendSZLineDel(const XLine *x) override { /* this will likely fail so its only here for legacy */ UplinkSocket::Message() << "UNSZLINE 0 " << x->GetHost(); @@ -104,7 +104,7 @@ class BahamutIRCdProto : public IRCDProto } /* SZLINE */ - void SendSZLine(User *, const XLine *x) anope_override + void SendSZLine(User *, const XLine *x) override { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -117,19 +117,19 @@ class BahamutIRCdProto : public IRCDProto } /* SVSNOOP */ - void SendSVSNOOP(const Server *server, bool set) anope_override + void SendSVSNOOP(const Server *server, bool set) override { UplinkSocket::Message() << "SVSNOOP " << server->GetName() << " " << (set ? "+" : "-"); } /* SGLINE */ - void SendSGLine(User *, const XLine *x) anope_override + void SendSGLine(User *, const XLine *x) override { UplinkSocket::Message() << "SGLINE " << x->mask.length() << " :" << x->mask << ":" << x->GetReason(); } /* RAKILL */ - void SendAkillDel(const XLine *x) anope_override + void SendAkillDel(const XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) return; @@ -149,19 +149,19 @@ class BahamutIRCdProto : public IRCDProto } /* TOPIC */ - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } /* UNSQLINE */ - void SendSQLineDel(const XLine *x) anope_override + void SendSQLineDel(const XLine *x) override { UplinkSocket::Message() << "UNSQLINE " << x->mask; } /* JOIN - SJOIN */ - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { UplinkSocket::Message(user) << "SJOIN " << c->creation_time << " " << c->name; if (status) @@ -184,7 +184,7 @@ class BahamutIRCdProto : public IRCDProto } } - void SendAkill(User *u, XLine *x) anope_override + void SendAkill(User *u, XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) { @@ -230,34 +230,34 @@ class BahamutIRCdProto : public IRCDProto /* Note: if the stamp is null 0, the below usage is correct of Bahamut */ - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override { UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; } - void SendBOB() anope_override + void SendBOB() override { UplinkSocket::Message() << "BURST"; } - void SendEOB() anope_override + void SendEOB() override { UplinkSocket::Message() << "BURST 0"; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 0 :" << u->realname; } /* SERVER */ - void SendServer(const Server *server) anope_override + void SendServer(const Server *server) override { UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " :TS"; UplinkSocket::Message() << "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3"; @@ -274,7 +274,7 @@ class BahamutIRCdProto : public IRCDProto this->SendBOB(); } - void SendChannel(Channel *c) anope_override + void SendChannel(Channel *c) override { Anope::string modes = c->GetModes(true, true); if (modes.empty()) @@ -282,12 +282,12 @@ class BahamutIRCdProto : public IRCDProto UplinkSocket::Message() << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :"; } - void SendLogin(User *u, NickAlias *) anope_override + void SendLogin(User *u, NickAlias *) override { IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon); } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 1"); } @@ -297,7 +297,7 @@ struct IRCDMessageBurst : IRCDMessage { IRCDMessageBurst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* If we found a server with the given source, that one just * finished bursting. If there was no source, then our uplink @@ -315,7 +315,7 @@ struct IRCDMessageMode : IRCDMessage { IRCDMessageMode(Module *creator, const Anope::string &sname) : IRCDMessage(creator, sname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() > 2 && IRCD->IsChannelValid(params[0])) { @@ -366,7 +366,7 @@ struct IRCDMessageNick : IRCDMessage { IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() == 10) { @@ -399,7 +399,7 @@ struct IRCDMessageServer : IRCDMessage { IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[2]); @@ -410,7 +410,7 @@ struct IRCDMessageSJoin : IRCDMessage { IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string modes; if (params.size() >= 4) @@ -466,7 +466,7 @@ struct IRCDMessageTopic : IRCDMessage { IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Channel *c = Channel::Find(params[0]); if (c) @@ -559,7 +559,7 @@ class ProtoBahamut : public Module } - void OnUserNickChange(User *u, const Anope::string &) anope_override + void OnUserNickChange(User *u, const Anope::string &) override { u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); IRCD->SendLogout(u); diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 5c034d624..8d9267438 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -16,7 +16,7 @@ static bool UseSVSAccount = false; // Temporary backwards compatibility hack un class HybridProto : public IRCDProto { - void SendSVSKillInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *u, const Anope::string &buf) override { IRCDProto::SendSVSKillInternal(source, u, buf); u->KillInternal(source, buf); @@ -39,42 +39,42 @@ class HybridProto : public IRCDProto MaxModes = 6; } - void SendInvite(const MessageSource &source, const Channel *c, User *u) anope_override + void SendInvite(const MessageSource &source, const Channel *c, User *u) override { UplinkSocket::Message(source) << "INVITE " << u->GetUID() << " " << c->name << " " << c->creation_time; } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "NOTICE $$" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "PRIVMSG $$" << dest->GetName() << " :" << msg; } - void SendSQLine(User *, const XLine *x) anope_override + void SendSQLine(User *, const XLine *x) override { UplinkSocket::Message(Me) << "RESV * " << (x->expires ? x->expires - Anope::CurTime : 0) << " " << x->mask << " :" << x->reason; } - void SendSGLineDel(const XLine *x) anope_override + void SendSGLineDel(const XLine *x) override { UplinkSocket::Message(Me) << "UNXLINE * " << x->mask; } - void SendSGLine(User *, const XLine *x) anope_override + void SendSGLine(User *, const XLine *x) override { UplinkSocket::Message(Me) << "XLINE * " << x->mask << " " << (x->expires ? x->expires - Anope::CurTime : 0) << " :" << x->GetReason(); } - void SendSZLineDel(const XLine *x) anope_override + void SendSZLineDel(const XLine *x) override { UplinkSocket::Message(Me) << "UNDLINE * " << x->GetHost(); } - void SendSZLine(User *, const XLine *x) anope_override + void SendSZLine(User *, const XLine *x) override { /* Calculate the time left before this would expire, capping it at 2 days */ time_t timeleft = x->expires - Anope::CurTime; @@ -85,7 +85,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "DLINE * " << timeleft << " " << x->GetHost() << " :" << x->GetReason(); } - void SendAkillDel(const XLine *x) anope_override + void SendAkillDel(const XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) return; @@ -93,12 +93,12 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "UNKLINE * " << x->GetUser() << " " << x->GetHost(); } - void SendSQLineDel(const XLine *x) anope_override + void SendSQLineDel(const XLine *x) override { UplinkSocket::Message(Me) << "UNRESV * " << x->mask; } - void SendJoin(User *u, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *u, Channel *c, const ChannelStatus *status) override { /* * Note that we must send our modes with the SJOIN and can not add them to the @@ -117,7 +117,7 @@ class HybridProto : public IRCDProto } } - void SendAkill(User *u, XLine *x) anope_override + void SendAkill(User *u, XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) { @@ -158,7 +158,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->GetReason(); } - void SendServer(const Server *server) anope_override + void SendServer(const Server *server) override { if (server == Me) UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " +" << " :" << server->GetDescription(); @@ -166,7 +166,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " +" << " :" << server->GetDescription(); } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password; @@ -186,7 +186,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SVINFO 6 6 0 :" << Anope::CurTime; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); @@ -194,17 +194,17 @@ class HybridProto : public IRCDProto << u->host << " " << u->host << " 0.0.0.0 " << u->GetUID() << " * :" << u->realname; } - void SendEOB() anope_override + void SendEOB() override { UplinkSocket::Message(Me) << "EOB"; } - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { UplinkSocket::Message(source) << "SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickAlias *na) override { if (UseSVSAccount == false) IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->nc->display.c_str()); @@ -212,7 +212,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SVSACCOUNT " << u->GetUID() << " " << u->timestamp << " " << na->nc->display; } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { if (UseSVSAccount == false) IRCD->SendMode(Config->GetClient("NickServ"), u, "+d *"); @@ -220,7 +220,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SVSACCOUNT " << u->GetUID() << " " << u->timestamp << " *"; } - void SendChannel(Channel *c) anope_override + void SendChannel(Channel *c) override { Anope::string modes = c->GetModes(true, true); @@ -230,22 +230,22 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :"; } - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { UplinkSocket::Message(source) << "TBURST " << c->creation_time << " " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic; } - void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override { UplinkSocket::Message(Me) << "SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; } - void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) anope_override + void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override { UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; } - void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) override { if (!param.empty()) UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param; @@ -253,29 +253,29 @@ class HybridProto : public IRCDProto UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; } - void SendSVSHold(const Anope::string &nick, time_t t) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) override { XLine x(nick, Me->GetName(), Anope::CurTime + t, "Being held for registered user"); this->SendSQLine(NULL, &x); } - void SendSVSHoldDel(const Anope::string &nick) anope_override + void SendSVSHoldDel(const Anope::string &nick) override { XLine x(nick); this->SendSQLineDel(&x); } - void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override + void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override { UplinkSocket::Message(Me) << "SVSHOST " << u->GetUID() << " " << u->timestamp << " " << host; } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { UplinkSocket::Message(Me) << "SVSHOST " << u->GetUID() << " " << u->timestamp << " " << u->host; } - bool IsIdentValid(const Anope::string &ident) anope_override + bool IsIdentValid(const Anope::string &ident) override { if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) return false; @@ -305,7 +305,7 @@ struct IRCDMessageBMask : IRCDMessage /* 0 1 2 3 */ /* :0MC BMASK 1350157102 #channel b :*!*@*.test.com */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Channel *c = Channel::Find(params[1]); ChannelMode *mode = ModeManager::FindChannelModeByChar(params[2][0]); @@ -325,7 +325,7 @@ struct IRCDMessageEOB : IRCDMessage { IRCDMessageEOB(Module *creator) : IRCDMessage(creator, "EOB", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetServer()->Sync(true); } @@ -335,7 +335,7 @@ struct IRCDMessageJoin : Message::Join { IRCDMessageJoin(Module *creator) : Message::Join(creator, "JOIN") { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() < 2) return; @@ -343,7 +343,7 @@ struct IRCDMessageJoin : Message::Join std::vector<Anope::string> p = params; p.erase(p.begin()); - return Message::Join::Run(source, p); + return Message::Join::Run(source, p, tags); } }; @@ -353,7 +353,7 @@ struct IRCDMessageNick : IRCDMessage /* 0 1 */ /* :0MCAAAAAB NICK newnick 1350157102 */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetUser()->ChangeNick(params[0], convertTo<time_t>(params[1])); } @@ -365,7 +365,7 @@ struct IRCDMessagePass : IRCDMessage /* 0 */ /* PASS password */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() == 4) UplinkSID = params[3]; @@ -376,7 +376,7 @@ struct IRCDMessagePong : IRCDMessage { IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetServer()->Sync(false); } @@ -388,7 +388,7 @@ struct IRCDMessageServer : IRCDMessage /* 0 1 2 3 4 */ /* SERVER hades.arpa 1 4XY + :ircd-hybrid test server */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* Servers other than our immediate uplink are introduced via SID */ if (params[1] != "1") @@ -412,7 +412,7 @@ struct IRCDMessageSID : IRCDMessage /* 0 1 2 3 4 */ /* :0MC SID hades.arpa 2 4XY + :ircd-hybrid test server */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { unsigned int hops = params[1].is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params.back(), params[2]); @@ -425,7 +425,7 @@ struct IRCDMessageSJoin : IRCDMessage { IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string modes; @@ -476,7 +476,7 @@ struct IRCDMessageSVSMode : IRCDMessage * parv[1] = TS * parv[2] = mode */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = User::Find(params[0]); @@ -494,7 +494,7 @@ struct IRCDMessageTBurst : IRCDMessage { IRCDMessageTBurst(Module *creator) : IRCDMessage(creator, "TBURST", 5) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string setter; sepstream(params[3], '!').GetToken(setter, 0); @@ -510,7 +510,7 @@ struct IRCDMessageTMode : IRCDMessage { IRCDMessageTMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { time_t ts = 0; @@ -535,7 +535,7 @@ struct IRCDMessageUID : IRCDMessage { IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 10) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { NickAlias *na = NULL; @@ -557,7 +557,7 @@ struct IRCDMessageCertFP: IRCDMessage /* 0 */ /* :0MCAAAAAB CERTFP 4C62287BA6776A89CD4F8FF10A62FFB35E79319F51AF6C62C674984974FCCB1D */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = source.GetUser(); @@ -677,7 +677,7 @@ public: this->AddModes(); } - void OnUserNickChange(User *u, const Anope::string &) anope_override + void OnUserNickChange(User *u, const Anope::string &) override { u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); } diff --git a/modules/protocol/inspircd3.cpp b/modules/protocol/inspircd.cpp index 52f6b5b87..842db8db7 100644 --- a/modules/protocol/inspircd3.cpp +++ b/modules/protocol/inspircd.cpp @@ -1,4 +1,4 @@ -/* InspIRCd 3.0 functions +/* InspIRCd functions * * (C) 2003-2021 Anope Team * Contact us at team@anope.org @@ -26,7 +26,7 @@ static std::list<SASLUser> saslusers; static Anope::string rsquit_server, rsquit_id; -class InspIRCd3Proto : public IRCDProto +class InspIRCdProto : public IRCDProto { private: void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent) @@ -58,7 +58,7 @@ class InspIRCd3Proto : public IRCDProto public: PrimitiveExtensibleItem<ListLimits> maxlist; - InspIRCd3Proto(Module *creator) : IRCDProto(creator, "InspIRCd 3"), maxlist(creator, "maxlist") + InspIRCdProto(Module *creator) : IRCDProto(creator, "InspIRCd 3+"), maxlist(creator, "maxlist") { DefaultPseudoclientModes = "+oI"; CanSVSNick = true; @@ -70,12 +70,13 @@ class InspIRCd3Proto : public IRCDProto CanSZLine = true; CanSVSHold = true; CanCertFP = true; + CanSendTags = true; RequiresID = true; MaxModes = 20; MaxLine = 4096; } - unsigned GetMaxListFor(Channel *c, ChannelMode *cm) anope_override + unsigned GetMaxListFor(Channel *c, ChannelMode *cm) override { ListLimits *limits = maxlist.Get(c); if (limits) @@ -89,7 +90,7 @@ class InspIRCd3Proto : public IRCDProto return IRCDProto::GetMaxListFor(c, cm); } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "CAPAB START 1205"; UplinkSocket::Message() << "CAPAB CAPABILITIES :CASEMAPPING=" << Config->GetBlock("options")->Get<const Anope::string>("casemap", "ascii"); @@ -97,7 +98,7 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message() << "SERVER " << Me->GetName() << " " << Config->Uplinks[Anope::CurrentUplink].password << " 0 " << Me->GetSID() << " :" << Me->GetDescription(); } - void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) anope_override + void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override { Anope::string mechlist; for (unsigned i = 0; i < mechanisms.size(); ++i) @@ -106,23 +107,23 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(Me) << "METADATA * saslmechlist :" << (mechanisms.empty() ? "" : mechlist.substr(1)); } - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override { IRCDProto::SendSVSKillInternal(source, user, buf); user->KillInternal(source, buf); } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } - void SendPong(const Anope::string &servname, const Anope::string &who) anope_override + void SendPong(const Anope::string &servname, const Anope::string &who) override { Server *serv = servname.empty() ? NULL : Server::Find(servname); if (!serv) @@ -131,7 +132,7 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(serv) << "PONG " << who; } - void SendAkillDel(const XLine *x) anope_override + void SendAkillDel(const XLine *x) override { { /* InspIRCd may support regex bans @@ -170,12 +171,12 @@ class InspIRCd3Proto : public IRCDProto } } - void SendInvite(const MessageSource &source, const Channel *c, User *u) anope_override + void SendInvite(const MessageSource &source, const Channel *c, User *u) override { UplinkSocket::Message(source) << "INVITE " << u->GetUID() << " " << c->name << " " << c->creation_time; } - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { if (Servers::Capab.count("SVSTOPIC")) { @@ -192,7 +193,7 @@ class InspIRCd3Proto : public IRCDProto } } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { UserMode *um = ModeManager::FindUserModeByName("CLOAK"); @@ -204,7 +205,7 @@ class InspIRCd3Proto : public IRCDProto this->SendChgHostInternal(u->nick, u->chost); } - void SendAkill(User *u, XLine *x) anope_override + void SendAkill(User *u, XLine *x) override { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -266,17 +267,17 @@ class InspIRCd3Proto : public IRCDProto SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->by, x->GetReason()); } - void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override + void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) override { UplinkSocket::Message() << "NUM " << Me->GetSID() << " " << dest << " " << numeric << " " << buf; } - void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) override { UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname; @@ -284,14 +285,14 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(u) << "OPERTYPE :service"; } - void SendServer(const Server *server) anope_override + void SendServer(const Server *server) override { /* if rsquit is set then we are waiting on a squit */ if (rsquit_id.empty() && rsquit_server.empty()) UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetSID() << " :" << server->GetDescription(); } - void SendSquit(Server *s, const Anope::string &message) anope_override + void SendSquit(Server *s, const Anope::string &message) override { if (s != Me) { @@ -303,7 +304,7 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message; } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID(); /* Note that we can send this with the FJOIN but choose not to @@ -330,7 +331,7 @@ class InspIRCd3Proto : public IRCDProto } } - void SendSQLineDel(const XLine *x) anope_override + void SendSQLineDel(const XLine *x) override { if (IRCD->CanSQLineChannel && (x->mask[0] == '#')) SendDelLine("CBAN", x->mask); @@ -338,7 +339,7 @@ class InspIRCd3Proto : public IRCDProto SendDelLine("Q", x->mask); } - void SendSQLine(User *u, const XLine *x) anope_override + void SendSQLine(User *u, const XLine *x) override { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -351,7 +352,7 @@ class InspIRCd3Proto : public IRCDProto SendAddLine("Q", x->mask, timeleft, x->by, x->GetReason()); } - void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override + void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override { if (!vIdent.empty()) this->SendChgIdentInternal(u->nick, vIdent); @@ -359,22 +360,22 @@ class InspIRCd3Proto : public IRCDProto this->SendChgHostInternal(u->nick, vhost); } - void SendSVSHold(const Anope::string &nick, time_t t) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) override { UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick << " " << t << " :Being held for registered user"; } - void SendSVSHoldDel(const Anope::string &nick) anope_override + void SendSVSHoldDel(const Anope::string &nick) override { UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick; } - void SendSZLineDel(const XLine *x) anope_override + void SendSZLineDel(const XLine *x) override { SendDelLine("Z", x->GetHost()); } - void SendSZLine(User *u, const XLine *x) anope_override + void SendSZLine(User *u, const XLine *x) override { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -383,12 +384,12 @@ class InspIRCd3Proto : public IRCDProto SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason()); } - void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) anope_override + void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) override { UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; } - void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) override { if (!param.empty()) UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param; @@ -396,14 +397,14 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; } - void SendSWhois(const MessageSource &bi, const Anope::string &who, const Anope::string &mask) anope_override + void SendSWhois(const MessageSource &bi, const Anope::string &who, const Anope::string &mask) override { User *u = User::Find(who); UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " swhois :" << mask; } - void SendBOB() anope_override + void SendBOB() override { UplinkSocket::Message(Me) << "BURST " << Anope::CurTime; Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); @@ -412,12 +413,12 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(Me) << "SINFO rawversion :Anope-" << Anope::VersionShort(); } - void SendEOB() anope_override + void SendEOB() override { UplinkSocket::Message(Me) << "ENDBURST"; } - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { if (Servers::Capab.count("GLOBOPS")) UplinkSocket::Message(source) << "SNONOTICE g :" << buf; @@ -425,7 +426,7 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(source) << "SNONOTICE A :" << buf; } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickAlias *na) override { /* InspIRCd uses an account to bypass chmode +R, not umode +r, so we can't send this here */ if (na->nc->HasExt("UNCONFIRMED")) @@ -435,40 +436,35 @@ class InspIRCd3Proto : public IRCDProto UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display; } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountid :"; UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :"; } - void SendChannel(Channel *c) anope_override + void SendChannel(Channel *c) override { UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :"; } - void SendSASLMessage(const SASL::Message &message) anope_override + void SendSASLMessage(const SASL::Message &message) override { UplinkSocket::Message(Me) << "ENCAP " << message.target.substr(0, 3) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); } - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override + void SendSVSLogin(const Anope::string &uid, NickAlias *na) override { - // TODO: in 2.1 this function should take a NickAlias instead of strings. - NickCore *nc = NickCore::Find(acc); - if (!nc) - return; - - UplinkSocket::Message(Me) << "METADATA " << uid << " accountid :" << nc->GetId(); - UplinkSocket::Message(Me) << "METADATA " << uid << " accountname :" << acc; + UplinkSocket::Message(Me) << "METADATA " << uid << " accountid :" << na->nc->GetId(); + UplinkSocket::Message(Me) << "METADATA " << uid << " accountname :" << na->nc->display; - if (!vident.empty()) - UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGIDENT " << uid << " " << vident; - if (!vhost.empty()) - UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGHOST " << uid << " " << vhost; + if (!na->GetVhostIdent().empty()) + UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGIDENT " << uid << " " << na->GetVhostIdent(); + if (!na->GetVhostHost().empty()) + UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGHOST " << uid << " " << na->GetVhostHost(); SASLUser su; su.uid = uid; - su.acc = acc; + su.acc = na->nc->display; su.created = Anope::CurTime; for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) @@ -484,12 +480,12 @@ class InspIRCd3Proto : public IRCDProto saslusers.push_back(su); } - bool IsExtbanValid(const Anope::string &mask) anope_override + bool IsExtbanValid(const Anope::string &mask) override { return mask.length() >= 3 && mask[1] == ':'; } - bool IsIdentValid(const Anope::string &ident) anope_override + bool IsIdentValid(const Anope::string &ident) override { if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) return false; @@ -518,7 +514,7 @@ class InspIRCdAutoOpMode : public ChannelModeList { } - bool IsValid(Anope::string &mask) const anope_override + bool IsValid(Anope::string &mask) const override { // We can not validate this because we don't know about the // privileges of the setter so just reject attempts to set it. @@ -536,13 +532,13 @@ class InspIRCdExtBan : public ChannelModeVirtual<ChannelModeList> { } - ChannelMode *Wrap(Anope::string ¶m) anope_override + ChannelMode *Wrap(Anope::string ¶m) override { param = Anope::string(ext) + ":" + param; return ChannelModeVirtual<ChannelModeList>::Wrap(param); } - ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override + ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) override { if (cm->type != MODE_LIST || param.length() < 3 || param[0] != ext || param[1] != ':') return cm; @@ -561,7 +557,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); @@ -577,7 +573,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); @@ -613,7 +609,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); @@ -629,7 +625,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); @@ -644,7 +640,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); @@ -659,7 +655,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); @@ -674,7 +670,7 @@ namespace InspIRCdExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); @@ -688,7 +684,7 @@ class ColonDelimitedParamMode : public ChannelModeParam public: ColonDelimitedParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { } - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { return IsValid(value, false); } @@ -737,7 +733,7 @@ class SimpleNumberParamMode : public ChannelModeParam public: SimpleNumberParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { } - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { if (value.empty()) return false; // empty param is never valid @@ -762,7 +758,7 @@ class ChannelModeFlood : public ColonDelimitedParamMode public: ChannelModeFlood(char modeChar) : ColonDelimitedParamMode("FLOOD", modeChar) { } - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { // The parameter of this mode is a bit different, it may begin with a '*', // ignore it if that's the case @@ -776,7 +772,7 @@ class ChannelModeHistory : public ColonDelimitedParamMode public: ChannelModeHistory(char modeChar) : ColonDelimitedParamMode("HISTORY", modeChar) { } - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { return (ColonDelimitedParamMode::IsValid(value, true)); } @@ -787,7 +783,7 @@ class ChannelModeRedirect : public ChannelModeParam public: ChannelModeRedirect(char modeChar) : ChannelModeParam("REDIRECT", modeChar, true) { } - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { // The parameter of this mode is a channel, and channel names start with '#' return ((!value.empty()) && (value[0] == '#')); @@ -798,13 +794,13 @@ struct IRCDMessageAway : Message::Away { IRCDMessageAway(Module *creator) : Message::Away(creator, "AWAY") { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { std::vector<Anope::string> newparams(params); if (newparams.size() > 1) newparams.erase(newparams.begin()); - Message::Away::Run(source, newparams); + Message::Away::Run(source, newparams, tags); } }; @@ -813,21 +809,19 @@ struct IRCDMessageCapab : Message::Capab struct ModeInfo { // The letter assigned to the mode (e.g. o). - char letter; + char letter = 0; // If a prefix mode then the rank of the prefix. - unsigned level; + unsigned level = 0; // The name of the mode. Anope::string name; // If a prefix mode then the symbol associated with the prefix. - char symbol; + char symbol = 0; // The type of mode. Anope::string type; - - ModeInfo() : letter(0), level(0), symbol(0) { } }; static bool ParseMode(const Anope::string& token, ModeInfo& mode) @@ -876,7 +870,7 @@ struct IRCDMessageCapab : Message::Capab IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params[0].equals_cs("START")) { @@ -1204,7 +1198,7 @@ struct IRCDMessageCapab : Message::Capab Log() << "CHGIDENT missing, Usage disabled until module is loaded."; } - Message::Capab::Run(source, params); + Message::Capab::Run(source, params, tags); } }; @@ -1212,7 +1206,7 @@ struct IRCDMessageEncap : IRCDMessage { IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (!Anope::Match(Me->GetSID(), params[0]) && !Anope::Match(Me->GetName(), params[0])) return; @@ -1262,7 +1256,7 @@ struct IRCDMessageFHost : IRCDMessage { IRCDMessageFHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = source.GetUser(); if (u->HasMode("CLOAK")) @@ -1275,7 +1269,7 @@ struct IRCDMessageFIdent : IRCDMessage { IRCDMessageFIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetUser()->SetIdent(params[0]); } @@ -1285,7 +1279,7 @@ struct IRCDMessageKick : IRCDMessage { IRCDMessageKick(Module *creator) : IRCDMessage(creator, "KICK", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // Received: :715AAAAAA KICK #chan 715AAAAAD :reason // Received: :715AAAAAA KICK #chan 628AAAAAA 4 :reason @@ -1300,11 +1294,11 @@ struct IRCDMessageKick : IRCDMessage struct IRCDMessageSave : IRCDMessage { - time_t last_collide; + time_t last_collide = 0; - IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2), last_collide(0) { } + IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *targ = User::Find(params[0]); time_t ts; @@ -1349,7 +1343,7 @@ class IRCDMessageMetadata : IRCDMessage public: IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock, PrimitiveExtensibleItem<ListLimits> &listlimits) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock), maxlist(listlimits) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // We deliberately ignore non-bursting servers to avoid pseudoserver fights // Channel METADATA has an additional parameter: the channel TS @@ -1480,7 +1474,7 @@ struct IRCDMessageEndburst : IRCDMessage { IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Server *s = source.GetServer(); @@ -1494,7 +1488,7 @@ struct IRCDMessageFJoin : IRCDMessage { IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string modes; if (params.size() >= 3) @@ -1550,7 +1544,7 @@ struct IRCDMessageFMode : IRCDMessage { IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* :source FMODE #test 12345678 +nto foo */ @@ -1579,7 +1573,7 @@ struct IRCDMessageFTopic : IRCDMessage { IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // :source FTOPIC channel ts topicts :topic // :source FTOPIC channel ts topicts setby :topic (burst or RESYNC) @@ -1597,7 +1591,7 @@ struct IRCDMessageIdle : IRCDMessage { IRCDMessageIdle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { BotInfo *bi = BotInfo::Find(params[0]); if (bi) @@ -1615,7 +1609,7 @@ struct IRCDMessageIJoin : IRCDMessage { IRCDMessageIJoin(Module *creator) : IRCDMessage(creator, "IJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // :<uid> IJOIN <chan> <membid> [<ts> [<flags>]] Channel *c = Channel::Find(params[0]); @@ -1651,7 +1645,7 @@ struct IRCDMessageMode : IRCDMessage { IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (IRCD->IsChannelValid(params[0])) { @@ -1681,7 +1675,7 @@ struct IRCDMessageNick : IRCDMessage { IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetUser()->ChangeNick(params[0]); } @@ -1691,7 +1685,7 @@ struct IRCDMessageOperType : IRCDMessage { IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* opertype is equivalent to mode +o because servers don't do this directly */ @@ -1705,7 +1699,7 @@ struct IRCDMessagePing : IRCDMessage { IRCDMessagePing(Module *creator) : IRCDMessage(creator, "PING", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params[0] == Me->GetSID()) IRCD->SendPong(params[0], source.GetServer()->GetSID()); @@ -1716,7 +1710,7 @@ struct IRCDMessageRSQuit : IRCDMessage { IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Server *s = Server::Find(params[0]); const Anope::string &reason = params.size() > 1 ? params[1] : ""; @@ -1732,7 +1726,7 @@ struct IRCDMessageServer : IRCDMessage { IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (!source.GetServer() && params.size() == 5) { @@ -1765,7 +1759,7 @@ struct IRCDMessageSQuit : Message::SQuit { IRCDMessageSQuit(Module *creator) : Message::SQuit(creator) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params[0] == rsquit_id || params[0] == rsquit_server) { @@ -1779,7 +1773,7 @@ struct IRCDMessageSQuit : Message::SQuit IRCD->SendServer(s); } else - Message::SQuit::Run(source, params); + Message::SQuit::Run(source, params, tags); } }; @@ -1787,7 +1781,7 @@ struct IRCDMessageTime : IRCDMessage { IRCDMessageTime(Module *creator) : IRCDMessage(creator, "TIME", 2) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { UplinkSocket::Message(Me) << "TIME " << source.GetSource() << " " << params[1] << " " << Anope::CurTime; } @@ -1810,7 +1804,7 @@ struct IRCDMessageUID : IRCDMessage * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname! * last: realname */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { time_t ts = convertTo<time_t>(params[1]); @@ -1841,9 +1835,9 @@ struct IRCDMessageUID : IRCDMessage } }; -class ProtoInspIRCd3 : public Module +class ProtoInspIRCd : public Module { - InspIRCd3Proto ircd_proto; + InspIRCdProto ircd_proto; ExtensibleItem<bool> ssl; /* Core message handlers */ @@ -1890,7 +1884,7 @@ class ProtoInspIRCd3 : public Module } public: - ProtoInspIRCd3(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), + ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), ircd_proto(this), ssl(this, "ssl"), message_error(this), message_invite(this), message_kill(this), message_motd(this), message_notice(this), message_part(this), message_privmsg(this), message_quit(this), message_stats(this), @@ -1902,24 +1896,24 @@ class ProtoInspIRCd3 : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { use_server_side_topiclock = conf->GetModule(this)->Get<bool>("use_server_side_topiclock"); use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); } - void OnUserNickChange(User *u, const Anope::string &) anope_override + void OnUserNickChange(User *u, const Anope::string &) override { u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { if (c->ci) this->OnChanRegistered(c->ci); } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); if (use_server_side_mlock && ci->c && modelocks && !modelocks->GetMLockAsString(false).empty()) @@ -1935,7 +1929,7 @@ class ProtoInspIRCd3 : public Module } } - void OnDelChan(ChannelInfo *ci) anope_override + void OnDelChan(ChannelInfo *ci) override { if (use_server_side_mlock && ci->c) SendChannelMetadata(ci->c, "mlock", ""); @@ -1944,7 +1938,7 @@ class ProtoInspIRCd3 : public Module SendChannelMetadata(ci->c, "topiclock", ""); } - EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override + EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); @@ -1957,7 +1951,7 @@ class ProtoInspIRCd3 : public Module return EVENT_CONTINUE; } - EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override + EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); @@ -1970,7 +1964,7 @@ class ProtoInspIRCd3 : public Module return EVENT_CONTINUE; } - EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) anope_override + EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) override { if (cmd->name == "chanserv/topic" && ci->c) { @@ -1984,4 +1978,4 @@ class ProtoInspIRCd3 : public Module } }; -MODULE_INIT(ProtoInspIRCd3) +MODULE_INIT(ProtoInspIRCd) diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp deleted file mode 100644 index 5e4e61eb0..000000000 --- a/modules/protocol/inspircd12.cpp +++ /dev/null @@ -1,1400 +0,0 @@ -/* inspircd 1.2 functions - * - * (C) 2003-2021 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "module.h" -#include "modules/sasl.h" - -struct SASLUser -{ - Anope::string uid; - Anope::string acc; - time_t created; -}; - -static std::list<SASLUser> saslusers; - -static Anope::string rsquit_server, rsquit_id; - -class ChannelModeFlood : public ChannelModeParam -{ - public: - ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } - - bool IsValid(Anope::string &value) const anope_override - { - try - { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - } - catch (const ConvertException &) { } - - return false; - } -}; - -class InspIRCd12Proto : public IRCDProto -{ - private: - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override - { - IRCDProto::SendSVSKillInternal(source, user, buf); - user->KillInternal(source, buf); - } - - void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent) - { - if (!Servers::Capab.count("CHGIDENT")) - Log() << "CHGIDENT not loaded!"; - else - UplinkSocket::Message(Me) << "CHGIDENT " << nick << " " << vIdent; - } - - void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost) - { - if (!Servers::Capab.count("CHGHOST")) - Log() << "CHGHOST not loaded!"; - else - UplinkSocket::Message(Me) << "CHGHOST " << nick << " " << vhost; - } - - void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason) - { - UplinkSocket::Message(Me) << "ADDLINE " << xtype << " " << mask << " " << addedby << " " << Anope::CurTime << " " << duration << " :" << reason; - } - - void SendDelLine(const Anope::string &xtype, const Anope::string &mask) - { - UplinkSocket::Message(Me) << "DELLINE " << xtype << " " << mask; - } - - public: - InspIRCd12Proto(Module *creator) : IRCDProto(creator, "InspIRCd 1.2") - { - DefaultPseudoclientModes = "+I"; - CanSVSNick = true; - CanSVSJoin = true; - CanSetVHost = true; - CanSetVIdent = true; - CanSQLine = true; - CanSZLine = true; - CanSVSHold = true; - CanCertFP = true; - RequiresID = true; - MaxModes = 20; - } - - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override - { - UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; - } - - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override - { - UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; - } - - void SendAkillDel(const XLine *x) anope_override - { - /* InspIRCd may support regex bans - * Mask is expected in format: 'n!u@h\sr' and spaces as '\s' - * We remove the '//' and replace '#' and any ' ' with '\s' - */ - if (x->IsRegex() && Servers::Capab.count("RLINE")) - { - Anope::string mask = x->mask; - if (mask.length() >= 2 && mask[0] == '/' && mask[mask.length() - 1] == '/') - mask = mask.substr(1, mask.length() - 2); - size_t h = mask.find('#'); - if (h != Anope::string::npos) - { - mask = mask.replace(h, 1, "\\s"); - mask = mask.replace_all_cs(" ", "\\s"); - } - SendDelLine("R", mask); - return; - } - else if (x->IsRegex() || x->HasNickOrReal()) - return; - - /* ZLine if we can instead */ - if (x->GetUser() == "*") - { - cidr addr(x->GetHost()); - if (addr.valid()) - { - IRCD->SendSZLineDel(x); - return; - } - } - - SendDelLine("G", x->GetUser() + "@" + x->GetHost()); - } - - void SendTopic(const MessageSource &source, Channel *c) anope_override - { - if (Servers::Capab.count("SVSTOPIC")) - { - UplinkSocket::Message(c->ci->WhoSends()) << "SVSTOPIC " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic; - } - else - { - /* If the last time a topic was set is after the TS we want for this topic we must bump this topic's timestamp to now */ - time_t ts = c->topic_ts; - if (c->topic_time > ts) - ts = Anope::CurTime; - /* But don't modify c->topic_ts, it should remain set to the real TS we want as ci->last_topic_time pulls from it */ - UplinkSocket::Message(source) << "FTOPIC " << c->name << " " << ts << " " << c->topic_setter << " :" << c->topic; - } - } - - void SendVhostDel(User *u) anope_override - { - UserMode *um = ModeManager::FindUserModeByName("CLOAK"); - - if (um && !u->HasMode(um->name)) - // Just set +x if we can - u->SetMode(NULL, um); - else - // Try to restore cloaked host - this->SendChgHostInternal(u->nick, u->chost); - } - - void SendAkill(User *u, XLine *x) anope_override - { - // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = x->expires - Anope::CurTime; - if (timeleft > 172800 || !x->expires) - timeleft = 172800; - - /* InspIRCd may support regex bans, if they do we can send this and forget about it - * Mask is expected in format: 'n!u@h\sr' and spaces as '\s' - * We remove the '//' and replace '#' and any ' ' with '\s' - */ - if (x->IsRegex() && Servers::Capab.count("RLINE")) - { - Anope::string mask = x->mask; - if (mask.length() >= 2 && mask[0] == '/' && mask[mask.length() - 1] == '/') - mask = mask.substr(1, mask.length() - 2); - size_t h = mask.find('#'); - if (h != Anope::string::npos) - { - mask = mask.replace(h, 1, "\\s"); - mask = mask.replace_all_cs(" ", "\\s"); - } - SendAddLine("R", mask, timeleft, x->by, x->GetReason()); - return; - } - else if (x->IsRegex() || x->HasNickOrReal()) - { - if (!u) - { - /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */ - for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) - if (x->manager->Check(it->second, x)) - this->SendAkill(it->second, x); - return; - } - - const XLine *old = x; - - if (old->manager->HasEntry("*@" + u->host)) - return; - - /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */ - x = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id); - old->manager->AddXLine(x); - - Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->mask; - } - - /* ZLine if we can instead */ - if (x->GetUser() == "*") - { - cidr addr(x->GetHost()); - if (addr.valid()) - { - IRCD->SendSZLine(u, x); - return; - } - } - - SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->by, x->GetReason()); - } - - void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override - { - User *u = User::Find(dest); - UplinkSocket::Message() << "PUSH " << dest << " ::" << Me->GetName() << " " << numeric << " " << (u ? u->nick : dest) << " " << buf; - } - - void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override - { - UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; - } - - void SendClientIntroduction(User *u) anope_override - { - Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname; - if (modes.find('o') != Anope::string::npos) - UplinkSocket::Message(u) << "OPERTYPE :service"; - } - - /* SERVER services-dev.chatspike.net password 0 :Description here */ - void SendServer(const Server *server) anope_override - { - /* if rsquit is set then we are waiting on a squit */ - if (rsquit_id.empty() && rsquit_server.empty()) - UplinkSocket::Message() << "SERVER " << server->GetName() << " " << Config->Uplinks[Anope::CurrentUplink].password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); - } - - void SendSquit(Server *s, const Anope::string &message) anope_override - { - if (s != Me) - { - rsquit_id = s->GetSID(); - rsquit_server = s->GetName(); - UplinkSocket::Message() << "RSQUIT " << s->GetName() << " :" << message; - } - else - UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message; - } - - /* JOIN */ - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override - { - UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID(); - /* Note that we can send this with the FJOIN but choose not to - * because the mode stacker will handle this and probably will - * merge these modes with +nrt and other mlocked modes - */ - if (status) - { - /* First save the channel status incase uc->Status == status */ - ChannelStatus cs = *status; - /* If the user is internally on the channel with flags, kill them so that - * the stacker will allow this. - */ - ChanUserContainer *uc = c->FindUser(user); - if (uc != NULL) - uc->status.Clear(); - - BotInfo *setter = BotInfo::Find(user->GetUID()); - for (size_t i = 0; i < cs.Modes().length(); ++i) - c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); - - if (uc != NULL) - uc->status = cs; - } - } - - /* UNSQLINE */ - void SendSQLineDel(const XLine *x) anope_override - { - SendDelLine("Q", x->mask); - } - - /* SQLINE */ - void SendSQLine(User *, const XLine *x) anope_override - { - // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = x->expires - Anope::CurTime; - if (timeleft > 172800 || !x->expires) - timeleft = 172800; - SendAddLine("Q", x->mask, timeleft, x->by, x->GetReason()); - } - - void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override - { - if (!vIdent.empty()) - this->SendChgIdentInternal(u->nick, vIdent); - if (!vhost.empty()) - this->SendChgHostInternal(u->nick, vhost); - } - - void SendConnect() anope_override - { - SendServer(Me); - } - - /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick, time_t t) anope_override - { - UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick << " " << t << " :Being held for registered user"; - } - - /* SVSHOLD - release */ - void SendSVSHoldDel(const Anope::string &nick) anope_override - { - UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick; - } - - /* UNSZLINE */ - void SendSZLineDel(const XLine *x) anope_override - { - SendDelLine("Z", x->GetHost()); - } - - /* SZLINE */ - void SendSZLine(User *, const XLine *x) anope_override - { - // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = x->expires - Anope::CurTime; - if (timeleft > 172800 || !x->expires) - timeleft = 172800; - SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason()); - } - - void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) anope_override - { - UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; - } - - void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) anope_override - { - if (!param.empty()) - UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param; - else - UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; - } - - void SendSWhois(const MessageSource &, const Anope::string &who, const Anope::string &mask) anope_override - { - User *u = User::Find(who); - - UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " swhois :" << mask; - } - - void SendBOB() anope_override - { - UplinkSocket::Message(Me) << "BURST " << Anope::CurTime; - Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); - UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << IRCD->GetProtocolName() << " - (" << (enc ? enc->name : "none") << ") -- " << Anope::VersionBuildString(); - } - - void SendEOB() anope_override - { - UplinkSocket::Message(Me) << "ENDBURST"; - } - - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override - { - if (Servers::Capab.count("GLOBOPS")) - UplinkSocket::Message(source) << "SNONOTICE g :" << buf; - else - UplinkSocket::Message(source) << "SNONOTICE A :" << buf; - } - - void SendLogin(User *u, NickAlias *na) anope_override - { - /* InspIRCd uses an account to bypass chmode +R, not umode +r, so we can't send this here */ - if (na->nc->HasExt("UNCONFIRMED")) - return; - - UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display; - } - - void SendLogout(User *u) anope_override - { - UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :"; - } - - void SendChannel(Channel *c) anope_override - { - UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :"; - } - - void SendOper(User *u) anope_override - { - } - - void SendSASLMessage(const SASL::Message &message) anope_override - { - UplinkSocket::Message(Me) << "ENCAP " << message.target.substr(0, 3) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); - } - - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override - { - UplinkSocket::Message(Me) << "METADATA " << uid << " accountname :" << acc; - - if (!vident.empty()) - UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGIDENT " << uid << " " << vident; - if (!vhost.empty()) - UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGHOST " << uid << " " << vhost; - - SASLUser su; - su.uid = uid; - su.acc = acc; - su.created = Anope::CurTime; - - for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) - { - SASLUser &u = *it; - - if (u.created + 30 < Anope::CurTime || u.uid == uid) - it = saslusers.erase(it); - else - ++it; - } - - saslusers.push_back(su); - } - - bool IsExtbanValid(const Anope::string &mask) anope_override - { - return mask.length() >= 3 && mask[1] == ':'; - } - - bool IsIdentValid(const Anope::string &ident) anope_override - { - if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) - return false; - - for (unsigned i = 0; i < ident.length(); ++i) - { - const char &c = ident[i]; - - if (c >= 'A' && c <= '}') - continue; - - if ((c >= '0' && c <= '9') || c == '-' || c == '.') - continue; - - return false; - } - - return true; - } -}; - -class InspIRCdExtBan : public ChannelModeList -{ - public: - InspIRCdExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - - if (mask.find("m:") == 0 || mask.find("N:") == 0) - { - Anope::string real_mask = mask.substr(2); - - Entry en(this->name, real_mask); - if (en.Matches(u)) - return true; - } - else if (mask.find("j:") == 0) - { - Anope::string real_mask = mask.substr(2); - - Channel *c = Channel::Find(real_mask); - if (c != NULL && c->FindUser(u) != NULL) - return true; - } - else if (mask.find("M:") == 0 || mask.find("R:") == 0) - { - Anope::string real_mask = mask.substr(2); - - if (u->IsIdentified() && real_mask.equals_ci(u->Account()->display)) - return true; - } - else if (mask.find("r:") == 0) - { - Anope::string real_mask = mask.substr(2); - - if (Anope::Match(u->realname, real_mask)) - return true; - } - else if (mask.find("s:") == 0) - { - Anope::string real_mask = mask.substr(2); - - if (Anope::Match(u->server->GetName(), real_mask)) - return true; - } - - return false; - } -}; - -struct IRCDMessageCapab : Message::Capab -{ - IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (params[0].equals_cs("START")) - { - /* reset CAPAB */ - Servers::Capab.clear(); - Servers::Capab.insert("NOQUIT"); - IRCD->CanSVSHold = false; - } - else if (params[0].equals_cs("MODULES") && params.size() > 1) - { - if (params[1].find("m_globops.so") != Anope::string::npos) - Servers::Capab.insert("GLOBOPS"); - if (params[1].find("m_services_account.so") != Anope::string::npos) - Servers::Capab.insert("SERVICES"); - if (params[1].find("m_svshold.so") != Anope::string::npos) - IRCD->CanSVSHold = true; - if (params[1].find("m_chghost.so") != Anope::string::npos) - Servers::Capab.insert("CHGHOST"); - if (params[1].find("m_chgident.so") != Anope::string::npos) - Servers::Capab.insert("CHGIDENT"); - if (params[1].find("m_hidechans.so") != Anope::string::npos) - Servers::Capab.insert("HIDECHANS"); - if (params[1].find("m_servprotect.so") != Anope::string::npos) - IRCD->DefaultPseudoclientModes = "+Ik"; - if (params[1].find("m_rline.so") != Anope::string::npos) - Servers::Capab.insert("RLINE"); - } - else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string capab; - while (ssep.GetToken(capab)) - { - if (capab.find("CHANMODES") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 10, capab.end()); - commasepstream sep(modes); - Anope::string modebuf; - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'b': - ModeManager::AddChannelMode(new InspIRCdExtBan("BAN", 'b')); - continue; - case 'e': - ModeManager::AddChannelMode(new InspIRCdExtBan("EXCEPT", 'e')); - continue; - case 'I': - ModeManager::AddChannelMode(new InspIRCdExtBan("INVITEOVERRIDE", 'I')); - continue; - /* InspIRCd sends q and a here if they have no prefixes */ - case 'q': - ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '@', 4)); - continue; - case 'a': - ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT" , 'a', '@', 3)); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t])); - } - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'k': - ModeManager::AddChannelMode(new ChannelModeKey('k')); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t])); - } - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'F': - ModeManager::AddChannelMode(new ChannelModeParam("NICKFLOOD", 'F', true)); - continue; - case 'J': - ModeManager::AddChannelMode(new ChannelModeParam("NOREJOIN", 'J', true)); - continue; - case 'L': - ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L', true)); - continue; - case 'f': - ModeManager::AddChannelMode(new ChannelModeFlood('f', true)); - continue; - case 'j': - ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true)); - continue; - case 'l': - ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true)); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t], true)); - } - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'A': - ModeManager::AddChannelMode(new ChannelMode("ALLINVITE", 'A')); - continue; - case 'B': - ModeManager::AddChannelMode(new ChannelMode("BLOCKCAPS", 'B')); - continue; - case 'C': - ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C')); - continue; - case 'D': - ModeManager::AddChannelMode(new ChannelMode("DELAYEDJOIN", 'D')); - continue; - case 'G': - ModeManager::AddChannelMode(new ChannelMode("CENSOR", 'G')); - continue; - case 'K': - ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K')); - continue; - case 'M': - ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M')); - continue; - case 'N': - ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N')); - continue; - case 'O': - ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); - continue; - case 'P': - ModeManager::AddChannelMode(new ChannelMode("PERM", 'P')); - continue; - case 'Q': - ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q')); - continue; - case 'R': - ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); - continue; - case 'S': - ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S')); - continue; - case 'T': - ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T')); - continue; - case 'c': - ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c')); - continue; - case 'i': - ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i')); - continue; - case 'm': - ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm')); - continue; - case 'n': - ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n')); - continue; - case 'p': - ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p')); - continue; - case 'r': - ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); - continue; - case 's': - ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); - continue; - case 't': - ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't')); - continue; - case 'u': - ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u')); - continue; - case 'z': - ModeManager::AddChannelMode(new ChannelMode("SSL", 'z')); - continue; - default: - ModeManager::AddChannelMode(new ChannelMode("", modebuf[t])); - } - } - } - else if (capab.find("USERMODES") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 10, capab.end()); - commasepstream sep(modes); - Anope::string modebuf; - - while (sep.GetToken(modebuf)) - { - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'h': - ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h')); - continue; - case 'B': - ModeManager::AddUserMode(new UserMode("BOT", 'B')); - continue; - case 'G': - ModeManager::AddUserMode(new UserMode("CENSOR", 'G')); - continue; - case 'H': - ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H')); - continue; - case 'I': - ModeManager::AddUserMode(new UserMode("PRIV", 'I')); - continue; - case 'Q': - ModeManager::AddUserMode(new UserModeOperOnly("HIDDEN", 'Q')); - continue; - case 'R': - ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); - continue; - case 'S': - ModeManager::AddUserMode(new UserMode("STRIPCOLOR", 'S')); - continue; - case 'W': - ModeManager::AddUserMode(new UserMode("WHOIS", 'W')); - continue; - case 'c': - ModeManager::AddUserMode(new UserMode("COMMONCHANS", 'c')); - continue; - case 'g': - ModeManager::AddUserMode(new UserMode("CALLERID", 'g')); - continue; - case 'i': - ModeManager::AddUserMode(new UserMode("INVIS", 'i')); - continue; - case 'k': - ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'k')); - continue; - case 'o': - ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); - continue; - case 'r': - ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); - continue; - case 'w': - ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); - continue; - case 'x': - ModeManager::AddUserMode(new UserMode("CLOAK", 'x')); - continue; - case 'd': - ModeManager::AddUserMode(new UserMode("DEAF", 'd')); - continue; - default: - ModeManager::AddUserMode(new UserMode("", modebuf[t])); - } - } - } - } - else if (capab.find("PREFIX=(") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')')); - Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end()); - unsigned short level = modes.length() - 1; - - for (size_t t = 0, end = modes.length(); t < end; ++t) - { - switch (modes[t]) - { - case 'q': - ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', chars[t], level--)); - continue; - case 'a': - ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', chars[t], level--)); - continue; - case 'o': - ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', chars[t], level--)); - continue; - case 'h': - ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', chars[t], level--)); - continue; - case 'v': - ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', chars[t], level--)); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeStatus("", modes[t], chars[t], level--)); - } - } - - ModeManager::RebuildStatusModes(); - } - else if (capab.find("MAXMODES=") != Anope::string::npos) - { - Anope::string maxmodes(capab.begin() + 9, capab.end()); - IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; - } - } - } - else if (params[0].equals_cs("END")) - { - if (!Servers::Capab.count("GLOBOPS")) - { - UplinkSocket::Message() << "ERROR :m_globops is not loaded. This is required by Anope"; - Anope::QuitReason = "Remote server does not have the m_globops module loaded, and this is required."; - Anope::Quitting = true; - return; - } - if (!Servers::Capab.count("SERVICES")) - { - UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope"; - Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required."; - Anope::Quitting = true; - return; - } - if (!Servers::Capab.count("HIDECHANS")) - { - UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope"; - Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required."; - Anope::Quitting = true; - return; - } - if (!IRCD->CanSVSHold) - Log() << "SVSHOLD missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("CHGHOST")) - Log() << "CHGHOST missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("CHGIDENT")) - Log() << "CHGIDENT missing, Usage disabled until module is loaded."; - } - - Message::Capab::Run(source, params); - } -}; - -struct IRCDMessageChgIdent : IRCDMessage -{ - IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = User::Find(params[0]); - if (u) - u->SetIdent(params[1]); - } -}; - -struct IRCDMessageChgName : IRCDMessage -{ - IRCDMessageChgName(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetUser()->SetRealname(params[0]); - } -}; - -struct IRCDMessageEncap : IRCDMessage -{ - IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (!Anope::Match(Me->GetSID(), params[0]) && !Anope::Match(Me->GetName(), params[0])) - return; - - if (SASL::sasl && params[1] == "SASL" && params.size() >= 6) - { - SASL::Message m; - m.source = params[2]; - m.target = params[3]; - m.type = params[4]; - m.data = params[5]; - m.ext = params.size() > 6 ? params[6] : ""; - - SASL::sasl->ProcessMessage(m); - } - } -}; - -struct IRCDMessageEndburst : IRCDMessage -{ - IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - Server *s = source.GetServer(); - - Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName(); - - s->Sync(true); - } -}; - -struct IRCDMessageFHost : IRCDMessage -{ - IRCDMessageFHost(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetUser()->SetDisplayedHost(params[0]); - } -}; - -struct IRCDMessageFJoin : IRCDMessage -{ - IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - Anope::string modes; - if (params.size() >= 3) - { - for (unsigned i = 2; i < params.size() - 1; ++i) - modes += " " + params[i]; - if (!modes.empty()) - modes.erase(modes.begin()); - } - - std::list<Message::Join::SJoinUser> users; - - spacesepstream sep(params[params.size() - 1]); - Anope::string buf; - while (sep.GetToken(buf)) - { - Message::Join::SJoinUser sju; - - /* Loop through prefixes and find modes for them */ - for (char c; (c = buf[0]) != ',' && c;) - { - buf.erase(buf.begin()); - sju.first.AddMode(c); - } - /* Erase the , */ - if (!buf.empty()) - buf.erase(buf.begin()); - - sju.second = User::Find(buf); - if (!sju.second) - { - Log(LOG_DEBUG) << "FJOIN for nonexistent user " << buf << " on " << params[0]; - continue; - } - - users.push_back(sju); - } - - time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; - Message::Join::SJoin(source, params[0], ts, modes, users); - } -}; - -struct IRCDMessageFMode : IRCDMessage -{ - IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - /* :source FMODE #test 12345678 +nto foo */ - - Anope::string modes = params[2]; - for (unsigned n = 3; n < params.size(); ++n) - modes += " " + params[n]; - - Channel *c = Channel::Find(params[0]); - time_t ts; - - try - { - ts = convertTo<time_t>(params[1]); - } - catch (const ConvertException &) - { - ts = 0; - } - - if (c) - c->SetModesInternal(source, modes, ts); - } -}; - -struct IRCDMessageFTopic : IRCDMessage -{ - IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - /* :source FTOPIC channel topicts setby :topic */ - - Channel *c = Channel::Find(params[0]); - if (c) - c->ChangeTopicInternal(NULL, params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime); - } -}; - -struct IRCDMessageIdle : IRCDMessage -{ - IRCDMessageIdle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - BotInfo *bi = BotInfo::Find(params[0]); - if (bi) - UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (Anope::CurTime - bi->lastmsg); - else - { - User *u = User::Find(params[0]); - if (u && u->server == Me) - UplinkSocket::Message(u) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " 0"; - } - } -}; - -/* - * source = numeric of the sending server - * params[0] = uuid - * params[1] = metadata name - * params[2] = data - */ -struct IRCDMessageMetadata : IRCDMessage -{ - IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (isdigit(params[0][0])) - { - if (params[1].equals_cs("accountname")) - { - User *u = User::Find(params[0]); - NickCore *nc = NickCore::Find(params[2]); - if (u && nc) - u->Login(nc); - } - - /* - * possible incoming ssl_cert messages: - * Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...> - * Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0) - */ - else if (params[1].equals_cs("ssl_cert")) - { - User *u = User::Find(params[0]); - if (!u) - return; - u->Extend<bool>("ssl"); - Anope::string data = params[2].c_str(); - size_t pos1 = data.find(' ') + 1; - size_t pos2 = data.find(' ', pos1); - if ((pos2 - pos1) >= 32) // inspircd supports md5 and sha1 fingerprint hashes -> size 32 or 40 bytes. - { - u->fingerprint = data.substr(pos1, pos2 - pos1); - } - FOREACH_MOD(OnFingerprint, (u)); - } - } - else if (params[0][0] == '#') - { - } - else if (params[0] == "*") - { - // Wed Oct 3 15:40:27 2012: S[14] O :20D METADATA * modules :-m_svstopic.so - - if (params[1].equals_cs("modules") && !params[2].empty()) - { - // only interested when it comes from our uplink - Server* server = source.GetServer(); - if (!server || server->GetUplink() != Me) - return; - - bool plus = (params[2][0] == '+'); - if (!plus && params[2][0] != '-') - return; - - bool required = false; - Anope::string capab, module = params[2].substr(1); - - if (module.equals_cs("m_services_account.so")) - required = true; - else if (module.equals_cs("m_hidechans.so")) - required = true; - else if (module.equals_cs("m_chghost.so")) - capab = "CHGHOST"; - else if (module.equals_cs("m_chgident.so")) - capab = "CHGIDENT"; - else if (module.equals_cs("m_svshold.so")) - capab = "SVSHOLD"; - else if (module.equals_cs("m_rline.so")) - capab = "RLINE"; - else if (module.equals_cs("m_topiclock.so")) - capab = "TOPICLOCK"; - else - return; - - if (required) - { - if (!plus) - Log() << "Warning: InspIRCd unloaded module " << module << ", Anope won't function correctly without it"; - } - else - { - if (plus) - Servers::Capab.insert(capab); - else - Servers::Capab.erase(capab); - - Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " module " << module << ", adjusted functionality"; - } - - } - } - } -}; - -struct IRCDMessageMode : IRCDMessage -{ - IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (IRCD->IsChannelValid(params[0])) - { - Channel *c = Channel::Find(params[0]); - - Anope::string modes = params[1]; - for (unsigned n = 2; n < params.size(); ++n) - modes += " " + params[n]; - - if (c) - c->SetModesInternal(source, modes); - } - else - { - /* InspIRCd lets opers change another - users modes, we have to kludge this - as it slightly breaks RFC1459 - */ - User *u = User::Find(params[0]); - if (u) - u->SetModesInternal(source, "%s", params[1].c_str()); - } - } -}; - -struct IRCDMessageNick : IRCDMessage -{ - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetUser()->ChangeNick(params[0]); - } -}; - -struct IRCDMessageOperType : IRCDMessage -{ - IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - /* opertype is equivalent to mode +o because servers - don't do this directly */ - User *u = source.GetUser(); - if (!u->HasMode("OPER")) - u->SetModesInternal(source, "+o"); - } -}; - -struct IRCDMessageRSQuit : IRCDMessage -{ - IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - Server *s = Server::Find(params[0]); - const Anope::string &reason = params.size() > 1 ? params[1] : ""; - if (!s) - return; - - UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << reason; - s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); - } -}; - -struct IRCDMessageSetIdent : IRCDMessage -{ - IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetUser()->SetIdent(params[0]); - } -}; - -struct IRCDMessageServer : IRCDMessage -{ - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 5) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - /* - * [Nov 04 00:08:46.308435 2009] debug: Received: SERVER irc.inspircd.com pass 0 964 :Testnet Central! - * 0: name - * 1: pass - * 2: hops - * 3: numeric - * 4: desc - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - unsigned int hops = Anope::string(params[2]).is_pos_number_only() ? convertTo<unsigned>(params[2]) : 0; - new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[4], params[3]); - } -}; - -struct IRCDMessageSQuit : Message::SQuit -{ - IRCDMessageSQuit(Module *creator) : Message::SQuit(creator) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (params[0] == rsquit_id || params[0] == rsquit_server) - { - /* squit for a recently squit server, introduce the juped server now */ - Server *s = Server::Find(rsquit_server); - - rsquit_id.clear(); - rsquit_server.clear(); - - if (s && s->IsJuped()) - IRCD->SendServer(s); - } - else - Message::SQuit::Run(source, params); - } -}; - -struct IRCDMessageTime : IRCDMessage -{ - IRCDMessageTime(Module *creator) : IRCDMessage(creator, "TIME", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - UplinkSocket::Message(Me) << "TIME " << source.GetSource() << " " << params[1] << " " << Anope::CurTime; - } -}; - -struct IRCDMessageUID : IRCDMessage -{ - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - /* - * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org> - * 0: uid - * 1: ts - * 2: nick - * 3: host - * 4: dhost - * 5: ident - * 6: ip - * 7: signon - * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname! - * last: realname - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - time_t ts = convertTo<time_t>(params[1]); - - Anope::string modes = params[8]; - for (unsigned i = 9; i < params.size() - 1; ++i) - modes += " " + params[i]; - - NickAlias *na = NULL; - if (SASL::sasl) - for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) - { - SASLUser &u = *it; - - if (u.created + 30 < Anope::CurTime) - it = saslusers.erase(it); - else if (u.uid == params[0]) - { - na = NickAlias::Find(u.acc); - it = saslusers.erase(it); - } - else - ++it; - } - - User *u = User::OnIntroduce(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0], na ? *na->nc : NULL); - if (u) - u->signon = convertTo<time_t>(params[7]); - } -}; - -class ProtoInspIRCd12 : public Module -{ - InspIRCd12Proto ircd_proto; - ExtensibleItem<bool> ssl; - - /* Core message handlers */ - Message::Away message_away; - Message::Error message_error; - Message::Invite message_invite; - Message::Join message_join; - Message::Kick message_kick; - Message::Kill message_kill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::Stats message_stats; - Message::Topic message_topic; - - /* Our message handlers */ - IRCDMessageChgIdent message_chgident; - IRCDMessageChgName message_setname, message_chgname; - IRCDMessageCapab message_capab; - IRCDMessageEncap message_encap; - IRCDMessageEndburst message_endburst; - IRCDMessageFHost message_fhost, message_sethost; - IRCDMessageFJoin message_fjoin; - IRCDMessageFMode message_fmode; - IRCDMessageFTopic message_ftopic; - IRCDMessageIdle message_idle; - IRCDMessageMetadata message_metadata; - IRCDMessageMode message_mode; - IRCDMessageNick message_nick; - IRCDMessageOperType message_opertype; - IRCDMessageRSQuit message_rsquit; - IRCDMessageSetIdent message_setident; - IRCDMessageServer message_server; - IRCDMessageSQuit message_squit; - IRCDMessageTime message_time; - IRCDMessageUID message_uid; - - public: - ProtoInspIRCd12(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), - ircd_proto(this), ssl(this, "ssl"), - message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this), message_kill(this), - message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), - message_stats(this), message_topic(this), - - message_chgident(this), message_setname(this, "SETNAME"), message_chgname(this, "FNAME"), message_capab(this), message_encap(this), - message_endburst(this), - message_fhost(this, "FHOST"), message_sethost(this, "SETHOST"), message_fjoin(this), message_fmode(this), message_ftopic(this), - message_idle(this), message_metadata(this), message_mode(this), message_nick(this), message_opertype(this), message_rsquit(this), - message_setident(this), message_server(this), message_squit(this), message_time(this), message_uid(this) - { - Servers::Capab.insert("NOQUIT"); - } - - void OnUserNickChange(User *u, const Anope::string &) anope_override - { - /* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later - * this will cancel out this -r, resulting in no mode changes. - * - * Do not set -r if we don't have a NickServ loaded - DP - */ - BotInfo *NickServ = Config->GetClient("NickServ"); - if (NickServ) - u->RemoveMode(NickServ, "REGISTERED"); - } -}; - -MODULE_INIT(ProtoInspIRCd12) diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp deleted file mode 100644 index 221de3d2b..000000000 --- a/modules/protocol/inspircd20.cpp +++ /dev/null @@ -1,1106 +0,0 @@ -/* InspIRCd 2.0 functions - * - * (C) 2003-2021 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "module.h" -#include "modules/cs_mode.h" - -static unsigned int spanningtree_proto_ver = 0; - -static ServiceReference<IRCDProto> insp12("IRCDProto", "inspircd12"); - -class InspIRCd20Proto : public IRCDProto -{ - public: - InspIRCd20Proto(Module *creator) : IRCDProto(creator, "InspIRCd 2.0") - { - DefaultPseudoclientModes = "+I"; - CanSVSNick = true; - CanSVSJoin = true; - CanSetVHost = true; - CanSetVIdent = true; - CanSQLine = true; - CanSZLine = true; - CanSVSHold = true; - CanCertFP = true; - RequiresID = true; - MaxModes = 20; - } - - void SendConnect() anope_override - { - UplinkSocket::Message() << "CAPAB START 1202"; - UplinkSocket::Message() << "CAPAB CAPABILITIES :PROTOCOL=1202"; - UplinkSocket::Message() << "CAPAB END"; - insp12->SendConnect(); - } - - void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) anope_override - { - Anope::string mechlist; - for (unsigned i = 0; i < mechanisms.size(); ++i) - mechlist += "," + mechanisms[i]; - - UplinkSocket::Message(Me) << "METADATA * saslmechlist :" << (mechanisms.empty() ? "" : mechlist.substr(1)); - } - - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override { insp12->SendSVSKillInternal(source, user, buf); } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { insp12->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { insp12->SendGlobalPrivmsg(bi, dest, msg); } - void SendAkillDel(const XLine *x) anope_override { insp12->SendAkillDel(x); } - void SendTopic(const MessageSource &whosets, Channel *c) anope_override { insp12->SendTopic(whosets, c); }; - void SendVhostDel(User *u) anope_override { insp12->SendVhostDel(u); } - void SendAkill(User *u, XLine *x) anope_override { insp12->SendAkill(u, x); } - void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override { insp12->SendNumericInternal(numeric, dest, buf); } - void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override { insp12->SendModeInternal(source, dest, buf); } - void SendClientIntroduction(User *u) anope_override { insp12->SendClientIntroduction(u); } - void SendServer(const Server *server) anope_override { insp12->SendServer(server); } - void SendSquit(Server *s, const Anope::string &message) anope_override { insp12->SendSquit(s, message); } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { insp12->SendJoin(user, c, status); } - void SendSQLineDel(const XLine *x) anope_override { insp12->SendSQLineDel(x); } - void SendSQLine(User *u, const XLine *x) anope_override { insp12->SendSQLine(u, x); } - void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost) anope_override { insp12->SendVhost(u, vident, vhost); } - void SendSVSHold(const Anope::string &nick, time_t t) anope_override { insp12->SendSVSHold(nick, t); } - void SendSVSHoldDel(const Anope::string &nick) anope_override { insp12->SendSVSHoldDel(nick); } - void SendSZLineDel(const XLine *x) anope_override { insp12->SendSZLineDel(x); } - void SendSZLine(User *u, const XLine *x) anope_override { insp12->SendSZLine(u, x); } - void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) anope_override { insp12->SendSVSJoin(source, u, chan, other); } - void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) anope_override { insp12->SendSVSPart(source, u, chan, param); } - void SendSWhois(const MessageSource &bi, const Anope::string &who, const Anope::string &mask) anope_override { insp12->SendSWhois(bi, who, mask); } - void SendBOB() anope_override { insp12->SendBOB(); } - void SendEOB() anope_override { insp12->SendEOB(); } - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) { insp12->SendGlobopsInternal(source, buf); } - void SendLogin(User *u, NickAlias *na) anope_override { insp12->SendLogin(u, na); } - void SendLogout(User *u) anope_override { insp12->SendLogout(u); } - void SendChannel(Channel *c) anope_override { insp12->SendChannel(c); } - void SendSASLMessage(const SASL::Message &message) anope_override { insp12->SendSASLMessage(message); } - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override { insp12->SendSVSLogin(uid, acc, vident, vhost); } - bool IsExtbanValid(const Anope::string &mask) anope_override { return insp12->IsExtbanValid(mask); } - bool IsIdentValid(const Anope::string &ident) anope_override { return insp12->IsIdentValid(ident); } -}; - -class InspIRCdAutoOpMode : public ChannelModeList -{ - public: - InspIRCdAutoOpMode(char mode) : ChannelModeList("AUTOOP", mode) - { - } - - bool IsValid(Anope::string &mask) const anope_override - { - // We can not validate this because we don't know about the - // privileges of the setter so just reject attempts to set it. - return false; - } -}; - -class InspIRCdExtBan : public ChannelModeVirtual<ChannelModeList> -{ - char ext; - - public: - InspIRCdExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual<ChannelModeList>(mname, basename) - , ext(extban) - { - } - - ChannelMode *Wrap(Anope::string ¶m) anope_override - { - param = Anope::string(ext) + ":" + param; - return ChannelModeVirtual<ChannelModeList>::Wrap(param); - } - - ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override - { - if (cm->type != MODE_LIST || param.length() < 3 || param[0] != ext || param[1] != ':') - return cm; - - param = param.substr(2); - return this; - } -}; - -namespace InspIRCdExtban -{ - class EntryMatcher : public InspIRCdExtBan - { - public: - EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(3); - - return Entry(this->name, real_mask).Matches(u); - } - }; - - class ChannelMatcher : public InspIRCdExtBan - { - public: - ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - - Anope::string channel = mask.substr(3); - - ChannelMode *cm = NULL; - if (channel[0] != '#') - { - char modeChar = ModeManager::GetStatusChar(channel[0]); - channel.erase(channel.begin()); - cm = ModeManager::FindChannelModeByChar(modeChar); - if (cm != NULL && cm->type != MODE_STATUS) - cm = NULL; - } - - Channel *c = Channel::Find(channel); - if (c != NULL) - { - ChanUserContainer *uc = c->FindUser(u); - if (uc != NULL) - if (cm == NULL || uc->status.HasMode(cm->mchar)) - return true; - } - - return false; - } - }; - - class AccountMatcher : public InspIRCdExtBan - { - public: - AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(2); - - return u->IsIdentified() && real_mask.equals_ci(u->Account()->display); - } - }; - - class RealnameMatcher : public InspIRCdExtBan - { - public: - RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(2); - return Anope::Match(u->realname, real_mask); - } - }; - - class ServerMatcher : public InspIRCdExtBan - { - public: - ServerMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(2); - return Anope::Match(u->server->GetName(), real_mask); - } - }; - - class FingerprintMatcher : public InspIRCdExtBan - { - public: - FingerprintMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(2); - return !u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask); - } - }; - - class UnidentifiedMatcher : public InspIRCdExtBan - { - public: - UnidentifiedMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(2); - return !u->Account() && Entry("BAN", real_mask).Matches(u); - } - }; -} - -class ColonDelimitedParamMode : public ChannelModeParam -{ - public: - ColonDelimitedParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { } - - bool IsValid(Anope::string &value) const anope_override - { - return IsValid(value, false); - } - - bool IsValid(const Anope::string &value, bool historymode) const - { - if (value.empty()) - return false; // empty param is never valid - - Anope::string::size_type pos = value.find(':'); - if ((pos == Anope::string::npos) || (pos == 0)) - return false; // no ':' or it's the first char, both are invalid - - Anope::string rest; - try - { - if (convertTo<int>(value, rest, false) <= 0) - return false; // negative numbers and zero are invalid - - rest = rest.substr(1); - int n; - if (historymode) - { - // For the history mode, the part after the ':' is a duration and it - // can be in the user friendly "1d3h20m" format, make sure we accept that - n = Anope::DoTime(rest); - } - else - n = convertTo<int>(rest); - - if (n <= 0) - return false; - } - catch (const ConvertException &e) - { - // conversion error, invalid - return false; - } - - return true; - } -}; - -class SimpleNumberParamMode : public ChannelModeParam -{ - public: - SimpleNumberParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { } - - bool IsValid(Anope::string &value) const anope_override - { - if (value.empty()) - return false; // empty param is never valid - - try - { - if (convertTo<int>(value) <= 0) - return false; - } - catch (const ConvertException &e) - { - // conversion error, invalid - return false; - } - - return true; - } -}; - -class ChannelModeFlood : public ColonDelimitedParamMode -{ - public: - ChannelModeFlood(char modeChar) : ColonDelimitedParamMode("FLOOD", modeChar) { } - - bool IsValid(Anope::string &value) const anope_override - { - // The parameter of this mode is a bit different, it may begin with a '*', - // ignore it if that's the case - Anope::string v = value[0] == '*' ? value.substr(1) : value; - return ((!value.empty()) && (ColonDelimitedParamMode::IsValid(v))); - } -}; - -class ChannelModeHistory : public ColonDelimitedParamMode -{ - public: - ChannelModeHistory(char modeChar) : ColonDelimitedParamMode("HISTORY", modeChar) { } - - bool IsValid(Anope::string &value) const anope_override - { - return (ColonDelimitedParamMode::IsValid(value, true)); - } -}; - -class ChannelModeRedirect : public ChannelModeParam -{ - public: - ChannelModeRedirect(char modeChar) : ChannelModeParam("REDIRECT", modeChar, true) { } - - bool IsValid(Anope::string &value) const anope_override - { - // The parameter of this mode is a channel, and channel names start with '#' - return ((!value.empty()) && (value[0] == '#')); - } -}; - -struct IRCDMessageAway : Message::Away -{ - IRCDMessageAway(Module *creator) : Message::Away(creator, "AWAY") { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - std::vector<Anope::string> newparams(params); - if (newparams.size() > 1) - newparams.erase(newparams.begin()); - - Message::Away::Run(source, newparams); - } -}; - -struct IRCDMessageCapab : Message::Capab -{ - std::map<char, Anope::string> chmodes, umodes; - - IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (params[0].equals_cs("START")) - { - if (params.size() >= 2) - spanningtree_proto_ver = (Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0); - - if (spanningtree_proto_ver < 1202) - { - UplinkSocket::Message() << "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START"; - Anope::QuitReason = "Protocol mismatch, no or invalid protocol version given in CAPAB START"; - Anope::Quitting = true; - return; - } - - /* reset CAPAB */ - chmodes.clear(); - umodes.clear(); - Servers::Capab.insert("SERVERS"); - Servers::Capab.insert("TOPICLOCK"); - IRCD->CanSVSHold = false; - IRCD->DefaultPseudoclientModes = "+I"; - } - else if (params[0].equals_cs("CHANMODES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string capab; - - while (ssep.GetToken(capab)) - { - Anope::string modename = capab.substr(0, capab.find('=')); - Anope::string modechar = capab.substr(capab.find('=') + 1); - ChannelMode *cm = NULL; - - if (modename.equals_cs("admin")) - cm = new ChannelModeStatus("PROTECT", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 3); - else if (modename.equals_cs("allowinvite")) - { - cm = new ChannelMode("ALLINVITE", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("INVITEBAN", "BAN", 'A')); - } - else if (modename.equals_cs("auditorium")) - cm = new ChannelMode("AUDITORIUM", modechar[0]); - else if (modename.equals_cs("autoop")) - cm = new InspIRCdAutoOpMode(modechar[0]); - else if (modename.equals_cs("ban")) - cm = new ChannelModeList("BAN", modechar[0]); - else if (modename.equals_cs("banexception")) - cm = new ChannelModeList("EXCEPT", modechar[0]); - else if (modename.equals_cs("blockcaps")) - { - cm = new ChannelMode("BLOCKCAPS", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCAPSBAN", "BAN", 'B')); - } - else if (modename.equals_cs("blockcolor")) - { - cm = new ChannelMode("BLOCKCOLOR", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCOLORBAN", "BAN", 'c')); - } - else if (modename.equals_cs("c_registered")) - cm = new ChannelModeNoone("REGISTERED", modechar[0]); - else if (modename.equals_cs("censor")) - cm = new ChannelMode("CENSOR", modechar[0]); - else if (modename.equals_cs("delayjoin")) - cm = new ChannelMode("DELAYEDJOIN", modechar[0]); - else if (modename.equals_cs("delaymsg")) - cm = new SimpleNumberParamMode("DELAYMSG", modechar[0]); - else if (modename.equals_cs("filter")) - cm = new ChannelModeList("FILTER", modechar[0]); - else if (modename.equals_cs("flood")) - cm = new ChannelModeFlood(modechar[0]); - else if (modename.equals_cs("founder")) - cm = new ChannelModeStatus("OWNER", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 4); - else if (modename.equals_cs("halfop")) - cm = new ChannelModeStatus("HALFOP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 1); - else if (modename.equals_cs("history")) - cm = new ChannelModeHistory(modechar[0]); - else if (modename.equals_cs("invex")) - cm = new ChannelModeList("INVITEOVERRIDE", modechar[0]); - else if (modename.equals_cs("inviteonly")) - cm = new ChannelMode("INVITE", modechar[0]); - else if (modename.equals_cs("joinflood")) - cm = new ColonDelimitedParamMode("JOINFLOOD", modechar[0]); - else if (modename.equals_cs("key")) - cm = new ChannelModeKey(modechar[0]); - else if (modename.equals_cs("kicknorejoin")) - cm = new SimpleNumberParamMode("NOREJOIN", modechar[0]); - else if (modename.equals_cs("limit")) - cm = new ChannelModeParam("LIMIT", modechar[0], true); - else if (modename.equals_cs("moderated")) - cm = new ChannelMode("MODERATED", modechar[0]); - else if (modename.equals_cs("nickflood")) - cm = new ColonDelimitedParamMode("NICKFLOOD", modechar[0]); - else if (modename.equals_cs("noctcp")) - { - cm = new ChannelMode("NOCTCP", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOCTCPBAN", "BAN", 'C')); - } - else if (modename.equals_cs("noextmsg")) - cm = new ChannelMode("NOEXTERNAL", modechar[0]); - else if (modename.equals_cs("nokick")) - { - cm = new ChannelMode("NOKICK", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOKICKBAN", "BAN", 'Q')); - } - else if (modename.equals_cs("noknock")) - cm = new ChannelMode("NOKNOCK", modechar[0]); - else if (modename.equals_cs("nonick")) - { - cm = new ChannelMode("NONICK", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONICKBAN", "BAN", 'N')); - } - else if (modename.equals_cs("nonotice")) - { - cm = new ChannelMode("NONOTICE", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONOTICEBAN", "BAN", 'T')); - } - else if (modename.equals_cs("official-join")) - cm = new ChannelModeStatus("OFFICIALJOIN", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 2); - else if (modename.equals_cs("op")) - cm = new ChannelModeStatus("OP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 2); - else if (modename.equals_cs("operonly")) - cm = new ChannelModeOperOnly("OPERONLY", modechar[0]); - else if (modename.equals_cs("operprefix")) - cm = new ChannelModeStatus("OPERPREFIX", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 2); - else if (modename.equals_cs("permanent")) - cm = new ChannelMode("PERM", modechar[0]); - else if (modename.equals_cs("private")) - cm = new ChannelMode("PRIVATE", modechar[0]); - else if (modename.equals_cs("redirect")) - cm = new ChannelModeRedirect(modechar[0]); - else if (modename.equals_cs("reginvite")) - cm = new ChannelMode("REGISTEREDONLY", modechar[0]); - else if (modename.equals_cs("regmoderated")) - cm = new ChannelMode("REGMODERATED", modechar[0]); - else if (modename.equals_cs("secret")) - cm = new ChannelMode("SECRET", modechar[0]); - else if (modename.equals_cs("sslonly")) - { - cm = new ChannelMode("SSL", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::FingerprintMatcher("SSLBAN", "BAN", 'z')); - } - else if (modename.equals_cs("stripcolor")) - { - cm = new ChannelMode("STRIPCOLOR", modechar[0]); - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("STRIPCOLORBAN", "BAN", 'S')); - } - else if (modename.equals_cs("topiclock")) - cm = new ChannelMode("TOPIC", modechar[0]); - else if (modename.equals_cs("voice")) - cm = new ChannelModeStatus("VOICE", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 0); - /* Unknown status mode, (customprefix) - add it */ - else if (modechar.length() == 2) - cm = new ChannelModeStatus(modename.upper(), modechar[1], modechar[0], -1); - /* Unknown non status mode, add it to our list for later */ - else - chmodes[modechar[0]] = modename.upper(); - - if (cm) - ModeManager::AddChannelMode(cm); - } - } - if (params[0].equals_cs("USERMODES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string capab; - - while (ssep.GetToken(capab)) - { - Anope::string modename = capab.substr(0, capab.find('=')); - Anope::string modechar = capab.substr(capab.find('=') + 1); - UserMode *um = NULL; - - if (modename.equals_cs("bot")) - { - um = new UserMode("BOT", modechar[0]); - IRCD->DefaultPseudoclientModes += modechar; - } - else if (modename.equals_cs("callerid")) - um = new UserMode("CALLERID", modechar[0]); - else if (modename.equals_cs("cloak")) - um = new UserMode("CLOAK", modechar[0]); - else if (modename.equals_cs("deaf")) - um = new UserMode("DEAF", modechar[0]); - else if (modename.equals_cs("deaf_commonchan")) - um = new UserMode("COMMONCHANS", modechar[0]); - else if (modename.equals_cs("helpop")) - um = new UserModeOperOnly("HELPOP", modechar[0]); - else if (modename.equals_cs("hidechans")) - um = new UserMode("PRIV", modechar[0]); - else if (modename.equals_cs("hideoper")) - um = new UserModeOperOnly("HIDEOPER", modechar[0]); - else if (modename.equals_cs("invisible")) - um = new UserMode("INVIS", modechar[0]); - else if (modename.equals_cs("invis-oper")) - um = new UserModeOperOnly("INVISIBLE_OPER", modechar[0]); - else if (modename.equals_cs("oper")) - um = new UserModeOperOnly("OPER", modechar[0]); - else if (modename.equals_cs("regdeaf")) - um = new UserMode("REGPRIV", modechar[0]); - else if (modename.equals_cs("servprotect")) - { - um = new UserModeNoone("PROTECTED", modechar[0]); - IRCD->DefaultPseudoclientModes += modechar; - } - else if (modename.equals_cs("showwhois")) - um = new UserMode("WHOIS", modechar[0]); - else if (modename.equals_cs("u_censor")) - um = new UserMode("CENSOR", modechar[0]); - else if (modename.equals_cs("u_registered")) - um = new UserModeNoone("REGISTERED", modechar[0]); - else if (modename.equals_cs("u_stripcolor")) - um = new UserMode("STRIPCOLOR", modechar[0]); - else if (modename.equals_cs("wallops")) - um = new UserMode("WALLOPS", modechar[0]); - else - umodes[modechar[0]] = modename.upper(); - - if (um) - ModeManager::AddUserMode(um); - } - } - else if (params[0].equals_cs("MODULES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string module; - - while (ssep.GetToken(module)) - { - if (module.equals_cs("m_svshold.so")) - IRCD->CanSVSHold = true; - else if (module.find("m_rline.so") == 0) - { - Servers::Capab.insert("RLINE"); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); - if (!regexengine.empty() && module.length() > 11 && regexengine != module.substr(11)) - Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << regexengine << ". This may cause inconsistencies."; - } - else if (module.equals_cs("m_topiclock.so")) - Servers::Capab.insert("TOPICLOCK"); - } - } - else if (params[0].equals_cs("MODSUPPORT") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string module; - - while (ssep.GetToken(module)) - { - if (module.equals_cs("m_services_account.so")) - { - Servers::Capab.insert("SERVICES"); - ModeManager::AddChannelMode(new InspIRCdExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'R')); - ModeManager::AddChannelMode(new InspIRCdExtban::UnidentifiedMatcher("UNREGISTEREDBAN", "BAN", 'U')); - } - else if (module.equals_cs("m_chghost.so")) - Servers::Capab.insert("CHGHOST"); - else if (module.equals_cs("m_chgident.so")) - Servers::Capab.insert("CHGIDENT"); - else if (module == "m_channelban.so") - ModeManager::AddChannelMode(new InspIRCdExtban::ChannelMatcher("CHANNELBAN", "BAN", 'j')); - else if (module == "m_gecosban.so") - ModeManager::AddChannelMode(new InspIRCdExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r')); - else if (module == "m_nopartmessage.so") - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("PARTMESSAGEBAN", "BAN", 'p')); - else if (module == "m_serverban.so") - ModeManager::AddChannelMode(new InspIRCdExtban::ServerMatcher("SERVERBAN", "BAN", 's')); - else if (module == "m_muteban.so") - ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("QUIET", "BAN", 'm')); - } - } - else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string capab; - while (ssep.GetToken(capab)) - { - if (capab.find("CHANMODES") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 10, capab.end()); - commasepstream sep(modes, true); - Anope::string modebuf; - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - if (ModeManager::FindChannelModeByChar(modebuf[t])) - continue; - ModeManager::AddChannelMode(new ChannelModeList(chmodes[modebuf[t]], modebuf[t])); - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - if (ModeManager::FindChannelModeByChar(modebuf[t])) - continue; - ModeManager::AddChannelMode(new ChannelModeParam(chmodes[modebuf[t]], modebuf[t])); - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - if (ModeManager::FindChannelModeByChar(modebuf[t])) - continue; - ModeManager::AddChannelMode(new ChannelModeParam(chmodes[modebuf[t]], modebuf[t], true)); - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - if (ModeManager::FindChannelModeByChar(modebuf[t])) - continue; - ModeManager::AddChannelMode(new ChannelMode(chmodes[modebuf[t]], modebuf[t])); - } - } - else if (capab.find("USERMODES") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 10, capab.end()); - commasepstream sep(modes, true); - Anope::string modebuf; - - sep.GetToken(modebuf); - sep.GetToken(modebuf); - - if (sep.GetToken(modebuf)) - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - ModeManager::AddUserMode(new UserModeParam(umodes[modebuf[t]], modebuf[t])); - - if (sep.GetToken(modebuf)) - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - ModeManager::AddUserMode(new UserMode(umodes[modebuf[t]], modebuf[t])); - } - else if (capab.find("MAXMODES=") != Anope::string::npos) - { - Anope::string maxmodes(capab.begin() + 9, capab.end()); - IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; - } - else if (capab.find("PREFIX=") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')')); - Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end()); - short level = modes.length() - 1; - - for (size_t t = 0, end = modes.length(); t < end; ++t) - { - ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[t]); - if (cm == NULL || cm->type != MODE_STATUS) - { - Log() << "CAPAB PREFIX gave unknown channel status mode " << modes[t]; - continue; - } - - ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm); - cms->level = level--; - - Log(LOG_DEBUG) << cms->name << " is now level " << cms->level; - } - - ModeManager::RebuildStatusModes(); - } - else if (capab == "GLOBOPS=1") - Servers::Capab.insert("GLOBOPS"); - } - } - else if (params[0].equals_cs("END")) - { - if (!Servers::Capab.count("SERVICES")) - { - UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope"; - Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required."; - Anope::Quitting = true; - return; - } - if (!ModeManager::FindUserModeByName("PRIV")) - { - UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope"; - Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required."; - Anope::Quitting = true; - return; - } - if (!IRCD->CanSVSHold) - Log() << "SVSHOLD missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("CHGHOST")) - Log() << "CHGHOST missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("CHGIDENT")) - Log() << "CHGIDENT missing, Usage disabled until module is loaded."; - - chmodes.clear(); - umodes.clear(); - } - - Message::Capab::Run(source, params); - } -}; - -struct IRCDMessageEncap : IRCDMessage -{ - ServiceReference<IRCDMessage> insp12_encap; - - IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4), insp12_encap("IRCDMessage", "inspircd12/encap") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (!Anope::Match(Me->GetSID(), params[0]) && !Anope::Match(Me->GetName(), params[0])) - return; - - if (params[1] == "CHGIDENT") - { - User *u = User::Find(params[2]); - if (!u || u->server != Me) - return; - - u->SetIdent(params[3]); - UplinkSocket::Message(u) << "FIDENT :" << params[3]; - } - else if (params[1] == "CHGHOST") - { - User *u = User::Find(params[2]); - if (!u || u->server != Me) - return; - - u->SetDisplayedHost(params[3]); - UplinkSocket::Message(u) << "FHOST :" << params[3]; - } - else if (params[1] == "CHGNAME") - { - User *u = User::Find(params[2]); - if (!u || u->server != Me) - return; - - u->SetRealname(params[3]); - UplinkSocket::Message(u) << "FNAME :" << params[3]; - } - - if (insp12_encap) - insp12_encap->Run(source, params); - } -}; - -struct IRCDMessageFHost : IRCDMessage -{ - IRCDMessageFHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = source.GetUser(); - if (u->HasMode("CLOAK")) - u->RemoveModeInternal(source, ModeManager::FindUserModeByName("CLOAK")); - u->SetDisplayedHost(params[0]); - } -}; - -struct IRCDMessageFIdent : IRCDMessage -{ - IRCDMessageFIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetUser()->SetIdent(params[0]); - } -}; - -struct IRCDMessageSave : IRCDMessage -{ - time_t last_collide; - - IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2), last_collide(0) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *targ = User::Find(params[0]); - time_t ts; - - try - { - ts = convertTo<time_t>(params[1]); - } - catch (const ConvertException &) - { - return; - } - - if (!targ || targ->timestamp != ts) - return; - - BotInfo *bi; - if (targ->server == Me && (bi = dynamic_cast<BotInfo *>(targ))) - { - if (last_collide == Anope::CurTime) - { - Anope::QuitReason = "Nick collision fight on " + targ->nick; - Anope::Quitting = true; - return; - } - - IRCD->SendKill(Me, targ->nick, "Nick collision"); - IRCD->SendNickChange(targ, targ->nick); - last_collide = Anope::CurTime; - } - else - targ->ChangeNick(targ->GetUID()); - } -}; - -class IRCDMessageMetadata : IRCDMessage -{ - ServiceReference<IRCDMessage> insp12_metadata; - const bool &do_topiclock; - const bool &do_mlock; - - public: - IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock) : IRCDMessage(creator, "METADATA", 3), insp12_metadata("IRCDMessage", "inspircd12/metadata"), do_topiclock(handle_topiclock), do_mlock(handle_mlock) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - // We deliberately ignore non-bursting servers to avoid pseudoserver fights - if ((params[0][0] == '#') && (!source.GetServer()->IsSynced())) - { - Channel *c = Channel::Find(params[0]); - if (c && c->ci) - { - if ((do_mlock) && (params[1] == "mlock")) - { - ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); - Anope::string modes; - if (modelocks) - modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - - // Mode lock string is not what we say it is? - if (modes != params[2]) - UplinkSocket::Message(Me) << "METADATA " << c->name << " mlock :" << modes; - } - else if ((do_topiclock) && (params[1] == "topiclock")) - { - bool mystate = c->ci->HasExt("TOPICLOCK"); - bool serverstate = (params[2] == "1"); - if (mystate != serverstate) - UplinkSocket::Message(Me) << "METADATA " << c->name << " topiclock :" << (mystate ? "1" : ""); - } - } - } - - if (insp12_metadata) - insp12_metadata->Run(source, params); - } -}; - -class ProtoInspIRCd20 : public Module -{ - Module *m_insp12; - - InspIRCd20Proto ircd_proto; - - /* Core message handlers */ - Message::Error message_error; - Message::Invite message_invite; - Message::Join message_join; - Message::Kick message_kick; - Message::Kill message_kill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::Stats message_stats; - Message::Topic message_topic; - - /* InspIRCd 1.2 message handlers */ - ServiceAlias message_endburst, message_fjoin, message_fmode, - message_ftopic, message_idle, message_mode, - message_nick, message_opertype, message_rsquit, message_server, - message_squit, message_time, message_uid; - - /* Our message handlers */ - IRCDMessageAway message_away; - IRCDMessageCapab message_capab; - IRCDMessageEncap message_encap; - IRCDMessageFHost message_fhost; - IRCDMessageFIdent message_fident; - IRCDMessageMetadata message_metadata; - IRCDMessageSave message_save; - - bool use_server_side_topiclock, use_server_side_mlock; - - void SendChannelMetadata(Channel *c, const Anope::string &metadataname, const Anope::string &value) - { - UplinkSocket::Message(Me) << "METADATA " << c->name << " " << metadataname << " :" << value; - } - - public: - ProtoInspIRCd20(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), - ircd_proto(this), - message_error(this), message_invite(this), message_join(this), message_kick(this), message_kill(this), - message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), - message_quit(this), message_stats(this), message_topic(this), - - message_endburst("IRCDMessage", "inspircd20/endburst", "inspircd12/endburst"), - message_fjoin("IRCDMessage", "inspircd20/fjoin", "inspircd12/fjoin"), - message_fmode("IRCDMessage", "inspircd20/fmode", "inspircd12/fmode"), - message_ftopic("IRCDMessage", "inspircd20/ftopic", "inspircd12/ftopic"), - message_idle("IRCDMessage", "inspircd20/idle", "inspircd12/idle"), - message_mode("IRCDMessage", "inspircd20/mode", "inspircd12/mode"), - message_nick("IRCDMessage", "inspircd20/nick", "inspircd12/nick"), - message_opertype("IRCDMessage", "inspircd20/opertype", "inspircd12/opertype"), - message_rsquit("IRCDMessage", "inspircd20/rsquit", "inspircd12/rsquit"), - message_server("IRCDMessage", "inspircd20/server", "inspircd12/server"), - message_squit("IRCDMessage", "inspircd20/squit", "inspircd12/squit"), - message_time("IRCDMessage", "inspircd20/time", "inspircd12/time"), - message_uid("IRCDMessage", "inspircd20/uid", "inspircd12/uid"), - - message_away(this), message_capab(this), message_encap(this), message_fhost(this), message_fident(this), - message_metadata(this, use_server_side_topiclock, use_server_side_mlock), message_save(this) - { - - if (ModuleManager::LoadModule("inspircd12", User::Find(creator)) != MOD_ERR_OK) - throw ModuleException("Unable to load inspircd12"); - m_insp12 = ModuleManager::FindModule("inspircd12"); - if (!m_insp12) - throw ModuleException("Unable to find inspircd12"); - if (!insp12) - throw ModuleException("No protocol interface for insp12"); - ModuleManager::DetachAll(m_insp12); - - } - - ~ProtoInspIRCd20() - { - m_insp12 = ModuleManager::FindModule("inspircd12"); - ModuleManager::UnloadModule(m_insp12, NULL); - } - - void OnReload(Configuration::Conf *conf) anope_override - { - use_server_side_topiclock = conf->GetModule(this)->Get<bool>("use_server_side_topiclock"); - use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); - } - - void OnUserNickChange(User *u, const Anope::string &) anope_override - { - u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); - } - - void OnChannelSync(Channel *c) anope_override - { - if (c->ci) - this->OnChanRegistered(c->ci); - } - - void OnChanRegistered(ChannelInfo *ci) anope_override - { - ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); - if (use_server_side_mlock && ci->c && modelocks && !modelocks->GetMLockAsString(false).empty()) - { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - SendChannelMetadata(ci->c, "mlock", modes); - } - - if (use_server_side_topiclock && Servers::Capab.count("TOPICLOCK") && ci->c) - { - if (ci->HasExt("TOPICLOCK")) - SendChannelMetadata(ci->c, "topiclock", "1"); - } - } - - void OnDelChan(ChannelInfo *ci) anope_override - { - if (use_server_side_mlock && ci->c) - SendChannelMetadata(ci->c, "mlock", ""); - - if (use_server_side_topiclock && Servers::Capab.count("TOPICLOCK") && ci->c) - SendChannelMetadata(ci->c, "topiclock", ""); - } - - EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override - { - ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); - ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) - { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; - SendChannelMetadata(ci->c, "mlock", modes); - } - - return EVENT_CONTINUE; - } - - EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override - { - ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); - ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) - { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); - SendChannelMetadata(ci->c, "mlock", modes); - } - - return EVENT_CONTINUE; - } - - EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) anope_override - { - if (cmd->name == "chanserv/topic" && ci->c) - { - if (setting == "topiclock on") - SendChannelMetadata(ci->c, "topiclock", "1"); - else if (setting == "topiclock off") - SendChannelMetadata(ci->c, "topiclock", "0"); - } - - return EVENT_CONTINUE; - } -}; - -MODULE_INIT(ProtoInspIRCd20) diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 0d062d8ae..5b41b3d7f 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -13,7 +13,7 @@ class ngIRCdProto : public IRCDProto { - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override { IRCDProto::SendSVSKillInternal(source, user, buf); user->KillInternal(source, buf); @@ -30,7 +30,7 @@ class ngIRCdProto : public IRCDProto MaxModes = 5; } - void SendAkill(User *u, XLine *x) anope_override + void SendAkill(User *u, XLine *x) override { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -39,24 +39,24 @@ class ngIRCdProto : public IRCDProto UplinkSocket::Message(Me) << "GLINE " << x->mask << " " << timeleft << " :" << x->GetReason() << " (" << x->by << ")"; } - void SendAkillDel(const XLine *x) anope_override + void SendAkillDel(const XLine *x) override { UplinkSocket::Message(Me) << "GLINE " << x->mask; } - void SendChannel(Channel *c) anope_override + void SendChannel(Channel *c) override { UplinkSocket::Message(Me) << "CHANINFO " << c->name << " +" << c->GetModes(true, true); } // Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "NICK " << u->nick << " 1 " << u->GetIdent() << " " << u->host << " 1 " << modes << " :" << u->realname; } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHMSo P"; /* Make myself known to myself in the serverlist */ @@ -65,27 +65,27 @@ class ngIRCdProto : public IRCDProto this->SendNumeric(376, "*", ":End of MOTD command"); } - void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override { UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick; } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { UplinkSocket::Message(source) << "WALLOPS :" << buf; } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { UplinkSocket::Message(user) << "JOIN " << c->name; if (status) @@ -108,23 +108,23 @@ class ngIRCdProto : public IRCDProto } } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickAlias *na) override { UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display; } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :"; } /* SERVER name hop descript */ - void SendServer(const Server *server) anope_override + void SendServer(const Server *server) override { UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); } - void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override + void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override { if (!vIdent.empty()) UplinkSocket::Message(Me) << "METADATA " << u->nick << " user :" << vIdent; @@ -137,12 +137,12 @@ class ngIRCdProto : public IRCDProto } } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { this->SendVhost(u, u->GetIdent(), ""); } - Anope::string Format(const Anope::string &source, const Anope::string &message) anope_override + Anope::string Format(const Anope::string &source, const Anope::string &message) override { return IRCDProto::Format(source.empty() ? Me->GetSID() : source, message); } @@ -153,7 +153,7 @@ struct IRCDMessage005 : IRCDMessage IRCDMessage005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } // Please see <http://www.irc.org/tech_docs/005.html> for details. - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { size_t pos; Anope::string parameter, data; @@ -194,7 +194,7 @@ struct IRCDMessage376 : IRCDMessage * */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { } }; @@ -220,7 +220,7 @@ struct IRCDMessageChaninfo : IRCDMessage * a channel has no user limit (the parameter <modes> doesn't list the "l" * channel mode). In this case <limit> should be "0". */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { bool created; Channel *c = Channel::FindOrCreate(params[0], created); @@ -262,7 +262,7 @@ struct IRCDMessageJoin : Message::Join * * if a user joins a new channel, the ircd sends <channelname>\7<umode> */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *user = source.GetUser(); size_t pos = params[0].find('\7'); @@ -281,7 +281,7 @@ struct IRCDMessageJoin : Message::Join std::vector<Anope::string> new_params; new_params.push_back(channel); - Message::Join::Run(source, new_params); + Message::Join::Run(source, new_params, tags); if (!modes.empty()) { @@ -312,7 +312,7 @@ struct IRCDMessageMetadata : IRCDMessage * - "user": the user name (ident) of a client (can't be empty) */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = User::Find(params[0]); if (!u) @@ -363,7 +363,7 @@ struct IRCDMessageMode : IRCDMessage * params[n] = parameters */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string modes = params[1]; @@ -410,7 +410,7 @@ struct IRCDMessageNick : IRCDMessage * params[0] = newnick * */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() == 1) { @@ -454,7 +454,7 @@ struct IRCDMessageNJoin : IRCDMessage * * Received: :dev.anope.de NJOIN #test :DukeP2,@DukeP,%test,+test2 */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { std::list<Message::Join::SJoinUser> users; @@ -494,7 +494,7 @@ struct IRCDMessagePong : IRCDMessage * when receiving a new server and then finish sync once we * get a pong back from that server. */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (!source.GetServer()->IsSynced()) source.GetServer()->Sync(false); @@ -530,7 +530,7 @@ struct IRCDMessageServer : IRCDMessage * params[3] = server description */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() == 3) { @@ -557,7 +557,7 @@ struct IRCDMessageTopic : IRCDMessage IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } // Received: :DukeP TOPIC #anope :test - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Channel *c = Channel::Find(params[0]); if (!c) @@ -670,7 +670,7 @@ class ProtongIRCd : public Module } - void OnUserNickChange(User *u, const Anope::string &) anope_override + void OnUserNickChange(User *u, const Anope::string &) override { u->RemoveMode(Config->GetClient("NickServ"), "REGISTERED"); } diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index e88e5b7b2..5884ed831 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -35,26 +35,26 @@ class PlexusProto : public IRCDProto MaxModes = 4; } - void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) anope_override { hybrid->SendSVSKillInternal(source, targ, reason); } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } - void SendSQLine(User *u, const XLine *x) anope_override { hybrid->SendSQLine(u, x); } - void SendSQLineDel(const XLine *x) anope_override { hybrid->SendSQLineDel(x); } - void SendSGLineDel(const XLine *x) anope_override { hybrid->SendSGLineDel(x); } - void SendSGLine(User *u, const XLine *x) anope_override { hybrid->SendSGLine(u, x); } - void SendAkillDel(const XLine *x) anope_override { hybrid->SendAkillDel(x); } - void SendAkill(User *u, XLine *x) anope_override { hybrid->SendAkill(u, x); } - void SendServer(const Server *server) anope_override { hybrid->SendServer(server); } - void SendChannel(Channel *c) anope_override { hybrid->SendChannel(c); } - void SendSVSHold(const Anope::string &nick, time_t t) anope_override { hybrid->SendSVSHold(nick, t); } - void SendSVSHoldDel(const Anope::string &nick) anope_override { hybrid->SendSVSHoldDel(nick); } - - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) override { hybrid->SendSVSKillInternal(source, targ, reason); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } + void SendSQLine(User *u, const XLine *x) override { hybrid->SendSQLine(u, x); } + void SendSQLineDel(const XLine *x) override { hybrid->SendSQLineDel(x); } + void SendSGLineDel(const XLine *x) override { hybrid->SendSGLineDel(x); } + void SendSGLine(User *u, const XLine *x) override { hybrid->SendSGLine(u, x); } + void SendAkillDel(const XLine *x) override { hybrid->SendAkillDel(x); } + void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); } + void SendServer(const Server *server) override { hybrid->SendServer(server); } + void SendChannel(Channel *c) override { hybrid->SendChannel(c); } + void SendSVSHold(const Anope::string &nick, time_t t) override { hybrid->SendSVSHold(nick, t); } + void SendSVSHoldDel(const Anope::string &nick) override { hybrid->SendSVSHoldDel(nick); } + + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { UplinkSocket::Message(source) << "OPERWALL :" << buf; } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID(); if (status) @@ -77,12 +77,12 @@ class PlexusProto : public IRCDProto } } - void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override { UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; } - void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override + void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override { if (!ident.empty()) UplinkSocket::Message(Me) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident; @@ -90,12 +90,12 @@ class PlexusProto : public IRCDProto u->SetMode(Config->GetClient("HostServ"), "CLOAK"); } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { u->RemoveMode(Config->GetClient("HostServ"), "CLOAK"); } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* CAPAB @@ -132,56 +132,56 @@ class PlexusProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 5 0 :" << Anope::CurTime; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname; } - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { UplinkSocket::Message(source) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickAlias *na) override { UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->nc->display; } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { UplinkSocket::Message(source) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } - void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override { UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSJOIN " << user->GetUID() << " " << chan; } - void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override { UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSPART " << user->GetUID() << " " << chan; } - void SendSASLMessage(const SASL::Message &message) anope_override + void SendSASLMessage(const SASL::Message &message) override { Server *s = Server::Find(message.target.substr(0, 3)); UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : message.target.substr(0, 3)) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); } - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override + void SendSVSLogin(const Anope::string &uid, NickAlias *na) override { Server *s = Server::Find(uid.substr(0, 3)); UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * * " - << (vhost.empty() ? "*" : vhost) << " " << acc; + << (na->GetVhostHost().empty() ? "*" : na->GetVhostHost()) << " " << na->nc->display; } - void SendSVSNOOP(const Server *server, bool set) anope_override + void SendSVSNOOP(const Server *server, bool set) override { UplinkSocket::Message() << "ENCAP " << server->GetName() << " SVSNOOP " << (set ? "+" : "-"); } @@ -191,7 +191,7 @@ struct IRCDMessageEncap : IRCDMessage { IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* * Received: :dev.anope.de ENCAP * SU DukePyrolator DukePyrolator @@ -247,7 +247,7 @@ struct IRCDMessagePass : IRCDMessage { IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { UplinkSID = params[3]; } @@ -259,7 +259,7 @@ struct IRCDMessageServer : IRCDMessage /* 0 1 2 */ /* SERVER hades.arpa 1 :ircd-hybrid test server */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* Servers other than our immediate uplink are introduced via SID */ if (params[1] != "1") @@ -287,7 +287,7 @@ struct IRCDMessageUID : IRCDMessage params[10] = info */ // :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB 0 192.168.0.5 :Adam - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* An IP of 0 means the user is spoofed */ Anope::string ip = params[6]; diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 3a5c47728..2b62b1bc2 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -43,25 +43,25 @@ class RatboxProto : public IRCDProto MaxModes = 4; } - void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) anope_override { hybrid->SendSVSKillInternal(source, targ, reason); } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } - void SendSGLine(User *u, const XLine *x) anope_override { hybrid->SendSGLine(u, x); } - void SendSGLineDel(const XLine *x) anope_override { hybrid->SendSGLineDel(x); } - void SendAkill(User *u, XLine *x) anope_override { hybrid->SendAkill(u, x); } - void SendAkillDel(const XLine *x) anope_override { hybrid->SendAkillDel(x); } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { hybrid->SendJoin(user, c, status); } - void SendServer(const Server *server) anope_override { hybrid->SendServer(server); } - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { hybrid->SendModeInternal(source, u, buf); } - void SendChannel(Channel *c) anope_override { hybrid->SendChannel(c); } - bool IsIdentValid(const Anope::string &ident) anope_override { return hybrid->IsIdentValid(ident); } - - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) override { hybrid->SendSVSKillInternal(source, targ, reason); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } + void SendSGLine(User *u, const XLine *x) override { hybrid->SendSGLine(u, x); } + void SendSGLineDel(const XLine *x) override { hybrid->SendSGLineDel(x); } + void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); } + void SendAkillDel(const XLine *x) override { hybrid->SendAkillDel(x); } + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { hybrid->SendJoin(user, c, status); } + void SendServer(const Server *server) override { hybrid->SendServer(server); } + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { hybrid->SendModeInternal(source, u, buf); } + void SendChannel(Channel *c) override { hybrid->SendChannel(c); } + bool IsIdentValid(const Anope::string &ident) override { return hybrid->IsIdentValid(ident); } + + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { UplinkSocket::Message(source) << "OPERWALL :" << buf; } - void SendSQLine(User *, const XLine *x) anope_override + void SendSQLine(User *, const XLine *x) override { /* Calculate the time left before this would expire, capping it at 2 days */ time_t timeleft = x->expires - Anope::CurTime; @@ -72,12 +72,12 @@ class RatboxProto : public IRCDProto UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << timeleft << " " << x->mask << " 0 :" << x->GetReason(); } - void SendSQLineDel(const XLine *x) anope_override + void SendSQLineDel(const XLine *x) override { UplinkSocket::Message(Config->GetClient("OperServ")) << "ENCAP * UNRESV " << x->mask; } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* @@ -104,13 +104,13 @@ class RatboxProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 3 0 :" << Anope::CurTime; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname; } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickAlias *na) override { if (na->nc->HasExt("UNCONFIRMED")) return; @@ -118,12 +118,12 @@ class RatboxProto : public IRCDProto UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->nc->display; } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { BotInfo *bi = source.GetBot(); bool needjoin = c->FindUser(bi) == NULL; @@ -148,7 +148,7 @@ struct IRCDMessageEncap : IRCDMessage IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } // Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params[1] == "LOGIN" || params[1] == "SU") { @@ -172,10 +172,10 @@ struct IRCDMessageJoin : Message::Join { IRCDMessageJoin(Module *creator) : Message::Join(creator, "JOIN") { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() == 1 && params[0] == "0") - return Message::Join::Run(source, params); + return Message::Join::Run(source, params, tags); if (params.size() < 2) return; @@ -183,7 +183,7 @@ struct IRCDMessageJoin : Message::Join std::vector<Anope::string> p = params; p.erase(p.begin()); - return Message::Join::Run(source, p); + return Message::Join::Run(source, p, tags); } }; @@ -191,7 +191,7 @@ struct IRCDMessagePass : IRCDMessage { IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { UplinkSID = params[3]; } @@ -202,7 +202,7 @@ struct IRCDMessageServer : IRCDMessage IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } // SERVER hades.arpa 1 :ircd-ratbox test server - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // Servers other then our immediate uplink are introduced via SID if (params[1] != "1") @@ -222,7 +222,7 @@ struct IRCDMessageTBurst : IRCDMessage * params[2] = topic OR who set the topic * params[3] = topic if params[2] isn't the topic */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; Channel *c = Channel::Find(params[0]); @@ -242,7 +242,7 @@ struct IRCDMessageUID : IRCDMessage IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 9) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } // :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB :Adam - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { /* Source is always the server */ User::OnIntroduce(params[0], params[4], params[5], "", params[6], source.GetServer(), params[8], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[3], params[7], NULL); diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/solanum.cpp index 558594a33..7da405208 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/solanum.cpp @@ -1,4 +1,4 @@ -/* Charybdis IRCD functions +/* Solanum functions * * (C) 2003-2021 Anope Team * Contact us at team@anope.org @@ -22,18 +22,18 @@ class ChannelModeLargeBan : public ChannelMode public: ChannelModeLargeBan(const Anope::string &mname, char modeChar) : ChannelMode(mname, modeChar) { } - bool CanSet(User *u) const anope_override + bool CanSet(User *u) const override { return u && u->HasMode("OPER"); } }; -class CharybdisProto : public IRCDProto +class SolanumProto : public IRCDProto { public: - CharybdisProto(Module *creator) : IRCDProto(creator, "Charybdis 3.4+") + SolanumProto(Module *creator) : IRCDProto(creator, "Solanum") { DefaultPseudoclientModes = "+oiS"; CanCertFP = true; @@ -48,25 +48,25 @@ class CharybdisProto : public IRCDProto MaxModes = 4; } - void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) anope_override { ratbox->SendSVSKillInternal(source, targ, reason); } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalPrivmsg(bi, dest, msg); } - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { ratbox->SendGlobopsInternal(source, buf); } - void SendSGLine(User *u, const XLine *x) anope_override { ratbox->SendSGLine(u, x); } - void SendSGLineDel(const XLine *x) anope_override { ratbox->SendSGLineDel(x); } - void SendAkill(User *u, XLine *x) anope_override { ratbox->SendAkill(u, x); } - void SendAkillDel(const XLine *x) anope_override { ratbox->SendAkillDel(x); } - void SendSQLine(User *u, const XLine *x) anope_override { ratbox->SendSQLine(u, x); } - void SendSQLineDel(const XLine *x) anope_override { ratbox->SendSQLineDel(x); } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); } - void SendServer(const Server *server) anope_override { ratbox->SendServer(server); } - void SendChannel(Channel *c) anope_override { ratbox->SendChannel(c); } - void SendTopic(const MessageSource &source, Channel *c) anope_override { ratbox->SendTopic(source, c); } - bool IsIdentValid(const Anope::string &ident) anope_override { return ratbox->IsIdentValid(ident); } - void SendLogin(User *u, NickAlias *na) anope_override { ratbox->SendLogin(u, na); } - void SendLogout(User *u) anope_override { ratbox->SendLogout(u); } - - void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) anope_override + void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) override { ratbox->SendSVSKillInternal(source, targ, reason); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { ratbox->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { ratbox->SendGlobalPrivmsg(bi, dest, msg); } + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { ratbox->SendGlobopsInternal(source, buf); } + void SendSGLine(User *u, const XLine *x) override { ratbox->SendSGLine(u, x); } + void SendSGLineDel(const XLine *x) override { ratbox->SendSGLineDel(x); } + void SendAkill(User *u, XLine *x) override { ratbox->SendAkill(u, x); } + void SendAkillDel(const XLine *x) override { ratbox->SendAkillDel(x); } + void SendSQLine(User *u, const XLine *x) override { ratbox->SendSQLine(u, x); } + void SendSQLineDel(const XLine *x) override { ratbox->SendSQLineDel(x); } + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { ratbox->SendJoin(user, c, status); } + void SendServer(const Server *server) override { ratbox->SendServer(server); } + void SendChannel(Channel *c) override { ratbox->SendChannel(c); } + void SendTopic(const MessageSource &source, Channel *c) override { ratbox->SendTopic(source, c); } + bool IsIdentValid(const Anope::string &ident) override { return ratbox->IsIdentValid(ident); } + void SendLogin(User *u, NickAlias *na) override { ratbox->SendLogin(u, na); } + void SendLogout(User *u) override { ratbox->SendLogout(u); } + + void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override { Anope::string mechlist; @@ -78,7 +78,7 @@ class CharybdisProto : public IRCDProto UplinkSocket::Message(Me) << "ENCAP * MECHLIST :" << (mechanisms.empty() ? "" : mechlist.substr(1)); } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* @@ -88,6 +88,7 @@ class CharybdisProto : public IRCDProto * BAN - Can do BAN message * CHW - Can do channel wall @# * CLUSTER - Supports umode +l, can send LOCOPS (encap only) + * ECHO - Supports sending echoed messages * ENCAP - Can do ENCAP message * EOPMOD - Can do channel wall =# (for cmode +z) * EUID - Can do EUID (its similar to UID but includes the ENCAP REALHOST and ENCAP LOGIN information) @@ -104,7 +105,7 @@ class CharybdisProto : public IRCDProto * UNKLN - Can do UNKLINE (encap only) * QS - Can handle quit storm removal */ - UplinkSocket::Message() << "CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SERVICES TB UNKLN"; + UplinkSocket::Message() << "CAPAB :BAN CHW CLUSTER ECHO ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SERVICES TB UNKLN"; /* Make myself known to myself in the serverlist */ SendServer(Me); @@ -119,48 +120,49 @@ class CharybdisProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 6 0 :" << Anope::CurTime; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "EUID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " * * :" << u->realname; } - void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override { UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " RSFNC " << u->GetUID() << " " << newnick << " " << when << " " << u->timestamp; } - void SendSVSHold(const Anope::string &nick, time_t delay) anope_override + void SendSVSHold(const Anope::string &nick, time_t delay) override { UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << delay << " " << nick; } - void SendSVSHoldDel(const Anope::string &nick) anope_override + void SendSVSHoldDel(const Anope::string &nick) override { UplinkSocket::Message(Me) << "ENCAP * NICKDELAY 0 " << nick; } - void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override + void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override { UplinkSocket::Message(Me) << "ENCAP * CHGHOST " << u->GetUID() << " :" << host; } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { this->SendVhost(u, "", u->host); } - void SendSASLMessage(const SASL::Message &message) anope_override + void SendSASLMessage(const SASL::Message &message) override { Server *s = Server::Find(message.target.substr(0, 3)); UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : message.target.substr(0, 3)) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); } - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override + void SendSVSLogin(const Anope::string &uid, NickAlias *na) override { Server *s = Server::Find(uid.substr(0, 3)); - UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * " << (!vident.empty() ? vident : '*') << " " << (!vhost.empty() ? vhost : '*') << " " << acc; + UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() : '*') + << " " << (!na->GetVhostHost().empty() ? na->GetVhostHost() : '*') << " " << na->nc->display; } }; @@ -172,7 +174,7 @@ struct IRCDMessageEncap : IRCDMessage SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // In a burst, states that the source user is logged in as the account. if (params[1] == "LOGIN" || params[1] == "SU") @@ -205,7 +207,7 @@ struct IRCDMessageEncap : IRCDMessage * termination: 'A' for abort, 'F' for authentication failure, 'S' for * authentication success). * - * Charybdis only accepts messages from SASL agents; these must have umode +S + * Solanum only accepts messages from SASL agents; these must have umode +S */ else if (params[1] == "SASL" && SASL::sasl && params.size() >= 6) { @@ -238,7 +240,7 @@ struct IRCDMessageEUID : IRCDMessage * user is not logged in with services). Hence a NICK or UID command received * from a remote server should not be sent in EUID form to other servers. */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { NickAlias *na = NULL; if (params[9] != "*") @@ -253,8 +255,8 @@ struct IRCDMessageServer : IRCDMessage { IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - // SERVER dev.anope.de 1 :charybdis test server - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + // SERVER dev.anope.de 1 :solanum test server + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // Servers other then our immediate uplink are introduced via SID if (params[1] != "1") @@ -269,18 +271,44 @@ struct IRCDMessagePass : IRCDMessage { IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { // UplinkSID is used in IRCDMessageServer UplinkSID = params[3]; } }; -class ProtoCharybdis : public Module +struct IRCDMessageNotice : Message::Notice +{ + IRCDMessageNotice(Module *creator) : Message::Notice(creator) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override + { + if (Servers::Capab.count("ECHO")) + UplinkSocket::Message(Me) << "ECHO N " << source.GetSource() << " :" << params[1]; + + Message::Notice::Run(source, params, tags); + } +}; + +struct IRCDMessagePrivmsg : Message::Privmsg +{ + IRCDMessagePrivmsg(Module *creator) : Message::Privmsg(creator) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override + { + if (Servers::Capab.count("ECHO")) + UplinkSocket::Message(Me) << "ECHO P " << source.GetSource() << " :" << params[1]; + + Message::Privmsg::Run(source, params, tags); + } +}; + +class ProtoSolanum : public Module { Module *m_ratbox; - CharybdisProto ircd_proto; + SolanumProto ircd_proto; /* Core message handlers */ Message::Away message_away; @@ -291,10 +319,8 @@ class ProtoCharybdis : public Module Message::Kill message_kill; Message::Mode message_mode; Message::MOTD message_motd; - Message::Notice message_notice; Message::Part message_part; Message::Ping message_ping; - Message::Privmsg message_privmsg; Message::Quit message_quit; Message::SQuit message_squit; Message::Stats message_stats; @@ -310,7 +336,9 @@ class ProtoCharybdis : public Module /* Our message handlers */ IRCDMessageEncap message_encap; IRCDMessageEUID message_euid; + IRCDMessageNotice message_notice; IRCDMessagePass message_pass; + IRCDMessagePrivmsg message_privmsg; IRCDMessageServer message_server; bool use_server_side_mlock; @@ -340,25 +368,25 @@ class ProtoCharybdis : public Module } public: - ProtoCharybdis(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), + ProtoSolanum(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), ircd_proto(this), message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this), - message_kill(this), message_mode(this), message_motd(this), message_notice(this), message_part(this), - message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), - message_time(this), message_topic(this), message_version(this), message_whois(this), - - message_bmask("IRCDMessage", "charybdis/bmask", "ratbox/bmask"), - message_join("IRCDMessage", "charybdis/join", "ratbox/join"), - message_nick("IRCDMessage", "charybdis/nick", "ratbox/nick"), - message_pong("IRCDMessage", "charybdis/pong", "ratbox/pong"), - message_sid("IRCDMessage", "charybdis/sid", "ratbox/sid"), - message_sjoin("IRCDMessage", "charybdis/sjoin", "ratbox/sjoin"), - message_tb("IRCDMessage", "charybdis/tb", "ratbox/tb"), - message_tmode("IRCDMessage", "charybdis/tmode", "ratbox/tmode"), - message_uid("IRCDMessage", "charybdis/uid", "ratbox/uid"), - - message_encap(this), message_euid(this), message_pass(this), message_server(this) - + message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this), + message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), + message_version(this), message_whois(this), + + message_bmask("IRCDMessage", "solanum/bmask", "ratbox/bmask"), + message_join("IRCDMessage", "solanum/join", "ratbox/join"), + message_nick("IRCDMessage", "solanum/nick", "ratbox/nick"), + message_pong("IRCDMessage", "solanum/pong", "ratbox/pong"), + message_sid("IRCDMessage", "solanum/sid", "ratbox/sid"), + message_sjoin("IRCDMessage", "solanum/sjoin", "ratbox/sjoin"), + message_tb("IRCDMessage", "solanum/tb", "ratbox/tb"), + message_tmode("IRCDMessage", "solanum/tmode", "ratbox/tmode"), + message_uid("IRCDMessage", "solanum/uid", "ratbox/uid"), + + message_encap(this), message_euid(this), message_notice(this), message_pass(this), + message_privmsg(this), message_server(this) { @@ -373,18 +401,42 @@ class ProtoCharybdis : public Module this->AddModes(); } - ~ProtoCharybdis() + ~ProtoSolanum() { m_ratbox = ModuleManager::FindModule("ratbox"); ModuleManager::UnloadModule(m_ratbox, NULL); } - void OnReload(Configuration::Conf *conf) anope_override + void OnUserLogin(User *u) override + { + // If the user has logged into their current nickname then mark them as such. + NickAlias *na = NickAlias::Find(u->nick); + if (na && na->nc == u->Account()) + UplinkSocket::Message(Me) << "ENCAP * IDENTIFIED " << u->GetUID() << " " << u->nick; + else + UplinkSocket::Message(Me) << "ENCAP * IDENTIFIED " << u->GetUID() << " " << u->nick << " OFF"; + } + + void OnNickLogout(User *u) override + { + // We don't know what account the user was logged into so send in all cases. + UplinkSocket::Message(Me) << "ENCAP * IDENTIFIED " << u->GetUID() << " " << u->nick << " OFF"; + } + + void OnUserNickChange(User *u, const Anope::string &) override + { + // If the user is logged into an account check if we need to mark them + // as not identified to their nick. + if (u->Account()) + OnUserLogin(u); + } + + void OnReload(Configuration::Conf *conf) override { use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { if (!c->ci) return; @@ -397,7 +449,7 @@ class ProtoCharybdis : public Module } } - EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override + EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); @@ -410,7 +462,7 @@ class ProtoCharybdis : public Module return EVENT_CONTINUE; } - EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override + EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); @@ -424,4 +476,4 @@ class ProtoCharybdis : public Module } }; -MODULE_INIT(ProtoCharybdis) +MODULE_INIT(ProtoSolanum) diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp deleted file mode 100644 index 2c3b0c0f5..000000000 --- a/modules/protocol/unreal.cpp +++ /dev/null @@ -1,1340 +0,0 @@ -/* Unreal IRCD 3.2.x functions - * - * (C) 2003-2021 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "module.h" -#include "modules/cs_mode.h" -#include "modules/sasl.h" - -class UnrealIRCdProto : public IRCDProto -{ - public: - UnrealIRCdProto(Module *creator) : IRCDProto(creator, "UnrealIRCd 3.2.x") - { - DefaultPseudoclientModes = "+Soiq"; - CanSVSNick = true; - CanSVSJoin = true; - CanSetVHost = true; - CanSetVIdent = true; - CanSNLine = true; - CanSQLine = true; - CanSZLine = true; - CanSVSHold = true; - CanSVSO = true; - MaxModes = 12; - } - - private: - /* SVSNOOP */ - void SendSVSNOOP(const Server *server, bool set) anope_override - { - UplinkSocket::Message() << "SVSNOOP " << server->GetName() << " " << (set ? "+" : "-"); - } - - void SendAkillDel(const XLine *x) anope_override - { - if (x->IsRegex() || x->HasNickOrReal()) - return; - - /* ZLine if we can instead */ - if (x->GetUser() == "*") - { - cidr a(x->GetHost()); - if (a.valid()) - { - IRCD->SendSZLineDel(x); - return; - } - } - - UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by; - } - - void SendTopic(const MessageSource &source, Channel *c) anope_override - { - UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; - } - - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override - { - UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; - } - - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override - { - UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; - } - - void SendVhostDel(User *u) anope_override - { - BotInfo *HostServ = Config->GetClient("HostServ"); - u->RemoveMode(HostServ, "CLOAK"); - u->RemoveMode(HostServ, "VHOST"); - ModeManager::ProcessModes(); - u->SetMode(HostServ, "CLOAK"); - } - - void SendAkill(User *u, XLine *x) anope_override - { - if (x->IsRegex() || x->HasNickOrReal()) - { - if (!u) - { - /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */ - for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) - if (x->manager->Check(it->second, x)) - this->SendAkill(it->second, x); - return; - } - - const XLine *old = x; - - if (old->manager->HasEntry("*@" + u->host)) - return; - - /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */ - XLine *xline = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id); - old->manager->AddXLine(xline); - x = xline; - - Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->mask; - } - - /* ZLine if we can instead */ - if (x->GetUser() == "*") - { - cidr a(x->GetHost()); - if (a.valid()) - { - IRCD->SendSZLine(u, x); - return; - } - } - - // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = x->expires - Anope::CurTime; - if (timeleft > 172800 || !x->expires) - timeleft = 172800; - UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason(); - } - - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override - { - UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; - user->KillInternal(source, buf); - } - - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override - { - UplinkSocket::Message(source) << "SVS2MODE " << u->nick <<" " << buf; - } - - void SendClientIntroduction(User *u) anope_override - { - Anope::string modes = "+" + u->GetModes(); - UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 " << modes << " " << u->host << " * :" << u->realname; - } - - /* SERVER name hop descript */ - /* Unreal 3.2 actually sends some info about itself in the descript area */ - void SendServer(const Server *server) anope_override - { - if (!server->GetSID().empty() && server == Me) - UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :U0-*-" << server->GetSID() << " " << server->GetDescription(); - else - UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); - } - - /* JOIN */ - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override - { - UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " :" << user->nick; - if (status) - { - /* First save the channel status incase uc->Status == status */ - ChannelStatus cs = *status; - /* If the user is internally on the channel with flags, kill them so that - * the stacker will allow this. - */ - ChanUserContainer *uc = c->FindUser(user); - if (uc != NULL) - uc->status.Clear(); - - BotInfo *setter = BotInfo::Find(user->GetUID()); - for (size_t i = 0; i < cs.Modes().length(); ++i) - c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); - - if (uc != NULL) - uc->status = cs; - } - } - - /* unsqline - */ - void SendSQLineDel(const XLine *x) anope_override - { - UplinkSocket::Message() << "UNSQLINE " << x->mask; - } - - /* SQLINE */ - /* - ** - Unreal will translate this to TKL for us - ** - */ - void SendSQLine(User *, const XLine *x) anope_override - { - UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason(); - } - - /* - ** svso - ** parv[0] = sender prefix - ** parv[1] = nick - ** parv[2] = options - */ - void SendSVSO(BotInfo *source, const Anope::string &nick, const Anope::string &flag) anope_override - { - UplinkSocket::Message(source) << "SVSO " << nick << " " << flag; - } - - /* Functions that use serval cmd functions */ - - void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override - { - if (!vIdent.empty()) - UplinkSocket::Message(Me) << "CHGIDENT " << u->nick << " " << vIdent; - if (!vhost.empty()) - UplinkSocket::Message(Me) << "CHGHOST " << u->nick << " " << vhost; - } - - void SendConnect() anope_override - { - /* - NICKv2 = Nick Version 2 - VHP = Sends hidden host - UMODE2 = sends UMODE2 on user modes - NICKIP = Sends IP on NICK - TOKEN = Use tokens to talk - SJ3 = Supports SJOIN - NOQUIT = No Quit - TKLEXT = Extended TKL we don't use it but best to have it - SJB64 = Base64 encoded time stamps - ESVID = Allows storing account names as services stamp - MLOCK = Supports the MLOCK server command - VL = Version Info - NS = Config->Numeric Server - */ - Anope::string protoctl = "NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT ESVID MLOCK VL"; - if (!Me->GetSID().empty()) - protoctl += " VL"; - UplinkSocket::Message() << "PROTOCTL " << protoctl; - UplinkSocket::Message() << "PASS :" << Config->Uplinks[Anope::CurrentUplink].password; - SendServer(Me); - } - - /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick, time_t t) anope_override - { - UplinkSocket::Message() << "TKL + Q H " << nick << " " << Me->GetName() << " " << Anope::CurTime + t << " " << Anope::CurTime << " :Being held for registered user"; - } - - /* SVSHOLD - release */ - void SendSVSHoldDel(const Anope::string &nick) anope_override - { - UplinkSocket::Message() << "TKL - Q * " << nick << " " << Me->GetName(); - } - - /* UNSGLINE */ - /* - * SVSNLINE - :realname mask - */ - void SendSGLineDel(const XLine *x) anope_override - { - UplinkSocket::Message() << "SVSNLINE - :" << x->mask; - } - - /* UNSZLINE */ - void SendSZLineDel(const XLine *x) anope_override - { - UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->by; - } - - /* SZLINE */ - void SendSZLine(User *, const XLine *x) anope_override - { - // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = x->expires - Anope::CurTime; - if (timeleft > 172800 || !x->expires) - timeleft = 172800; - UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason(); - } - - /* SGLINE */ - /* - * SVSNLINE + reason_where_is_space :realname mask with spaces - */ - void SendSGLine(User *, const XLine *x) anope_override - { - Anope::string edited_reason = x->GetReason(); - edited_reason = edited_reason.replace_all_cs(" ", "_"); - UplinkSocket::Message() << "SVSNLINE + " << edited_reason << " :" << x->mask; - } - - /* svsjoin - parv[0] - sender - parv[1] - nick to make join - parv[2] - channel to join - parv[3] - (optional) channel key(s) - */ - /* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken - when coming from a none TOKEN'd server - */ - void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override - { - if (!param.empty()) - UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param; - else - UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan; - } - - void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override - { - if (!param.empty()) - UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan << " :" << param; - else - UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan; - } - - void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) anope_override - { - UplinkSocket::Message(source) << "SWHOIS " << who << " :" << mask; - } - - void SendEOB() anope_override - { - UplinkSocket::Message(Me) << "EOS"; - } - - bool IsNickValid(const Anope::string &nick) anope_override - { - if (nick.equals_ci("ircd") || nick.equals_ci("irc")) - return false; - - return IRCDProto::IsNickValid(nick); - } - - bool IsChannelValid(const Anope::string &chan) anope_override - { - if (chan.find(':') != Anope::string::npos) - return false; - - return IRCDProto::IsChannelValid(chan); - } - - bool IsExtbanValid(const Anope::string &mask) anope_override - { - return mask.length() >= 4 && mask[0] == '~' && mask[2] == ':'; - } - - void SendLogin(User *u, NickAlias *na) anope_override - { - /* 3.2.10.4+ treats users logged in with accounts as fully registered, even if -r, so we can not set this here. Just use the timestamp. */ - if (Servers::Capab.count("ESVID") > 0 && !na->nc->HasExt("UNCONFIRMED")) - IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->nc->display.c_str()); - else - IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon); - } - - void SendLogout(User *u) anope_override - { - IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 0"); - } - - void SendChannel(Channel *c) anope_override - { - /* Unreal does not support updating a channels TS without actually joining a user, - * so we will join and part us now - */ - BotInfo *bi = c->ci->WhoSends(); - if (!bi) - ; - else if (c->FindUser(bi) == NULL) - { - bi->Join(c); - bi->Part(c); - } - else - { - bi->Part(c); - bi->Join(c); - } - } - - void SendSASLMessage(const SASL::Message &message) anope_override - { - size_t p = message.target.find('!'); - if (p == Anope::string::npos) - return; - - UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << message.target.substr(0, p) << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext); - } - - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override - { - size_t p = uid.find('!'); - if (p == Anope::string::npos) - return; - UplinkSocket::Message(Me) << "SVSLOGIN " << uid.substr(0, p) << " " << uid << " " << acc; - } - - bool IsIdentValid(const Anope::string &ident) anope_override - { - if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) - return false; - - for (unsigned i = 0; i < ident.length(); ++i) - { - const char &c = ident[i]; - - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-') - continue; - - if (c == '-' || c == '.' || c == '_') - continue; - - return false; - } - - return true; - } -}; - -class UnrealExtBan : public ChannelModeVirtual<ChannelModeList> -{ - char ext; - - public: - UnrealExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual<ChannelModeList>(mname, basename) - , ext(extban) - { - } - - ChannelMode *Wrap(Anope::string ¶m) anope_override - { - param = "~" + Anope::string(ext) + ":" + param; - return ChannelModeVirtual<ChannelModeList>::Wrap(param); - } - - ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override - { - if (cm->type != MODE_LIST || param.length() < 4 || param[0] != '~' || param[1] != ext || param[2] != ':') - return cm; - - param = param.substr(3); - return this; - } -}; - -namespace UnrealExtban -{ - class ChannelMatcher : public UnrealExtBan - { - public: - ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string channel = mask.substr(3); - - ChannelMode *cm = NULL; - if (channel[0] != '#') - { - char modeChar = ModeManager::GetStatusChar(channel[0]); - channel.erase(channel.begin()); - cm = ModeManager::FindChannelModeByChar(modeChar); - if (cm != NULL && cm->type != MODE_STATUS) - cm = NULL; - } - - Channel *c = Channel::Find(channel); - if (c != NULL) - { - ChanUserContainer *uc = c->FindUser(u); - if (uc != NULL) - if (cm == NULL || uc->status.HasMode(cm->mchar)) - return true; - } - - return false; - } - }; - - class EntryMatcher : public UnrealExtBan - { - public: - EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(3); - - return Entry(this->name, real_mask).Matches(u); - } - }; - - class RealnameMatcher : public UnrealExtBan - { - public: - RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(3); - - return Anope::Match(u->realname, real_mask); - } - }; - - class RegisteredMatcher : public UnrealExtBan - { - public: - RegisteredMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - return u->HasMode("REGISTERED") && mask.equals_ci(u->nick); - } - }; - - class AccountMatcher : public UnrealExtBan - { - public: - AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) - { - } - - bool Matches(User *u, const Entry *e) anope_override - { - const Anope::string &mask = e->GetMask(); - Anope::string real_mask = mask.substr(3); - - return u->Account() && Anope::Match(u->Account()->display, real_mask); - } - }; -} - -class ChannelModeFlood : public ChannelModeParam -{ - public: - ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } - - /* Borrowed part of this check from UnrealIRCd */ - bool IsValid(Anope::string &value) const anope_override - { - if (value.empty()) - return false; - try - { - Anope::string rest; - if (value[0] != ':' && convertTo<unsigned>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<unsigned>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - } - catch (const ConvertException &) { } - - /* '['<number><1 letter>[optional: '#'+1 letter],[next..]']'':'<number> */ - size_t end_bracket = value.find(']', 1); - if (end_bracket == Anope::string::npos) - return false; - Anope::string xbuf = value.substr(0, end_bracket); - if (value[end_bracket + 1] != ':') - return false; - commasepstream args(xbuf.substr(1)); - Anope::string arg; - while (args.GetToken(arg)) - { - /* <number><1 letter>[optional: '#'+1 letter] */ - size_t p = 0; - while (p < arg.length() && isdigit(arg[p])) - ++p; - if (p == arg.length() || !(arg[p] == 'c' || arg[p] == 'j' || arg[p] == 'k' || arg[p] == 'm' || arg[p] == 'n' || arg[p] == 't')) - continue; /* continue instead of break for forward compatibility. */ - try - { - int v = arg.substr(0, p).is_number_only() ? convertTo<int>(arg.substr(0, p)) : 0; - if (v < 1 || v > 999) - return false; - } - catch (const ConvertException &) - { - return false; - } - } - - return true; - } -}; - -class ChannelModeUnrealSSL : public ChannelMode -{ - public: - ChannelModeUnrealSSL(const Anope::string &n, char c) : ChannelMode(n, c) - { - } - - bool CanSet(User *u) const anope_override - { - return false; - } -}; - -struct IRCDMessageCapab : Message::Capab -{ - IRCDMessageCapab(Module *creator) : Message::Capab(creator, "PROTOCTL") { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - for (unsigned i = 0; i < params.size(); ++i) - { - Anope::string capab = params[i]; - - if (capab.find("CHANMODES") != Anope::string::npos) - { - Anope::string modes(capab.begin() + 10, capab.end()); - commasepstream sep(modes); - Anope::string modebuf; - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'b': - ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b')); - - ModeManager::AddChannelMode(new UnrealExtban::ChannelMatcher("CHANNELBAN", "BAN", 'c')); - ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("JOINBAN", "BAN", 'j')); - ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("NONICKBAN", "BAN", 'n')); - ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("QUIET", "BAN", 'q')); - ModeManager::AddChannelMode(new UnrealExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r')); - ModeManager::AddChannelMode(new UnrealExtban::RegisteredMatcher("REGISTEREDBAN", "BAN", 'R')); - ModeManager::AddChannelMode(new UnrealExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'a')); - continue; - case 'e': - ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e')); - continue; - case 'I': - ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I')); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t])); - } - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'k': - ModeManager::AddChannelMode(new ChannelModeKey('k')); - continue; - case 'f': - ModeManager::AddChannelMode(new ChannelModeFlood('f', false)); - continue; - case 'L': - ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L')); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t])); - } - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'l': - ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true)); - continue; - case 'j': - ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true)); - continue; - default: - ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t], true)); - } - } - - sep.GetToken(modebuf); - for (size_t t = 0, end = modebuf.length(); t < end; ++t) - { - switch (modebuf[t]) - { - case 'p': - ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p')); - continue; - case 's': - ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); - continue; - case 'm': - ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm')); - continue; - case 'n': - ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n')); - continue; - case 't': - ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't')); - continue; - case 'i': - ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i')); - continue; - case 'r': - ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); - continue; - case 'R': - ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); - continue; - case 'c': - ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c')); - continue; - case 'O': - ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); - continue; - case 'A': - ModeManager::AddChannelMode(new ChannelModeOperOnly("ADMINONLY", 'A')); - continue; - case 'Q': - ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q')); - continue; - case 'K': - ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K')); - continue; - case 'V': - ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V')); - continue; - case 'C': - ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C')); - continue; - case 'u': - ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u')); - continue; - case 'z': - ModeManager::AddChannelMode(new ChannelMode("SSL", 'z')); - continue; - case 'N': - ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N')); - continue; - case 'S': - ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S')); - continue; - case 'M': - ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M')); - continue; - case 'T': - ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T')); - continue; - case 'G': - ModeManager::AddChannelMode(new ChannelMode("CENSOR", 'G')); - continue; - case 'Z': - ModeManager::AddChannelMode(new ChannelModeUnrealSSL("", 'Z')); - continue; - default: - ModeManager::AddChannelMode(new ChannelMode("", modebuf[t])); - } - } - } - } - - Message::Capab::Run(source, params); - } -}; - -struct IRCDMessageChgHost : IRCDMessage -{ - IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = User::Find(params[0]); - if (u) - u->SetDisplayedHost(params[1]); - } -}; - -struct IRCDMessageChgIdent : IRCDMessage -{ - IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = User::Find(params[0]); - if (u) - u->SetVIdent(params[1]); - } -}; - -struct IRCDMessageChgName : IRCDMessage -{ - IRCDMessageChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = User::Find(params[0]); - if (u) - u->SetRealname(params[1]); - } -}; - -struct IRCDMessageMode : IRCDMessage -{ - IRCDMessageMode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - bool server_source = source.GetServer() != NULL; - Anope::string modes = params[1]; - for (unsigned i = 2; i < params.size() - (server_source ? 1 : 0); ++i) - modes += " " + params[i]; - - if (IRCD->IsChannelValid(params[0])) - { - Channel *c = Channel::Find(params[0]); - time_t ts = 0; - - try - { - if (server_source) - ts = convertTo<time_t>(params[params.size() - 1]); - } - catch (const ConvertException &) { } - - if (c) - c->SetModesInternal(source, modes, ts); - } - else - { - User *u = User::Find(params[0]); - if (u) - u->SetModesInternal(source, "%s", params[1].c_str()); - } - } -}; - -/* netinfo - * argv[0] = max global count - * argv[1] = time of end sync - * argv[2] = unreal protocol using (numeric) - * argv[3] = cloak-crc (> u2302) - * argv[4] = free(**) - * argv[5] = free(**) - * argv[6] = free(**) - * argv[7] = ircnet - */ -struct IRCDMessageNetInfo : IRCDMessage -{ - IRCDMessageNetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - UplinkSocket::Message() << "NETINFO " << MaxUserCount << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7]; - } -}; - -struct IRCDMessageNick : IRCDMessage -{ - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - /* - ** NICK - new - ** source = NULL - ** parv[0] = nickname - ** parv[1] = hopcount - ** parv[2] = timestamp - ** parv[3] = username - ** parv[4] = hostname - ** parv[5] = servername - ** parv[6] = servicestamp - ** parv[7] = umodes - ** parv[8] = virthost, * if none - ** parv[9] = ip - ** parv[10] = info - ** - ** NICK - change - ** source = oldnick - ** parv[0] = new nickname - ** parv[1] = hopcount - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (params.size() == 11) - { - Anope::string ip; - if (params[9] != "*") - { - Anope::string decoded_ip; - Anope::B64Decode(params[9], decoded_ip); - - sockaddrs ip_addr; - ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); - ip = ip_addr.addr(); - } - - Anope::string vhost = params[8]; - if (vhost.equals_cs("*")) - vhost.clear(); - - time_t user_ts = params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime; - - Server *s = Server::Find(params[5]); - if (s == NULL) - { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistent server " << params[5] << "?"; - return; - } - - NickAlias *na = NULL; - - if (params[6] == "0") - ; - else if (params[6].is_pos_number_only()) - { - if (convertTo<time_t>(params[6]) == user_ts) - na = NickAlias::Find(params[0]); - } - else - { - na = NickAlias::Find(params[6]); - } - - User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? *na->nc : NULL); - } - else - { - User *u = source.GetUser(); - if (u) - u->ChangeNick(params[0]); - } - } -}; - -/** This is here because: - * - * If we had three servers, A, B & C linked like so: A<->B<->C - * If Anope is linked to A and B splits from A and then reconnects - * B introduces itself, introduces C, sends EOS for C, introduces Bs clients - * introduces Cs clients, sends EOS for B. This causes all of Cs clients to be introduced - * with their server "not syncing". We now send a PING immediately when receiving a new server - * and then finish sync once we get a pong back from that server. - */ -struct IRCDMessagePong : IRCDMessage -{ - IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - if (!source.GetServer()->IsSynced()) - source.GetServer()->Sync(false); - } -}; - -struct IRCDMessageSASL : IRCDMessage -{ - IRCDMessageSASL(Module *creator) : IRCDMessage(creator, "SASL", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - size_t p = params[1].find('!'); - if (!SASL::sasl || p == Anope::string::npos) - return; - - SASL::Message m; - m.source = params[1]; - m.target = params[0]; - m.type = params[2]; - m.data = params[3]; - m.ext = params.size() > 4 ? params[4] : ""; - - SASL::sasl->ProcessMessage(m); - } -}; - -struct IRCDMessageSDesc : IRCDMessage -{ - IRCDMessageSDesc(Module *creator) : IRCDMessage(creator, "SDESC", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetServer()->SetDescription(params[0]); - } -}; - -struct IRCDMessageSetHost : IRCDMessage -{ - IRCDMessageSetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = source.GetUser(); - - /* When a user sets +x we receive the new host and then the mode change */ - if (u->HasMode("CLOAK")) - u->SetDisplayedHost(params[0]); - else - u->SetCloakedHost(params[0]); - } -}; - -struct IRCDMessageSetIdent : IRCDMessage -{ - IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = source.GetUser(); - u->SetVIdent(params[0]); - } -}; - -struct IRCDMessageSetName : IRCDMessage -{ - IRCDMessageSetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - User *u = source.GetUser(); - u->SetRealname(params[0]); - } -}; - -struct IRCDMessageServer : IRCDMessage -{ - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; - - if (params[1].equals_cs("1")) - { - Anope::string desc; - spacesepstream(params[2]).GetTokenRemainder(desc, 1); - - new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, desc); - } - else - new Server(source.GetServer(), params[0], hops, params[2]); - - IRCD->SendPing(Me->GetName(), params[0]); - } -}; - -struct IRCDMessageSJoin : IRCDMessage -{ - IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - Anope::string modes; - if (params.size() >= 4) - for (unsigned i = 2; i < params.size() - 1; ++i) - modes += " " + params[i]; - if (!modes.empty()) - modes.erase(modes.begin()); - - std::list<Anope::string> bans, excepts, invites; - std::list<Message::Join::SJoinUser> users; - - spacesepstream sep(params[params.size() - 1]); - Anope::string buf; - while (sep.GetToken(buf)) - { - /* Ban */ - if (buf[0] == '&') - { - buf.erase(buf.begin()); - bans.push_back(buf); - } - /* Except */ - else if (buf[0] == '"') - { - buf.erase(buf.begin()); - excepts.push_back(buf); - } - /* Invex */ - else if (buf[0] == '\'') - { - buf.erase(buf.begin()); - invites.push_back(buf); - } - else - { - Message::Join::SJoinUser sju; - - /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) - { - sju.first.AddMode(ch); - buf.erase(buf.begin()); - } - - sju.second = User::Find(buf); - if (!sju.second) - { - Log(LOG_DEBUG) << "SJOIN for nonexistent user " << buf << " on " << params[1]; - continue; - } - - users.push_back(sju); - } - } - - time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; - Message::Join::SJoin(source, params[1], ts, modes, users); - - if (!bans.empty() || !excepts.empty() || !invites.empty()) - { - Channel *c = Channel::Find(params[1]); - - if (!c || c->creation_time != ts) - return; - - ChannelMode *ban = ModeManager::FindChannelModeByName("BAN"), - *except = ModeManager::FindChannelModeByName("EXCEPT"), - *invex = ModeManager::FindChannelModeByName("INVITEOVERRIDE"); - - if (ban) - for (std::list<Anope::string>::iterator it = bans.begin(), it_end = bans.end(); it != it_end; ++it) - c->SetModeInternal(source, ban, *it); - if (except) - for (std::list<Anope::string>::iterator it = excepts.begin(), it_end = excepts.end(); it != it_end; ++it) - c->SetModeInternal(source, except, *it); - if (invex) - for (std::list<Anope::string>::iterator it = invites.begin(), it_end = invites.end(); it != it_end; ++it) - c->SetModeInternal(source, invex, *it); - } - } -}; - -struct IRCDMessageTopic : IRCDMessage -{ - IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } - - /* - ** source = sender prefix - ** parv[0] = channel name - ** parv[1] = topic nickname - ** parv[2] = topic time - ** parv[3] = topic text - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - Channel *c = Channel::Find(params[0]); - if (c) - c->ChangeTopicInternal(source.GetUser(), params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime); - } -}; - - -struct IRCDMessageUmode2 : IRCDMessage -{ - IRCDMessageUmode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override - { - source.GetUser()->SetModesInternal(source, "%s", params[0].c_str()); - } -}; - -class ProtoUnreal : public Module -{ - UnrealIRCdProto ircd_proto; - - /* Core message handlers */ - Message::Away message_away; - Message::Error message_error; - Message::Invite message_invite; - Message::Join message_join; - Message::Kick message_kick; - Message::Kill message_kill, message_svskill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Version message_version; - Message::Whois message_whois; - - /* Our message handlers */ - IRCDMessageCapab message_capab; - IRCDMessageChgHost message_chghost; - IRCDMessageChgIdent message_chgident; - IRCDMessageChgName message_chgname; - IRCDMessageMode message_mode, message_svsmode, message_svs2mode; - IRCDMessageNetInfo message_netinfo; - IRCDMessageNick message_nick; - IRCDMessagePong message_pong; - IRCDMessageSASL message_sasl; - IRCDMessageSDesc message_sdesc; - IRCDMessageSetHost message_sethost; - IRCDMessageSetIdent message_setident; - IRCDMessageSetName message_setname; - IRCDMessageServer message_server; - IRCDMessageSJoin message_sjoin; - IRCDMessageTopic message_topic; - IRCDMessageUmode2 message_umode2; - - bool use_server_side_mlock; - - void AddModes() - { - ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0)); - ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1)); - ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2)); - /* Unreal sends +q as * and +a as ~ */ - ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '~', 3)); - ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '*', 4)); - - /* Add user modes */ - ModeManager::AddUserMode(new UserModeOperOnly("SERV_ADMIN", 'A')); - ModeManager::AddUserMode(new UserMode("BOT", 'B')); - ModeManager::AddUserMode(new UserModeOperOnly("CO_ADMIN", 'C')); - ModeManager::AddUserMode(new UserMode("CENSOR", 'G')); - ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H')); - ModeManager::AddUserMode(new UserModeOperOnly("HIDEIDLE", 'I')); - ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N')); - ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); - ModeManager::AddUserMode(new UserModeOperOnly("PROTECTED", 'S')); - ModeManager::AddUserMode(new UserMode("NOCTCP", 'T')); - ModeManager::AddUserMode(new UserMode("WEBTV", 'V')); - ModeManager::AddUserMode(new UserModeOperOnly("WHOIS", 'W')); - ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a')); - ModeManager::AddUserMode(new UserMode("DEAF", 'd')); - ModeManager::AddUserMode(new UserModeOperOnly("GLOBOPS", 'g')); - ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h')); - ModeManager::AddUserMode(new UserMode("INVIS", 'i')); - ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); - ModeManager::AddUserMode(new UserMode("PRIV", 'p')); - ModeManager::AddUserMode(new UserModeOperOnly("GOD", 'q')); - ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); - ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); - ModeManager::AddUserMode(new UserModeNoone("VHOST", 't')); - ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); - ModeManager::AddUserMode(new UserMode("CLOAK", 'x')); - ModeManager::AddUserMode(new UserModeNoone("SSL", 'z')); - } - - public: - ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), - ircd_proto(this), - message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this), - message_kill(this), message_svskill(this, "SVSKILL"), message_motd(this), message_notice(this), message_part(this), message_ping(this), - message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), - message_version(this), message_whois(this), - - message_capab(this), message_chghost(this), message_chgident(this), message_chgname(this), message_mode(this, "MODE"), - message_svsmode(this, "SVSMODE"), message_svs2mode(this, "SVS2MODE"), message_netinfo(this), message_nick(this), message_pong(this), - message_sasl(this), message_sdesc(this), message_sethost(this), message_setident(this), message_setname(this), message_server(this), - message_sjoin(this), message_topic(this), message_umode2(this) - { - - this->AddModes(); - } - - void Prioritize() anope_override - { - ModuleManager::SetPriority(this, PRIORITY_FIRST); - } - - void OnReload(Configuration::Conf *conf) anope_override - { - use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); - } - - void OnUserNickChange(User *u, const Anope::string &) anope_override - { - u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); - if (Servers::Capab.count("ESVID") == 0) - IRCD->SendLogout(u); - } - - void OnChannelSync(Channel *c) anope_override - { - if (!c->ci) - return; - - ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); - if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && modelocks) - { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; - } - } - - void OnChanRegistered(ChannelInfo *ci) anope_override - { - ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); - if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK")) - return; - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); - UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; - } - - void OnDelChan(ChannelInfo *ci) anope_override - { - if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) - return; - UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " :"; - } - - EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override - { - ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); - ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) - { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; - UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; - } - - return EVENT_CONTINUE; - } - - EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override - { - ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); - ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) - { - Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); - UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; - } - - return EVENT_CONTINUE; - } -}; - -MODULE_INIT(ProtoUnreal) diff --git a/modules/protocol/unreal4.cpp b/modules/protocol/unrealircd.cpp index 79b168f35..d423874b9 100644 --- a/modules/protocol/unreal4.cpp +++ b/modules/protocol/unrealircd.cpp @@ -1,4 +1,4 @@ -/* Unreal IRCD 4 functions +/* UnrealIRCd functions * * (C) 2003-2021 Anope Team * Contact us at team@anope.org @@ -36,12 +36,12 @@ class UnrealIRCdProto : public IRCDProto private: /* SVSNOOP */ - void SendSVSNOOP(const Server *server, bool set) anope_override + void SendSVSNOOP(const Server *server, bool set) override { UplinkSocket::Message() << "SVSNOOP " << server->GetSID() << " " << (set ? "+" : "-"); } - void SendAkillDel(const XLine *x) anope_override + void SendAkillDel(const XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) return; @@ -60,22 +60,22 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by; } - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { BotInfo *HostServ = Config->GetClient("HostServ"); u->RemoveMode(HostServ, "CLOAK"); @@ -84,7 +84,7 @@ class UnrealIRCdProto : public IRCDProto u->SetMode(HostServ, "CLOAK"); } - void SendAkill(User *u, XLine *x) anope_override + void SendAkill(User *u, XLine *x) override { if (x->IsRegex() || x->HasNickOrReal()) { @@ -128,18 +128,18 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason(); } - void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override { UplinkSocket::Message(source) << "SVSKILL " << user->GetUID() << " :" << buf; user->KillInternal(source, buf); } - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { UplinkSocket::Message(source) << "SVS2MODE " << u->GetUID() <<" " << buf; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(u->server) << "UID " << u->nick << " 1 " << u->timestamp << " " << u->GetIdent() << " " << u->host << " " @@ -147,7 +147,7 @@ class UnrealIRCdProto : public IRCDProto << (!u->chost.empty() ? u->chost : "*") << " " << "*" << " :" << u->realname; } - void SendServer(const Server *server) anope_override + void SendServer(const Server *server) override { if (server == Me) UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() + 1 << " :" << server->GetDescription(); @@ -156,7 +156,7 @@ class UnrealIRCdProto : public IRCDProto } /* JOIN */ - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID(); @@ -182,7 +182,7 @@ class UnrealIRCdProto : public IRCDProto /* unsqline */ - void SendSQLineDel(const XLine *x) anope_override + void SendSQLineDel(const XLine *x) override { UplinkSocket::Message() << "UNSQLINE " << x->mask; } @@ -192,14 +192,14 @@ class UnrealIRCdProto : public IRCDProto ** - Unreal will translate this to TKL for us ** */ - void SendSQLine(User *, const XLine *x) anope_override + void SendSQLine(User *, const XLine *x) override { UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason(); } /* Functions that use serval cmd functions */ - void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override + void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override { if (!vIdent.empty()) UplinkSocket::Message(Me) << "CHGIDENT " << u->GetUID() << " " << vIdent; @@ -211,7 +211,7 @@ class UnrealIRCdProto : public IRCDProto u->SetMode(bi, "VHOST"); } - void SendConnect() anope_override + void SendConnect() override { /* NICKv2 = Nick Version 2 @@ -232,7 +232,7 @@ class UnrealIRCdProto : public IRCDProto SendServer(Me); } - void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) anope_override + void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override { Anope::string mechlist; for (unsigned i = 0; i < mechanisms.size(); ++i) @@ -242,13 +242,13 @@ class UnrealIRCdProto : public IRCDProto } /* SVSHOLD - set */ - void SendSVSHold(const Anope::string &nick, time_t t) anope_override + void SendSVSHold(const Anope::string &nick, time_t t) override { UplinkSocket::Message() << "TKL + Q H " << nick << " " << Me->GetName() << " " << Anope::CurTime + t << " " << Anope::CurTime << " :Being held for registered user"; } /* SVSHOLD - release */ - void SendSVSHoldDel(const Anope::string &nick) anope_override + void SendSVSHoldDel(const Anope::string &nick) override { UplinkSocket::Message() << "TKL - Q * " << nick << " " << Me->GetName(); } @@ -257,19 +257,19 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE - :realname mask */ - void SendSGLineDel(const XLine *x) anope_override + void SendSGLineDel(const XLine *x) override { UplinkSocket::Message() << "SVSNLINE - :" << x->mask; } /* UNSZLINE */ - void SendSZLineDel(const XLine *x) anope_override + void SendSZLineDel(const XLine *x) override { UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->by; } /* SZLINE */ - void SendSZLine(User *, const XLine *x) anope_override + void SendSZLine(User *, const XLine *x) override { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -282,7 +282,7 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE + reason_where_is_space :realname mask with spaces */ - void SendSGLine(User *, const XLine *x) anope_override + void SendSGLine(User *, const XLine *x) override { Anope::string edited_reason = x->GetReason(); edited_reason = edited_reason.replace_all_cs(" ", "_"); @@ -298,7 +298,7 @@ class UnrealIRCdProto : public IRCDProto /* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken when coming from a none TOKEN'd server */ - void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override { if (!param.empty()) UplinkSocket::Message() << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param; @@ -306,7 +306,7 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "SVSJOIN " << user->GetUID() << " " << chan; } - void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override { if (!param.empty()) UplinkSocket::Message() << "SVSPART " << user->GetUID() << " " << chan << " :" << param; @@ -314,22 +314,22 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "SVSPART " << user->GetUID() << " " << chan; } - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { UplinkSocket::Message(Me) << "SENDUMODE o :from " << source.GetName() << ": " << buf; } - void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) anope_override + void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) override { UplinkSocket::Message() << "SWHOIS " << who << " :" << mask; } - void SendEOB() anope_override + void SendEOB() override { UplinkSocket::Message(Me) << "EOS"; } - bool IsNickValid(const Anope::string &nick) anope_override + bool IsNickValid(const Anope::string &nick) override { if (nick.equals_ci("ircd") || nick.equals_ci("irc")) return false; @@ -337,7 +337,7 @@ class UnrealIRCdProto : public IRCDProto return IRCDProto::IsNickValid(nick); } - bool IsChannelValid(const Anope::string &chan) anope_override + bool IsChannelValid(const Anope::string &chan) override { if (chan.find(':') != Anope::string::npos) return false; @@ -345,12 +345,12 @@ class UnrealIRCdProto : public IRCDProto return IRCDProto::IsChannelValid(chan); } - bool IsExtbanValid(const Anope::string &mask) anope_override + bool IsExtbanValid(const Anope::string &mask) override { return mask.length() >= 4 && mask[0] == '~' && mask[2] == ':'; } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickAlias *na) override { /* 3.2.10.4+ treats users logged in with accounts as fully registered, even if -r, so we can not set this here. Just use the timestamp. */ if (Servers::Capab.count("ESVID") > 0 && !na->nc->HasExt("UNCONFIRMED")) @@ -359,18 +359,18 @@ class UnrealIRCdProto : public IRCDProto IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon); } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 0"); } - void SendChannel(Channel *c) anope_override + void SendChannel(Channel *c) override { UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :"; } - void SendSASLMessage(const SASL::Message &message) anope_override + void SendSASLMessage(const SASL::Message &message) override { size_t p = message.target.find('!'); Anope::string distmask; @@ -390,7 +390,7 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << distmask << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext); } - void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_override + void SendSVSLogin(const Anope::string &uid, NickAlias *na) override { size_t p = uid.find('!'); Anope::string distmask; @@ -406,10 +406,10 @@ class UnrealIRCdProto : public IRCDProto { distmask = uid.substr(0, p); } - UplinkSocket::Message(Me) << "SVSLOGIN " << distmask << " " << uid << " " << acc; + UplinkSocket::Message(Me) << "SVSLOGIN " << distmask << " " << uid << " " << na->nc->display; } - bool IsIdentValid(const Anope::string &ident) anope_override + bool IsIdentValid(const Anope::string &ident) override { if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) return false; @@ -441,13 +441,13 @@ class UnrealExtBan : public ChannelModeVirtual<ChannelModeList> { } - ChannelMode *Wrap(Anope::string ¶m) anope_override + ChannelMode *Wrap(Anope::string ¶m) override { param = "~" + Anope::string(ext) + ":" + param; return ChannelModeVirtual<ChannelModeList>::Wrap(param); } - ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override + ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) override { if (cm->type != MODE_LIST || param.length() < 4 || param[0] != '~' || param[1] != ext || param[2] != ':') return cm; @@ -466,7 +466,7 @@ namespace UnrealExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string channel = mask.substr(3); @@ -501,7 +501,7 @@ namespace UnrealExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); @@ -517,7 +517,7 @@ namespace UnrealExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); @@ -533,7 +533,7 @@ namespace UnrealExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); return u->HasMode("REGISTERED") && mask.equals_ci(u->nick); @@ -547,7 +547,7 @@ namespace UnrealExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); @@ -563,7 +563,7 @@ namespace UnrealExtban { } - bool Matches(User *u, const Entry *e) anope_override + bool Matches(User *u, const Entry *e) override { const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); @@ -578,7 +578,7 @@ class ChannelModeFlood : public ChannelModeParam ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } /* Borrowed part of this check from UnrealIRCd */ - bool IsValid(Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const override { if (value.empty()) return false; @@ -630,7 +630,7 @@ class ChannelModeUnrealSSL : public ChannelMode { } - bool CanSet(User *u) const anope_override + bool CanSet(User *u) const override { return false; } @@ -640,7 +640,7 @@ struct IRCDMessageCapab : Message::Capab { IRCDMessageCapab(Module *creator) : Message::Capab(creator, "PROTOCTL") { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { for (unsigned i = 0; i < params.size(); ++i) { @@ -801,7 +801,7 @@ struct IRCDMessageCapab : Message::Capab } } - Message::Capab::Run(source, params); + Message::Capab::Run(source, params, tags); } }; @@ -809,7 +809,7 @@ struct IRCDMessageChgHost : IRCDMessage { IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = User::Find(params[0]); if (u) @@ -821,7 +821,7 @@ struct IRCDMessageChgIdent : IRCDMessage { IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = User::Find(params[0]); if (u) @@ -833,7 +833,7 @@ struct IRCDMessageChgName : IRCDMessage { IRCDMessageChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = User::Find(params[0]); if (u) @@ -845,7 +845,7 @@ struct IRCDMessageMD : IRCDMessage { IRCDMessageMD(Module *creator) : IRCDMessage(creator, "MD", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { const Anope::string &mdtype = params[0], &obj = params[1], @@ -873,7 +873,7 @@ struct IRCDMessageMode : IRCDMessage { IRCDMessageMode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { bool server_source = source.GetServer() != NULL; Anope::string modes = params[1]; @@ -918,7 +918,7 @@ struct IRCDMessageNetInfo : IRCDMessage { IRCDMessageNetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { UplinkSocket::Message() << "NETINFO " << MaxUserCount << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7]; } @@ -948,7 +948,7 @@ struct IRCDMessageNick : IRCDMessage ** parv[0] = new nickname ** parv[1] = hopcount */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (params.size() == 11) { @@ -1014,7 +1014,7 @@ struct IRCDMessagePong : IRCDMessage { IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (!source.GetServer()->IsSynced()) source.GetServer()->Sync(false); @@ -1025,7 +1025,7 @@ struct IRCDMessageSASL : IRCDMessage { IRCDMessageSASL(Module *creator) : IRCDMessage(creator, "SASL", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { if (!SASL::sasl) return; @@ -1045,7 +1045,7 @@ struct IRCDMessageSDesc : IRCDMessage { IRCDMessageSDesc(Module *creator) : IRCDMessage(creator, "SDESC", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetServer()->SetDescription(params[0]); } @@ -1055,7 +1055,7 @@ struct IRCDMessageSetHost : IRCDMessage { IRCDMessageSetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = source.GetUser(); @@ -1071,7 +1071,7 @@ struct IRCDMessageSetIdent : IRCDMessage { IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = source.GetUser(); u->SetVIdent(params[0]); @@ -1082,7 +1082,7 @@ struct IRCDMessageSetName : IRCDMessage { IRCDMessageSetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { User *u = source.GetUser(); u->SetRealname(params[0]); @@ -1093,7 +1093,7 @@ struct IRCDMessageServer : IRCDMessage { IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; @@ -1115,7 +1115,7 @@ struct IRCDMessageSID : IRCDMessage { IRCDMessageSID(Module *creator) : IRCDMessage(creator, "SID", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; @@ -1129,7 +1129,7 @@ struct IRCDMessageSJoin : IRCDMessage { IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string modes; if (params.size() >= 4) @@ -1223,7 +1223,7 @@ struct IRCDMessageTopic : IRCDMessage ** parv[2] = topic time ** parv[3] = topic text */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Channel *c = Channel::Find(params[0]); if (c) @@ -1249,7 +1249,7 @@ struct IRCDMessageUID : IRCDMessage { IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 12) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { Anope::string nickname = params[0], @@ -1318,7 +1318,7 @@ struct IRCDMessageUmode2 : IRCDMessage { IRCDMessageUmode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { source.GetUser()->SetModesInternal(source, "%s", params[0].c_str()); } @@ -1422,24 +1422,24 @@ class ProtoUnreal : public Module this->AddModes(); } - void Prioritize() anope_override + void Prioritize() override { ModuleManager::SetPriority(this, PRIORITY_FIRST); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock"); } - void OnUserNickChange(User *u, const Anope::string &) anope_override + void OnUserNickChange(User *u, const Anope::string &) override { u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); if (Servers::Capab.count("ESVID") == 0) IRCD->SendLogout(u); } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { if (!c->ci) return; @@ -1452,7 +1452,7 @@ class ProtoUnreal : public Module } } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK")) @@ -1461,14 +1461,14 @@ class ProtoUnreal : public Module UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; } - void OnDelChan(ChannelInfo *ci) anope_override + void OnDelChan(ChannelInfo *ci) override { if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) return; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " :"; } - EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override + EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); @@ -1481,7 +1481,7 @@ class ProtoUnreal : public Module return EVENT_CONTINUE; } - EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override + EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) override { ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp index 6aa75919c..b379293c8 100644 --- a/modules/pseudoclients/botserv.cpp +++ b/modules/pseudoclients/botserv.cpp @@ -22,13 +22,13 @@ class BotServCore : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &bsnick = conf->GetModule(this)->Get<const Anope::string>("client"); BotServ = BotInfo::Find(bsnick, true); } - void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override + void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) override { /* Do not allow removing bot modes on our service bots */ if (chan->ci && chan->ci->bi == user) @@ -39,7 +39,7 @@ class BotServCore : public Module } } - void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) anope_override + void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) override { if (ci->c && ci->c->users.size() >= Config->GetModule(this)->Get<unsigned>("minusers")) { @@ -48,7 +48,7 @@ class BotServCore : public Module } } - void OnJoinChannel(User *user, Channel *c) anope_override + void OnJoinChannel(User *user, Channel *c) override { if (!Config || !IRCD) return; @@ -103,7 +103,7 @@ class BotServCore : public Module } } - void OnLeaveChannel(User *u, Channel *c) anope_override + void OnLeaveChannel(User *u, Channel *c) override { /* Channel is persistent, it shouldn't be deleted and the service bot should stay */ if (c->ci && persist && persist->HasExt(c->ci)) @@ -124,7 +124,7 @@ class BotServCore : public Module c->ci->bi->Part(c->ci->c); } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty()) return EVENT_CONTINUE; @@ -159,7 +159,7 @@ class BotServCore : public Module return EVENT_CONTINUE; } - void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *BotServ) return; @@ -174,7 +174,7 @@ class BotServCore : public Module "one of the following characters: %s"), fantasycharacters.c_str()); } - EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string ¶m) override { if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi)) { @@ -188,7 +188,7 @@ class BotServCore : public Module return EVENT_CONTINUE; } - void OnCreateChan(ChannelInfo *ci) anope_override + void OnCreateChan(ChannelInfo *ci) override { /* Set default bot flags */ spacesepstream sep(Config->GetModule(this)->Get<const Anope::string>("defaults", "greet fantasy")); @@ -196,7 +196,7 @@ class BotServCore : public Module ci->Extend<bool>("BS_" + token.upper()); } - void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) anope_override + void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) override { BotInfo *bi = BotInfo::Find(target->GetUID()); if (bi) @@ -204,7 +204,7 @@ class BotServCore : public Module bi->Join(channel, &status); } - void OnCreateBot(BotInfo *bi) anope_override + void OnCreateBot(BotInfo *bi) override { if (bi->botmodes.empty()) bi->botmodes = Config->GetModule(this)->Get<const Anope::string>("botumodes"); diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index 034859d91..100b0e50b 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -25,15 +25,15 @@ class ChanServCore : public Module, public ChanServService std::vector<Anope::string> defaults; ExtensibleItem<bool> inhabit; ExtensibleRef<bool> persist; - bool always_lower; + bool always_lower = false; public: ChanServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PSEUDOCLIENT | VENDOR), - ChanServService(this), inhabit(this, "inhabit"), persist("PERSIST"), always_lower(false) + ChanServService(this), inhabit(this, "inhabit"), persist("PERSIST") { } - void Hold(Channel *c) anope_override + void Hold(Channel *c) override { /** A timer used to keep the BotServ bot/ChanServ in the channel * after kicking the last user in a channel @@ -68,7 +68,7 @@ class ChanServCore : public Module, public ChanServService /** Called when the delay is up * @param The current time */ - void Tick(time_t) anope_override + void Tick(time_t) override { if (!c) return; @@ -96,7 +96,7 @@ class ChanServCore : public Module, public ChanServService new ChanServTimer(ChanServ, inhabit, this->owner, c); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &channick = conf->GetModule(this)->Get<const Anope::string>("client"); @@ -123,13 +123,13 @@ class ChanServCore : public Module, public ChanServService always_lower = conf->GetModule(this)->Get<bool>("always_lower_ts"); } - void OnBotDelete(BotInfo *bi) anope_override + void OnBotDelete(BotInfo *bi) override { if (bi == ChanServ) ChanServ = NULL; } - EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override { if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER")) { @@ -140,7 +140,7 @@ class ChanServCore : public Module, public ChanServService return EVENT_CONTINUE; } - void OnDelCore(NickCore *nc) anope_override + void OnDelCore(NickCore *nc) override { std::deque<ChannelInfo *> chans; nc->GetChannelReferences(chans); @@ -213,7 +213,7 @@ class ChanServCore : public Module, public ChanServService } } - void OnDelChan(ChannelInfo *ci) anope_override + void OnDelChan(ChannelInfo *ci) override { /* remove access entries that are this channel */ @@ -248,7 +248,7 @@ class ChanServCore : public Module, public ChanServService } } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *ChanServ) return EVENT_CONTINUE; @@ -263,11 +263,11 @@ class ChanServCore : public Module, public ChanServService return EVENT_CONTINUE; } - void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *ChanServ) return; - time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "14d"); + time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d"); if (chanserv_expire >= 86400) source.Reply(_(" \n" "Note that any channel which is not used for %d days\n" @@ -280,7 +280,7 @@ class ChanServCore : public Module, public ChanServService "lists and settings for any channel.")); } - void OnCheckModes(Reference<Channel> &c) anope_override + void OnCheckModes(Reference<Channel> &c) override { if (!c) return; @@ -288,7 +288,7 @@ class ChanServCore : public Module, public ChanServService if (c->ci) c->SetMode(c->ci->WhoSends(), "REGISTERED", "", false); else - c->RemoveMode(c->ci->WhoSends(), "REGISTERED", "", false); + c->RemoveMode(ChanServ, "REGISTERED", "", false); const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require"); if (!require.empty()) @@ -296,18 +296,18 @@ class ChanServCore : public Module, public ChanServService if (c->ci) c->SetModes(c->ci->WhoSends(), false, "+%s", require.c_str()); else - c->SetModes(c->ci->WhoSends(), false, "-%s", require.c_str()); + c->SetModes(ChanServ, false, "-%s", require.c_str()); } } - void OnCreateChan(ChannelInfo *ci) anope_override + void OnCreateChan(ChannelInfo *ci) override { /* Set default chan flags */ for (unsigned i = 0; i < defaults.size(); ++i) ci->Extend<bool>(defaults[i].upper()); } - EventReturn OnCanSet(User *u, const ChannelMode *cm) anope_override + EventReturn OnCanSet(User *u, const ChannelMode *cm) override { if (Config->GetModule(this)->Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos || Config->GetModule(this)->Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos) @@ -315,7 +315,7 @@ class ChanServCore : public Module, public ChanServService return EVENT_CONTINUE; } - void OnChannelSync(Channel *c) anope_override + void OnChannelSync(Channel *c) override { bool perm = c->HasMode("PERM") || (c->ci && persist && persist->HasExt(c->ci)); if (!perm && !c->botchannel && (c->users.empty() || (c->users.size() == 1 && c->users.begin()->second->user->server == Me))) @@ -324,15 +324,15 @@ class ChanServCore : public Module, public ChanServService } } - void OnLog(Log *l) anope_override + void OnLog(Log *l) override { if (l->type == LOG_CHANNEL) l->bi = ChanServ; } - void OnExpireTick() anope_override + void OnExpireTick() override { - time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "14d"); + time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d"); if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly) return; @@ -368,7 +368,7 @@ class ChanServCore : public Module, public ChanServService } } - EventReturn OnCheckDelete(Channel *c) anope_override + EventReturn OnCheckDelete(Channel *c) override { /* Do not delete this channel if ChanServ/a BotServ bot is inhabiting it */ if (inhabit.HasExt(c)) @@ -377,7 +377,7 @@ class ChanServCore : public Module, public ChanServService return EVENT_CONTINUE; } - void OnPostInit() anope_override + void OnPostInit() override { if (!persist) return; @@ -413,7 +413,7 @@ class ChanServCore : public Module, public ChanServService } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) override { if (!persist || !ci->c) return; @@ -425,7 +425,7 @@ class ChanServCore : public Module, public ChanServService ci->c->SetMode(NULL, "PERM"); } - void OnJoinChannel(User *u, Channel *c) anope_override + void OnJoinChannel(User *u, Channel *c) override { if (always_lower && c->ci && c->creation_time > c->ci->time_registered) { @@ -436,7 +436,7 @@ class ChanServCore : public Module, public ChanServService } } - EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override + EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) override { if (!always_lower && Anope::CurTime == c->creation_time && c->ci && setter.GetUser() && !setter.GetUser()->server->IsULined()) { @@ -455,17 +455,17 @@ class ChanServCore : public Module, public ChanServService return EVENT_CONTINUE; } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) override { if (!show_all) return; - time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "14d"); + time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d"); if (!ci->HasExt("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->last_used != Anope::CurTime) info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount()); } - void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override + void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) override { if (always_lower) // Since we always lower the TS, the other side will remove the modes if the channel ts lowers, so we don't diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp index d07a541e9..9285f3845 100644 --- a/modules/pseudoclients/global.cpp +++ b/modules/pseudoclients/global.cpp @@ -29,12 +29,12 @@ class GlobalCore : public Module, public GlobalService { } - Reference<BotInfo> GetDefaultSender() anope_override + Reference<BotInfo> GetDefaultSender() override { return Global; } - void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) anope_override + void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) override { if (Me->GetLinks().empty()) return; @@ -53,7 +53,7 @@ class GlobalCore : public Module, public GlobalService this->ServerGlobal(sender, Servers::GetUplink(), rmessage); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &glnick = conf->GetModule(this)->Get<const Anope::string>("client"); @@ -67,28 +67,28 @@ class GlobalCore : public Module, public GlobalService Global = bi; } - void OnRestart() anope_override + void OnRestart() override { const Anope::string &gl = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown"); if (!gl.empty()) this->SendGlobal(Global, "", gl); } - void OnShutdown() anope_override + void OnShutdown() override { const Anope::string &gl = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown"); if (!gl.empty()) this->SendGlobal(Global, "", gl); } - void OnNewServer(Server *s) anope_override + void OnNewServer(Server *s) override { const Anope::string &gl = Config->GetModule(this)->Get<const Anope::string>("globaloncycleup"); if (!gl.empty() && !Me->IsSynced()) s->Notice(Global, gl); } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *Global) return EVENT_CONTINUE; diff --git a/modules/pseudoclients/hostserv.cpp b/modules/pseudoclients/hostserv.cpp index d0140b9a2..6c510ecfc 100644 --- a/modules/pseudoclients/hostserv.cpp +++ b/modules/pseudoclients/hostserv.cpp @@ -21,7 +21,7 @@ class HostServCore : public Module throw ModuleException("Your IRCd does not support vhosts"); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &hsnick = conf->GetModule(this)->Get<const Anope::string>("client"); @@ -35,7 +35,7 @@ class HostServCore : public Module HostServ = bi; } - void OnUserLogin(User *u) anope_override + void OnUserLogin(User *u) override { if (!IRCD->CanSetVHost) return; @@ -66,7 +66,7 @@ class HostServCore : public Module } } - void OnNickDrop(CommandSource &source, NickAlias *na) anope_override + void OnNickDrop(CommandSource &source, NickAlias *na) override { if (na->HasVhost()) { @@ -75,12 +75,12 @@ class HostServCore : public Module } } - void OnNickUpdate(User *u) anope_override + void OnNickUpdate(User *u) override { this->OnUserLogin(u); } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *HostServ) return EVENT_CONTINUE; @@ -88,7 +88,7 @@ class HostServCore : public Module return EVENT_CONTINUE; } - void OnSetVhost(NickAlias *na) anope_override + void OnSetVhost(NickAlias *na) override { if (Config->GetModule(this)->Get<bool>("activate_on_set")) { @@ -115,7 +115,7 @@ class HostServCore : public Module } } - void OnDeleteVhost(NickAlias *na) anope_override + void OnDeleteVhost(NickAlias *na) override { if (Config->GetModule(this)->Get<bool>("activate_on_set")) { diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp index d4d00df64..f04681fd5 100644 --- a/modules/pseudoclients/memoserv.cpp +++ b/modules/pseudoclients/memoserv.cpp @@ -41,7 +41,7 @@ class MemoServCore : public Module, public MemoServService { } - MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force) anope_override + MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force) override { bool ischan; MemoInfo *mi = MemoInfo::GetMemoInfo(target, ischan); @@ -129,7 +129,7 @@ class MemoServCore : public Module, public MemoServService return MEMO_SUCCESS; } - void Check(User *u) anope_override + void Check(User *u) override { const NickCore *nc = u->Account(); if (!nc) @@ -150,7 +150,7 @@ class MemoServCore : public Module, public MemoServService } } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &msnick = conf->GetModule(this)->Get<const Anope::string>("client"); @@ -164,28 +164,28 @@ class MemoServCore : public Module, public MemoServService MemoServ = bi; } - void OnNickCoreCreate(NickCore *nc) anope_override + void OnNickCoreCreate(NickCore *nc) override { nc->memos.memomax = Config->GetModule(this)->Get<int>("maxmemos"); } - void OnCreateChan(ChannelInfo *ci) anope_override + void OnCreateChan(ChannelInfo *ci) override { ci->memos.memomax = Config->GetModule(this)->Get<int>("maxmemos"); } - void OnBotDelete(BotInfo *bi) anope_override + void OnBotDelete(BotInfo *bi) override { if (bi == MemoServ) MemoServ = NULL; } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { this->Check(u); } - void OnJoinChannel(User *u, Channel *c) anope_override + void OnJoinChannel(User *u, Channel *c) override { if (c->ci && !c->ci->memos.memos->empty() && c->ci->AccessFor(u).HasPriv("MEMO")) { @@ -196,18 +196,18 @@ class MemoServCore : public Module, public MemoServService } } - void OnUserAway(User *u, const Anope::string &message) anope_override + void OnUserAway(User *u, const Anope::string &message) override { if (message.empty()) this->Check(u); } - void OnNickUpdate(User *u) anope_override + void OnNickUpdate(User *u) override { this->Check(u); } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *MemoServ) return EVENT_CONTINUE; @@ -220,7 +220,7 @@ class MemoServCore : public Module, public MemoServService return EVENT_CONTINUE; } - void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *MemoServ) return; diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index 6720d7768..e09118e58 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -44,7 +44,7 @@ class NickServCollide : public Timer return na; } - void Tick(time_t t) anope_override + void Tick(time_t t) override { if (!u || !na) return; @@ -107,7 +107,7 @@ class NickServRelease : public User, public Timer NickServReleases.erase(this->nick); } - void Tick(time_t t) anope_override { } + void Tick(time_t t) override { } }; class NickServCore : public Module, public NickServService @@ -142,7 +142,7 @@ class NickServCore : public Module, public NickServService OnShutdown(); } - void OnShutdown() anope_override + void OnShutdown() override { /* On shutdown, restart, or mod unload, remove all of our holds for nicks (svshold or qlines) * because some IRCds do not allow us to have these automatically expire @@ -151,12 +151,12 @@ class NickServCore : public Module, public NickServService this->Release(it->second); } - void OnRestart() anope_override + void OnRestart() override { OnShutdown(); } - void Validate(User *u) anope_override + void Validate(User *u) override { NickAlias *na = NickAlias::Find(u->nick); if (!na) @@ -215,7 +215,7 @@ class NickServCore : public Module, public NickServService } - void OnUserLogin(User *u) anope_override + void OnUserLogin(User *u) override { NickAlias *na = NickAlias::Find(u->nick); if (na && *na->nc == u->Account() && !Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED")) @@ -226,7 +226,7 @@ class NickServCore : public Module, public NickServService u->SetModes(NickServ, "%s", modesonid.c_str()); } - void Collide(User *u, NickAlias *na) anope_override + void Collide(User *u, NickAlias *na) override { if (na) collided.Set(na); @@ -259,7 +259,7 @@ class NickServCore : public Module, public NickServService u->Kill(*NickServ, "Services nickname-enforcer kill"); } - void Release(NickAlias *na) anope_override + void Release(NickAlias *na) override { if (held.HasExt(na)) { @@ -279,7 +279,7 @@ class NickServCore : public Module, public NickServService collided.Unset(na); /* clear pending collide */ } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &nsnick = conf->GetModule(this)->Get<const Anope::string>("client"); @@ -303,7 +303,7 @@ class NickServCore : public Module, public NickServService defaults.clear(); } - void OnDelNick(NickAlias *na) anope_override + void OnDelNick(NickAlias *na) override { User *u = User::Find(na->nick); if (u && u->Account() == na->nc) @@ -314,7 +314,7 @@ class NickServCore : public Module, public NickServService } } - void OnDelCore(NickCore *nc) anope_override + void OnDelCore(NickCore *nc) override { Log(NickServ, "nick") << "Deleting nickname group " << nc->display; @@ -330,12 +330,12 @@ class NickServCore : public Module, public NickServService nc->users.clear(); } - void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) anope_override + void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) override { Log(LOG_NORMAL, "nick", NickServ) << "Changing " << nc->display << " nickname group display to " << newdisplay; } - void OnNickIdentify(User *u) anope_override + void OnNickIdentify(User *u) override { Configuration::Block *block = Config->GetModule(this); @@ -374,13 +374,13 @@ class NickServCore : public Module, public NickServService } } - void OnNickGroup(User *u, NickAlias *target) anope_override + void OnNickGroup(User *u, NickAlias *target) override { if (!target->nc->HasExt("UNCONFIRMED")) u->SetMode(NickServ, "REGISTERED"); } - void OnNickUpdate(User *u) anope_override + void OnNickUpdate(User *u) override { for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it) { @@ -391,7 +391,7 @@ class NickServCore : public Module, public NickServService } } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (u->Quitting() || !u->server->IsSynced() || u->server->IsULined()) return; @@ -405,14 +405,14 @@ class NickServCore : public Module, public NickServService this->Validate(u); } - void OnPostUserLogoff(User *u) anope_override + void OnPostUserLogoff(User *u) override { NickAlias *na = NickAlias::Find(u->nick); if (na) OnCancel(u, na); } - void OnServerSync(Server *s) anope_override + void OnServerSync(Server *s) override { for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) { @@ -428,7 +428,7 @@ class NickServCore : public Module, public NickServService } } - void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override + void OnUserNickChange(User *u, const Anope::string &oldnick) override { NickAlias *old_na = NickAlias::Find(oldnick), *na = NickAlias::Find(u->nick); /* If the new nick isn't registered or it's registered and not yours */ @@ -452,13 +452,13 @@ class NickServCore : public Module, public NickServService OnCancel(u, old_na); } - void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override { if (u->server->IsSynced() && mname == "REGISTERED" && !u->IsIdentified(true)) u->RemoveMode(NickServ, mname); } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *NickServ) return EVENT_CONTINUE; @@ -478,7 +478,7 @@ class NickServCore : public Module, public NickServService return EVENT_CONTINUE; } - void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void OnPostHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *NickServ) return; @@ -487,7 +487,7 @@ class NickServCore : public Module, public NickServService "Services Operators can also drop any nickname without needing\n" "to identify for the nick, and may view the access list for\n" "any nickname.")); - time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "21d"); + time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d"); if (nickserv_expire >= 86400) source.Reply(_(" \n" "Accounts that are not used anymore are subject to\n" @@ -495,14 +495,14 @@ class NickServCore : public Module, public NickServService "after %d days if not used."), nickserv_expire / 86400); } - void OnNickCoreCreate(NickCore *nc) anope_override + void OnNickCoreCreate(NickCore *nc) override { /* Set default flags */ for (unsigned i = 0; i < defaults.size(); ++i) nc->Extend<bool>(defaults[i].upper()); } - void OnUserQuit(User *u, const Anope::string &msg) anope_override + void OnUserQuit(User *u, const Anope::string &msg) override { if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this)->Get<bool>("hidenetsplitquit")) return; @@ -516,12 +516,12 @@ class NickServCore : public Module, public NickServService } } - void OnExpireTick() anope_override + void OnExpireTick() override { if (Anope::NoExpire || Anope::ReadOnly) return; - time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "21d"); + time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d"); for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ) { @@ -548,11 +548,11 @@ class NickServCore : public Module, public NickServService } } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { if (!na->nc->HasExt("UNCONFIRMED")) { - time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "21d"); + time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d"); if (!na->HasExt("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->last_seen != Anope::CurTime)) info[_("Expires")] = Anope::strftime(na->last_seen + nickserv_expire, source.GetAccount()); } diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 4be03e228..afacb6d52 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -16,27 +16,27 @@ class SGLineManager : public XLineManager public: SGLineManager(Module *creator) : XLineManager(creator, "xlinemanager/sgline", 'G') { } - void OnMatch(User *u, XLine *x) anope_override + void OnMatch(User *u, XLine *x) override { this->Send(u, x); } - void OnExpire(const XLine *x) anope_override + void OnExpire(const XLine *x) override { Log(Config->GetClient("OperServ"), "expire/akill") << "AKILL on \002" << x->mask << "\002 has expired"; } - void Send(User *u, XLine *x) anope_override + void Send(User *u, XLine *x) override { IRCD->SendAkill(u, x); } - void SendDel(XLine *x) anope_override + void SendDel(XLine *x) override { IRCD->SendAkillDel(x); } - bool Check(User *u, const XLine *x) anope_override + bool Check(User *u, const XLine *x) override { if (x->regex) { @@ -70,17 +70,17 @@ class SQLineManager : public XLineManager public: SQLineManager(Module *creator) : XLineManager(creator, "xlinemanager/sqline", 'Q'), nickserv("NickServService", "NickServ") { } - void OnMatch(User *u, XLine *x) anope_override + void OnMatch(User *u, XLine *x) override { this->Send(u, x); } - void OnExpire(const XLine *x) anope_override + void OnExpire(const XLine *x) override { Log(Config->GetClient("OperServ"), "expire/sqline") << "SQLINE on \002" << x->mask << "\002 has expired"; } - void Send(User *u, XLine *x) anope_override + void Send(User *u, XLine *x) override { if (!IRCD->CanSQLine) { @@ -105,7 +105,7 @@ class SQLineManager : public XLineManager } } - void SendDel(XLine *x) anope_override + void SendDel(XLine *x) override { if (!IRCD->CanSQLine || x->IsRegex()) ; @@ -113,7 +113,7 @@ class SQLineManager : public XLineManager IRCD->SendSQLineDel(x); } - bool Check(User *u, const XLine *x) anope_override + bool Check(User *u, const XLine *x) override { if (x->regex) return x->regex->Matches(u->nick); @@ -149,17 +149,17 @@ class SNLineManager : public XLineManager public: SNLineManager(Module *creator) : XLineManager(creator, "xlinemanager/snline", 'N') { } - void OnMatch(User *u, XLine *x) anope_override + void OnMatch(User *u, XLine *x) override { this->Send(u, x); } - void OnExpire(const XLine *x) anope_override + void OnExpire(const XLine *x) override { Log(Config->GetClient("OperServ"), "expire/snline") << "SNLINE on \002" << x->mask << "\002 has expired"; } - void Send(User *u, XLine *x) anope_override + void Send(User *u, XLine *x) override { if (IRCD->CanSNLine && !x->IsRegex()) IRCD->SendSGLine(u, x); @@ -168,13 +168,13 @@ class SNLineManager : public XLineManager u->Kill(Config->GetClient("OperServ"), "SNLined: " + x->reason); } - void SendDel(XLine *x) anope_override + void SendDel(XLine *x) override { if (IRCD->CanSNLine && !x->IsRegex()) IRCD->SendSGLineDel(x); } - bool Check(User *u, const XLine *x) anope_override + bool Check(User *u, const XLine *x) override { if (x->regex) return x->regex->Matches(u->realname); @@ -211,7 +211,7 @@ class OperServCore : public Module XLineManager::UnregisterXLineManager(&snlines); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { const Anope::string &osnick = conf->GetModule(this)->Get<const Anope::string>("client"); @@ -225,7 +225,7 @@ class OperServCore : public Module OperServ = bi; } - EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override + EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override { if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly")) { @@ -237,37 +237,37 @@ class OperServCore : public Module return EVENT_CONTINUE; } - void OnServerQuit(Server *server) anope_override + void OnServerQuit(Server *server) override { if (server->IsJuped()) Log(server, "squit", OperServ) << "Received SQUIT for juped server " << server->GetName(); } - void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override { if (mname == "OPER") Log(u, "oper", OperServ) << "is now an IRC operator."; } - void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override + void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override { if (mname == "OPER") Log(u, "oper", OperServ) << "is no longer an IRC operator"; } - void OnUserConnect(User *u, bool &exempt) anope_override + void OnUserConnect(User *u, bool &exempt) override { if (!u->Quitting() && !exempt) XLineManager::CheckAll(u); } - void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override + void OnUserNickChange(User *u, const Anope::string &oldnick) override { if (!u->HasMode("OPER")) this->sqlines.CheckAllXLines(u); } - EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override + EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override { XLine *x = this->sqlines.CheckChannel(c); if (x) @@ -280,7 +280,7 @@ class OperServCore : public Module return EVENT_CONTINUE; } - EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (!params.empty() || source.c || source.service != *OperServ) return EVENT_CONTINUE; @@ -288,7 +288,7 @@ class OperServCore : public Module return EVENT_CONTINUE; } - void OnLog(Log *l) anope_override + void OnLog(Log *l) override { if (l->type == LOG_SERVER) l->bi = OperServ; diff --git a/modules/third/language/CMakeLists.txt b/modules/third/language/CMakeLists.txt index 85278f5be..835b4ee4f 100644 --- a/modules/third/language/CMakeLists.txt +++ b/modules/third/language/CMakeLists.txt @@ -2,7 +2,7 @@ if(GETTEXT_FOUND) # Get all of the .po files file(GLOB LANG_SRCS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.*.po") - sort_list(LANG_SRCS_PO) + list(SORT LANG_SRCS_PO) foreach(LANG_PO ${LANG_SRCS_PO}) # Get the domain for this language file @@ -26,13 +26,13 @@ if(GETTEXT_FOUND) # Add to cpack ignored files if not on Windows. if(NOT WIN32) add_to_cpack_ignored_files("${LANG_MO}") - endif(NOT WIN32) + endif() # Install the new language file install(CODE "FILE(MAKE_DIRECTORY ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES/)") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS}) - endforeach(LANG_PO) + endforeach() # Generate languages, depends on the mo files add_custom_target(module_language DEPENDS ${LANG_SRCS_MO}) -endif(GETTEXT_FOUND) +endif() diff --git a/modules/webcpanel/pages/chanserv/access.h b/modules/webcpanel/pages/chanserv/access.h index 35545d416..2633f1db7 100644 --- a/modules/webcpanel/pages/chanserv/access.h +++ b/modules/webcpanel/pages/chanserv/access.h @@ -16,9 +16,9 @@ class Access : public WebPanelProtectedPage public: Access(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; - std::set<Anope::string> GetData() anope_override; + std::set<Anope::string> GetData() override; }; } diff --git a/modules/webcpanel/pages/chanserv/akick.h b/modules/webcpanel/pages/chanserv/akick.h index e0ab94497..9d79e4c11 100644 --- a/modules/webcpanel/pages/chanserv/akick.h +++ b/modules/webcpanel/pages/chanserv/akick.h @@ -16,9 +16,9 @@ class Akick : public WebPanelProtectedPage public: Akick(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; - std::set<Anope::string> GetData() anope_override; + std::set<Anope::string> GetData() override; }; } diff --git a/modules/webcpanel/pages/chanserv/drop.h b/modules/webcpanel/pages/chanserv/drop.h index 269cc2c19..9fb121d4d 100644 --- a/modules/webcpanel/pages/chanserv/drop.h +++ b/modules/webcpanel/pages/chanserv/drop.h @@ -16,7 +16,7 @@ namespace WebCPanel public: Drop(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; diff --git a/modules/webcpanel/pages/chanserv/info.h b/modules/webcpanel/pages/chanserv/info.h index 9f0c74c46..94ec0fde5 100644 --- a/modules/webcpanel/pages/chanserv/info.h +++ b/modules/webcpanel/pages/chanserv/info.h @@ -16,7 +16,7 @@ class Info : public WebPanelProtectedPage public: Info(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/chanserv/modes.h b/modules/webcpanel/pages/chanserv/modes.h index 2c87e50e4..60d83f24a 100644 --- a/modules/webcpanel/pages/chanserv/modes.h +++ b/modules/webcpanel/pages/chanserv/modes.h @@ -16,9 +16,9 @@ class Modes : public WebPanelProtectedPage public: Modes(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; - std::set<Anope::string> GetData() anope_override; + std::set<Anope::string> GetData() override; }; } diff --git a/modules/webcpanel/pages/chanserv/set.h b/modules/webcpanel/pages/chanserv/set.h index 2305f213e..157d02dea 100644 --- a/modules/webcpanel/pages/chanserv/set.h +++ b/modules/webcpanel/pages/chanserv/set.h @@ -16,9 +16,9 @@ class Set : public WebPanelProtectedPage public: Set(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; - std::set<Anope::string> GetData() anope_override; + std::set<Anope::string> GetData() override; }; } diff --git a/modules/webcpanel/pages/confirm.h b/modules/webcpanel/pages/confirm.h index d8eafdd19..66ded4d50 100644 --- a/modules/webcpanel/pages/confirm.h +++ b/modules/webcpanel/pages/confirm.h @@ -15,7 +15,7 @@ class Confirm : public WebPanelPage public: Confirm(const Anope::string &u) : WebPanelPage(u) { } - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) override; }; } diff --git a/modules/webcpanel/pages/hostserv/request.h b/modules/webcpanel/pages/hostserv/request.h index 2b77428e7..9ec729a20 100644 --- a/modules/webcpanel/pages/hostserv/request.h +++ b/modules/webcpanel/pages/hostserv/request.h @@ -16,7 +16,7 @@ class Request : public WebPanelProtectedPage public: Request(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/index.cpp b/modules/webcpanel/pages/index.cpp index dfbe8988b..ce535fac1 100644 --- a/modules/webcpanel/pages/index.cpp +++ b/modules/webcpanel/pages/index.cpp @@ -19,7 +19,7 @@ class WebpanelRequest : public IdentifyRequest public: WebpanelRequest(Module *o, HTTPReply &r, HTTPMessage &m, HTTPProvider *s, const Anope::string &p_n, HTTPClient *c, TemplateFileServer::Replacements &re, const Anope::string &user, const Anope::string &pass) : IdentifyRequest(o, user, pass), reply(r), message(m), server(s), page_name(p_n), client(c), replacements(re) { } - void OnSuccess() anope_override + void OnSuccess() override { if (!client || !server) return; @@ -78,7 +78,7 @@ class WebpanelRequest : public IdentifyRequest client->SendReply(&reply); } - void OnFail() anope_override + void OnFail() override { if (!client || !server) return; diff --git a/modules/webcpanel/pages/index.h b/modules/webcpanel/pages/index.h index c0386e4d5..715fc72ec 100644 --- a/modules/webcpanel/pages/index.h +++ b/modules/webcpanel/pages/index.h @@ -15,12 +15,12 @@ class Index : public WebPanelPage static const int FLUSH_TIME = 60; Anope::hash_map<time_t> last_login_attempt; - time_t last_clear; + time_t last_clear = 0; public: - Index(const Anope::string &u) : WebPanelPage(u), last_clear(0) { } + Index(const Anope::string &u) : WebPanelPage(u) { } - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) override; }; } diff --git a/modules/webcpanel/pages/logout.h b/modules/webcpanel/pages/logout.h index 328a5411d..bbb84c2fa 100644 --- a/modules/webcpanel/pages/logout.h +++ b/modules/webcpanel/pages/logout.h @@ -13,7 +13,7 @@ class Logout : public WebPanelProtectedPage public: Logout(const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/memoserv/memos.h b/modules/webcpanel/pages/memoserv/memos.h index 404039ac6..b64ce4677 100644 --- a/modules/webcpanel/pages/memoserv/memos.h +++ b/modules/webcpanel/pages/memoserv/memos.h @@ -16,7 +16,7 @@ class Memos : public WebPanelProtectedPage public: Memos(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/nickserv/access.h b/modules/webcpanel/pages/nickserv/access.h index 116e9a1b5..2421e2d6d 100644 --- a/modules/webcpanel/pages/nickserv/access.h +++ b/modules/webcpanel/pages/nickserv/access.h @@ -16,7 +16,7 @@ class Access : public WebPanelProtectedPage public: Access(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/nickserv/alist.h b/modules/webcpanel/pages/nickserv/alist.h index ab6ae2988..e1767519e 100644 --- a/modules/webcpanel/pages/nickserv/alist.h +++ b/modules/webcpanel/pages/nickserv/alist.h @@ -16,7 +16,7 @@ class Alist : public WebPanelProtectedPage public: Alist(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/nickserv/cert.h b/modules/webcpanel/pages/nickserv/cert.h index 791ba47c5..f5da08987 100644 --- a/modules/webcpanel/pages/nickserv/cert.h +++ b/modules/webcpanel/pages/nickserv/cert.h @@ -16,7 +16,7 @@ class Cert : public WebPanelProtectedPage public: Cert(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/nickserv/info.h b/modules/webcpanel/pages/nickserv/info.h index df2873232..9d360d9ac 100644 --- a/modules/webcpanel/pages/nickserv/info.h +++ b/modules/webcpanel/pages/nickserv/info.h @@ -16,7 +16,7 @@ class Info : public WebPanelProtectedPage public: Info(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/operserv/akill.h b/modules/webcpanel/pages/operserv/akill.h index 7441eb4f1..6567e50f1 100644 --- a/modules/webcpanel/pages/operserv/akill.h +++ b/modules/webcpanel/pages/operserv/akill.h @@ -16,7 +16,7 @@ class Akill : public WebPanelProtectedPage public: Akill(const Anope::string &cat, const Anope::string &u); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, NickAlias *, TemplateFileServer::Replacements &) override; }; } diff --git a/modules/webcpanel/pages/register.h b/modules/webcpanel/pages/register.h index 2da8fa4d8..c8545ef48 100644 --- a/modules/webcpanel/pages/register.h +++ b/modules/webcpanel/pages/register.h @@ -15,7 +15,7 @@ class Register : public WebPanelPage public: Register(const Anope::string &u) : WebPanelPage(u) { } - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) override; }; } diff --git a/modules/webcpanel/static_fileserver.h b/modules/webcpanel/static_fileserver.h index 204fd622f..d75a889c5 100644 --- a/modules/webcpanel/static_fileserver.h +++ b/modules/webcpanel/static_fileserver.h @@ -14,5 +14,5 @@ class StaticFileServer : public HTTPPage public: StaticFileServer(const Anope::string &f_n, const Anope::string &u, const Anope::string &c_t); - bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override; + bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) override; }; diff --git a/modules/webcpanel/webcpanel.cpp b/modules/webcpanel/webcpanel.cpp index f95307f22..210d84d2f 100644 --- a/modules/webcpanel/webcpanel.cpp +++ b/modules/webcpanel/webcpanel.cpp @@ -260,7 +260,7 @@ namespace WebPanel MyComandReply(TemplateFileServer::Replacements &_r, const Anope::string &_k) : re(_r), k(_k) { } - void SendMessage(BotInfo *source, const Anope::string &msg) anope_override + void SendMessage(BotInfo *source, const Anope::string &msg) override { re[k] = msg; } @@ -300,7 +300,7 @@ namespace WebPanel MyComandReply(TemplateFileServer::Replacements &_r, const Anope::string &_k) : re(_r), k(_k) { } - void SendMessage(BotInfo *source, const Anope::string &msg) anope_override + void SendMessage(BotInfo *source, const Anope::string &msg) override { re[k] = msg; } diff --git a/modules/webcpanel/webcpanel.h b/modules/webcpanel/webcpanel.h index c73d48301..b40942f39 100644 --- a/modules/webcpanel/webcpanel.h +++ b/modules/webcpanel/webcpanel.h @@ -80,7 +80,7 @@ class WebPanelProtectedPage : public WebPanelPage { } - bool OnRequest(HTTPProvider *provider, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) anope_override anope_final + bool OnRequest(HTTPProvider *provider, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) override final { ServiceReference<Panel> panel("Panel", "webcpanel"); NickAlias *na; |