summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-29 19:37:20 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-29 19:37:20 +0000
commit292291100c8f27e79f6829cbe9c74300f1604f0b (patch)
tree45e1b2fe2528d50edf4cd1db38c994dc5135a9bc
parent5ae91f09031b0452f5cc201d0917aec5ed439c60 (diff)
Fix m_redirect to work properly with SAMODE
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11339 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_redirect.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 8e66060b8..f778b5fef 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -30,38 +30,35 @@ class Redirect : public ModeHandler
return std::make_pair(false, parameter);
}
- bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
- {
- /* When TS is equal, the alphabetically later one wins */
- return (their_param < our_param);
- }
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool server)
{
if (adding)
{
- Channel* c = NULL;
-
- if (IS_LOCAL(source) && !ServerInstance->IsChannel(parameter.c_str(), ServerInstance->Config->Limits.ChanMax))
- {
- source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
- parameter.clear();
- return MODEACTION_DENY;
- }
-
- c = ServerInstance->FindChan(parameter);
- if (!c && !IS_OPER(source))
+ if (IS_LOCAL(source))
{
- source->WriteNumeric(690, "%s :Target channel %s must exist to be set as a redirect.",source->nick.c_str(),parameter.c_str());
- parameter.clear();
- return MODEACTION_DENY;
+ if (!ServerInstance->IsChannel(parameter.c_str(), ServerInstance->Config->Limits.ChanMax))
+ {
+ source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
+ parameter.clear();
+ return MODEACTION_DENY;
+ }
}
- if (c && c->GetStatus(source) < STATUS_OP && !IS_OPER(source))
+ if (IS_LOCAL(source) && !IS_OPER(source) && !server)
{
- source->WriteNumeric(690, "%s :You must be opped on %s to set it as a redirect.",source->nick.c_str(),parameter.c_str());
- parameter.clear();
- return MODEACTION_DENY;
+ Channel* c = ServerInstance->FindChan(parameter);
+ if (!c)
+ {
+ source->WriteNumeric(690, "%s :Target channel %s must exist to be set as a redirect.",source->nick.c_str(),parameter.c_str());
+ parameter.clear();
+ return MODEACTION_DENY;
+ }
+ else if (c->GetStatus(source) < STATUS_OP)
+ {
+ source->WriteNumeric(690, "%s :You must be opped on %s to set it as a redirect.",source->nick.c_str(),parameter.c_str());
+ parameter.clear();
+ return MODEACTION_DENY;
+ }
}
/*