summaryrefslogtreecommitdiff
path: root/src/modules/m_namedmodes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_namedmodes.cpp')
-rw-r--r--src/modules/m_namedmodes.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp
index 10bef981a..d4263d899 100644
--- a/src/modules/m_namedmodes.cpp
+++ b/src/modules/m_namedmodes.cpp
@@ -19,38 +19,40 @@
#include "inspircd.h"
-static void DisplayList(User* user, Channel* channel)
+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;
+ numeric.Add("+" + mh->name);
if (mh->GetNumParams(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");
}
-class CommandProp : public Command
+class CommandProp : public SplitCommand
{
public:
- CommandProp(Module* parent) : Command(parent, "PROP", 1)
+ CommandProp(Module* parent)
+ : SplitCommand(parent, "PROP", 1)
{
syntax = "<user|channel> {[+-]<mode> [<value>]}*";
}
- CmdResult Handle(const std::vector<std::string> &parameters, User *src)
+ CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* src)
{
Channel* const chan = ServerInstance->FindChan(parameters[0]);
if (!chan)
@@ -103,7 +105,8 @@ class DummyZ : public ModeHandler
// Handle /MODE #chan Z
void DisplayList(User* user, Channel* chan)
{
- ::DisplayList(user, chan);
+ if (IS_LOCAL(user))
+ ::DisplayList(static_cast<LocalUser*>(user), chan);
}
};