diff options
| author | 2010-08-24 19:14:00 -0400 | |
|---|---|---|
| committer | 2010-08-24 19:14:00 -0400 | |
| commit | 2465f16ed9cd80da76542fc722465f28cfb911cd (patch) | |
| tree | 662c5996179a367c8c2ba0d7dd6a91f68259ed13 /src/modules/m_timedmodes.cpp | |
| parent | Add options to config to recheck autoop upon logging in or changing host (diff) | |
| download | inspircd++-2465f16ed9cd80da76542fc722465f28cfb911cd.tar.gz inspircd++-2465f16ed9cd80da76542fc722465f28cfb911cd.tar.bz2 inspircd++-2465f16ed9cd80da76542fc722465f28cfb911cd.zip | |
Prevent using /TMODE to register channels over the limit
Diffstat (limited to 'src/modules/m_timedmodes.cpp')
| -rw-r--r-- | src/modules/m_timedmodes.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/m_timedmodes.cpp b/src/modules/m_timedmodes.cpp index af1fef8d1..b7f77d4b8 100644 --- a/src/modules/m_timedmodes.cpp +++ b/src/modules/m_timedmodes.cpp @@ -162,9 +162,14 @@ class CommandTmode : public Command if(modes.sequence.empty()) return CMD_SUCCESS; stable_sort(modes.sequence.begin(), modes.sequence.end(), &modeChangeLessThan); T.modes = modes; + ModeHandler* regmh = ServerInstance->Modes->FindMode("registered"); for (std::vector<irc::modechange>::iterator iter = T.modes.sequence.begin(); iter != T.modes.sequence.end();) { ModeHandler* mh = ServerInstance->Modes->FindMode(iter->mode); + if(mh == regmh && !user->HasPrivPermission("channels/set-registration", false)) { + iter = T.modes.sequence.erase(iter); + continue; + } if(!iter->adding) { // if we're about to remove the mode now if(mh->GetNumParams(true) && !mh->IsListMode()) // and it needs a parameter to put back iter->value = channel->GetModeParameter(mh); // then save the parameter we have now @@ -187,14 +192,20 @@ class CommandTmode : public Command } ++iter; } - for (std::vector<irc::modechange>::iterator iter = modes.sequence.begin(); iter != modes.sequence.end(); ++iter) + for (std::vector<irc::modechange>::iterator iter = modes.sequence.begin(); iter != modes.sequence.end();) { ModeHandler* mh = ServerInstance->Modes->FindMode(iter->mode); + if(mh == regmh && !user->HasPrivPermission("channels/set-registration", false)) { + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission denied - you may not set the registered channel mode as a timed mode", user->nick.c_str()); + iter = modes.sequence.erase(iter); + continue; + } if(mh->GetNumParams(iter->adding) && mh->GetTranslateType() == TR_NICK) { // if this mode takes a nick as a parameter User* u = ServerInstance->FindNick(iter->value); // look for the user with the given nick if(u) iter->value = u->uuid; // and change it to the UID if we found them // otherwise, let SendMode remove it and tell the user } + ++iter; } current = &T; |
