#done: #msg page notice away back disconnect connect filesent #fileget dccsend dccchat welcome invite topic nick kicked #split rejoin exit #not implemented (why do we need sounds for a msglog?): #gotmsg nomsg seemsg delmsg #+++ the alias/es alias ircn { ircn alias [args] complete } #+++ the proc/s proc ircn args { global N litehelp darkhelp set cmd [lindex $args 0] set args [lrange $args 1 end] switch -- $cmd { alias { set args [lindex $args 0] switch -- [string tolower [lindex $args 0]] { load { set file [join [lrange $args 1 end]] if {$file == ""} { set ans [FALC_fileopen -t "ircN Sound Theme" -f "ircN Sound Files (*.thm)|*.thm|All files|*" -d [file join [pwd] [file dirname [get_cookie N-theme]]]] if {$ans == ""} return ircn load $ans } elseif {![file exists $file]} { set file [recurse [file tail $file] [pwd]] echo "[kano] [llength $file] match[s [llength $file] es]" foreach i [lsort $file] { echo " $i" } } { ircn load $file } } on { if {[get_cookie N-on 0]} { echo "[kano] N-sound already on" } { set_cookie N-on 1 echo "[kano] N-sound turned on" } } off { if {![get_cookie N-on 0]} { echo "[kano] N-sound already off" } { set_cookie N-on 0 echo "[kano] N-sound turned off" mmstop wave } } default { echo "[kano] usage - /ircn on|off\n /ircn load \[\]\n /ircn config" } } } load { set file [lindex $args 0] set low_dir [string tolower [lindex [file split [file dirname [file join [pwd] $file]]] end]] set ldir [file dirname $file] set existent [list] set found [list] set nonexistent [list] foreach i $N(possible) { set read [FALC_ini -read $file default $i] set key [lindex $read 0] set okey $key set this_dir [string tolower [file tail [file dirname [file join [pwd] $key]]]] if {$key == ""} {set key } if ![file exists $key] { set test [file join $ldir [file tail $key]] if [file exists $test] { set key $test } { set search [recurse [file tail $key] [file dirname [file join [pwd] $file]]] if {$search != ""} { set key [list] foreach j $search { set current_dir [string tolower [file tail [file dirname [file join [pwd] $j]]]] set last_dir [string tolower [file tail $ldir]] if {$current_dir == $this_dir || $current_dir == $low_dir || $current_dir == $last_dir} {set key $j;break} } if {$key != ""} {set ldir [file dirname $key]} {set key [file join $ldir [file tail $okey]]} } } } if {$okey != ""} {lappend found $i} lappend [expr {[file exists $key] ? "" : "non"}]existent [list $i $key] set_cookie N-sound-$i $key } ircn print set_cookie N-theme [file join [pwd] $file] } print { set existent [list] set nonexistent [list] set found [list] foreach i $N(possible) { set key [get_cookie N-sound-$i] lappend [expr {[file exists $key] ? "" : "non"}]existent [list $i $key] if {$key != "" && $key != ""} {lappend found $key} } echo "[kano] Loaded [string tolower [file tail [get_cookie N-theme]]] ([llength $found]/[llength $N(possible)] entries filled) ([llength $existent]/[llength $N(possible)] files exist)" foreach i $nonexistent { set f [expr {$i == "" || $i == "" ? "" : [local [lindex $i 1]]}] echo " $darkhelp[format %10s [lindex $i 0]]: \"$f\" doesn't exist" } foreach i $existent { echo " $litehelp[format %10s [lindex $i 0]]: \"[local [lindex $i 1]]\" exists" } } play { if {[get_cookie N-on 0]} { set file [get_cookie N-sound-[lindex $args 0]] mmstop [expr {[lsearch -exact [list .mid .rmi] [file extension $file]] != -1 ? "midi" : "wave"}] mmplay $file } } } } #+++ the sound theme events on privmsg { if {[lindex [args] 0] == [my_nick]} { ircn play msg } } on notice { if {[lindex [args] 0] == [my_nick]} { ircn play notice } } on ctcp { if {[lindex [args] 0] == [my_nick]} { if {[string tolower [lindex [args] 1]] == "page"} { ircn play page } elseif {[regexp -nocase {^dcc chat chat ([0-9]+) ([0-9]+)$} [join [lrange [args] 1 end]]]} { ircn play dccchat } } } on connect {ircn play connect} on disconnect {ircn play disconnect} on dcc_complete { ircn play file[expr {[lindex [args] 0] == "SEND" ? "sent" : "get"}] } on dcc_create { if {[lindex [args] 0] == "GET"} { ircn play dccsend } } on topic {ircn play topic} on 305 {ircn play back} on 306 {ircn play away} on invite {ircn play invite} on nick { if {[nick] == [my_nick]} {ircn play nick} } on kick { if {[lindex [args] 1] == [my_nick]} {ircn play kicked} } #+++ more if ![catch {rename t ircn_t}] { proc t type { switch -- $type { split {ircn play split} rejoin {ircn play rejoin} autoignore - autoignoreall {ircn play flood} } ircn_t $type } kaddhelp ircn ";Configures ircN sound themes." set N(ver) 1 set N(possible) [list away back connect dccchat dccsend disconnect exit fileget filesent flood invite kicked msg nick notice page rejoin split topic welcome] addname "ircNsound$N(ver)" addecho "[kano] ircN sound theme loader initialized: sound[expr {[get_cookie N-on 0] ? "s on" : " off"}] using [get_cookie N-theme "(no theme)"]. type /ircn for help." } on load {ircn play welcome} on unload {ircn play exit}