diff options
-rw-r--r-- | docs/inspircd.conf.example | 3 | ||||
-rw-r--r-- | src/modules/m_denychans.cpp | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example index 4735ffd48..b09c7256d 100644 --- a/docs/inspircd.conf.example +++ b/docs/inspircd.conf.example @@ -1573,7 +1573,10 @@ # # # reason - Reason given for the deny. # # # +# redirect - Redirect the user to a different channel # +# # #<badchan name="#gods*" allowopers="yes" reason="Tortoises!"> # +#<badchan name="#heaven" redirect="#hell" reason="Nice try!"> # # # # Additionally, you may specify channels which are allowed, even if # # a badchan tag specifies it would be denied: # diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 7daf225ca..2605bcec2 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -62,6 +62,7 @@ class ModuleDenyChannels : public Module else { std::string reason = Conf->ReadValue("badchan","reason",j); + std::string redirect = Conf->ReadValue("badchan","redirect",j); for (int j = 0; j < Conf->Enumerate("goodchan"); j++) { @@ -70,6 +71,13 @@ class ModuleDenyChannels : public Module return 0; } } + + if (ServerInstance->IsChannel(redirect.c_str())) + { + user->writeserv("926 %s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick,cname,cname,redirect.c_str(), reason.c_str()); + Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time(true)); + return 1; + } user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str()); return 1; |