bind dcc - note+ flagnote4.0 proc flagnote4.0 {hand idx arg} { regsub -all {\*} $arg "" arg set flagpourtous "A G T C" set flagpouradmins "A G C T E O J M R P H" set flag [lindex $arg 0] set message [lrange $arg 1 end] set projet "" if {[string index $flag 0] == "+"} { set flag [string range $flag 1 end] } if {$flag == ""} { notebug $idx return 0 } if {([string tolower $flag] == "projet") && [matchattr $hand GTRP]} { set ou 0 set ici 0 foreach mot $message { incr ou if {($mot == "+") && !$ici} { set ici $ou } } if !$ici { notebug $idx return 0 } else { set projet [lrange $message 0 [expr $ici - 2]] set message [lrange $message $ici end] } if {((![string match *[string tolower $projet]* [string tolower "[getuser $hand xtra responsable] [getuser $hand xtra adjoint] [getuser $hand xtra participant]"]]) && ![matchattr $hand GT]) | ($projet == "")} { notebug $idx return 0 } set destinataires "" foreach user [userlist RP] { if [string match *[string tolower $projet]* [string tolower "[getuser $user xtra responsable] [getuser $user xtra adjoint] [getuser $user xtra participant]"]] { lappend destinataires $user } } } elseif {([string tolower $flag] == "membres") && [matchattr $hand A]} { set destinataires [userlist AGTCOJMRPH] } elseif [matchattr $hand A] { for {set i 0} {$i < [string length $flag]} {incr i} { if ![string match *[string index $flag $i]* $flagpouradmins] { notebug $idx return 0 } } set destinataires [userlist $flag] } else { for {set i 0} {$i < [string length $flag]} {incr i} { if ![string match *[string index $flag $i]* $flagpourtous] { notebug $idx return 0 } } set destinataires [userlist $flag] } if {($message == "") || ($destinataires == "")} { notebug $idx return 0 } if {$projet == ""} { set boldflag "\[\002+$flag\002\]" } else { set boldflag "\[\002+$flag $projet\002\]" } if {[string tolower $hand] != [string tolower [getuser $hand xtra vrainick]]} { set plus " (-[getuser $hand xtra vrainick])" } else { set plus "" } putlog "#$hand# note+ \[+$flag\] ..." putdcc $idx "*** La note est envoyée à tous les membres: $boldflag" foreach user $destinataires { if ![matchattr $user b] { sendnote $hand $user "$boldflag $message$plus" if {[notes $user] > 90} { dcc_mailnotes $user -1 "" erasenotes $user 1-90 } } } return 0 } proc notebug { idx } { putdcc $idx "## Syntaxe: .note+ <\[+\]attribut|Projet|Membres> \[ <+>\] " putdcc $idx " Le second + est optionel. Dans le cas 'projet', le 3em + est obligatoire. Le nom du projet doit respecter les majuscules," putdcc $idx " Pour rejoindre respectivement tous les admins, les admins généraux, les admins canal ou les admins projets, utiliser: +A +G +C ou +T" putdcc $idx " L'option Membres est réservée aux admins, l'option Projet ne peut permettre que de rejoindre les membres d'un projet où l'on participe." putdcc $idx " Les admins peuvent utiliser les autres 'flags'. L'option projet est aussi accessible pour les admins projet de façon libre." }