diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_autoop.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_exemptchanops.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_rmode.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/capab.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 2 |
5 files changed, 21 insertions, 19 deletions
diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index 8ecee9578..d195345ca 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -32,13 +32,13 @@ class AutoOpList : public ListModeBase tidy = false; } - ModeHandler* FindMode(const std::string& mid) + PrefixMode* FindMode(const std::string& mid) { if (mid.length() == 1) - return ServerInstance->Modes->FindMode(mid[0], MODETYPE_CHANNEL); + return ServerInstance->Modes->FindPrefixMode(mid[0]); for(char c='A'; c < 'z'; c++) { - ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); + PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(c); if (mh && mh->name == mid) return mh; } @@ -52,9 +52,9 @@ class AutoOpList : public ListModeBase return adding ? MOD_RES_DENY : MOD_RES_PASSTHRU; unsigned int mylevel = channel->GetPrefixValue(source); std::string mid = parameter.substr(0, pos); - ModeHandler* mh = FindMode(mid); + PrefixMode* mh = FindMode(mid); - if (adding && (!mh || !mh->GetPrefixRank())) + if (adding && !mh) { source->WriteNumeric(415, "%s %s :Cannot find prefix mode '%s' for autoop", source->nick.c_str(), mid.c_str(), mid.c_str()); @@ -103,8 +103,8 @@ class ModuleAutoOp : public Module continue; if (memb->chan->CheckBan(memb->user, it->mask.substr(colon+1))) { - ModeHandler* given = mh.FindMode(it->mask.substr(0, colon)); - if (given && given->GetPrefixRank()) + PrefixMode* given = mh.FindMode(it->mask.substr(0, colon)); + if (given) modeline.push_back(given->GetModeChar()); } } diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 068f503c3..5d8958665 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -61,13 +61,13 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std: ExemptChanOps ec; ExemptHandler(Module* me) : ec(me) {} - ModeHandler* FindMode(const std::string& mid) + PrefixMode* FindMode(const std::string& mid) { if (mid.length() == 1) - return ServerInstance->Modes->FindMode(mid[0], MODETYPE_CHANNEL); + return ServerInstance->Modes->FindPrefixMode(mid[0]); for(char c='A'; c < 'z'; c++) { - ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); + PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(c); if (mh && mh->name == mid) return mh; } @@ -93,7 +93,7 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std: } } - ModeHandler* mh = FindMode(minmode); + PrefixMode* mh = FindMode(minmode); if (mh && mypfx >= mh->GetPrefixRank()) return MOD_RES_ALLOW; if (mh || minmode == "*") diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp index 1bbbb37bf..6d17820a5 100644 --- a/src/modules/m_rmode.cpp +++ b/src/modules/m_rmode.cpp @@ -56,9 +56,8 @@ class CommandRMode : public Command return CMD_FAILURE; } - unsigned int prefixrank; - char prefixchar; std::string pattern = parameters.size() > 2 ? parameters[2] : "*"; + PrefixMode* pm; ListModeBase* lm; ListModeBase::ModeList* ml; irc::modestacker modestack(false); @@ -68,14 +67,14 @@ class CommandRMode : public Command if (chan->IsModeSet(mh)) modestack.Push(modeletter); } - else if (((prefixrank = mh->GetPrefixRank()) && (prefixchar = mh->GetPrefix()))) + else if ((pm = mh->IsPrefixMode())) { // As user prefix modes don't have a GetList() method, let's iterate through the channel's users. for (UserMembIter it = chan->userlist.begin(); it != chan->userlist.end(); ++it) { if (!InspIRCd::Match(it->first->nick, pattern)) continue; - if (((strchr(chan->GetAllPrefixChars(user), prefixchar)) != NULL) && !(it->first == user && prefixrank > VOICE_VALUE)) + if (it->second->hasMode(modeletter) && !((it->first == user) && (pm->GetPrefixRank() > VOICE_VALUE))) modestack.Push(modeletter, it->first->nick); } } diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index f4f1e1ace..7afcc50e5 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -59,10 +59,13 @@ static std::string BuildModeList(ModeType type) { std::string mdesc = mh->name; mdesc.push_back('='); - if (mh->GetPrefix()) - mdesc.push_back(mh->GetPrefix()); - if (mh->GetModeChar()) + PrefixMode* pm = mh->IsPrefixMode(); + if (pm) + { + if (pm->GetPrefix()) + mdesc.push_back(pm->GetPrefix()); mdesc.push_back(mh->GetModeChar()); + } modes.push_back(mdesc); } } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 0372172f5..6c3ee703c 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -163,7 +163,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet unsigned int minrank = 0; if (status) { - ModeHandler* mh = ServerInstance->Modes->FindPrefix(status); + PrefixMode* mh = ServerInstance->Modes->FindPrefix(status); if (mh) minrank = mh->GetPrefixRank(); } |