]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_namedmodes.cpp
Move some unused modules to -extras
[user/henk/code/inspircd.git] / src / modules / m_namedmodes.cpp
index 1ba39b54a36cd83c77d310cce5a79f758dc99971..020b1eb0a1d87340152e2011ac6ac2d54d958ed4 100644 (file)
@@ -23,10 +23,9 @@ static void DisplayList(User* user, Channel* channel)
                        continue;
                if (!channel->IsModeSet(letter))
                        continue;
-               std::string item = mh->name;
+               items << " +" << mh->name;
                if (mh->GetNumParams(true))
-                       item += "=" + channel->GetModeParameter(letter);
-               items << item << " ";
+                       items << " " << channel->GetModeParameter(letter);
        }
        char pfx[MAXBUF];
        snprintf(pfx, MAXBUF, ":%s 961 %s %s", ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), channel->name.c_str());
@@ -70,9 +69,8 @@ class CommandProp : public Command
                                        modes[1].append((plus ? "+" : "-") + std::string(1, letter));
                                        if (mh->GetNumParams(plus))
                                        {
-                                               if (i == parameters.size())
-                                                       return CMD_FAILURE;
-                                               modes.push_back(parameters[i++]);
+                                               if (i != parameters.size())
+                                                       modes.push_back(parameters[i++]);
                                        }
                                }
                        }
@@ -82,19 +80,31 @@ class CommandProp : public Command
        }
 };
 
+class DummyZ : public ModeHandler
+{
+ public:
+       DummyZ(Module* parent) : ModeHandler(parent, "namebase", 'Z', PARAM_ALWAYS, MODETYPE_CHANNEL)
+       {
+               list = true;
+       }
+};
+
 class ModuleNamedModes : public Module
 {
        CommandProp cmd;
+       DummyZ dummyZ;
  public:
-       ModuleNamedModes() : cmd(this)
+       ModuleNamedModes() : cmd(this), dummyZ(this)
        {
        }
 
        void init()
        {
                ServerInstance->Modules->AddService(cmd);
-               Implementation eventlist[] = { I_OnPreMode, I_On005Numeric };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               ServerInstance->Modules->AddService(dummyZ);
+
+               Implementation eventlist[] = { I_OnPreMode };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
        Version GetVersion()
@@ -107,18 +117,6 @@ class ModuleNamedModes : public Module
                ServerInstance->Modules->SetPriority(this, I_OnPreMode, PRIORITY_FIRST);
        }
 
-       void On005Numeric(std::string& line)
-       {
-               std::string::size_type pos = line.find(" CHANMODES=");
-               if (pos != std::string::npos)
-               {
-                       pos += 11;
-                       while (line[pos] > 'A' && line[pos] < 'Z')
-                               pos++;
-                       line.insert(pos, 1, 'Z');
-               }
-       }
-
        ModResult OnPreMode(User* source, User* dest, Channel* channel, const std::vector<std::string>& parameters)
        {
                if (!channel)