X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_hostchange.cpp;h=8d7abede47bbaca538b9db5465900bd5095ce5fd;hb=355d51770e9a6d868eab7aa5442f4c0ac08a0046;hp=201c4b59b3abad3eaa4114ae004cd695d6e77e01;hpb=77730fd5f09f8fc193205654c8bba84d34365670;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 201c4b59b..8d7abede4 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -1,9 +1,13 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2005-2007 Craig Edwards + * Copyright (C) 2013, 2018-2020 Sadie Powell + * Copyright (C) 2012-2014 Attila Molnar + * Copyright (C) 2012 Robby + * Copyright (C) 2009 Robin Burchell + * Copyright (C) 2009 Daniel De Graaf * Copyright (C) 2007 Dennis Friis - * Copyright (C) 2007 Robin Burchell + * Copyright (C) 2006-2007, 2010 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -34,7 +38,7 @@ class HostRule // Add the user's nickname to their hostname. HCA_ADDNICK, - // Set the user's hostname to the specific value. + // Set the user's hostname to the specific value. HCA_SET }; @@ -47,7 +51,7 @@ class HostRule std::string suffix; public: - HostRule(const std::string& Host, const std::string& Mask, const insp::flat_set& Ports) + HostRule(const std::string& Mask, const std::string& Host, const insp::flat_set& Ports) : action(HCA_SET) , host(Host) , mask(Mask) @@ -76,7 +80,7 @@ class HostRule bool Matches(LocalUser* user) const { - if (!ports.empty() && !ports.count(user->GetServerPort())) + if (!ports.empty() && !ports.count(user->server_sa.port())) return false; if (InspIRCd::MatchCIDR(user->MakeHost(), mask)) @@ -136,7 +140,7 @@ private: insp::flat_set ports; const std::string portlist = tag->getString("ports"); - if (!ports.empty()) + if (!portlist.empty()) { irc::portparser portrange(portlist, false); while (int port = portrange.GetToken()) @@ -168,11 +172,13 @@ private: } else { - throw ModuleException(action + " is an invalid type, at " + tag->getTagLocation()); + throw ModuleException(action + " is an invalid type, at " + tag->getTagLocation()); } } - const std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789"); + ConfigTag* tag = ServerInstance->Config->ConfValue("hostname"); + const std::string hmap = tag->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789", 1); + hostmap.reset(); for (std::string::const_iterator iter = hmap.begin(); iter != hmap.end(); ++iter) hostmap.set(static_cast(*iter)); @@ -181,7 +187,7 @@ private: Version GetVersion() CXX11_OVERRIDE { - return Version("Provides rule-based masking of user hostnames", VF_VENDOR); + return Version("Allows the server administrator to define custom rules for applying hostnames to users.", VF_VENDOR); } void OnUserConnect(LocalUser* user) CXX11_OVERRIDE