diff options
Diffstat (limited to 'src/misc.cpp')
-rw-r--r-- | src/misc.cpp | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/src/misc.cpp b/src/misc.cpp index 7e68686a2..0728daab1 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -19,15 +19,15 @@ #include "regexpr.h" #include "sockets.h" -#include <errno.h> -#include <sys/types.h> +#include <cerrno> #include <sys/stat.h> +#include <sys/types.h> #ifndef _WIN32 #include <sys/socket.h> #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) @@ -147,7 +143,7 @@ void ListFormatter::Process(std::vector<Anope::string> &buffer) std::set<Anope::string> breaks; for (unsigned i = 0; i < this->columns.size(); ++i) { - tcolumns.push_back(Language::Translate(this->nc, this->columns[i].c_str())); + tcolumns.emplace_back(Language::Translate(this->nc, this->columns[i].c_str())); lengths[this->columns[i]] = tcolumns[i].length(); } for (unsigned i = 0; i < this->entries.size(); ++i) @@ -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) { } @@ -238,7 +234,7 @@ Anope::string& InfoFormatter::operator[](const Anope::string &key) Anope::string tkey = Language::Translate(this->nc, key.c_str()); if (tkey.length() > this->longest) this->longest = tkey.length(); - this->replies.push_back(std::make_pair(tkey, "")); + this->replies.emplace_back(tkey, ""); return this->replies.back().second; } @@ -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; @@ -639,7 +617,7 @@ Anope::string Anope::VersionBuildString() #endif Anope::string flags; -#ifdef DEBUG_BUILD +#if DEBUG_BUILD flags += "D"; #endif #ifdef VERSION_GIT |