diff options
author | Adam <Adam@anope.org> | 2016-10-06 14:36:41 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-10-06 14:36:41 -0400 |
commit | 7a5c4e55991a8b884c1a2f4b00fd2e6f5297c0d6 (patch) | |
tree | f5c4c6c61d22a0c04f82b9ad4813789526a48f82 /src/modes.cpp | |
parent | d280234e14974c7db1c243b8c30caa63d82bd396 (diff) |
#1682: store aftype with masks and include cidrs in GetNUHMask
Diffstat (limited to 'src/modes.cpp')
-rw-r--r-- | src/modes.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/modes.cpp b/src/modes.cpp index 065558747..b41bece1d 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -836,14 +836,11 @@ Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh if (addr.valid() && cidr_range.is_pos_number_only()) { this->cidr_len = convertTo<unsigned short>(cidr_range); - /* If we got here, cidr_len is a valid number. - * If cidr_len is >32 (or 128) it is handled later in - * cidr::match - */ this->host = cidr_ip; + this->family = addr.family(); - Log(LOG_DEBUG) << "Ban " << m << " has cidr " << this->cidr_len; + Log(LOG_DEBUG) << "Ban " << mask << " has cidr " << this->cidr_len; } } catch (const ConvertException &) { } @@ -864,8 +861,21 @@ const Anope::string Entry::GetNUHMask() const Anope::string n = nick.empty() ? "*" : nick, u = user.empty() ? "*" : user, h = host.empty() ? "*" : host, - r = real.empty() ? "" : "#" + real; - return n + "!" + u + "@" + h + r; + r = real.empty() ? "" : "#" + real, + c; + + switch (family) + { + case AF_INET: + if (cidr_len <= 32) + c = "/" + stringify(cidr_len); + break; + case AF_INET6: + if (cidr_len <= 128) + c = "/" + stringify(cidr_len); + break; + } + return n + "!" + u + "@" + h + r + c; } bool Entry::Matches(User *u, bool full) const |