The simplest way imho is to add a flag to the channels to enable/disable the feature.
Now, I'm not sure to understand the query: do you want to disallow the usage of the pub command in channels or do you want to forbid the display of the message in channels ?
To block the command on channels:
Code: Select all
setudef flag nopub
proc pub:global {nick uhost handle chan text} {
if {[matchattr $hand G]} {
if {[channel get $chan nopub]} { return }
foreach c [channels] {
putserv "PRIVMSG $c :\002AANKONDIGING:\002 $nick: $text"
}
} else {
putserv "NOTICE $nick :U hebt geen toegang."
}
}
To block the display of the message in channels:
Code: Select all
setudef flag nopub
proc pub:global {nick uhost handle chan text} {
if {[matchattr $hand G]} {
if {[string tolower $chan] eq "#ircop"} { return }
foreach c [channels] {
if {[channel get $c nopub]} { continue }
putserv "PRIVMSG $c :\002AANKONDIGING:\002 $nick: $text"
}
} else {
putserv "NOTICE $nick :U hebt geen toegang."
}
}
And in the two case, you have to do
.chanset #channel +nopub to forbid the usage or the display on #channel.
Note that the second script disallow the command in #ircop in any case