]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_channames.cpp
m_spanningtree Add ServerCommand::ExtractTS() to convert string to raw TS
[user/henk/code/inspircd.git] / src / modules / m_channames.cpp
index 4228d505033ccae1fa7e050ec9db51c3cc1b69b8..69b501792c77830bf407ecb7549e048d4ccdaff5 100644 (file)
@@ -24,8 +24,6 @@ static std::bitset<256> allowedmap;
 class NewIsChannelHandler : public HandlerBase1<bool, const std::string&>
 {
  public:
-       NewIsChannelHandler() { }
-       ~NewIsChannelHandler() { }
        bool Call(const std::string&);
 };
 
@@ -62,14 +60,14 @@ class ModuleChannelNames : public Module
        void init() CXX11_OVERRIDE
        {
                ServerInstance->IsChannel = &myhandler;
-               OnRehash(NULL);
        }
 
        void ValidateChans()
        {
                badchan = true;
                std::vector<Channel*> chanvec;
-               for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); ++i)
+               const chan_hash& chans = ServerInstance->GetChans();
+               for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ++i)
                {
                        if (!ServerInstance->IsChannel(i->second->name))
                                chanvec.push_back(i->second);
@@ -82,7 +80,7 @@ class ModuleChannelNames : public Module
                        {
                                std::vector<std::string> modes;
                                modes.push_back(c->name);
-                               modes.push_back("-" + permchannelmode->GetModeChar());
+                               modes.push_back(std::string("-") + permchannelmode->GetModeChar());
 
                                ServerInstance->Modes->Process(modes, ServerInstance->FakeClient);
                        }
@@ -102,11 +100,17 @@ class ModuleChannelNames : public Module
                badchan = false;
        }
 
-       void OnRehash(User* user) CXX11_OVERRIDE
+       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("channames");
                std::string denyToken = tag->getString("denyrange");
                std::string allowToken = tag->getString("allowrange");
+
+               if (!denyToken.compare(0, 2, "0-"))
+                       denyToken[0] = '1';
+               if (!allowToken.compare(0, 2, "0-"))
+                       allowToken[0] = '1';
+
                allowedmap.set();
 
                irc::portparser denyrange(denyToken, false);