From df2a3d6fc49ec91b2e0396667df8038fc33b8063 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 29 Nov 2019 13:43:49 +0000 Subject: Minor cleanup of the conn_umodes module. --- src/modules/m_conn_umodes.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index ceb1b66fa..d76e21d60 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -32,22 +32,18 @@ class ModuleModesOnConnect : public Module void OnUserConnect(LocalUser* user) CXX11_OVERRIDE { - ConfigTag* tag = user->MyClass->config; - std::string ThisModes = tag->getString("modes"); - if (!ThisModes.empty()) - { - std::string buf; - irc::spacesepstream ss(ThisModes); - - CommandBase::Params modes; - modes.push_back(user->nick); - - // split ThisUserModes into modes and mode params - while (ss.GetToken(buf)) - modes.push_back(buf); - - ServerInstance->Parser.CallHandler("MODE", modes, user); - } + const std::string modestr = user->MyClass->config->getString("modes"); + if (modestr.empty()) + return; + + CommandBase::Params params; + params.push_back(user->nick); + + irc::spacesepstream modestream(modestr); + for (std::string modetoken; modestream.GetToken(modetoken); ) + params.push_back(modetoken); + + ServerInstance->Parser.CallHandler("MODE", params, user); } }; -- cgit v1.2.3