diff options
| author | 2025-12-07 20:55:20 +0000 | |
|---|---|---|
| committer | 2025-12-07 20:55:20 +0000 | |
| commit | 79c01cb2a2615fbcb2a568d5a49c6d470459cf45 (patch) | |
| tree | be0f4c84145b8902abec690e5885831a061407f3 /modules/dccallow.cpp | |
| parent | Avoid using deprecated functions in ssl_openssl. (diff) | |
| parent | Release v4.9.0. (diff) | |
Merge branch 'insp4' into master.
Diffstat (limited to 'modules/dccallow.cpp')
| -rw-r--r-- | modules/dccallow.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/modules/dccallow.cpp b/modules/dccallow.cpp index 4092c325c..dd71f4a1d 100644 --- a/modules/dccallow.cpp +++ b/modules/dccallow.cpp @@ -130,7 +130,7 @@ public: // Remove the old list and create a new one. Unset(user, false); - auto* list = new dccallowlist(); + dccallowlist* list = nullptr; irc::spacesepstream ts(value); while (!ts.StreamEnd()) @@ -158,36 +158,32 @@ public: } // Store the DCC allow entry. + if (!list) + list = new dccallowlist(); list->push_back(dccallow); } - // If we have an empty list then don't store it. - if (list->empty()) - { - delete list; - return; - } - // The value was well formed. - Set(user, list); + if (list) + Set(user, list); } std::string ToInternal(const Extensible* container, void* item) const noexcept override { - dccallowlist* list = static_cast<dccallowlist*>(item); + auto* list = static_cast<dccallowlist*>(item); std::string buf; - for (dccallowlist::const_iterator iter = list->begin(); iter != list->end(); ++iter) + for (const auto& entry : *list) { - if (iter != list->begin()) + if (!buf.empty()) buf.push_back(' '); - buf.append(iter->nickname); + buf.append(entry.nickname); buf.push_back(' '); - buf.append(iter->hostmask); + buf.append(entry.hostmask); buf.push_back(' '); - buf.append(ConvToStr(iter->set_on)); + buf.append(ConvToStr(entry.set_on)); buf.push_back(' '); - buf.append(ConvToStr(iter->length)); + buf.append(ConvToStr(entry.length)); } return buf; } |
