X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_channames.cpp;h=d0d122b436c91225e7a953f5fdcfb1fa2b05f569;hb=de4e4860091fe5a9a530acdb25f9a17e22323acf;hp=b4266e63b38975ba40bfea3abd5260d127c86e30;hpb=04ece67c3d8534f74a3d75ec77378cb57a9c044e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index b4266e63b..d0d122b43 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -21,10 +21,10 @@ static std::bitset<256> allowedmap; -class NewIsChannelHandler : public HandlerBase1 +class NewIsChannelHandler { public: - bool Call(const std::string&); + static bool Call(const std::string&); }; bool NewIsChannelHandler::Call(const std::string& channame) @@ -44,8 +44,7 @@ bool NewIsChannelHandler::Call(const std::string& channame) class ModuleChannelNames : public Module { - NewIsChannelHandler myhandler; - caller1 rememberer; + TR1NS::function rememberer; bool badchan; ChanModeReference permchannelmode; @@ -59,11 +58,13 @@ class ModuleChannelNames : public Module void init() CXX11_OVERRIDE { - ServerInstance->IsChannel = &myhandler; + ServerInstance->IsChannel = NewIsChannelHandler::Call; } void ValidateChans() { + Modes::ChangeList removepermchan; + badchan = true; const chan_hash& chans = ServerInstance->GetChans(); for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ) @@ -76,19 +77,18 @@ class ModuleChannelNames : public Module if (c->IsModeSet(permchannelmode) && c->GetUserCounter()) { - std::vector modes; - modes.push_back(c->name); - modes.push_back(std::string("-") + permchannelmode->GetModeChar()); - - ServerInstance->Modes->Process(modes, ServerInstance->FakeClient); + removepermchan.clear(); + removepermchan.push_remove(*permchannelmode); + ServerInstance->Modes->Process(ServerInstance->FakeClient, c, NULL, removepermchan); } + Channel::MemberMap& users = c->userlist; - for (UserMembIter j = users.begin(); j != users.end(); ) + for (Channel::MemberMap::iterator j = users.begin(); j != users.end(); ) { if (IS_LOCAL(j->first)) { // KickUser invalidates the iterator - UserMembIter it = j++; + Channel::MemberMap::iterator it = j++; c->KickUser(ServerInstance->FakeClient, it, "Channel name no longer valid"); } else @@ -133,7 +133,7 @@ class ModuleChannelNames : public Module if (badchan) { const Channel::MemberMap& users = memb->chan->GetUsers(); - for (UserMembCIter i = users.begin(); i != users.end(); ++i) + for (Channel::MemberMap::const_iterator i = users.begin(); i != users.end(); ++i) if (i->first != memb->user) except_list.insert(i->first); }