"
} 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 "
"
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 !!! ***"
}