diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-08-30 16:12:39 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-08-30 16:12:39 +0200 |
commit | cf6a8ee7e3fb11ea19d627216f53118c563a0a71 (patch) | |
tree | 6111e8b977604cb542c037c4b7699a844b7459bf /src/modules/m_spanningtree | |
parent | f0debf907a36846e3b48767e9797880135a4583b (diff) |
Replace loop over alphabet with loop over mode list in several places
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/capab.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index b75fbc3cc..a2e68aa61 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -82,22 +82,20 @@ std::string TreeSocket::MyModules(int filter) static std::string BuildModeList(ModeType type) { std::vector<std::string> modes; - for(char c='A'; c <= 'z'; c++) + const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes.GetModes(type); + for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i) { - ModeHandler* mh = ServerInstance->Modes->FindMode(c, type); - if (mh) + const ModeHandler* const mh = i->second; + std::string mdesc = mh->name; + mdesc.push_back('='); + const PrefixMode* const pm = mh->IsPrefixMode(); + if (pm) { - std::string mdesc = mh->name; - mdesc.push_back('='); - PrefixMode* pm = mh->IsPrefixMode(); - if (pm) - { - if (pm->GetPrefix()) - mdesc.push_back(pm->GetPrefix()); - } - mdesc.push_back(mh->GetModeChar()); - modes.push_back(mdesc); + if (pm->GetPrefix()) + mdesc.push_back(pm->GetPrefix()); } + mdesc.push_back(mh->GetModeChar()); + modes.push_back(mdesc); } std::sort(modes.begin(), modes.end()); return irc::stringjoiner(modes); |