diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-10 18:23:03 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-10 18:23:03 +0000 |
commit | 5d09cbf63475851d6aaa7035d97787727ba456da (patch) | |
tree | 29ba9dcc997a9b45a229dd3c16690a3314fe0f3e | |
parent | 8e7fceba881712e481545d8908b1d6492bb5e5e5 (diff) |
Add <badchan:redirect>: redirects users attempting to join a bad channel to a second channel. Contributed by dz. (thanks)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8881 e03df62e-2008-0410-955e-edbf42e46eb7
-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; |