diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 19 | ||||
-rw-r--r-- | src/modules/m_namedmodes.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 8 |
3 files changed, 20 insertions, 14 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index cbb8661ae..88d89a35b 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -408,16 +408,23 @@ void ModuleManager::DoSafeUnload(Module* mod) mod->OnCleanup(TYPE_USER, user); user->doUnhookExtensions(items); } - for(char m='A'; m <= 'z'; m++) + + const ModeParser::ModeHandlerMap& usermodes = ServerInstance->Modes->GetModes(MODETYPE_USER); + for (ModeParser::ModeHandlerMap::const_iterator i = usermodes.begin(); i != usermodes.end(); ++i) { - ModeHandler* mh; - mh = ServerInstance->Modes->FindMode(m, MODETYPE_USER); - if (mh && mh->creator == mod) + ModeHandler* mh = i->second; + if (mh->creator == mod) this->DelService(*mh); - mh = ServerInstance->Modes->FindMode(m, MODETYPE_CHANNEL); - if (mh && mh->creator == mod) + } + + const ModeParser::ModeHandlerMap& chanmodes = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL); + for (ModeParser::ModeHandlerMap::const_iterator i = chanmodes.begin(); i != chanmodes.end(); ++i) + { + ModeHandler* mh = i->second; + if (mh->creator == mod) this->DelService(*mh); } + for(std::multimap<std::string, ServiceProvider*>::iterator i = DataProviders.begin(); i != DataProviders.end(); ) { std::multimap<std::string, ServiceProvider*>::iterator curr = i++; diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index e8b90caa3..5c0ffeea5 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -22,11 +22,10 @@ static void DisplayList(User* user, Channel* channel) { std::stringstream items; - for(char letter = 'A'; letter <= 'z'; letter++) + const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL); + for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i) { - ModeHandler* mh = ServerInstance->Modes->FindMode(letter, MODETYPE_CHANNEL); - if (!mh || mh->IsListMode()) - continue; + ModeHandler* mh = i->second; if (!channel->IsModeSet(mh)) continue; items << " +" << mh->name; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index d697af63d..ea7711332 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -214,16 +214,16 @@ void CommandFJoin::RemoveStatus(Channel* c) { irc::modestacker stack(false); - for (char modeletter = 'A'; modeletter <= 'z'; ++modeletter) + const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL); + for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i) { - ModeHandler* mh = ServerInstance->Modes->FindMode(modeletter, MODETYPE_CHANNEL); + ModeHandler* mh = i->second; /* Passing a pointer to a modestacker here causes the mode to be put onto the mode stack, * rather than applied immediately. Module unloads require this to be done immediately, * for this function we require tidyness instead. Fixes bug #493 */ - if (mh) - mh->RemoveMode(c, stack); + mh->RemoveMode(c, stack); } ApplyModeStack(ServerInstance->FakeClient, c, stack); |