- OperPrefixMode(Module* Creator) : ModeHandler(Creator, "operprefix", 'y', PARAM_ALWAYS, MODETYPE_CHANNEL)
- {
- std::string pfx = ServerInstance->Config->ConfValue("operprefix")->getString("prefix", "!");
- list = true;
- prefix = pfx.empty() ? '!' : pfx[0];
- levelrequired = OPERPREFIX_VALUE;
- m_paramtype = TR_NICK;
- }
-
- unsigned int GetPrefixRank()
- {
- return OPERPREFIX_VALUE;
- }
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
- {
- if (IS_SERVER(source) || ServerInstance->ULine(source->server))
- return MODEACTION_ALLOW;
- else
- {
- if (channel)
- source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only servers are permitted to change channel mode '%c'", source->nick.c_str(), channel->name.c_str(), 'y');
- return MODEACTION_DENY;
- }
- }
-
- bool NeedsOper() { return true; }
-
- void RemoveMode(Channel* chan, irc::modestacker* stack)
- {
- irc::modestacker modestack(false);
- const UserMembList* users = chan->GetUsers();
- for (UserMembCIter i = users->begin(); i != users->end(); ++i)
- {
- if (i->second->hasMode(mode))
- {
- if (stack)
- stack->Push(this->GetModeChar(), i->first->nick);
- else
- modestack.Push(this->GetModeChar(), i->first->nick);
- }
- }
-
- if (stack)
- return;
-
- std::deque<std::string> stackresult;
- std::vector<std::string> mode_junk;
- mode_junk.push_back(chan->name);
- while (modestack.GetStackedLine(stackresult))
- {
- mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
- ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
- mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
- }
- }
-
- void RemoveMode(User* user, irc::modestacker* stack)