diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-13 17:47:35 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-13 17:47:35 +0000 |
commit | 5f02706fb0a3db069a2e5a7754c2aad91cbe86e4 (patch) | |
tree | 7682bffdb4366c119b064a7db4b6cd37bbf4b8bd | |
parent | 456516e3f5372cb0e8f135ce39d4de7df988cb93 (diff) |
Merge jamies many patches
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5223 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_joinflood.cpp | 27 | ||||
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 39 | ||||
-rw-r--r-- | src/modules/m_services.cpp | 4 |
3 files changed, 64 insertions, 6 deletions
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index c7b5700d2..391f13b24 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -157,6 +157,33 @@ class JoinFlood : public ModeHandler channel->SetModeParam('j', parameter.c_str(), true); return MODEACTION_ALLOW; } + else + { + std::string cur_param = channel->GetModeParameter('j'); + parameter = ConvToStr(njoins) + ":" +ConvToStr(nsecs); + if (cur_param == parameter) + { + // mode params match + return MODEACTION_DENY; + } + else + { + // new mode param, replace old with new + if ((!nsecs) && (!njoins)) + { + joinfloodsettings *f = new joinfloodsettings(nsecs,njoins); + channel->Shrink("joinflood"); + channel->Extend("joinflood", f); + channel->SetModeParam('j', cur_param.c_str(), false); + channel->SetModeParam('j', parameter.c_str(), true); + return MODEACTION_ALLOW; + } + else + { + return MODEACTION_DENY; + } + } + } } } else diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index fddcae288..4845e633e 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -55,10 +55,41 @@ class KickRejoin : public ModeHandler } if ((!adding) || (atoi(parameter.c_str()) > 0)) { - parameter = ConvToStr(atoi(parameter.c_str())); - channel->SetModeParam('J', parameter.c_str(), adding); - channel->SetMode('J', adding); - return MODEACTION_ALLOW; + ServerInstance->Log(DEBUG,"Got parameter: '%s'",parameter.c_str()); + + if (!channel->IsModeSet('J')) + { + parameter = ConvToStr(atoi(parameter.c_str())); + channel->SetModeParam('J', parameter.c_str(), adding); + channel->SetMode('J', adding); + return MODEACTION_ALLOW; + } + else + { + std::string cur_param = channel->GetModeParameter('J'); + if (cur_param == parameter) + { + // mode params match, don't change mode + return MODEACTION_DENY; + } + else + { + // new mode param, replace old with new + parameter = ConvToStr(atoi(parameter.c_str())); + cur_param = ConvToStr(atoi(cur_param.c_str())); + if (parameter != "0") + { + channel->SetModeParam('J', cur_param.c_str(), false); + channel->SetModeParam('J', parameter.c_str(), adding); + return MODEACTION_ALLOW; + } + else + { + /* Fix to jamie's fix, dont allow +J 0 on the new value! */ + return MODEACTION_DENY; + } + } + } } else { diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 856a93b85..63f04287a 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -231,7 +231,7 @@ class ModuleServices : public Module if (target_type == TYPE_USER) { userrec* u = (userrec*)dest; - if ((u->IsModeSet('R')) && (user->IsModeSet('r'))) + if ((u->IsModeSet('R')) && (!user->IsModeSet('r'))) { if ((ServerInstance->ULine(user->nick)) || (ServerInstance->ULine(user->server))) { @@ -257,7 +257,7 @@ class ModuleServices : public Module { if (chan->IsModeSet('R')) { - if (user->IsModeSet('r')) + if (!user->IsModeSet('r')) { if ((ServerInstance->ULine(user->nick)) || (ServerInstance->ULine(user->server))) { |