X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_channames.cpp;h=b5f5853e739bfc0acfbf7af0bf9c54d9cf6af254;hb=8d172c077e41e08e3864615538c6b06f07f24d84;hp=559ec5314e6d324101e8b823fc3da36259a68775;hpb=ac7defcd3e52695dcf5e5150e9fe3e1624205e64;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index 559ec5314..b5f5853e7 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -63,7 +63,7 @@ class ModuleChannelNames : public Module { ServerInstance->IsChannel = &myhandler; Implementation eventlist[] = { I_OnRehash, I_OnUserKick }; - ServerInstance->Modules->Attach(eventlist, this, 2); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } @@ -89,9 +89,17 @@ class ModuleChannelNames : public Module ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient); } const UserMembList* users = c->GetUsers(); - for(UserMembCIter j = users->begin(); j != users->end(); ++j) + for(UserMembCIter j = users->begin(); j != users->end(); ) + { if (IS_LOCAL(j->first)) - c->KickUser(ServerInstance->FakeClient, j->first, "Channel name no longer valid"); + { + // KickUser invalidates the iterator + UserMembCIter it = j++; + c->KickUser(ServerInstance->FakeClient, it->first, "Channel name no longer valid"); + } + else + ++j; + } } badchan = false; }