#--------------------------------------------------------------------- # Angelvoice # Upon each ".next" command on the partyline or in public, a nick is # voiced. Voicing is in chronological order of nicks that joined # after the bot joined. # Nicks already on the channel before the bot joined are excluded. # Exception: all nick!uhosts associated with the handle "novoice" # (.+user novoice) will not be voiced. # v0: 29-Jan-2002 # v1: 30-Jan-2002 # v2: 01-Feb-2002 # v3: 10-Feb-2002 # + accept both dcc & pub #--------------------------------------------------------------------- #--------------------------------------------------------------------- # dcc & pub binding # Change the flags of these bindings to your specific taste. #--------------------------------------------------------------------- bind dcc - next dccangelvoice bind pub o|o .next pubangelvoice #--------------------------------------------------------------------- # procs triggered by bindings #--------------------------------------------------------------------- proc dccangelvoice { handle idx arg } { set channel [lindex [console $idx] 0] set retstring [angelvoice $channel] putdcc $idx $retstring } proc pubangelvoice { nick uhost hand chan arg } { set retstring [angelvoice $chan] puthelp "NOTICE $nick :$retstring" return 1 } #--------------------------------------------------------------------- # Proc for voicing. # This proc must return a one line string and may voice a nick. #--------------------------------------------------------------------- proc angelvoice { channel } { global botnick # forget about it if it is an invalid channel if {![validchan $channel]} { return "I am not monitoring $channel." } # forget about it if the bot doesn't have op. if {![botisop $channel]} { return "I am not an op on $channel." } # assumptions/guesses/questions on [chanlist]: # - [chanlist] is in chronological order of joining # - when the bot joins, it will put itself on top of [chanlist] # and set the timestamps of all other nicks to 0 (zero). # - botnick ever not on top of the [chanlist]? set checklist [chanlist $channel] # if botnick is the only nick ... if {[llength $checklist ] <= 1 } { return "No nicks found to voice on $channel." } # bot on top of list, skip set checklist [lrange $checklist 1 end] # init set servedvoice 0 foreach nick $checklist { # skip all nicks before the bot joined ... if {[getchanjoin $nick $channel] == 0} { continue } # skip if nick has ops ... if {[isop $nick $channel]} { continue } # skip if already voiced ... if {[isvoice $nick $channel]} { continue } # not on channel? (from tcl-commands.doc it seems possible) if {![onchan $nick $channel]} { continue } # skip if nick is associated with handle "novoice" set hand [nick2hand $nick $channel] if {[string compare $hand "novoice"] == 0} { continue } # found a nick ... putserv "MODE $channel +v $nick" set servedvoice $nick break } if { $servedvoice == 0 } { return "No nicks found to voice on $channel." } else { return "Voiced $servedvoice on $channel." } } putlog "Angel voice version 3 loaded."