]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_namedmodes.cpp
Merge pull request #1141 from SaberUK/master+windows-purge
[user/henk/code/inspircd.git] / src / modules / m_namedmodes.cpp
index 9c7b24666eeba64a270be87855d885357cb3ac84..7f2687d66280b74ed5aa74e407cc2742d5b53312 100644 (file)
 
 static void DisplayList(LocalUser* user, Channel* channel)
 {
-       std::stringstream items;
+       Numeric::ParamBuilder<1> numeric(user, 961);
+       numeric.AddStatic(channel->name);
+
        const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL);
        for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i)
        {
                ModeHandler* mh = i->second;
                if (!channel->IsModeSet(mh))
                        continue;
-               items << " +" << mh->name;
-               if (mh->GetNumParams(true))
+               numeric.Add("+" + mh->name);
+               if (mh->NeedsParam(true))
                {
                        if ((mh->name == "key") && (!channel->HasUser(user)) && (!user->HasPrivPermission("channels/auspex")))
-                               items << " <key>";
+                               numeric.Add("<key>");
                        else
-                               items << " " << channel->GetModeParameter(mh);
+                               numeric.Add(channel->GetModeParameter(mh));
                }
        }
-       const std::string line = ":" + ServerInstance->Config->ServerName + " 961 " + user->nick + " " + channel->name;
-       user->SendText(line, items);
+       numeric.Flush();
        user->WriteNumeric(960, channel->name, "End of mode list");
 }
 
@@ -79,7 +80,7 @@ class CommandProp : public SplitCommand
                        ModeHandler* mh = ServerInstance->Modes->FindMode(prop, MODETYPE_CHANNEL);
                        if (mh)
                        {
-                               if (mh->GetNumParams(plus))
+                               if (mh->NeedsParam(plus))
                                {
                                        if (i != parameters.size())
                                                modes.push(mh, plus, parameters[i++]);
@@ -123,7 +124,7 @@ class ModuleNamedModes : public Module
                return Version("Provides the ability to manipulate modes via long names.",VF_VENDOR);
        }
 
-       void Prioritize()
+       void Prioritize() CXX11_OVERRIDE
        {
                ServerInstance->Modules->SetPriority(this, I_OnPreMode, PRIORITY_FIRST);
        }
@@ -160,7 +161,7 @@ class ModuleNamedModes : public Module
                                }
 
                                curr.param.clear();
-                               if (mh->GetNumParams(curr.adding))
+                               if (mh->NeedsParam(curr.adding))
                                {
                                        if (value.empty())
                                        {