diff options
author | Peter Powell <petpow@saberuk.com> | 2019-11-29 13:43:49 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-11-29 13:43:49 +0000 |
commit | df2a3d6fc49ec91b2e0396667df8038fc33b8063 (patch) | |
tree | cfecc6d10a386327077613705ae839fee2cea56a | |
parent | 965460400b271a178cc415783414de43c89341bf (diff) |
Minor cleanup of the conn_umodes module.
-rw-r--r-- | src/modules/m_conn_umodes.cpp | 28 |
1 files 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); } }; |