diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 72 | ||||
-rw-r--r-- | src/account.cpp | 2 | ||||
-rw-r--r-- | src/base.cpp | 4 | ||||
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/command.cpp | 4 | ||||
-rw-r--r-- | src/config.cpp | 31 | ||||
-rw-r--r-- | src/hashcomp.cpp | 2 | ||||
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/logger.cpp | 17 | ||||
-rw-r--r-- | src/mail.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/memos.cpp | 2 | ||||
-rw-r--r-- | src/messages.cpp | 40 | ||||
-rw-r--r-- | src/misc.cpp | 26 | ||||
-rw-r--r-- | src/modes.cpp | 14 | ||||
-rw-r--r-- | src/opertype.cpp | 2 | ||||
-rw-r--r-- | src/process.cpp | 1 | ||||
-rw-r--r-- | src/protocol.cpp | 15 | ||||
-rw-r--r-- | src/regchannel.cpp | 5 | ||||
-rw-r--r-- | src/serialize.cpp | 6 | ||||
-rw-r--r-- | src/servers.cpp | 2 | ||||
-rw-r--r-- | src/siphash.cpp | 10 | ||||
-rw-r--r-- | src/socket_transport.cpp | 16 | ||||
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 2 | ||||
-rw-r--r-- | src/sockets.cpp | 6 | ||||
-rw-r--r-- | src/threadengine.cpp | 8 | ||||
-rw-r--r-- | src/tools/CMakeLists.txt | 16 | ||||
-rw-r--r-- | src/tools/anoperc.in | 4 | ||||
-rw-r--r-- | src/tools/anopesmtp.cpp | 17 | ||||
-rw-r--r-- | src/users.cpp | 5 | ||||
-rw-r--r-- | src/version.sh | 4 | ||||
-rw-r--r-- | src/win32/anope_windows.h | 2 | ||||
-rw-r--r-- | src/xline.cpp | 2 |
33 files changed, 118 insertions, 229 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b390d164b..d957fb6df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,30 +2,26 @@ file(GLOB SRC_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") if(WIN32) - append_to_list(SRC_SRCS win32/dir/dir.cpp) - append_to_list(SRC_SRCS win32/socket.cpp) - append_to_list(SRC_SRCS win32/windows.cpp) - append_to_list(SRC_SRCS win32/dl/dl.cpp) - append_to_list(SRC_SRCS win32/pipe/pipe.cpp) - append_to_list(SRC_SRCS win32/pthread/pthread.cpp) - append_to_list(SRC_SRCS win32/sigaction/sigaction.cpp) -endif(WIN32) + list(APPEND SRC_SRCS win32/dir/dir.cpp) + list(APPEND SRC_SRCS win32/socket.cpp) + list(APPEND SRC_SRCS win32/windows.cpp) + list(APPEND SRC_SRCS win32/dl/dl.cpp) + list(APPEND SRC_SRCS win32/pipe/pipe.cpp) + list(APPEND SRC_SRCS win32/pthread/pthread.cpp) + list(APPEND SRC_SRCS win32/sigaction/sigaction.cpp) +endif() if(HAVE_EPOLL) - append_to_list(SRC_SRCS socketengines/socketengine_epoll.cpp) -else(HAVE_EPOLL) - if(HAVE_KQUEUE) - append_to_list(SRC_SRCS socketengines/socketengine_kqueue.cpp) - else(HAVE_KQUEUE) - if(HAVE_POLL) - append_to_list(SRC_SRCS socketengines/socketengine_poll.cpp) - else(HAVE_POLL) - append_to_list(SRC_SRCS socketengines/socketengine_select.cpp) - endif(HAVE_POLL) - endif(HAVE_KQUEUE) -endif(HAVE_EPOLL) + list(APPEND SRC_SRCS socketengines/socketengine_epoll.cpp) +elseif(HAVE_KQUEUE) + list(APPEND SRC_SRCS socketengines/socketengine_kqueue.cpp) +elseif(HAVE_POLL) + list(APPEND SRC_SRCS socketengines/socketengine_poll.cpp) +else() + list(APPEND SRC_SRCS socketengines/socketengine_select.cpp) +endif() -sort_list(SRC_SRCS) +list(SORT SRC_SRCS) # Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though) set_source_files_properties(${SRC_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") @@ -40,34 +36,34 @@ foreach(SRC ${SRC_SRCS}) calculate_depends(${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) -endforeach(SRC) + list(APPEND EXTRA_INCLUDES ${TEMP_INCLUDES}) + endif() +endforeach() # If there were extra include directories, remove the duplicates and add the directories to the include path if(EXTRA_INCLUDES) - remove_list_duplicates(EXTRA_INCLUDES) + list(REMOVE_DUPLICATES EXTRA_INCLUDES) include_directories(${EXTRA_INCLUDES}) -endif(EXTRA_INCLUDES) +endif() # Under Windows, we also include a resource file to the build if(WIN32) # Make sure that the resource file is seen as an RC file to be compiled with a resource compiler, not a C++ compiler set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc LANGUAGE RC) # Add the resource file to the list of sources - append_to_list(SRC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc) + list(APPEND SRC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc) # For MinGW, we have to change the compile flags if(MINGW) set(RC_CFLAGS "-DMINGW -Ocoff -I${Anope_SOURCE_DIR}/include") # If any sort of debugging is being enabled, add a _DEBUG define to the flags for the resource compiler if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") set(RC_CFLAGS "${RC_CFLAGS} -D_DEBUG") - endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") + endif() set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "${RC_CFLAGS}") # For anything else, assumingly Visual Studio at this point, use a different set of compile flags - else(MINGW) + else() set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"") - endif(MINGW) -endif(WIN32) + endif() +endif() # If compiling with Visual Studio, create a static library out of win32/win32_memory.cpp to be included with everything else, needed to override its override of new/delete operators if(MSVC) @@ -75,9 +71,9 @@ if(MSVC) add_library(win32_memory STATIC win32/win32_memory.cpp) set(WIN32_MEMORY win32_memory) set(EXTRA_LDFLAGS "/OPT:NOREF") # https://sourceware.org/bugzilla/show_bug.cgi?id=12633 -else(MSVC) +else() set(WIN32_MEMORY) -endif(MSVC) +endif() # Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module add_executable(${PROGRAM_NAME} ${SRC_SRCS}) @@ -86,18 +82,18 @@ set_target_properties(${PROGRAM_NAME} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS if(WIN32) target_link_libraries(${PROGRAM_NAME} wsock32 Ws2_32 ${LINK_LIBS} ${GETTEXT_LIBRARIES} ${WIN32_MEMORY}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") -else(WIN32) +else() target_link_libraries(${PROGRAM_NAME} ${LINK_LIBS} ${GETTEXT_LIBRARIES}) -endif(WIN32) +endif() # Building the Anope executable requires the version.h header to be generated add_dependencies(${PROGRAM_NAME} headers) # Also require the language files if we have gettext if(GETTEXT_FOUND) add_dependencies(${PROGRAM_NAME} language) -endif(GETTEXT_FOUND) +endif() # Get the filename of the Anope executable as it is in on this system -get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION) +set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>") get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME) # Add the Anope executable to the list of files for CPack to ignore add_to_cpack_ignored_files("${SERVICES_BINARY}$" TRUE) @@ -108,7 +104,7 @@ configure_file(${Anope_SOURCE_DIR}/include/sysconf.h.cmake ${Anope_BINARY_DIR}/i # Go into the following directories and run their CMakeLists.txt as well if(NOT DISABLE_TOOLS) add_subdirectory(tools) -endif(NOT DISABLE_TOOLS) +endif() # Set Anope to be installed to the bin directory install(TARGETS ${PROGRAM_NAME} diff --git a/src/account.cpp b/src/account.cpp index b8ac2cbda..e9768161b 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -18,7 +18,7 @@ std::set<IdentifyRequest *> IdentifyRequest::Requests; -IdentifyRequest::IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), account(acc), password(pass), dispatched(false), success(false) +IdentifyRequest::IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), account(acc), password(pass) { Requests.insert(this); } diff --git a/src/base.cpp b/src/base.cpp index b1b64c633..b52157859 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -13,10 +13,6 @@ std::map<Anope::string, std::map<Anope::string, Service *> > Service::Services; std::map<Anope::string, std::map<Anope::string, Anope::string> > Service::Aliases; -Base::Base() : references(NULL) -{ -} - Base::~Base() { if (this->references != NULL) diff --git a/src/channels.cpp b/src/channels.cpp index b2af559ae..77f23ea45 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -912,7 +912,7 @@ bool Channel::CheckKick(User *user) return false; if (mask.empty()) - mask = this->ci->GetIdealBan(user); + mask = this->ci ? this->ci->GetIdealBan(user) : "*!*@" + user->GetDisplayedHost(); if (reason.empty()) reason = Language::Translate(user->Account(), CHAN_NOT_ALLOWED_TO_JOIN); diff --git a/src/command.cpp b/src/command.cpp index 8e699255d..5216563d8 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -122,10 +122,6 @@ Command::Command(Module *o, const Anope::string &sname, size_t minparams, size_t allow_unregistered = require_user = false; } -Command::~Command() -{ -} - void Command::SetDesc(const Anope::string &d) { this->desc = d; diff --git a/src/config.cpp b/src/config.cpp index 06899b504..f323ae6c7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -19,7 +19,7 @@ using namespace Configuration; -File ServicesConf("services.conf", false); // Services configuration file name +File ServicesConf("anope.conf", false); // Services configuration file name Conf *Config = NULL; Block::Block(const Anope::string &n) : name(n), linenum(-1) @@ -33,47 +33,32 @@ const Anope::string &Block::GetName() const int Block::CountBlock(const Anope::string &bname) { - if (!this) - return 0; - return blocks.count(bname); } Block* Block::GetBlock(const Anope::string &bname, int num) { - if (!this) - return NULL; - std::pair<block_map::iterator, block_map::iterator> it = blocks.equal_range(bname); for (int i = 0; it.first != it.second; ++it.first, ++i) if (i == num) return &it.first->second; - return NULL; + return &(Config->EmptyBlock); } bool Block::Set(const Anope::string &tag, const Anope::string &value) { - if (!this) - return false; - items[tag] = value; return true; } -const Block::item_map* Block::GetItems() const +const Block::item_map& Block::GetItems() const { - if (this) - return &items; - else - return NULL; + return items; } template<> const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const { - if (!this) - return def; - Anope::map<Anope::string>::const_iterator it = items.find(tag); if (it != items.end()) return it->second; @@ -110,7 +95,7 @@ template<typename T> static void ValidateNotZero(const Anope::string &block, con throw ConfigException("The value for <" + block + ":" + name + "> cannot be zero!"); } -Conf::Conf() : Block("") +Conf::Conf() : Block(""), EmptyBlock("") { ReadTimeout = 0; UsePrivmsg = DefPrivmsg = false; @@ -596,7 +581,7 @@ void Conf::Post(Conf *old) Block *Conf::GetModule(Module *m) { if (!m) - return NULL; + return &(Config->EmptyBlock); return GetModule(m->name); } @@ -648,10 +633,10 @@ Block *Conf::GetCommand(CommandSource &source) return b; } - return NULL; + return &(Config->EmptyBlock); } -File::File(const Anope::string &n, bool e) : name(n), executable(e), fp(NULL) +File::File(const Anope::string &n, bool e) : name(n), executable(e) { } diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 9fcf766f3..9497078d7 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -91,7 +91,7 @@ bool ci::less::operator()(const Anope::string &s1, const Anope::string &s2) cons return s1.ci_str().compare(s2.ci_str()) < 0; } -sepstream::sepstream(const Anope::string &source, char separator, bool ae) : tokens(source), sep(separator), pos(0), allow_empty(ae) +sepstream::sepstream(const Anope::string &source, char separator, bool ae) : tokens(source), sep(separator), allow_empty(ae) { } diff --git a/src/init.cpp b/src/init.cpp index 4d9b8a327..42cba3f10 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -493,7 +493,7 @@ void Anope::Init(int ac, char **av) catch (const ConfigException &ex) { Log(LOG_TERMINAL) << ex.GetReason(); - Log(LOG_TERMINAL) << "*** Support resources: Read through the services.conf self-contained"; + Log(LOG_TERMINAL) << "*** Support resources: Read through the anope.conf self-contained"; Log(LOG_TERMINAL) << "*** documentation. Read the documentation files found in the 'docs'"; Log(LOG_TERMINAL) << "*** folder. Visit our portal located at https://www.anope.org/. Join"; Log(LOG_TERMINAL) << "*** our support channel on /server irc.anope.org channel #anope."; diff --git a/src/logger.cpp b/src/logger.cpp index b446e404f..c39219440 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -74,11 +74,11 @@ const Anope::string &LogFile::GetName() const return this->filename; } -Log::Log(LogType t, const Anope::string &cat, BotInfo *b) : bi(b), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), type(t), category(cat) +Log::Log(LogType t, const Anope::string &cat, BotInfo *b) : bi(b), type(t), category(cat) { } -Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.GetUser()), nc(src.nc), c(_c), source(&src), chan(NULL), ci(_ci), s(NULL), m(NULL), type(t) +Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.GetUser()), nc(src.nc), c(_c), source(&src), ci(_ci), type(t) { if (!c) throw CoreException("Invalid pointers passed to Log::Log"); @@ -87,35 +87,34 @@ Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.G throw CoreException("This constructor does not support this log type"); size_t sl = c->name.find('/'); - this->bi = NULL; if (sl != Anope::string::npos) this->bi = BotInfo::Find(c->name.substr(0, sl), true); this->category = c->name; } -Log::Log(User *_u, Channel *ch, const Anope::string &cat) : bi(NULL), u(_u), nc(NULL), c(NULL), source(NULL), chan(ch), ci(chan ? *chan->ci : NULL), s(NULL), m(NULL), type(LOG_CHANNEL), category(cat) +Log::Log(User *_u, Channel *ch, const Anope::string &cat) : u(_u), chan(ch), ci(chan ? *chan->ci : nullptr), type(LOG_CHANNEL), category(cat) { if (!chan) throw CoreException("Invalid pointers passed to Log::Log"); } -Log::Log(User *_u, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(_u), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), type(LOG_USER), category(cat) +Log::Log(User *_u, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(_u), type(LOG_USER), category(cat) { if (!u) throw CoreException("Invalid pointers passed to Log::Log"); } -Log::Log(Server *serv, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(serv), m(NULL), type(LOG_SERVER), category(cat) +Log::Log(Server *serv, const Anope::string &cat, BotInfo *_bi) : bi(_bi), s(serv), type(LOG_SERVER), category(cat) { if (!s) throw CoreException("Invalid pointer passed to Log::Log"); } -Log::Log(BotInfo *b, const Anope::string &cat) : bi(b), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), type(LOG_NORMAL), category(cat) +Log::Log(BotInfo *b, const Anope::string &cat) : bi(b), type(LOG_NORMAL), category(cat) { } -Log::Log(Module *mod, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(mod), type(LOG_MODULE), category(cat) +Log::Log(Module *mod, const Anope::string &cat, BotInfo *_bi) : bi(_bi), m(mod), type(LOG_MODULE), category(cat) { } @@ -227,7 +226,7 @@ Anope::string Log::BuildPrefix() const return buffer; } -LogInfo::LogInfo(int la, bool rio, bool ldebug) : bot(NULL), last_day(0), log_age(la), raw_io(rio), debug(ldebug) +LogInfo::LogInfo(int la, bool rio, bool ldebug) : log_age(la), raw_io(rio), debug(ldebug) { } diff --git a/src/mail.cpp b/src/mail.cpp index a1db0b232..2f765dac4 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -13,7 +13,7 @@ #include "mail.h" #include "config.h" -Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread(), sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath")), send_from(sf), mail_to(mailto), addr(a), subject(s), message(m), dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses")), success(false) +Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread(), sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath")), send_from(sf), mail_to(mailto), addr(a), subject(s), message(m), dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses")) { } diff --git a/src/main.cpp b/src/main.cpp index 960b280b6..f4db34054 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,7 @@ class UpdateTimer : public Timer public: UpdateTimer(time_t timeout) : Timer(timeout, Anope::CurTime, true) { } - void Tick(time_t) anope_override + void Tick(time_t) override { Anope::SaveDatabases(); } @@ -57,7 +57,7 @@ class ExpireTimer : public Timer public: ExpireTimer(time_t timeout) : Timer(timeout, Anope::CurTime, true) { } - void Tick(time_t) anope_override + void Tick(time_t) override { FOREACH_MOD(OnExpireTick, ()); } diff --git a/src/memos.cpp b/src/memos.cpp index 1e0570bd3..4c6ee8deb 100644 --- a/src/memos.cpp +++ b/src/memos.cpp @@ -76,7 +76,7 @@ Serializable* Memo::Unserialize(Serializable *obj, Serialize::Data &data) return m; } -MemoInfo::MemoInfo() : memomax(0), memos("Memo") +MemoInfo::MemoInfo() : memos("Memo") { } diff --git a/src/messages.cpp b/src/messages.cpp index dd91a3c6b..3a5c636c6 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -22,7 +22,7 @@ using namespace Message; -void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { const Anope::string &msg = !params.empty() ? params[0] : ""; @@ -33,7 +33,7 @@ void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) Log(source.GetUser(), "away") << "is no longer away"; } -void Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { if (params.size() == 1) { @@ -47,14 +47,14 @@ void Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) Servers::Capab.insert(params[i]); } -void Error::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Error::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Log(LOG_TERMINAL) << "ERROR: " << params[0]; Anope::QuitReason = "Received ERROR from uplink: " + params[0]; Anope::Quitting = true; } -void Invite::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Invite::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { User *targ = User::Find(params[0]); Channel *c = Channel::Find(params[1]); @@ -65,7 +65,7 @@ void Invite::Run(MessageSource &source, const std::vector<Anope::string> ¶ms FOREACH_MOD(OnInvite, (source.GetUser(), c, targ)); } -void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { User *user = source.GetUser(); const Anope::string &channels = params[0]; @@ -167,7 +167,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co } } -void Kick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Kick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { const Anope::string &channel = params[0]; const Anope::string &users = params[1]; @@ -184,7 +184,7 @@ void Kick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) c->KickInternal(source, user, reason); } -void Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { User *u = User::Find(params[0]); BotInfo *bi; @@ -211,7 +211,7 @@ void Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) u->KillInternal(source, params[1]); } -void Message::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Message::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Anope::string buf; for (unsigned i = 1; i < params.size(); ++i) @@ -234,7 +234,7 @@ void Message::Mode::Run(MessageSource &source, const std::vector<Anope::string> } /* XXX We should cache the file somewhere not open/read/close it on every request */ -void MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Server *s = Server::Find(params[0]); if (s != Me) @@ -257,7 +257,7 @@ void MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) IRCD->SendNumeric(422, source.GetSource(), ":- MOTD file not found! Please contact your IRC administrator."); } -void Notice::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Notice::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Anope::string message = params[1]; @@ -273,7 +273,7 @@ void Notice::Run(MessageSource &source, const std::vector<Anope::string> ¶ms } } -void Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { User *u = source.GetUser(); const Anope::string &reason = params.size() > 1 ? params[1] : ""; @@ -295,12 +295,12 @@ void Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) } } -void Ping::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Ping::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { IRCD->SendPong(params.size() > 1 ? params[1] : Me->GetSID(), params[0]); } -void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { const Anope::string &receiver = params[0]; Anope::string message = params[1]; @@ -373,7 +373,7 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m return; } -void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { const Anope::string &reason = params[0]; User *user = source.GetUser(); @@ -383,7 +383,7 @@ void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) user->Quit(reason); } -void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Server *s = Server::Find(params[0]); @@ -404,7 +404,7 @@ void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); } -void Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { User *u = source.GetUser(); @@ -455,7 +455,7 @@ void Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) return; } -void Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { time_t t; time(&t); @@ -466,7 +466,7 @@ void Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) return; } -void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Channel *c = Channel::Find(params[0]); if (c) @@ -475,13 +475,13 @@ void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) return; } -void Version::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Version::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); IRCD->SendNumeric(351, source.GetSource(), "Anope-%s %s :%s -(%s) -- %s", Anope::Version().c_str(), Me->GetName().c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "(none)", Anope::VersionBuildString().c_str()); } -void Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) { User *u = User::Find(params[0]); diff --git a/src/misc.cpp b/src/misc.cpp index 93ce13bd5..ff1b05b02 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -27,7 +27,7 @@ #include <netdb.h> #endif -NumberList::NumberList(const Anope::string &list, bool descending) : is_valid(true), desc(descending) +NumberList::NumberList(const Anope::string &list, bool descending) : desc(descending) { Anope::string error; commasepstream sep(list); @@ -90,10 +90,6 @@ NumberList::NumberList(const Anope::string &list, bool descending) : is_valid(tr } while (sep.GetToken(token)); } -NumberList::~NumberList() -{ -} - void NumberList::Process() { if (!is_valid) @@ -214,7 +210,7 @@ void ListFormatter::Process(std::vector<Anope::string> &buffer) } } -InfoFormatter::InfoFormatter(NickCore *acc) : nc(acc), longest(0) +InfoFormatter::InfoFormatter(NickCore *acc) : nc(acc) { } @@ -514,24 +510,6 @@ void Anope::Encrypt(const Anope::string &src, Anope::string &dest) static_cast<void>(MOD_RESULT); } -bool Anope::Decrypt(const Anope::string &src, Anope::string &dest) -{ - size_t pos = src.find(':'); - if (pos == Anope::string::npos) - { - Log() << "Error: Anope::Decrypt() called with invalid password string (" << src << ")"; - return false; - } - Anope::string hashm(src.begin(), src.begin() + pos); - - EventReturn MOD_RESULT; - FOREACH_RESULT(OnDecrypt, MOD_RESULT, (hashm, src, dest)); - if (MOD_RESULT == EVENT_ALLOW) - return true; - - return false; -} - Anope::string Anope::printf(const char *fmt, ...) { va_list args; diff --git a/src/modes.cpp b/src/modes.cpp index d6e3ff92f..0028ea37d 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -46,9 +46,7 @@ struct StackerInfo /* Modes to be deleted */ std::list<std::pair<Mode *, Anope::string> > DelModes; /* Bot this is sent from */ - BotInfo *bi; - - StackerInfo() : bi(NULL) { } + BotInfo *bi = nullptr; /** Add a mode to this object * @param mode The mode @@ -58,10 +56,6 @@ struct StackerInfo void AddMode(Mode *mode, bool set, const Anope::string ¶m); }; -ChannelStatus::ChannelStatus() -{ -} - ChannelStatus::ChannelStatus(const Anope::string &m) : modes(m) { } @@ -118,10 +112,6 @@ Mode::Mode(const Anope::string &mname, ModeClass mcl, char mch, ModeType mt) : n { } -Mode::~Mode() -{ -} - bool Mode::CanSet(User *u) const { return true; @@ -742,7 +732,7 @@ void ModeManager::StackerDel(Mode *m) } } -Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh), cidr_len(0), family(0) +Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh) { Anope::string n, u, h; diff --git a/src/opertype.cpp b/src/opertype.cpp index ee1e26096..006e780b7 100644 --- a/src/opertype.cpp +++ b/src/opertype.cpp @@ -13,7 +13,7 @@ std::vector<Oper *> Oper::opers; -Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o), require_oper(true) +Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o) { opers.push_back(this); } diff --git a/src/process.cpp b/src/process.cpp index dc6bd7994..ddb0a8750 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -133,7 +133,6 @@ Anope::string IRCDProto::Format(const Anope::string &source, const Anope::string MessageTokenizer::MessageTokenizer(const Anope::string &msg) : message(msg) - , position(0) { } diff --git a/src/protocol.cpp b/src/protocol.cpp index dbf44c03f..7027b64d0 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -25,7 +25,7 @@ IRCDProto::IRCDProto(Module *creator, const Anope::string &p) : Service(creator, { DefaultPseudoclientModes = "+io"; CanSVSNick = CanSVSJoin = CanSetVHost = CanSetVIdent = CanSNLine = CanSQLine = CanSQLineChannel - = CanSZLine = CanSVSHold = CanSVSO = CanCertFP = RequiresID = AmbiguousID = false; + = CanSZLine = CanSVSHold = CanCertFP = CanSendTags = RequiresID = AmbiguousID = false; MaxModes = 3; MaxLine = 512; @@ -450,7 +450,7 @@ Anope::string IRCDProto::NormalizeMask(const Anope::string &mask) return Entry("", mask).GetNUHMask(); } -MessageSource::MessageSource(const Anope::string &src) : source(src), u(NULL), s(NULL) +MessageSource::MessageSource(const Anope::string &src) : source(src) { /* no source for incoming message is our uplink */ if (src.empty()) @@ -461,11 +461,11 @@ MessageSource::MessageSource(const Anope::string &src) : source(src), u(NULL), s this->u = User::Find(src); } -MessageSource::MessageSource(User *_u) : source(_u ? _u->nick : ""), u(_u), s(NULL) +MessageSource::MessageSource(User *_u) : source(_u ? _u->nick : ""), u(_u) { } -MessageSource::MessageSource(Server *_s) : source(_s ? _s->GetName() : ""), u(NULL), s(_s) +MessageSource::MessageSource(Server *_s) : source(_s ? _s->GetName() : ""), s(_s) { } @@ -507,10 +507,3 @@ unsigned IRCDMessage::GetParamCount() const { return this->param_count; } - -void IRCDMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) -{ - // Most IRCds don't support message tags yet so use the tagless variant. - Run(source, params); -} - diff --git a/src/regchannel.cpp b/src/regchannel.cpp index bd6fcbbf0..d4c52bee0 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -355,7 +355,7 @@ NickCore *ChannelInfo::GetSuccessor() const BotInfo *ChannelInfo::WhoSends() const { - if (this && this->bi) + if (this->bi) return this->bi; BotInfo *ChanServ = Config->GetClient("ChanServ"); @@ -629,8 +629,7 @@ void ChannelInfo::ClearLevels() Anope::string ChannelInfo::GetIdealBan(User *u) const { - int bt = this ? this->bantype : -1; - switch (bt) + switch (this->bantype) { case 0: return "*!" + u->GetVIdent() + "@" + u->GetDisplayedHost(); diff --git a/src/serialize.cpp b/src/serialize.cpp index 86cc7e7b5..4c3e6f0f8 100644 --- a/src/serialize.cpp +++ b/src/serialize.cpp @@ -41,7 +41,7 @@ void Serialize::CheckTypes() } } -Serializable::Serializable(const Anope::string &serialize_type) : last_commit(0), last_commit_time(0), id(0), redis_ignore(0) +Serializable::Serializable(const Anope::string &serialize_type) { if (SerializableItems == NULL) SerializableItems = new std::list<Serializable *>(); @@ -55,7 +55,7 @@ Serializable::Serializable(const Anope::string &serialize_type) : last_commit(0) FOREACH_MOD(OnSerializableConstruct, (this)); } -Serializable::Serializable(const Serializable &other) : last_commit(0), last_commit_time(0), id(0), redis_ignore(0) +Serializable::Serializable(const Serializable &other) { SerializableItems->push_back(this); this->s_iter = SerializableItems->end(); @@ -112,7 +112,7 @@ const std::list<Serializable *> &Serializable::GetItems() return *SerializableItems; } -Type::Type(const Anope::string &n, unserialize_func f, Module *o) : name(n), unserialize(f), owner(o), timestamp(0) +Type::Type(const Anope::string &n, unserialize_func f, Module *o) : name(n), unserialize(f), owner(o) { TypeOrder.push_back(this->name); Types[this->name] = this; diff --git a/src/servers.cpp b/src/servers.cpp index 8ee5ed70b..5892b4f24 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -27,7 +27,7 @@ Anope::map<Server *> Servers::ByID; std::set<Anope::string> Servers::Capab; -Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Anope::string &desc, const Anope::string &ssid, bool jupe) : name(sname), hops(shops), description(desc), sid(ssid), uplink(up), users(0) +Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Anope::string &desc, const Anope::string &ssid, bool jupe) : name(sname), hops(shops), description(desc), sid(ssid), uplink(up) { syncing = true; juped = jupe; diff --git a/src/siphash.cpp b/src/siphash.cpp index 612b6eec7..9460f085b 100644 --- a/src/siphash.cpp +++ b/src/siphash.cpp @@ -120,12 +120,12 @@ uint64_t Anope::SipHash24(const void *src, unsigned long src_sz, const char key[ uint64_t t = 0; uint8_t *pt = (uint8_t *)&t; uint8_t *m = (uint8_t *)in; switch (src_sz) { - case 7: pt[6] = m[6]; - case 6: pt[5] = m[5]; - case 5: pt[4] = m[4]; + case 7: pt[6] = m[6]; [[fallthrough]]; + case 6: pt[5] = m[5]; [[fallthrough]]; + case 5: pt[4] = m[4]; [[fallthrough]]; case 4: *((uint32_t*)&pt[0]) = *((uint32_t*)&m[0]); break; - case 3: pt[2] = m[2]; - case 2: pt[1] = m[1]; + case 3: pt[2] = m[2]; [[fallthrough]]; + case 2: pt[1] = m[1]; [[fallthrough]]; case 1: pt[0] = m[0]; } b |= _le64toh(t); diff --git a/src/socket_transport.cpp b/src/socket_transport.cpp index 5abb308d2..94c69facf 100644 --- a/src/socket_transport.cpp +++ b/src/socket_transport.cpp @@ -13,14 +13,6 @@ #include "sockets.h" #include "socketengine.h" -BufferedSocket::BufferedSocket() -{ -} - -BufferedSocket::~BufferedSocket() -{ -} - bool BufferedSocket::ProcessRead() { char tbuffer[NET_BUFSIZE]; @@ -115,14 +107,6 @@ BinarySocket::DataBlock::~DataBlock() delete [] this->orig; } -BinarySocket::BinarySocket() -{ -} - -BinarySocket::~BinarySocket() -{ -} - bool BinarySocket::ProcessRead() { char tbuffer[NET_BUFSIZE]; diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 169c4b98a..851fea4e4 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -53,7 +53,7 @@ void SocketEngine::Change(Socket *s, bool set, SocketFlag flag) memset(&ev, 0, sizeof(ev)); - ev.events = (s->flags[SF_READABLE] ? EPOLLIN : 0) | (s->flags[SF_WRITABLE] ? EPOLLOUT : 0); + ev.events = (s->flags[SF_READABLE] ? EPOLLIN : 0u) | (s->flags[SF_WRITABLE] ? EPOLLOUT : 0u); ev.data.fd = s->GetFD(); int mod; diff --git a/src/sockets.cpp b/src/sockets.cpp index e2191dbd8..b05927691 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -306,7 +306,7 @@ bool cidr::match(const sockaddrs &other) byte = len % 8; if (byte) { - uint8_t m = ~0 << (8 - byte); + uint8_t m = ~0u << (8 - byte); return (*ip & m) == (*their_ip & m); } @@ -567,10 +567,6 @@ ListenSocket::ListenSocket(const Anope::string &bindip, int port, bool i) throw SocketException("Unable to listen: " + Anope::LastError()); } -ListenSocket::~ListenSocket() -{ -} - bool ListenSocket::ProcessRead() { try diff --git a/src/threadengine.cpp b/src/threadengine.cpp index e9ff8148d..fc9ee742e 100644 --- a/src/threadengine.cpp +++ b/src/threadengine.cpp @@ -44,14 +44,6 @@ static void *entry_point(void *parameter) return NULL; } -Thread::Thread() : exit(false) -{ -} - -Thread::~Thread() -{ -} - void Thread::Join() { this->SetExitState(); diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 3e00b981d..343778377 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -1,6 +1,6 @@ # Find all the *.cpp files within the current source directory, and sort the list file(GLOB TOOLS_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") -sort_list(TOOLS_SRCS) +list(SORT TOOLS_SRCS) # Set all the files to use C++ as well as set their compile flags set_source_files_properties(${TOOLS_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") @@ -20,20 +20,20 @@ foreach(SRC ${TOOLS_SRCS}) # Only for Windows, set anopesmtp to require the wsock32 library if(WIN32 AND ${EXE} STREQUAL anopesmtp) target_link_libraries(${EXE} wsock32) - endif(WIN32 AND ${EXE} STREQUAL anopesmtp) + endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp) target_link_libraries(${EXE} socket nsl) - endif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp) + endif() # Set the executable to be installed to the bin directory under the main directory install(TARGETS ${EXE} DESTINATION ${BIN_DIR} ) # Add the executable to the list of files for CPack to ignore - get_target_property(EXE_BINARY ${EXE} LOCATION) + set(EXE_BINARY "$<TARGET_FILE:${EXE}>") get_filename_component(EXE_BINARY ${EXE_BINARY} NAME) add_to_cpack_ignored_files("${EXE_BINARY}$" TRUE) - endif(NOT SKIP) -endforeach(SRC) + endif() +endforeach() # If not on Windows, generate anoperc and install it along with mydbgen if(NOT WIN32) @@ -44,9 +44,9 @@ if(NOT WIN32) install (PROGRAMS geoipupdate.sh DESTINATION ${BIN_DIR} ) -endif(NOT WIN32) +endif() # On non-Windows platforms, if RUNGROUP is set, change the permissions of the tools directory if(NOT WIN32 AND RUNGROUP) install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin\")") -endif(NOT WIN32 AND RUNGROUP) +endif() diff --git a/src/tools/anoperc.in b/src/tools/anoperc.in index ea14fe607..45e097cd4 100644 --- a/src/tools/anoperc.in +++ b/src/tools/anoperc.in @@ -14,8 +14,8 @@ -ANOPEPID="@INSTDIR@/data/services.pid" -ANOPROG="@INSTDIR@/bin/services" +ANOPEPID="@INSTDIR@/data/anope.pid" +ANOPROG="@INSTDIR@/bin/anope" LOG="@INSTDIR@/logs/" ARCVERSION="2" diff --git a/src/tools/anopesmtp.cpp b/src/tools/anopesmtp.cpp index d86f9c43f..f97af49ad 100644 --- a/src/tools/anopesmtp.cpp +++ b/src/tools/anopesmtp.cpp @@ -12,14 +12,6 @@ * *nix port by Trystan Scott Lee <trystan@nomadirc.net> */ -#include "sysconf.h" - -/* Some Linux boxes (or maybe glibc includes) require this for the - * prototype of strsignal(). */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - #include <string> #include <vector> #include <cstdarg> @@ -46,15 +38,6 @@ #include <sys/types.h> -#ifdef _AIX -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, size_t); -# if 0 /* These break on some AIX boxes (4.3.1 reported). */ -extern int socket(int, int, int); -extern int connect(int, struct sockaddr *, int); -# endif -#endif /* _AIX */ - /* Some SUN fixs */ #ifdef __sun /* Solaris specific code, types that do not exist in Solaris' diff --git a/src/users.cpp b/src/users.cpp index 1f0af4f63..c5fbfdcdb 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -448,6 +448,11 @@ bool User::IsRecognized(bool check_secure) const return on_access; } +bool User::IsSecurelyConnected() const +{ + return HasMode("SSL") || HasExt("ssl"); +} + bool User::IsServicesOper() { if (!this->nc || !this->nc->IsServicesOper()) diff --git a/src/version.sh b/src/version.sh index 313ef2369..c79f66a2f 100644 --- a/src/version.sh +++ b/src/version.sh @@ -1,6 +1,6 @@ #!/bin/sh VERSION_MAJOR=2 -VERSION_MINOR=0 -VERSION_PATCH=11 +VERSION_MINOR=1 +VERSION_PATCH=0 VERSION_EXTRA="-git" diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h index 2b6a231d0..8ee2973cb 100644 --- a/src/win32/anope_windows.h +++ b/src/win32/anope_windows.h @@ -29,8 +29,6 @@ # define DllExport __declspec(dllimport) #endif -#define MARK_DEPRECATED - #if GETTEXT_FOUND /* Undefine some functions libintl defines */ # undef snprintf diff --git a/src/xline.cpp b/src/xline.cpp index b1ca796ce..50c84e8e2 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -86,7 +86,7 @@ void XLine::Init() } } -XLine::XLine(const Anope::string &ma, const Anope::string &r, const Anope::string &uid) : Serializable("XLine"), mask(ma), by(Me->GetName()), created(0), expires(0), reason(r), id(uid) +XLine::XLine(const Anope::string &ma, const Anope::string &r, const Anope::string &uid) : Serializable("XLine"), mask(ma), by(Me->GetName()), reason(r), id(uid) { regex = NULL; manager = NULL; |