########################### ### Envoyer un mail-icq ### ########################### bind dcc A noteicq sendicqdcc proc sendicqdcc {hand idx args} { global botnick set args [lindex $args 0] set qui [lindex $args 0] set msg [lrange $args 1 end] if ![validuser $qui] { putdccsi $idx "Je ne connais pas $qui, désolé." return 0 } if {[getuser $qui XTRA ICQ] == "" } { putdccsi $idx "$qui n'a pas de numéro d'ICQ d'enregistré sur Aidebot :-(" return 0 } set icq [getuser $qui XTRA ICQ] set email "$icq\@pager.icq.com" set f [open aidebot.mail.icq w] puts $f "TO: $email" puts $f "FROM: [getuser $hand xtra vrainick] <[getuser $hand xtra vrainick]@AideBot.aide>" puts $f "De [getuser $hand xtra vrainick] par la messagerie AideBot express" puts $f "" puts $f $msg close $f exec cat aidebot.mail.icq | /usr/lib/sendmail $email exec rm aidebot.mail.icq putdccsi $idx "Message ICQ livré." return 1 } ###################### ### Party line ICQ ### ###################### if ![info exists ICQ] { set ICQ [open "|micq" r+] fconfigure $ICQ -blocking 0 set ICQlist(pass) "" set ICQlist(party) "" } utimer 10 ICQ_in_timer proc ICQ_in_timer { } { global ICQ if [string match *ICQ_in_timer* [utimers]] {return 0} if ![info exists ICQ] {return 0} utimer 5 ICQ_in_timer gets $ICQ line while {$line != ""} { gets $ICQ line set num [string range [lindex $line 0] 3 end] if {([lindex $line 2] == "Instant") & [estunnombre:ok $num]} { ICQ_msg_in $num [gets $ICQ] } } } proc ICQ_msg_in {num msg} { global ICQlist set hand [ICQ_num2hand $num] if [matchattr $hand A] { alo "<$hand@ICQ> $msg" if ![string match *$num* $ICQlist(party)] { lappend ICQlist(party) $num timer 5 ICQ_vider } } } proc ICQ_num2hand {num} { foreach user [userlist A] { if {[getuser $user xtra icq] == $num} { return [getuser $user xtra vrainick] } } } proc ICQ_vider { } { global ICQlist set ICQlist(party) [lrange $ICQlist(party) 1 end] } bind chat - * ICQ_msg_out proc ICQ_msg_out {hand chan text} { global ICQ ICQlist foreach user $ICQlist(party) { puts $ICQ "msg $user/<$hand> $text" } } bind dcc n stopicq dcc_stopicq proc dcc_stopicq {hand idx args} { global ICQ catch [exec killall micq] catch [close $ICQ] catch [unset ICQ] catch [unbind chat - * ICQ_msg_out] }