################ ### Potins ! ### ################ set maxlignes 5000 if ![info exists dernierpotin] { set lineinp "" set dernierpotin "0" } bind dcc - ragots dcc_ragots proc dcc_ragots {hand idx arg} { set max [expr [exec grep -c ===================================================== /aide/www/bot/potins.txt] - 2] set net 0 set fichier [open "/aide/www/bot/potins.txt" r] if {[matchattr $hand A] & ([lindex $arg 0] == "RETIRER") & [estunnombre:ok [lindex $arg 1]] & ([lindex $arg 1] < $max)} { set net 1 set arg [lindex $arg 1] set f2 [open "/aide/www/bot/potins.tmp" w] set f3 [open "/aide/www/bot/potins.html" w] puts $f3 "Les potins de #Aide

" set dedans 0 } if {[estunnombre:ok $arg] & ($arg < $max)} { while {$arg > 1} { set dernier [gets $fichier] if {$dernier == "====================================================="} { set arg [expr $arg - 1] } if $net { puts $f2 $dernier if {($dernier == "- - - - - - - - - - - - - - - - - - - - - - - - - - -") & !$dedans} { puts $f3 "
" set dedans 1 } elseif {($dernier == "=====================================================") & $dedans} { puts $f3 "

" set dedans 0 } elseif {($dernier == " ") & !$dedans} { puts $f3 "
" } else { puts $f3 "[cw_net $dernier]
" } } } set dernier [gets $fichier] while {$dernier != "====================================================="} { set dernier [gets $fichier] putdcc $idx $dernier } if $net { set dedans 0 putdcc $idx "4Ragot éliminé !" while {[gets $fichier dernier] >= 0} { puts $f2 $dernier if {($dernier == "- - - - - - - - - - - - - - - - - - - - - - - - - - -") & !$dedans} { puts $f3 "
" set dedans 1 } elseif {($dernier == "=====================================================") & $dedans} { puts $f3 "

" set dedans 0 } elseif {($dernier == " ") & !$dedans} { puts $f3 "
" } else { puts $f3 "[cw_net $dernier]
" } } } } elseif [validuser $arg] { set num 1 set qui [string tolower $arg] set dernier [gets $fichier] set dernier [gets $fichier] while {$num < $max} { set ligne [gets $fichier] if {$ligne == "====================================================="} { incr num set dernier [gets $fichier] set dernier [gets $fichier] } elseif [string match *$qui* [string tolower $ligne]] { putdcc $idx "La dernière fois que j'ai entendu parler de $arg, c'est dans un $dernier. Le ragot #$num" return 1 } } } else { set dernier [gets $fichier] set dernier [gets $fichier] putdcc $idx "Tu connais pas la dernière? C'est un $dernier !!! Elle est bonne! ( http://aide.igt.net/bot/potins.html )" } close $fichier if $net { close $f2 puts $f3 "
" close $f3 exec /bin/mv /aide/www/bot/potins.tmp /aide/www/bot/potins.txt } return 1 } ### bind dcc - potin dcc_potin proc dcc_potin {hand idx arg} { global lineinp dernierpotin set delais [expr [unixtime] - $dernierpotin] if {($delais < 180) & ![matchattr $hand n]} { putdcc $idx "## Hum, n'exagérons rien là, prends ça relaxe, respire un peu, tourne ta langue sept fois dans ta bouche, essaie le yoga... pis après reviens me proposer un potin ok? :-) (attends [dire_delai $delais])" dccputchan 0 "$hand est atteint de potino-manie, une séance de Yoga s'impose (parti méditer en enfer) ***" setchan $idx 1234 chattr $hand +D return 0 } if [string match *control_potin* [dcclist]] { putdcc $idx "## Heu, wow minute là, pas deux potins en même temps stp :-) (Il y a déjà quelqu'un en train de préparer un potin là...)" return 0 } set lineinp "" putdcc $idx "Alors, quel potin as-tu pour moi aujourd'hui ? Héhéhé" putdcc $idx "Pour terminer le potin, entre une ligne ne contenant que ceci: +" putdcc $idx "Pour annuler le potin, entre une ligne ne contenant que ceci: -" control $idx control_potin dccputchan 0 "Ha tiens tiens tiens... $hand nous prépare un mauvais coup ... ***" return 1 } proc control_potin {idx arg} { global lineinp dernierpotin if {$arg == "+"} { set dernierpotin [unixtime] release_potin $idx return 1 } elseif {$arg == "-"} { putdcc $idx "Ok, le potin a été annulé: retour au party line !" return 1 } else { lappend lineinp $arg return 0 } } proc release_potin {idx} { global lineinp maxlignes putdcc $idx "Ok, je mets le potin sur la page web ..." set jour [string tolower [queljour [strftime %w [unixtime]]]] set fichiertemp [open "/aide/www/bot/potins-temp.txt" w] set fichierhtml [open "/aide/www/bot/potins.html" w] puts $fichiertemp " " puts $fichiertemp "Potin mis par [idx2hand $idx], à [time] le $jour [strftime %d [unixtime]] [quelmois [strftime %m [unixtime]]] [strftime %Y [unixtime]]." puts $fichiertemp "- - - - - - - - - - - - - - - - - - - - - - - - - - -" for {set j 0} {[lindex $lineinp $j] != ""} {incr j} { puts $fichiertemp [lindex $lineinp $j] } puts $fichiertemp "=====================================================" puts $fichierhtml "Les potins de #Aide

" puts $fichierhtml "
" puts $fichierhtml "Potin mis par [idx2hand $idx], à [time] le $jour [strftime %d [unixtime]] [quelmois [strftime %m [unixtime]]] [strftime %Y [unixtime]]." puts $fichierhtml "
" for {set j 0} {[lindex $lineinp $j] != ""} {incr j} { puts $fichierhtml "[cw_net [lindex $lineinp $j]]
" } puts $fichierhtml "

" set fichier [open "/aide/www/bot/potins.txt" r] set lafin 0 set dedans 0 while {![eof $fichier]} { set inp [gets $fichier] incr lafin if {$lafin < $maxlignes} { puts $fichiertemp $inp if {($inp == "- - - - - - - - - - - - - - - - - - - - - - - - - - -") & !$dedans} { puts $fichierhtml "
" set dedans 1 } elseif {($inp == "=====================================================") & $dedans} { puts $fichierhtml "

" set dedans 0 } elseif {($inp == " ") & !$dedans} { puts $fichierhtml "
" } else { puts $fichierhtml "[cw_net $inp]
" } } } puts $fichierhtml "
" close $fichiertemp close $fichierhtml close $fichier exec /bin/mv /aide/www/bot/potins-temp.txt /aide/www/bot/potins.txt putdcc $idx "Votre potin a été enregistré... Retour au Party Line..." dccputchan 0 "C'est ça... qu'est-ce que je disais: [idx2hand $idx] vient de lancer un potin !!! ***" }