summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_conn_umodes.cpp28
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);
}
};