diff options
| author | 2022-03-09 17:13:54 +0000 | |
|---|---|---|
| committer | 2022-03-09 17:14:06 +0000 | |
| commit | 9e3c44ef20e8811659b6ff60638eaecaa2be60f5 (patch) | |
| tree | a1a3e994b651264f65f00475e2a29f4ed8c06bbe /src/modules/m_chanlog.cpp | |
| parent | Use windows-2019 for Windows builds. (diff) | |
Improve chanlog config reading.
Diffstat (limited to 'src/modules/m_chanlog.cpp')
| -rw-r--r-- | src/modules/m_chanlog.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index c80b4691c..68e6673a8 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -38,20 +38,20 @@ class ModuleChanLog : public Module public: void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - std::string snomasks; - std::string channel; ChanLogTargets newlogs; ConfigTagList tags = ServerInstance->Config->ConfTags("chanlog"); for (ConfigIter i = tags.first; i != tags.second; ++i) { - channel = i->second->getString("channel"); - snomasks = i->second->getString("snomasks"); + ConfigTag* tag = i->second; - if (channel.empty() || snomasks.empty()) - { - throw ModuleException("Malformed chanlog tag at " + i->second->getTagLocation()); - } + const std::string channel = tag->getString("channel"); + if (!ServerInstance->IsChannel(channel)) + throw ModuleException("<chanlog:channel> must be set to a channel name, at " + tag->getTagLocation()); + + const std::string snomasks = tag->getString("snomasks"); + if (snomasks.empty()) + throw ModuleException("<chanlog:snomasks> must not be empty, at " + tag->getTagLocation()); for (std::string::const_iterator it = snomasks.begin(); it != snomasks.end(); it++) { @@ -59,8 +59,8 @@ class ModuleChanLog : public Module ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Logging %c to %s", *it, channel.c_str()); } } - logstreams.swap(newlogs); + logstreams.swap(newlogs); } ModResult OnSendSnotice(char &sno, std::string &desc, const std::string &msg) CXX11_OVERRIDE |
