You would need quite a sofisticated TCL script to do that. It is not all that hard to make it, but requires moderate knowladge of TCL and RFC. There are (afaik) scripts out there that do that.
However, here is some pseudo code to help you if you decide to write it yourself:
# setup a bind that fires everytime nick containing "sex" joinsany channel
bind join - *sex* send:whois
# setup a bind that intercepts part of whois reply that contains channel names
bind raw - 319 got:319
# procedure send:whois should just dump WHOIS to server
proc send:whois {nick uhost handle channel} {
putquick "WHOIS $nick"
}
# procedure got:319 should play a bit with the reply from the server to determine if user is on a forbiden channel.
proc got:319 {from keyword text} {
some arbitary code here....
}
Note that procedure got:319 is quite tricky to write. It will return
string that looks something like this:
<your bot's nick> <nick that you whoised> #foo @#bar -#foobar @!localfoobar
You've got to familiarise yourself with the possible combinations of !, #, +, @, -, % ect... and comeup with a code that will succesfully mask them out leaving you with pure channel name, that can then be matched. Info can be found on
www.irchelp.org in RFC archives. Note that reply is a string and not a list, so i also suggest splitting it on whitespace to get a valid TCL list composed of elements that can be processed later.
Also, you should probably make something to do initial scan upon bot joining the channel to see if there already are users from the forbiden channels.
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.