diff options
Diffstat (limited to 'include')
51 files changed, 219 insertions, 1106 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 73e57f59e..448e7fdac 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -3,7 +3,7 @@ set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "$ # Generate version-bin executable to modify version.h, setting it's linker flags as well add_executable(version-bin version.cpp) set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}") -get_target_property(version_BINARY version-bin LOCATION) +set(version_BINARY "$<TARGET_FILE:version-bin>") # Modify version.h from the above executable, with dependencies to version.cpp # and all of the source files in the main build add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_build @@ -16,49 +16,7 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE) if(NOT WIN32) add_to_cpack_ignored_files("version.h$" TRUE) add_to_cpack_ignored_files("build.h$" TRUE) -endif(NOT WIN32) - -set(PCH_SOURCES_GCH "") -if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX) - string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}") - - file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h") - sort_list(PCH_SOURCES) - - foreach(PCH_SOURCE ${PCH_SOURCES}) - find_includes(${PCH_SOURCE} INCLUDES) - set(INCLUDES_LIST) - append_to_list(INCLUDES_LIST ${PCH_SOURCE}) - foreach(INCLUDE ${INCLUDES}) - # Extract the filename from the #include line - extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE) - if(QUOTE_TYPE STREQUAL "quotes") - find_in_list(PCH_SOURCES "${FILENAME}" FOUND) - if(NOT FOUND EQUAL -1) - append_to_list(INCLUDES_LIST ${FILENAME}) - endif(NOT FOUND EQUAL -1) - endif(QUOTE_TYPE STREQUAL "quotes") - endforeach(INCLUDE) - - set(PCH_EXTRAFLAGS "") - if(DEBUG_BUILD) - set(PCH_EXTRAFLAGS "-g") - endif(DEBUG_BUILD) - if(PCH_SOURCE STREQUAL "module.h") - set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC) - endif(PCH_SOURCE STREQUAL "module.h") - if(GETTEXT_INCLUDE) - set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}") - endif(GETTEXT_INCLUDE) - - set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch") - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch - COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS} - ${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch - DEPENDS ${INCLUDES_LIST} VERBATIM - ) - endforeach(PCH_SOURCE ${PCH_SOURCES}) -endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX) +endif() # Add a custom target to the above file -add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH}) +add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build) diff --git a/include/access.h b/include/access.h index fccf8220b..32b59e655 100644 --- a/include/access.h +++ b/include/access.h @@ -95,7 +95,7 @@ class CoreExport ChanAccess : public Serializable const Anope::string &Mask() const; NickCore *GetAccount() const; - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static const unsigned int MAX_DEPTH = 4; diff --git a/include/account.h b/include/account.h index 1a6809d90..92b892f65 100644 --- a/include/account.h +++ b/include/account.h @@ -54,7 +54,7 @@ class CoreExport NickAlias : public Serializable, public Extensible NickAlias(const Anope::string &nickname, NickCore *nickcore); ~NickAlias(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Set a vhost for the user @@ -149,7 +149,7 @@ class CoreExport NickCore : public Serializable, public Extensible NickCore(const Anope::string &nickdisplay, uint64_t nickid = 0); ~NickCore(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Changes the display for this account @@ -240,8 +240,8 @@ class CoreExport IdentifyRequest Anope::string password; std::set<Module *> holds; - bool dispatched; - bool success; + bool dispatched = false; + bool success = false; static std::set<IdentifyRequest *> Requests; diff --git a/include/anope.h b/include/anope.h index ccffa8c6c..129028fda 100644 --- a/include/anope.h +++ b/include/anope.h @@ -54,9 +54,7 @@ namespace Anope string(const ci::string &_str) : _string(_str.c_str()) { } string(const string &_str, size_type pos, size_type n = npos) : _string(_str._string, pos, n) { } template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { } -#if __cplusplus >= 201103L string(const string &) = default; -#endif /** * Assignment operators, so any type of string can be assigned to this class. @@ -369,7 +367,7 @@ namespace Anope */ extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug; - /** The root of the services installation. Usually ~/services + /** The root of the services installation. Usually ~/anope */ extern CoreExport Anope::string ServicesDir; @@ -465,14 +463,6 @@ namespace Anope */ extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest); - /** Decrypts what is in 'src' to 'dest'. - * @param src The source string to decrypt - * @param dest The destination where the decrypted string is placed - * @return true if decryption was successful. This is usually not the case - * as most encryption methods we use are one way. - */ - extern CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest); - /** Hashes a buffer with SipHash-2-4 * @param src The start of the buffer to hash * @param src_sz The total number of bytes in the buffer @@ -570,7 +560,7 @@ class CoreExport sepstream char sep; /** Current string position */ - size_t pos; + size_t pos = 0; /** If set then GetToken() can return an empty string */ bool allow_empty; @@ -676,7 +666,7 @@ class CoreException : public std::exception * Actually no, it does nothing. Never mind. * @throws Nothing! */ - virtual ~CoreException() throw() { } + virtual ~CoreException() throw() = default; /** Returns the reason for the exception. * The module should probably put something informative here as the user will see this upon failure. */ @@ -705,7 +695,7 @@ class ModuleException : public CoreException * Actually no, it does nothing. Never mind. * @throws Nothing! */ - virtual ~ModuleException() throw() { } + virtual ~ModuleException() throw() = default; }; class ConvertException : public CoreException @@ -713,7 +703,7 @@ class ConvertException : public CoreException public: ConvertException(const Anope::string &reason = "") : CoreException(reason) { } - virtual ~ConvertException() throw() { } + virtual ~ConvertException() throw() = default; }; /** Convert something to a string diff --git a/include/base.h b/include/base.h index 09ec83edf..3f0180247 100644 --- a/include/base.h +++ b/include/base.h @@ -16,9 +16,8 @@ class CoreExport Base { /* References to this base class */ - std::set<ReferenceBase *> *references; + std::set<ReferenceBase *> *references = nullptr; public: - Base(); virtual ~Base(); /** Adds a reference to this object. Eg, when a Reference @@ -33,11 +32,11 @@ class CoreExport Base class ReferenceBase { protected: - bool invalid; + bool invalid = false; public: - ReferenceBase() : invalid(false) { } + ReferenceBase() = default; ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { } - virtual ~ReferenceBase() { } + virtual ~ReferenceBase() = default; inline void Invalidate() { this->invalid = true; } }; @@ -48,11 +47,9 @@ template<typename T> class Reference : public ReferenceBase { protected: - T *ref; + T *ref = nullptr; public: - Reference() : ref(NULL) - { - } + Reference() = default; Reference(T *obj) : ref(obj) { diff --git a/include/commands.h b/include/commands.h index 64335720f..c5b718dea 100644 --- a/include/commands.h +++ b/include/commands.h @@ -26,8 +26,6 @@ struct CommandInfo { typedef Anope::map<CommandInfo> map; - CommandInfo() : hide(false), prepend_channel(false) { } - /* Service name of the command */ Anope::string name; /* Permission required to execute the command */ @@ -35,9 +33,9 @@ struct CommandInfo /* Group this command is in */ Anope::string group; /* whether or not to hide this command in help output */ - bool hide; + bool hide = false; /* Only used with fantasy */ - bool prepend_channel; + bool prepend_channel = false; }; /* Where the replies from commands go to. User inherits from this and is the normal @@ -45,7 +43,7 @@ struct CommandInfo */ struct CoreExport CommandReply { - virtual ~CommandReply() { } + virtual ~CommandReply() = default; virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0; }; @@ -120,7 +118,7 @@ class CoreExport Command : public Service Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0); public: - virtual ~Command(); + virtual ~Command() = default; protected: void SetDesc(const Anope::string &d); diff --git a/include/config.h b/include/config.h index d8ef07695..d2989cab4 100644 --- a/include/config.h +++ b/include/config.h @@ -60,7 +60,7 @@ namespace Configuration } bool Set(const Anope::string &tag, const Anope::string &value); - const item_map* GetItems() const; + const item_map &GetItems() const; }; template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const; @@ -73,7 +73,7 @@ namespace Configuration { Anope::string name; bool executable; - FILE *fp; + FILE *fp = nullptr; public: File(const Anope::string &, bool); ~File(); @@ -129,6 +129,9 @@ namespace Configuration std::map<Anope::string, Block *> modules; Anope::map<Anope::string> bots; + /* Represents a missing tag. */ + Block EmptyBlock; + Conf(); ~Conf(); @@ -175,7 +178,7 @@ class ConfigException : public CoreException * Actually no, it does nothing. Never mind. * @throws Nothing! */ - virtual ~ConfigException() throw() { } + virtual ~ConfigException() throw() = default; }; extern Configuration::File ServicesConf; diff --git a/include/extensible.h b/include/extensible.h index 9b8bbd853..bb7f38448 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -93,7 +93,7 @@ class BaseExtensibleItem : public ExtensibleBase return t; } - void Unset(Extensible *obj) anope_override + void Unset(Extensible *obj) override { T *value = Get(obj); items.erase(obj); @@ -128,7 +128,7 @@ template<typename T> class ExtensibleItem : public BaseExtensibleItem<T> { protected: - T* Create(Extensible *obj) anope_override + T* Create(Extensible *obj) override { return new T(obj); } @@ -140,7 +140,7 @@ template<typename T> class PrimitiveExtensibleItem : public BaseExtensibleItem<T> { protected: - T* Create(Extensible *obj) anope_override + T* Create(Extensible *obj) override { return new T(); } @@ -152,7 +152,7 @@ template<> class PrimitiveExtensibleItem<bool> : public BaseExtensibleItem<bool> { protected: - bool* Create(Extensible *) anope_override + bool* Create(Extensible *) override { return NULL; } @@ -166,13 +166,13 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem<T> public: SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<T>(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 { T* t = this->Get(e); data[this->name] << *t; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { T t; if (data[this->name] >> t) @@ -188,12 +188,12 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool> public: SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<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 { data[this->name] << true; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { bool b = false; data[this->name] >> b; diff --git a/include/hashcomp.h b/include/hashcomp.h index 983115620..a50ab334d 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -38,7 +38,7 @@ namespace Anope class ascii_ctype : public std::ctype<char_type> { public: - char_type do_toupper(char_type c) const anope_override + char_type do_toupper(char_type c) const override { if (c >= 'a' && c <= 'z') return c - 32; @@ -46,7 +46,7 @@ namespace Anope return c; } - char_type do_tolower(char_type c) const anope_override + char_type do_tolower(char_type c) const override { if (c >= 'A' && c <= 'Z') return c + 32; @@ -60,7 +60,7 @@ namespace Anope class rfc1459_ctype : public ascii_ctype<char_type> { public: - char_type do_toupper(char_type c) const anope_override + char_type do_toupper(char_type c) const override { if (c == '{' || c == '}' || c == '|') return c - 32; @@ -68,7 +68,7 @@ namespace Anope return ascii_ctype<char_type>::do_toupper(c); } - char_type do_tolower(char_type c) const anope_override + char_type do_tolower(char_type c) const override { if (c == '[' || c == ']' || c == '\\') return c + 32; diff --git a/include/language.h b/include/language.h index 49617a4c5..b6940ee99 100644 --- a/include/language.h +++ b/include/language.h @@ -11,7 +11,7 @@ namespace Language { - /* Languages we support as configured in services.conf. They are + /* Languages we support as configured in anope.conf. They are * added to this list if we detect a language exists in the correct * location for each language. */ @@ -70,10 +70,11 @@ namespace Language #define READ_ONLY_MODE _("Services are in read-only mode!") #define PASSWORD_INCORRECT _("Password incorrect.") #define ACCESS_DENIED _("Access denied.") -#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should be at least\n" \ - "five characters long, should not be something easily guessed\n" \ - "(e.g. your real name or your nick), and cannot contain the space or tab characters.") -#define PASSWORD_TOO_LONG _("Your password is too long. It must not exceed %u characters.") +#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should not be\n" \ + "something that could be easily guessed (e.g. your real name or your nick) and\n" \ + "cannot contain the space or tab characters.\n") +#define PASSWORD_TOO_SHORT _("Your password is too short. It must must be longer than %u characters.") +#define PASSWORD_TOO_LONG _("Your password is too long. It must be shorter than %u characters.") #define NICK_NOT_REGISTERED _("Your nick isn't registered.") #define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.") #define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.") diff --git a/include/lists.h b/include/lists.h index 7a3f744c6..cbde1494f 100644 --- a/include/lists.h +++ b/include/lists.h @@ -25,7 +25,7 @@ class CoreExport NumberList { private: - bool is_valid; + bool is_valid = true; std::set<unsigned> numbers; @@ -39,7 +39,7 @@ class CoreExport NumberList /** Destructor, does nothing */ - virtual ~NumberList(); + virtual ~NumberList() = default; /** Should be called after the constructors are done running. This calls the callbacks. */ @@ -83,7 +83,7 @@ class CoreExport InfoFormatter { NickCore *nc; std::vector<std::pair<Anope::string, Anope::string> > replies; - unsigned longest; + unsigned longest = 0; public: InfoFormatter(NickCore *nc); void Process(std::vector<Anope::string> &); diff --git a/include/logger.h b/include/logger.h index 51868d917..98e1bc156 100644 --- a/include/logger.h +++ b/include/logger.h @@ -53,23 +53,23 @@ class CoreExport Log { public: /* Bot that should log this message */ - BotInfo *bi; + BotInfo *bi = nullptr; /* For commands, the user executing the command, but might not always exist */ - User *u; + User *u = nullptr; /* For commands, the account executing the command, but will not always exist */ - NickCore *nc; + NickCore *nc = nullptr; /* For commands, the command being executed */ - Command *c; + Command *c = nullptr; /* For commands, the command source */ - CommandSource *source; + CommandSource *source = nullptr; /* Used for LOG_CHANNEL */ - Channel *chan; + Channel *chan = nullptr; /* For commands, the channel the command was executed on, will not always exist */ - const ChannelInfo *ci; + const ChannelInfo *ci = nullptr; /* For LOG_SERVER */ - Server *s; + Server *s = nullptr; /* For LOG_MODULE */ - Module *m; + Module *m = nullptr; LogType type; Anope::string category; @@ -113,10 +113,10 @@ class CoreExport Log class CoreExport LogInfo { public: - BotInfo *bot; + BotInfo *bot = nullptr; std::vector<Anope::string> targets; std::vector<LogFile *> logfiles; - int last_day; + int last_day = 0; std::vector<Anope::string> sources; int log_age; std::vector<Anope::string> admin; diff --git a/include/mail.h b/include/mail.h index e46848ded..65873feba 100644 --- a/include/mail.h +++ b/include/mail.h @@ -34,7 +34,7 @@ namespace Mail Anope::string message; bool dont_quote_addresses; - bool success; + bool success = false; public: /** Construct this message. Once constructed call Thread::Start to launch the mail sending. * @param sf Config->SendFrom @@ -48,7 +48,7 @@ namespace Mail ~Message(); /* Called from within the thread to actually send the mail */ - void Run() anope_override; + void Run() override; }; } // namespace Mail diff --git a/include/memo.h b/include/memo.h index 277f70da6..a41730b53 100644 --- a/include/memo.h +++ b/include/memo.h @@ -24,7 +24,7 @@ class CoreExport Memo : public Serializable Memo(); ~Memo(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); Anope::string owner; @@ -39,7 +39,7 @@ class CoreExport Memo : public Serializable */ struct CoreExport MemoInfo { - int16_t memomax; + int16_t memomax = 0; Serialize::Checker<std::vector<Memo *> > memos; std::vector<Anope::string> ignores; diff --git a/include/messages.h b/include/messages.h index 0f27e3006..3e8be52fd 100644 --- a/include/messages.h +++ b/include/messages.h @@ -23,35 +23,35 @@ namespace Message { Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { 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; }; struct CoreExport Capab : IRCDMessage { Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 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; }; struct CoreExport Error : IRCDMessage { Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 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; }; struct CoreExport Invite : IRCDMessage { Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 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; }; struct CoreExport Join : IRCDMessage { Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { 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; typedef std::pair<ChannelStatus, User *> SJoinUser; @@ -69,105 +69,105 @@ namespace Message { Kick(Module *creator, const Anope::string &mname = "KICK") : 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; }; struct CoreExport Kill : IRCDMessage { Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 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; }; struct CoreExport Mode : IRCDMessage { Mode(Module *creator, const Anope::string &mname = "MODE") : 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; }; struct CoreExport MOTD : IRCDMessage { MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 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; }; struct CoreExport Notice : IRCDMessage { Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 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; }; struct CoreExport Part : IRCDMessage { Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { 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; }; struct CoreExport Ping : IRCDMessage { Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 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; }; struct CoreExport Privmsg : IRCDMessage { Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 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; }; struct CoreExport Quit : IRCDMessage { Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 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; }; struct CoreExport SQuit : IRCDMessage { SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 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; }; struct CoreExport Stats : IRCDMessage { Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { 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; }; struct CoreExport Time : IRCDMessage { Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { 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; }; struct CoreExport Topic : IRCDMessage { Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 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; }; struct CoreExport Version : IRCDMessage { Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { 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; }; struct CoreExport Whois : IRCDMessage { Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 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; }; } // namespace Message diff --git a/include/modes.h b/include/modes.h index 04fc97791..af66a877c 100644 --- a/include/modes.h +++ b/include/modes.h @@ -55,7 +55,7 @@ class CoreExport Mode : public Base * @param type The mode type */ Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type); - virtual ~Mode(); + virtual ~Mode() = default; /** Can a user set this mode, used for mlock * @param u The user @@ -105,7 +105,7 @@ class CoreExport ChannelMode : public Mode */ ChannelMode(const Anope::string &name, char mc); - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; virtual void Check() { } @@ -217,11 +217,11 @@ class CoreExport ChannelModeVirtual : public T ~ChannelModeVirtual(); - void Check() anope_override; + void Check() override; - ChannelMode *Wrap(Anope::string ¶m) anope_override; + ChannelMode *Wrap(Anope::string ¶m) override; - ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override = 0; + ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) override = 0; }; /* The status a user has on a channel (+v, +h, +o) etc */ @@ -229,7 +229,7 @@ class CoreExport ChannelStatus { Anope::string modes; public: - ChannelStatus(); + ChannelStatus() = default; ChannelStatus(const Anope::string &modes); void AddMode(char c); void DelMode(char c); @@ -245,7 +245,7 @@ class CoreExport UserModeOperOnly : public UserMode public: UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { } - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; class CoreExport UserModeNoone : public UserMode @@ -253,7 +253,7 @@ class CoreExport UserModeNoone : public UserMode public: UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { } - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** Channel mode +k (key) @@ -263,7 +263,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam public: ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { } - bool IsValid(Anope::string &value) const anope_override; + bool IsValid(Anope::string &value) const override; }; /** This class is used for oper only channel modes @@ -274,7 +274,7 @@ class CoreExport ChannelModeOperOnly : public ChannelMode ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } /* Opers only */ - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** This class is used for channel modes only servers may set @@ -284,7 +284,7 @@ class CoreExport ChannelModeNoone : public ChannelMode public: ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** This is the mode manager @@ -394,8 +394,8 @@ class CoreExport Entry Anope::string name; Anope::string mask; public: - unsigned short cidr_len; - int family; + unsigned short cidr_len = 0; + int family = 0; Anope::string nick, user, host, real; /** Constructor diff --git a/include/modules.h b/include/modules.h index 034a98930..c3379bc6d 100644 --- a/include/modules.h +++ b/include/modules.h @@ -405,7 +405,6 @@ class CoreExport Module : public Extensible * see src/encrypt.c for detailed informations */ virtual EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); } - virtual EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); } /** Called on fantasy command * @param source The source of the command diff --git a/include/modules/bs_badwords.h b/include/modules/bs_badwords.h index e2361616e..7bb7f1130 100644 --- a/include/modules/bs_badwords.h +++ b/include/modules/bs_badwords.h @@ -30,14 +30,14 @@ struct BadWord Anope::string word; BadWordType type; - virtual ~BadWord() { } + virtual ~BadWord() = default; protected: - BadWord() { } + BadWord() = default; }; struct BadWords { - virtual ~BadWords() { } + virtual ~BadWords() = default; /** Add a badword to the badword list * @param word The badword diff --git a/include/modules/bs_kick.h b/include/modules/bs_kick.h index 1e292b25f..69c5c43ad 100644 --- a/include/modules/bs_kick.h +++ b/include/modules/bs_kick.h @@ -36,9 +36,9 @@ struct KickerData bool dontkickops, dontkickvoices; protected: - KickerData() { } + KickerData() = default; public: - virtual ~KickerData() { } + virtual ~KickerData() = default; virtual void Check(ChannelInfo *ci) = 0; }; diff --git a/include/modules/cs_entrymsg.h b/include/modules/cs_entrymsg.h index 23a40b4c2..5b899ec84 100644 --- a/include/modules/cs_entrymsg.h +++ b/include/modules/cs_entrymsg.h @@ -13,9 +13,9 @@ struct EntryMsg Anope::string message; time_t when; - virtual ~EntryMsg() { } + virtual ~EntryMsg() = default; protected: - EntryMsg() { } + EntryMsg() = default; }; struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> > diff --git a/include/modules/cs_log.h b/include/modules/cs_log.h index 0df61d4db..14f9764e3 100644 --- a/include/modules/cs_log.h +++ b/include/modules/cs_log.h @@ -22,9 +22,9 @@ struct LogSetting Anope::string creator; time_t created; - virtual ~LogSetting() { } + virtual ~LogSetting() = default; protected: - LogSetting() { } + LogSetting() = default; }; struct LogSettings : Serialize::Checker<std::vector<LogSetting *> > @@ -37,6 +37,6 @@ struct LogSettings : Serialize::Checker<std::vector<LogSetting *> > } public: - virtual ~LogSettings() { } + virtual ~LogSettings() = default; virtual LogSetting *Create() = 0; }; diff --git a/include/modules/cs_mode.h b/include/modules/cs_mode.h index fe59f17f9..d99a9a1ff 100644 --- a/include/modules/cs_mode.h +++ b/include/modules/cs_mode.h @@ -18,16 +18,16 @@ struct ModeLock Anope::string setter; time_t created; - virtual ~ModeLock() { } + virtual ~ModeLock() = default; protected: - ModeLock() { } + ModeLock() = default; }; struct ModeLocks { typedef std::vector<ModeLock *> ModeList; - virtual ~ModeLocks() { } + virtual ~ModeLocks() = default; /** Check if a mode is mlocked * @param mode The mode diff --git a/include/modules/dns.h b/include/modules/dns.h index 3b90fad7a..6c9eda89f 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -73,10 +73,10 @@ namespace DNS struct Question { Anope::string name; - QueryType type; - unsigned short qclass; + QueryType type = QUERY_NONE; + unsigned short qclass = 0; - Question() : type(QUERY_NONE), qclass(0) { } + Question() = default; Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { } inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; } @@ -91,12 +91,12 @@ namespace DNS struct ResourceRecord : Question { - unsigned int ttl; + unsigned int ttl = 0; Anope::string rdata; time_t created; - ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { } - ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { } + ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { } + ResourceRecord(const Question &q) : Question(q), created(Anope::CurTime) { } }; struct Query @@ -118,7 +118,7 @@ namespace DNS { public: Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { } - virtual ~Manager() { } + virtual ~Manager() = default; virtual void Process(Request *req) = 0; virtual void RemoveRequest(Request *req) = 0; @@ -139,12 +139,12 @@ namespace DNS /* Use result cache if available */ bool use_cache; /* Request id */ - unsigned short id; + unsigned short id = 0; /* Creator of this request */ Module *creator; Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr), - use_cache(cache), id(0), creator(c) { } + use_cache(cache), creator(c) { } virtual ~Request() { @@ -164,7 +164,7 @@ namespace DNS /** Used to time out the query, xalls OnError and lets the TimerManager * delete this request. */ - void Tick(time_t) anope_override + void Tick(time_t) override { Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name; Query rr(*this); diff --git a/include/modules/encryption.h b/include/modules/encryption.h index acb084835..4adc77136 100644 --- a/include/modules/encryption.h +++ b/include/modules/encryption.h @@ -17,7 +17,7 @@ namespace Encryption class Context { public: - virtual ~Context() { } + virtual ~Context() = default; virtual void Update(const unsigned char *data, size_t len) = 0; virtual void Finalize() = 0; virtual Hash GetFinalizedHash() = 0; @@ -27,7 +27,7 @@ namespace Encryption { public: Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { } - virtual ~Provider() { } + virtual ~Provider() = default; virtual Context *CreateContext(IV * = NULL) = 0; virtual IV GetDefaultIV() = 0; diff --git a/include/modules/httpd.h b/include/modules/httpd.h index 6431534e3..c4c2c7d74 100644 --- a/include/modules/httpd.h +++ b/include/modules/httpd.h @@ -21,13 +21,14 @@ enum HTTPError /* A message to someone */ struct HTTPReply { - HTTPError error; + HTTPError error = HTTP_ERROR_OK; Anope::string content_type; std::map<Anope::string, Anope::string, ci::less> headers; typedef std::list<std::pair<Anope::string, Anope::string> > cookie; std::vector<cookie> cookies; - HTTPReply() : error(HTTP_ERROR_OK), length(0) { } + HTTPReply() = default; + HTTPReply& operator=(const HTTPReply &) = default; HTTPReply(const HTTPReply& other) : error(other.error), length(other.length) { @@ -65,7 +66,7 @@ struct HTTPReply }; std::deque<Data *> out; - size_t length; + size_t length = 0; void Write(const Anope::string &message) { @@ -93,7 +94,7 @@ struct HTTPMessage class HTTPClient; class HTTPProvider; -class HTTPPage : public Base +class HTTPPage : public virtual Base { Anope::string url; Anope::string content_type; diff --git a/include/modules/ldap.h b/include/modules/ldap.h index 74dad36a3..7b778b6d4 100644 --- a/include/modules/ldap.h +++ b/include/modules/ldap.h @@ -14,7 +14,7 @@ class LDAPException : public ModuleException public: LDAPException(const Anope::string &reason) : ModuleException(reason) { } - virtual ~LDAPException() throw() { } + virtual ~LDAPException() throw() = default; }; struct LDAPModification @@ -116,7 +116,7 @@ class LDAPInterface Module *owner; LDAPInterface(Module *m) : owner(m) { } - virtual ~LDAPInterface() { } + virtual ~LDAPInterface() = default; virtual void OnResult(const LDAPResult &r) = 0; virtual void OnError(const LDAPResult &err) = 0; diff --git a/include/modules/ns_cert.h b/include/modules/ns_cert.h index a84276b52..62ac07846 100644 --- a/include/modules/ns_cert.h +++ b/include/modules/ns_cert.h @@ -12,9 +12,9 @@ struct NSCertList { protected: - NSCertList() { } + NSCertList() = default; public: - virtual ~NSCertList() { } + virtual ~NSCertList() = default; /** Add an entry to the nick's certificate list * diff --git a/include/modules/os_forbid.h b/include/modules/os_forbid.h index 3ae9b7551..dd73dca4a 100644 --- a/include/modules/os_forbid.h +++ b/include/modules/os_forbid.h @@ -23,13 +23,13 @@ struct ForbidData Anope::string mask; Anope::string creator; Anope::string reason; - time_t created; - time_t expires; + time_t created = 0; + time_t expires = 0; ForbidType type; - virtual ~ForbidData() { } + virtual ~ForbidData() = default; protected: - ForbidData() : created(0), expires(0) { } + ForbidData() = default; }; class ForbidService : public Service diff --git a/include/modules/os_ignore.h b/include/modules/os_ignore.h index 69596c4bb..c4e401e81 100644 --- a/include/modules/os_ignore.h +++ b/include/modules/os_ignore.h @@ -14,11 +14,11 @@ struct IgnoreData Anope::string mask; Anope::string creator; Anope::string reason; - time_t time; /* When do we stop ignoring them? */ + time_t time = 0; /* When do we stop ignoring them? */ - virtual ~IgnoreData() { } + virtual ~IgnoreData() = default; protected: - IgnoreData() : time(0) { } + IgnoreData() = default; }; class IgnoreService : public Service diff --git a/include/modules/os_session.h b/include/modules/os_session.h index b8a889b8e..8318a40ec 100644 --- a/include/modules/os_session.h +++ b/include/modules/os_session.h @@ -12,10 +12,10 @@ struct Session { cidr addr; /* A cidr (sockaddrs + len) representing this session */ - unsigned count; /* Number of clients with this host */ - unsigned hits; /* Number of subsequent kills for a host */ + unsigned count = 1; /* Number of clients with this host */ + unsigned hits = 0; /* Number of subsequent kills for a host */ - Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { } + Session(const sockaddrs &ip, int len) : addr(ip, len) { } }; struct Exception : Serializable @@ -28,7 +28,7 @@ struct Exception : Serializable time_t expires; /* Time when it expires. 0 == no expiry */ Exception() : Serializable("Exception") { } - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; diff --git a/include/modules/redis.h b/include/modules/redis.h index cb6f5380f..4d72b2afa 100644 --- a/include/modules/redis.h +++ b/include/modules/redis.h @@ -47,7 +47,7 @@ namespace Redis Module *owner; Interface(Module *m) : owner(m) { } - virtual ~Interface() { } + virtual ~Interface() = default; virtual void OnResult(const Reply &r) = 0; virtual void OnError(const Anope::string &error) { Log(owner) << error; } diff --git a/include/modules/sasl.h b/include/modules/sasl.h index bd6cfdb31..3b2d587fa 100644 --- a/include/modules/sasl.h +++ b/include/modules/sasl.h @@ -82,7 +82,7 @@ namespace SASL public: IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass, const Anope::string &h, const Anope::string &i) : ::IdentifyRequest(m, acc, pass), uid(id), hostname(h), ip(i) { } - void OnSuccess() anope_override + void OnSuccess() override { if (!sasl) return; @@ -108,7 +108,7 @@ namespace SASL } } - void OnFail() anope_override + void OnFail() override { if (!sasl) return; diff --git a/include/modules/set_misc.h b/include/modules/set_misc.h index de3d63228..c056c4c98 100644 --- a/include/modules/set_misc.h +++ b/include/modules/set_misc.h @@ -12,6 +12,7 @@ struct MiscData Anope::string name; Anope::string data; - MiscData() { } - virtual ~MiscData() { } + virtual ~MiscData() = default; + protected: + MiscData() = default; }; diff --git a/include/modules/sql.h b/include/modules/sql.h index c9849a8a5..f7734a717 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -21,7 +21,7 @@ namespace SQL Clear(); } - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { std::stringstream *&ss = data[key]; if (!ss) @@ -29,7 +29,7 @@ namespace SQL return *ss; } - std::set<Anope::string> KeySet() const anope_override + std::set<Anope::string> KeySet() const override { std::set<Anope::string> keys; for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -37,7 +37,7 @@ namespace SQL return keys; } - size_t Hash() const anope_override + size_t Hash() const override { size_t hash = 0; for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -61,12 +61,12 @@ namespace SQL this->data.clear(); } - void SetType(const Anope::string &key, Type t) anope_override + void SetType(const Anope::string &key, Type t) override { this->types[key] = t; } - Type GetType(const Anope::string &key) const anope_override + Type GetType(const Anope::string &key) const override { std::map<Anope::string, Type>::const_iterator it = this->types.find(key); if (it != this->types.end()) @@ -82,7 +82,7 @@ namespace SQL public: Exception(const Anope::string &reason) : ModuleException(reason) { } - virtual ~Exception() throw() { } + virtual ~Exception() throw() = default; }; /** A SQL query @@ -141,10 +141,10 @@ namespace SQL Query query; Anope::string error; public: - unsigned int id; + unsigned int id = 0; Anope::string finished_query; - Result() : id(0) { } + Result() = default; Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { } inline operator bool() const { return this->error.empty(); } @@ -187,7 +187,7 @@ namespace SQL Module *owner; Interface(Module *m) : owner(m) { } - virtual ~Interface() { } + virtual ~Interface() = default; virtual void OnResult(const Result &r) = 0; virtual void OnError(const Result &r) = 0; diff --git a/include/modules/suspend.h b/include/modules/suspend.h index 6b9177da4..b9865717d 100644 --- a/include/modules/suspend.h +++ b/include/modules/suspend.h @@ -14,6 +14,6 @@ struct SuspendInfo Anope::string what, by, reason; time_t when, expires; - SuspendInfo() { } - virtual ~SuspendInfo() { } + SuspendInfo() = default; + virtual ~SuspendInfo() = default; }; diff --git a/include/modules/xmlrpc.h b/include/modules/xmlrpc.h index 42d29bd2d..a39cdf061 100644 --- a/include/modules/xmlrpc.h +++ b/include/modules/xmlrpc.h @@ -28,7 +28,7 @@ class XMLRPCServiceInterface; class XMLRPCEvent { public: - virtual ~XMLRPCEvent() { } + virtual ~XMLRPCEvent() = default; virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0; }; diff --git a/include/opertype.h b/include/opertype.h index 58f6049ab..9e46dda5b 100644 --- a/include/opertype.h +++ b/include/opertype.h @@ -22,7 +22,7 @@ struct CoreExport Oper /* The type of operator this operator is */ OperType *ot; /* Whether the user must be an IRC operator (umode +o) to be considered a services operator */ - bool require_oper; + bool require_oper = true; Anope::string password; Anope::string certfp; /* Hosts allowed to use this operator block */ diff --git a/include/protocol.h b/include/protocol.h index 45aaa70d8..6bb649f74 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -61,10 +61,10 @@ class CoreExport IRCDProto : public Service bool CanSZLine; /* Can we place temporary holds on specific nicknames? */ bool CanSVSHold; - /* See os_oline */ - bool CanSVSO; /* See ns_cert */ bool CanCertFP; + /* Can we send arbitrary message tags? */ + bool CanSendTags; /* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */ bool RequiresID; /* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */ @@ -180,10 +180,6 @@ class CoreExport IRCDProto : public Service virtual void SendInvite(const MessageSource &source, const Channel *c, User *u); virtual void SendGlobops(const MessageSource &source, const char *fmt, ...); - /** Sets oper flags on a user, currently only supported by Unreal - */ - virtual void SendSVSO(BotInfo *, const Anope::string &, const Anope::string &) { } - /** Sends a nick change of one of our clients. */ virtual void SendNickChange(User *u, const Anope::string &newnick); @@ -230,7 +226,7 @@ class CoreExport IRCDProto : public Service virtual void SendSASLMechanisms(std::vector<Anope::string> &) { } virtual void SendSASLMessage(const SASL::Message &) { } - virtual void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) { } + virtual void SendSVSLogin(const Anope::string &uid, NickAlias *na) { } virtual bool IsNickValid(const Anope::string &); virtual bool IsChannelValid(const Anope::string &); @@ -250,8 +246,8 @@ class CoreExport IRCDProto : public Service class CoreExport MessageSource { Anope::string source; - User *u; - Server *s; + User *u = nullptr; + Server *s = nullptr; public: MessageSource(const Anope::string &); @@ -279,8 +275,7 @@ class CoreExport IRCDMessage : public Service public: IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0); unsigned GetParamCount() const; - virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms) = 0; - virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags); + virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) = 0; void SetFlag(IRCDMessageFlag f) { flags.insert(f); } bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); } @@ -294,7 +289,7 @@ private: Anope::string message; /** The current position within the message. */ - Anope::string::size_type position; + Anope::string::size_type position = 0; public: /** Create a tokenstream and fill it with the provided data. */ diff --git a/include/pstdint.h b/include/pstdint.h deleted file mode 100644 index b034ae086..000000000 --- a/include/pstdint.h +++ /dev/null @@ -1,800 +0,0 @@ -/* A portable stdint.h
- ****************************************************************************
- * BSD License:
- ****************************************************************************
- *
- * Copyright (c) 2005-2011 Paul Hsieh
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************
- *
- * Version 0.1.12
- *
- * The ANSI C standard committee, for the C99 standard, specified the
- * inclusion of a new standard include file called stdint.h. This is
- * a very useful and long desired include file which contains several
- * very precise definitions for integer scalar types that is
- * critically important for making portable several classes of
- * applications including cryptography, hashing, variable length
- * integer libraries and so on. But for most developers its likely
- * useful just for programming sanity.
- *
- * The problem is that most compiler vendors have decided not to
- * implement the C99 standard, and the next C++ language standard
- * (which has a lot more mindshare these days) will be a long time in
- * coming and its unknown whether or not it will include stdint.h or
- * how much adoption it will have. Either way, it will be a long time
- * before all compilers come with a stdint.h and it also does nothing
- * for the extremely large number of compilers available today which
- * do not include this file, or anything comparable to it.
- *
- * So that's what this file is all about. Its an attempt to build a
- * single universal include file that works on as many platforms as
- * possible to deliver what stdint.h is supposed to. A few things
- * that should be noted about this file:
- *
- * 1) It is not guaranteed to be portable and/or present an identical
- * interface on all platforms. The extreme variability of the
- * ANSI C standard makes this an impossibility right from the
- * very get go. Its really only meant to be useful for the vast
- * majority of platforms that possess the capability of
- * implementing usefully and precisely defined, standard sized
- * integer scalars. Systems which are not intrinsically 2s
- * complement may produce invalid constants.
- *
- * 2) There is an unavoidable use of non-reserved symbols.
- *
- * 3) Other standard include files are invoked.
- *
- * 4) This file may come in conflict with future platforms that do
- * include stdint.h. The hope is that one or the other can be
- * used with no real difference.
- *
- * 5) In the current version, if your platform can't represent
- * int32_t, int16_t and int8_t, it just dumps out with a compiler
- * error.
- *
- * 6) 64 bit integers may or may not be defined. Test for their
- * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
- * Note that this is different from the C99 specification which
- * requires the existence of 64 bit support in the compiler. If
- * this is not defined for your platform, yet it is capable of
- * dealing with 64 bits then it is because this file has not yet
- * been extended to cover all of your system's capabilities.
- *
- * 7) (u)intptr_t may or may not be defined. Test for its presence
- * with the test: #ifdef PTRDIFF_MAX. If this is not defined
- * for your platform, then it is because this file has not yet
- * been extended to cover all of your system's capabilities, not
- * because its optional.
- *
- * 8) The following might not been defined even if your platform is
- * capable of defining it:
- *
- * WCHAR_MIN
- * WCHAR_MAX
- * (u)int64_t
- * PTRDIFF_MIN
- * PTRDIFF_MAX
- * (u)intptr_t
- *
- * 9) The following have not been defined:
- *
- * WINT_MIN
- * WINT_MAX
- *
- * 10) The criteria for defining (u)int_least(*)_t isn't clear,
- * except for systems which don't have a type that precisely
- * defined 8, 16, or 32 bit types (which this include file does
- * not support anyways). Default definitions have been given.
- *
- * 11) The criteria for defining (u)int_fast(*)_t isn't something I
- * would trust to any particular compiler vendor or the ANSI C
- * committee. It is well known that "compatible systems" are
- * commonly created that have very different performance
- * characteristics from the systems they are compatible with,
- * especially those whose vendors make both the compiler and the
- * system. Default definitions have been given, but its strongly
- * recommended that users never use these definitions for any
- * reason (they do *NOT* deliver any serious guarantee of
- * improved performance -- not in this file, nor any vendor's
- * stdint.h).
- *
- * 12) The following macros:
- *
- * PRINTF_INTMAX_MODIFIER
- * PRINTF_INT64_MODIFIER
- * PRINTF_INT32_MODIFIER
- * PRINTF_INT16_MODIFIER
- * PRINTF_LEAST64_MODIFIER
- * PRINTF_LEAST32_MODIFIER
- * PRINTF_LEAST16_MODIFIER
- * PRINTF_INTPTR_MODIFIER
- *
- * are strings which have been defined as the modifiers required
- * for the "d", "u" and "x" printf formats to correctly output
- * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
- * (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
- * PRINTF_INTPTR_MODIFIER is not defined for some systems which
- * provide their own stdint.h. PRINTF_INT64_MODIFIER is not
- * defined if INT64_MAX is not defined. These are an extension
- * beyond what C99 specifies must be in stdint.h.
- *
- * In addition, the following macros are defined:
- *
- * PRINTF_INTMAX_HEX_WIDTH
- * PRINTF_INT64_HEX_WIDTH
- * PRINTF_INT32_HEX_WIDTH
- * PRINTF_INT16_HEX_WIDTH
- * PRINTF_INT8_HEX_WIDTH
- * PRINTF_INTMAX_DEC_WIDTH
- * PRINTF_INT64_DEC_WIDTH
- * PRINTF_INT32_DEC_WIDTH
- * PRINTF_INT16_DEC_WIDTH
- * PRINTF_INT8_DEC_WIDTH
- *
- * Which specifies the maximum number of characters required to
- * print the number of that type in either hexadecimal or decimal.
- * These are an extension beyond what C99 specifies must be in
- * stdint.h.
- *
- * Compilers tested (all with 0 warnings at their highest respective
- * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
- * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
- * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
- *
- * This file should be considered a work in progress. Suggestions for
- * improvements, especially those which increase coverage are strongly
- * encouraged.
- *
- * Acknowledgements
- *
- * The following people have made significant contributions to the
- * development and testing of this file:
- *
- * Chris Howie
- * John Steele Scott
- * Dave Thorup
- * John Dill
- *
- */
-
-#include <stddef.h>
-#include <limits.h>
-#include <signal.h>
-
-/*
- * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
- * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
- */
-
-#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
-#include <stdint.h>
-#define _PSTDINT_H_INCLUDED
-# ifndef PRINTF_INT64_MODIFIER
-# define PRINTF_INT64_MODIFIER "ll"
-# endif
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER "l"
-# endif
-# ifndef PRINTF_INT16_MODIFIER
-# define PRINTF_INT16_MODIFIER "h"
-# endif
-# ifndef PRINTF_INTMAX_MODIFIER
-# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
-# endif
-# ifndef PRINTF_INT64_HEX_WIDTH
-# define PRINTF_INT64_HEX_WIDTH "16"
-# endif
-# ifndef PRINTF_INT32_HEX_WIDTH
-# define PRINTF_INT32_HEX_WIDTH "8"
-# endif
-# ifndef PRINTF_INT16_HEX_WIDTH
-# define PRINTF_INT16_HEX_WIDTH "4"
-# endif
-# ifndef PRINTF_INT8_HEX_WIDTH
-# define PRINTF_INT8_HEX_WIDTH "2"
-# endif
-# ifndef PRINTF_INT64_DEC_WIDTH
-# define PRINTF_INT64_DEC_WIDTH "20"
-# endif
-# ifndef PRINTF_INT32_DEC_WIDTH
-# define PRINTF_INT32_DEC_WIDTH "10"
-# endif
-# ifndef PRINTF_INT16_DEC_WIDTH
-# define PRINTF_INT16_DEC_WIDTH "5"
-# endif
-# ifndef PRINTF_INT8_DEC_WIDTH
-# define PRINTF_INT8_DEC_WIDTH "3"
-# endif
-# ifndef PRINTF_INTMAX_HEX_WIDTH
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
-# endif
-# ifndef PRINTF_INTMAX_DEC_WIDTH
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
-# endif
-
-/*
- * Something really weird is going on with Open Watcom. Just pull some of
- * these duplicated definitions from Open Watcom's stdint.h file for now.
- */
-
-# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
-# if !defined (INT64_C)
-# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
-# endif
-# if !defined (UINT64_C)
-# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
-# endif
-# if !defined (INT32_C)
-# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
-# endif
-# if !defined (UINT32_C)
-# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
-# endif
-# if !defined (INT16_C)
-# define INT16_C(x) (x)
-# endif
-# if !defined (UINT16_C)
-# define UINT16_C(x) (x)
-# endif
-# if !defined (INT8_C)
-# define INT8_C(x) (x)
-# endif
-# if !defined (UINT8_C)
-# define UINT8_C(x) (x)
-# endif
-# if !defined (UINT64_MAX)
-# define UINT64_MAX 18446744073709551615ULL
-# endif
-# if !defined (INT64_MAX)
-# define INT64_MAX 9223372036854775807LL
-# endif
-# if !defined (UINT32_MAX)
-# define UINT32_MAX 4294967295UL
-# endif
-# if !defined (INT32_MAX)
-# define INT32_MAX 2147483647L
-# endif
-# if !defined (INTMAX_MAX)
-# define INTMAX_MAX INT64_MAX
-# endif
-# if !defined (INTMAX_MIN)
-# define INTMAX_MIN INT64_MIN
-# endif
-# endif
-#endif
-
-#ifndef _PSTDINT_H_INCLUDED
-#define _PSTDINT_H_INCLUDED
-
-#ifndef SIZE_MAX
-# define SIZE_MAX (~(size_t)0)
-#endif
-
-/*
- * Deduce the type assignments from limits.h under the assumption that
- * integer sizes in bits are powers of 2, and follow the ANSI
- * definitions.
- */
-
-#ifndef UINT8_MAX
-# define UINT8_MAX 0xff
-#endif
-#ifndef uint8_t
-# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
- typedef unsigned char uint8_t;
-# define UINT8_C(v) ((uint8_t) v)
-# else
-# error "Platform not supported"
-# endif
-#endif
-
-#ifndef INT8_MAX
-# define INT8_MAX 0x7f
-#endif
-#ifndef INT8_MIN
-# define INT8_MIN INT8_C(0x80)
-#endif
-#ifndef int8_t
-# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
- typedef signed char int8_t;
-# define INT8_C(v) ((int8_t) v)
-# else
-# error "Platform not supported"
-# endif
-#endif
-
-#ifndef UINT16_MAX
-# define UINT16_MAX 0xffff
-#endif
-#ifndef uint16_t
-#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
- typedef unsigned int uint16_t;
-# ifndef PRINTF_INT16_MODIFIER
-# define PRINTF_INT16_MODIFIER ""
-# endif
-# define UINT16_C(v) ((uint16_t) (v))
-#elif (USHRT_MAX == UINT16_MAX)
- typedef unsigned short uint16_t;
-# define UINT16_C(v) ((uint16_t) (v))
-# ifndef PRINTF_INT16_MODIFIER
-# define PRINTF_INT16_MODIFIER "h"
-# endif
-#else
-#error "Platform not supported"
-#endif
-#endif
-
-#ifndef INT16_MAX
-# define INT16_MAX 0x7fff
-#endif
-#ifndef INT16_MIN
-# define INT16_MIN INT16_C(0x8000)
-#endif
-#ifndef int16_t
-#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
- typedef signed int int16_t;
-# define INT16_C(v) ((int16_t) (v))
-# ifndef PRINTF_INT16_MODIFIER
-# define PRINTF_INT16_MODIFIER ""
-# endif
-#elif (SHRT_MAX == INT16_MAX)
- typedef signed short int16_t;
-# define INT16_C(v) ((int16_t) (v))
-# ifndef PRINTF_INT16_MODIFIER
-# define PRINTF_INT16_MODIFIER "h"
-# endif
-#else
-#error "Platform not supported"
-#endif
-#endif
-
-#ifndef UINT32_MAX
-# define UINT32_MAX (0xffffffffUL)
-#endif
-#ifndef uint32_t
-#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
- typedef unsigned long uint32_t;
-# define UINT32_C(v) v ## UL
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER "l"
-# endif
-#elif (UINT_MAX == UINT32_MAX)
- typedef unsigned int uint32_t;
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER ""
-# endif
-# define UINT32_C(v) v ## U
-#elif (USHRT_MAX == UINT32_MAX)
- typedef unsigned short uint32_t;
-# define UINT32_C(v) ((unsigned short) (v))
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER ""
-# endif
-#else
-#error "Platform not supported"
-#endif
-#endif
-
-#ifndef INT32_MAX
-# define INT32_MAX (0x7fffffffL)
-#endif
-#ifndef INT32_MIN
-# define INT32_MIN INT32_C(0x80000000)
-#endif
-#ifndef int32_t
-#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
- typedef signed long int32_t;
-# define INT32_C(v) v ## L
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER "l"
-# endif
-#elif (INT_MAX == INT32_MAX)
- typedef signed int int32_t;
-# define INT32_C(v) v
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER ""
-# endif
-#elif (SHRT_MAX == INT32_MAX)
- typedef signed short int32_t;
-# define INT32_C(v) ((short) (v))
-# ifndef PRINTF_INT32_MODIFIER
-# define PRINTF_INT32_MODIFIER ""
-# endif
-#else
-#error "Platform not supported"
-#endif
-#endif
-
-/*
- * The macro stdint_int64_defined is temporarily used to record
- * whether or not 64 integer support is available. It must be
- * defined for any 64 integer extensions for new platforms that are
- * added.
- */
-
-#undef stdint_int64_defined
-#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
-# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
-# define stdint_int64_defined
- typedef long long int64_t;
- typedef unsigned long long uint64_t;
-# define UINT64_C(v) v ## ULL
-# define INT64_C(v) v ## LL
-# ifndef PRINTF_INT64_MODIFIER
-# define PRINTF_INT64_MODIFIER "ll"
-# endif
-# endif
-#endif
-
-#if !defined (stdint_int64_defined)
-# if defined(__GNUC__)
-# define stdint_int64_defined
- __extension__ typedef long long int64_t;
- __extension__ typedef unsigned long long uint64_t;
-# define UINT64_C(v) v ## ULL
-# define INT64_C(v) v ## LL
-# ifndef PRINTF_INT64_MODIFIER
-# define PRINTF_INT64_MODIFIER "ll"
-# endif
-# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
-# define stdint_int64_defined
- typedef long long int64_t;
- typedef unsigned long long uint64_t;
-# define UINT64_C(v) v ## ULL
-# define INT64_C(v) v ## LL
-# ifndef PRINTF_INT64_MODIFIER
-# define PRINTF_INT64_MODIFIER "ll"
-# endif
-# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
-# define stdint_int64_defined
- typedef __int64 int64_t;
- typedef unsigned __int64 uint64_t;
-# define UINT64_C(v) v ## UI64
-# define INT64_C(v) v ## I64
-# ifndef PRINTF_INT64_MODIFIER
-# define PRINTF_INT64_MODIFIER "I64"
-# endif
-# endif
-#endif
-
-#if !defined (LONG_LONG_MAX) && defined (INT64_C)
-# define LONG_LONG_MAX INT64_C (9223372036854775807)
-#endif
-#ifndef ULONG_LONG_MAX
-# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
-#endif
-
-#if !defined (INT64_MAX) && defined (INT64_C)
-# define INT64_MAX INT64_C (9223372036854775807)
-#endif
-#if !defined (INT64_MIN) && defined (INT64_C)
-# define INT64_MIN INT64_C (-9223372036854775808)
-#endif
-#if !defined (UINT64_MAX) && defined (INT64_C)
-# define UINT64_MAX UINT64_C (18446744073709551615)
-#endif
-
-/*
- * Width of hexadecimal for number field.
- */
-
-#ifndef PRINTF_INT64_HEX_WIDTH
-# define PRINTF_INT64_HEX_WIDTH "16"
-#endif
-#ifndef PRINTF_INT32_HEX_WIDTH
-# define PRINTF_INT32_HEX_WIDTH "8"
-#endif
-#ifndef PRINTF_INT16_HEX_WIDTH
-# define PRINTF_INT16_HEX_WIDTH "4"
-#endif
-#ifndef PRINTF_INT8_HEX_WIDTH
-# define PRINTF_INT8_HEX_WIDTH "2"
-#endif
-
-#ifndef PRINTF_INT64_DEC_WIDTH
-# define PRINTF_INT64_DEC_WIDTH "20"
-#endif
-#ifndef PRINTF_INT32_DEC_WIDTH
-# define PRINTF_INT32_DEC_WIDTH "10"
-#endif
-#ifndef PRINTF_INT16_DEC_WIDTH
-# define PRINTF_INT16_DEC_WIDTH "5"
-#endif
-#ifndef PRINTF_INT8_DEC_WIDTH
-# define PRINTF_INT8_DEC_WIDTH "3"
-#endif
-
-/*
- * Ok, lets not worry about 128 bit integers for now. Moore's law says
- * we don't need to worry about that until about 2040 at which point
- * we'll have bigger things to worry about.
- */
-
-#ifdef stdint_int64_defined
- typedef int64_t intmax_t;
- typedef uint64_t uintmax_t;
-# define INTMAX_MAX INT64_MAX
-# define INTMAX_MIN INT64_MIN
-# define UINTMAX_MAX UINT64_MAX
-# define UINTMAX_C(v) UINT64_C(v)
-# define INTMAX_C(v) INT64_C(v)
-# ifndef PRINTF_INTMAX_MODIFIER
-# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
-# endif
-# ifndef PRINTF_INTMAX_HEX_WIDTH
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
-# endif
-# ifndef PRINTF_INTMAX_DEC_WIDTH
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
-# endif
-#else
- typedef int32_t intmax_t;
- typedef uint32_t uintmax_t;
-# define INTMAX_MAX INT32_MAX
-# define UINTMAX_MAX UINT32_MAX
-# define UINTMAX_C(v) UINT32_C(v)
-# define INTMAX_C(v) INT32_C(v)
-# ifndef PRINTF_INTMAX_MODIFIER
-# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
-# endif
-# ifndef PRINTF_INTMAX_HEX_WIDTH
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
-# endif
-# ifndef PRINTF_INTMAX_DEC_WIDTH
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
-# endif
-#endif
-
-/*
- * Because this file currently only supports platforms which have
- * precise powers of 2 as bit sizes for the default integers, the
- * least definitions are all trivial. Its possible that a future
- * version of this file could have different definitions.
- */
-
-#ifndef stdint_least_defined
- typedef int8_t int_least8_t;
- typedef uint8_t uint_least8_t;
- typedef int16_t int_least16_t;
- typedef uint16_t uint_least16_t;
- typedef int32_t int_least32_t;
- typedef uint32_t uint_least32_t;
-# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
-# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
-# define UINT_LEAST8_MAX UINT8_MAX
-# define INT_LEAST8_MAX INT8_MAX
-# define UINT_LEAST16_MAX UINT16_MAX
-# define INT_LEAST16_MAX INT16_MAX
-# define UINT_LEAST32_MAX UINT32_MAX
-# define INT_LEAST32_MAX INT32_MAX
-# define INT_LEAST8_MIN INT8_MIN
-# define INT_LEAST16_MIN INT16_MIN
-# define INT_LEAST32_MIN INT32_MIN
-# ifdef stdint_int64_defined
- typedef int64_t int_least64_t;
- typedef uint64_t uint_least64_t;
-# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
-# define UINT_LEAST64_MAX UINT64_MAX
-# define INT_LEAST64_MAX INT64_MAX
-# define INT_LEAST64_MIN INT64_MIN
-# endif
-#endif
-#undef stdint_least_defined
-
-/*
- * The ANSI C committee pretending to know or specify anything about
- * performance is the epitome of misguided arrogance. The mandate of
- * this file is to *ONLY* ever support that absolute minimum
- * definition of the fast integer types, for compatibility purposes.
- * No extensions, and no attempt to suggest what may or may not be a
- * faster integer type will ever be made in this file. Developers are
- * warned to stay away from these types when using this or any other
- * stdint.h.
- */
-
-typedef int_least8_t int_fast8_t;
-typedef uint_least8_t uint_fast8_t;
-typedef int_least16_t int_fast16_t;
-typedef uint_least16_t uint_fast16_t;
-typedef int_least32_t int_fast32_t;
-typedef uint_least32_t uint_fast32_t;
-#define UINT_FAST8_MAX UINT_LEAST8_MAX
-#define INT_FAST8_MAX INT_LEAST8_MAX
-#define UINT_FAST16_MAX UINT_LEAST16_MAX
-#define INT_FAST16_MAX INT_LEAST16_MAX
-#define UINT_FAST32_MAX UINT_LEAST32_MAX
-#define INT_FAST32_MAX INT_LEAST32_MAX
-#define INT_FAST8_MIN INT_LEAST8_MIN
-#define INT_FAST16_MIN INT_LEAST16_MIN
-#define INT_FAST32_MIN INT_LEAST32_MIN
-#ifdef stdint_int64_defined
- typedef int_least64_t int_fast64_t;
- typedef uint_least64_t uint_fast64_t;
-# define UINT_FAST64_MAX UINT_LEAST64_MAX
-# define INT_FAST64_MAX INT_LEAST64_MAX
-# define INT_FAST64_MIN INT_LEAST64_MIN
-#endif
-
-#undef stdint_int64_defined
-
-/*
- * Whatever piecemeal, per compiler thing we can do about the wchar_t
- * type limits.
- */
-
-#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
-# include <wchar.h>
-# ifndef WCHAR_MIN
-# define WCHAR_MIN 0
-# endif
-# ifndef WCHAR_MAX
-# define WCHAR_MAX ((wchar_t)-1)
-# endif
-#endif
-
-/*
- * Whatever piecemeal, per compiler/platform thing we can do about the
- * (u)intptr_t types and limits.
- */
-
-#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
-# define STDINT_H_UINTPTR_T_DEFINED
-#endif
-
-#ifndef STDINT_H_UINTPTR_T_DEFINED
-# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
-# define stdint_intptr_bits 64
-# elif defined (__WATCOMC__) || defined (__TURBOC__)
-# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
-# define stdint_intptr_bits 16
-# else
-# define stdint_intptr_bits 32
-# endif
-# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
-# define stdint_intptr_bits 32
-# elif defined (__INTEL_COMPILER)
-/* TODO -- what did Intel do about x86-64? */
-# endif
-
-# ifdef stdint_intptr_bits
-# define stdint_intptr_glue3_i(a,b,c) a##b##c
-# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
-# ifndef PRINTF_INTPTR_MODIFIER
-# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
-# endif
-# ifndef PTRDIFF_MAX
-# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
-# endif
-# ifndef PTRDIFF_MIN
-# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
-# endif
-# ifndef UINTPTR_MAX
-# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
-# endif
-# ifndef INTPTR_MAX
-# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
-# endif
-# ifndef INTPTR_MIN
-# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
-# endif
-# ifndef INTPTR_C
-# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
-# endif
-# ifndef UINTPTR_C
-# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
-# endif
- typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
- typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
-# else
-/* TODO -- This following is likely wrong for some platforms, and does
- nothing for the definition of uintptr_t. */
- typedef ptrdiff_t intptr_t;
-# endif
-# define STDINT_H_UINTPTR_T_DEFINED
-#endif
-
-/*
- * Assumes sig_atomic_t is signed and we have a 2s complement machine.
- */
-
-#ifndef SIG_ATOMIC_MAX
-# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
-#endif
-
-#endif
-
-#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
-
-/*
- * Please compile with the maximum warning settings to make sure macros are not
- * defined more than once.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#define glue3_aux(x,y,z) x ## y ## z
-#define glue3(x,y,z) glue3_aux(x,y,z)
-
-#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
-#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
-
-#define DECL(us,bits) glue3(DECL,us,) (bits)
-
-#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
-
-int main () {
- DECL(I,8)
- DECL(U,8)
- DECL(I,16)
- DECL(U,16)
- DECL(I,32)
- DECL(U,32)
-#ifdef INT64_MAX
- DECL(I,64)
- DECL(U,64)
-#endif
- intmax_t imax = INTMAX_C(0);
- uintmax_t umax = UINTMAX_C(0);
- char str0[256], str1[256];
-
- sprintf (str0, "%d %x\n", 0, ~0);
-
- sprintf (str1, "%d %x\n", i8, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
- sprintf (str1, "%u %x\n", u8, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
- sprintf (str1, "%d %x\n", i16, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
- sprintf (str1, "%u %x\n", u16, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
- sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
- sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
-#ifdef INT64_MAX
- sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
-#endif
- sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
- sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
- if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
-
- TESTUMAX(8);
- TESTUMAX(16);
- TESTUMAX(32);
-#ifdef INT64_MAX
- TESTUMAX(64);
-#endif
-
- return EXIT_SUCCESS;
-}
-
-#endif
diff --git a/include/regchannel.h b/include/regchannel.h index d0f0bf02f..9b05a2e62 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -38,7 +38,7 @@ class CoreExport AutoKick : public Serializable AutoKick(); ~AutoKick(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); }; @@ -93,8 +93,9 @@ class CoreExport ChannelInfo : public Serializable, public Extensible ChannelInfo(const ChannelInfo &ci); ~ChannelInfo(); + ChannelInfo& operator=(const ChannelInfo &) = default; - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Change the founder of the channel diff --git a/include/regexpr.h b/include/regexpr.h index 92be87c89..20ed28098 100644 --- a/include/regexpr.h +++ b/include/regexpr.h @@ -21,7 +21,7 @@ class RegexException : public CoreException public: RegexException(const Anope::string &reason = "") : CoreException(reason) { } - virtual ~RegexException() throw() { } + virtual ~RegexException() throw() = default; }; class CoreExport Regex @@ -30,7 +30,7 @@ class CoreExport Regex protected: Regex(const Anope::string &expr) : expression(expr) { } public: - virtual ~Regex() { } + virtual ~Regex() = default; const Anope::string &GetExpression() { return expression; } virtual bool Matches(const Anope::string &str) = 0; }; diff --git a/include/serialize.h b/include/serialize.h index 406b9698f..afe75c6d3 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -28,7 +28,7 @@ namespace Serialize DT_INT }; - virtual ~Data() { } + virtual ~Data() = default; virtual std::iostream& operator[](const Anope::string &key) = 0; virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); } @@ -65,9 +65,9 @@ class CoreExport Serializable : public virtual Base /* Iterator into serializable_items */ std::list<Serializable *>::iterator s_iter; /* The hash of the last serialized form of this object committed to the database */ - size_t last_commit; + size_t last_commit = 0; /* The last time this object was committed to the database */ - time_t last_commit_time; + time_t last_commit_time = 0; protected: Serializable(const Anope::string &serialize_type); @@ -79,10 +79,10 @@ class CoreExport Serializable : public virtual Base virtual ~Serializable(); /* Unique ID (per type, not globally) for this object */ - uint64_t id; + uint64_t id = 0; /* Only used by redis, to ignore updates */ - unsigned short redis_ignore; + unsigned short redis_ignore = 0; /** Marks the object as potentially being updated "soon". */ @@ -127,7 +127,7 @@ class CoreExport Serialize::Type : public Base * this timestamp. if curtime == timestamp then we have the most up to date * version of every object of this type. */ - time_t timestamp; + time_t timestamp = 0; public: /* Map of Serializable::id to Serializable objects */ @@ -187,7 +187,7 @@ class Serialize::Checker { Anope::string name; T obj; - mutable ::Reference<Serialize::Type> type; + mutable ::Reference<Serialize::Type> type = nullptr; inline void Check() const { @@ -198,7 +198,7 @@ class Serialize::Checker } public: - Checker(const Anope::string &n) : name(n), type(NULL) { } + Checker(const Anope::string &n) : name(n) { } inline const T* operator->() const { @@ -244,12 +244,10 @@ template<typename T> class Serialize::Reference : public ReferenceBase { protected: - T *ref; + T *ref = nullptr; public: - Reference() : ref(NULL) - { - } + Reference() = default; Reference(T *obj) : ref(obj) { diff --git a/include/servers.h b/include/servers.h index f88f66187..5864b7e11 100644 --- a/include/servers.h +++ b/include/servers.h @@ -80,7 +80,7 @@ class CoreExport Server : public Extensible public: /* Number of users on the server */ - unsigned users; + unsigned users = 0; /** Delete this server with a reason * @param reason The reason diff --git a/include/service.h b/include/service.h index 2f7618371..a29728b32 100644 --- a/include/service.h +++ b/include/service.h @@ -122,7 +122,7 @@ class ServiceReference : public Reference<T> Anope::string name; public: - ServiceReference() { } + ServiceReference() = default; ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n) { @@ -134,7 +134,7 @@ class ServiceReference : public Reference<T> this->invalid = true; } - operator bool() anope_override + operator bool() override { if (this->invalid) { diff --git a/include/services.h b/include/services.h index 8a9551155..823aad8a3 100644 --- a/include/services.h +++ b/include/services.h @@ -31,6 +31,8 @@ #endif /* Pull in the various bits of STL */ +#include <cstdint> +#include <cstddef> #include <iostream> #include <fstream> #include <sstream> @@ -48,18 +50,9 @@ #define _(x) x -#if defined __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L -# define anope_override override -# define anope_final final -#else -# define anope_override -# define anope_final -#endif - #ifndef _WIN32 -# define DllExport -# define CoreExport -# define MARK_DEPRECATED __attribute((deprecated)) +# define DllExport __attribute__ ((visibility ("default"))) +# define CoreExport __attribute__ ((visibility ("default"))) # define anope_close close #else # include "anope_windows.h" diff --git a/include/sockets.h b/include/sockets.h index 1a54e4fd1..823756a0e 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -126,7 +126,7 @@ class SocketException : public CoreException /** Destructor * @throws Nothing */ - virtual ~SocketException() throw() { } + virtual ~SocketException() throw() = default; }; enum SocketFlag @@ -144,7 +144,7 @@ enum SocketFlag class CoreExport SocketIO { public: - virtual ~SocketIO() { } + virtual ~SocketIO() = default; /** Receive something from the buffer * @param s The socket @@ -285,18 +285,17 @@ class CoreExport BufferedSocket : public virtual Socket int recv_len; public: - BufferedSocket(); - virtual ~BufferedSocket(); + virtual ~BufferedSocket() = default; /** Called when there is something to be received for this socket * @return true on success, false to drop this socket */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Called when the socket is ready to be written to * @return true on success, false to drop this socket */ - bool ProcessWrite() anope_override; + bool ProcessWrite() override; /** Gets the new line from the input buffer, if any */ @@ -339,18 +338,17 @@ class CoreExport BinarySocket : public virtual Socket std::deque<DataBlock *> write_buffer; public: - BinarySocket(); - virtual ~BinarySocket(); + virtual ~BinarySocket() = default; /** Called when there is something to be received for this socket * @return true on success, false to drop this socket */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Called when the socket is ready to be written to * @return true on success, false to drop this socket */ - bool ProcessWrite() anope_override; + bool ProcessWrite() override; /** Write data to the socket * @param buffer The data to write @@ -377,7 +375,7 @@ class CoreExport ListenSocket : public virtual Socket * @param ipv6 true for ipv6 */ ListenSocket(const Anope::string &bindip, int port, bool ipv6); - virtual ~ListenSocket(); + virtual ~ListenSocket() = default; /** Process what has come in from the connection * @return false to destroy this socket @@ -408,12 +406,12 @@ class CoreExport ConnectionSocket : public virtual Socket * Used to determine whether or not this socket is connected yet. * @return true to continue to call ProcessRead/ProcessWrite, false to not continue */ - bool Process() anope_override; + bool Process() override; /** Called when there is an error for this socket * @return true on success, false to drop this socket */ - void ProcessError() anope_override; + void ProcessError() override; /** Called on a successful connect */ @@ -443,12 +441,12 @@ class CoreExport ClientSocket : public virtual Socket * Used to determine whether or not this socket is connected yet. * @return true to continue to call ProcessRead/ProcessWrite, false to not continue */ - bool Process() anope_override; + bool Process() override; /** Called when there is an error for this socket * @return true on success, false to drop this socket */ - void ProcessError() anope_override; + void ProcessError() override; /** Called when a client has been accepted() successfully. */ @@ -472,7 +470,7 @@ class CoreExport Pipe : public Socket /** Called when data is to be read, reads the data then calls OnNotify */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Write data to this pipe * @param data The data to write diff --git a/include/sysconf.h.cmake b/include/sysconf.h.cmake index 5f0e275c3..b63598ae7 100644 --- a/include/sysconf.h.cmake +++ b/include/sysconf.h.cmake @@ -4,11 +4,6 @@ #cmakedefine DEBUG_BUILD #cmakedefine DEFUMASK @DEFUMASK@ -#cmakedefine HAVE_CSTDINT 1 -#cmakedefine HAVE_STDINT_H 1 -#cmakedefine HAVE_STDDEF_H 1 -#cmakedefine HAVE_STRCASECMP 1 -#cmakedefine HAVE_STRICMP 1 #cmakedefine HAVE_STRINGS_H 1 #cmakedefine HAVE_UMASK 1 #cmakedefine HAVE_EVENTFD 1 @@ -16,19 +11,6 @@ #cmakedefine HAVE_POLL 1 #cmakedefine GETTEXT_FOUND 1 -#ifdef HAVE_CSTDINT -# include <cstdint> -#else -# ifdef HAVE_STDINT_H -# include <stdint.h> -# else -# include "pstdint.h" -# endif -#endif -#ifdef HAVE_STDDEF_H -# include <stddef.h> -#endif - #ifdef _WIN32 # define popen _popen # define pclose _pclose @@ -38,9 +20,6 @@ # endif # define MAXPATHLEN MAX_PATH # define bzero(buf, size) memset(buf, 0, size) -# ifdef MSVCPP -# define strcasecmp stricmp -# endif # define sleep(x) Sleep(x * 1000) #endif diff --git a/include/threadengine.h b/include/threadengine.h index 14af252e6..b5f8e5755 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -19,19 +19,15 @@ class CoreExport Thread : public Pipe, public Extensible { private: /* Set to true to tell the thread to finish and we are waiting for it */ - bool exit; + bool exit = false; public: /* Handle for this thread */ pthread_t handle; - /** Threads constructor - */ - Thread(); - /** Threads destructor */ - virtual ~Thread(); + virtual ~Thread() = default; /** Join to the thread, sets the exit state to true */ diff --git a/include/uplink.h b/include/uplink.h index 6d3089137..5aac5dd2d 100644 --- a/include/uplink.h +++ b/include/uplink.h @@ -27,9 +27,9 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket bool error; UplinkSocket(); ~UplinkSocket(); - bool ProcessRead() anope_override; - void OnConnect() anope_override; - void OnError(const Anope::string &) anope_override; + bool ProcessRead() override; + void OnConnect() override; + void OnError(const Anope::string &) override; /* A message sent over the uplink socket */ class CoreExport Message diff --git a/include/users.h b/include/users.h index f7756e7c2..e9bef1c4a 100644 --- a/include/users.h +++ b/include/users.h @@ -190,7 +190,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe * @param ... any number of parameters */ void SendMessage(BotInfo *source, const char *fmt, ...); - void SendMessage(BotInfo *source, const Anope::string &msg) anope_override; + void SendMessage(BotInfo *source, const Anope::string &msg) override; /** Identify the user to a nick. * updates last_seen, logs the user in, @@ -226,6 +226,11 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe */ bool IsRecognized(bool check_secure = true) const; + /** Check if the user is connected securely. + * @return True if the user is connected securely; otherwise, false. + */ + bool IsSecurelyConnected() const; + /** Check if the user is a services oper * @return true if they are an oper */ diff --git a/include/xline.h b/include/xline.h index 413dc3340..f00937ba0 100644 --- a/include/xline.h +++ b/include/xline.h @@ -23,8 +23,8 @@ class CoreExport XLine : public Serializable Anope::string mask; Regex *regex; Anope::string by; - time_t created; - time_t expires; + time_t created = 0; + time_t expires = 0; Anope::string reason; XLineManager *manager; Anope::string id; @@ -44,7 +44,7 @@ class CoreExport XLine : public Serializable bool HasNickOrReal() const; bool IsRegex() const; - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; |