aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / addons / sound3.mrc
sound3.mrc — 26.62 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * Sound System (indexing+offering+soundtargets)
; *
; **********************************************************************/
;
;;
;
; -( Indexing )-
;
;;
alias sindex { _dialog -m _soundindex _soundindex }
; /_sindex.index [+methodflags] [file]
: flags: h (html)
; t (text)
; q (quick (1 dir))
;
alias _sindex.index {
if ($lock(run)) {
error.a Can't index files, the /run command is locked.
return
}
var %mircini = $scriptdir $+ indexlist.ini,%dde = $ddename $+ indexlist,%file = $_fixfilename($2),%errmsg,%qdir = %~sound.quickindexdir
unset %~sound.quickindexdir
if ($isdde(%dde)) { %errmsg = You are already indexing! }
elseif ($_mp3.files.total(*.mp?,-r) == 0) { %errmsg = No files to index! }
elseif (%file == $null) { %errmsg = Invalid file: ' $+ $2 $+ ' }
elseif ($isdir($nofile(%file)) == $false) { %errmsg = Invalid directory: ' $+ $nofile(%file) $+ ' }
if (%errmsg != $null) { halt $_errdlg(Sound Indexing,%errmsg) }
if ($isfile(%file)) {
if ($_filexists(0,Sound Indexing,%file)) { .remove $"(%file) }
}
writeini $"(%mircini) dde ServiceName %dde
remini $"(%mircini) rfiles
writeini $"(%mircini) mirc nick $iif($me,$me,airc)
writeini $"(%mircini) rfiles n0 $_fixfilename(%mircini,m)
writeini $"(%mircini) rfiles n1 $_fixfilename(%mircini,m)
writeini $"(%mircini) rfiles n2 $_fixfilename(%mircini,m)
writeini $"(%mircini) rfiles n3 $_scriptdir(progress.mrc)
writeini $"(%mircini) rfiles n4 $_scriptdir(evaltext.mrc)
writeini $"(%mircini) rfiles n5 $_scriptdir(dlls.mrc)
writeini $"(%mircini) rfiles n6 $scriptdir $+ sound1.mrc
writeini $"(%mircini) script n0 ;
writeini $"(%mircini) script n2 alias _verinf return $_verinf
writeini $"(%mircini) script n3 alias _vers return $_vers
writeini $"(%mircini) script n4 alias _vert return $_vert
writeini $"(%mircini) script n5 alias aircweb return $_aircweb
writeini $"(%mircini) script n6 alias _aircvernum return $_aircvernum
writeini $"(%mircini) script n7 ;
writeini $"(%mircini) script n11 % $+ method = $1
writeini $"(%mircini) script n12 % $+ maindde = $ddename
writeini $"(%mircini) script n13 % $+ file = %file
writeini $"(%mircini) script n14 % $+ lfile = $_list.file(mp3dirs)
writeini $"(%mircini) script n15 % $+ ifile = $_sound.tinifile
writeini $"(%mircini) script n15 % $+ ifile = $_sound.tinifile
writeini $"(%mircini) script n16 % $+ qdir = %qdir
flushini $"(%mircini)
run $shortfn($mircexe) $shortfn(%mircini)
}
dialog _soundindex {
size -1 -1 230 195
option dbu
title "Sound Indexing"
tab "Text",1001,5 5 220 165
tab "HTML",1002
tab "Options",1003
box "Header",101,10 20 210 54,tab 1001
edit "",102,15 30 200 40,tab 1001 multi return vsbar hsbar
box "Foot",103,10 70 210 54,tab 1001
edit "",104,15 80 200 40,tab 1001 multi return vsbar hsbar
text "Format:",105,10 125 20 8,tab 1001
edit "",106,10 133 210 11,tab 1001 autohs
text "Save in:",107,10 145 20 8,tab 1001
edit "",108,10 153 198 11,tab 1001 autohs
button "...",109,210 153 10 11,tab 1001
box "Header",201,10 20 210 54,tab 1002
edit "",202,15 30 200 40,tab 1002 multi return vsbar hsbar
box "Foot",203,10 70 210 54,tab 1002
edit "",204,15 80 200 40,tab 1002 multi return vsbar hsbar
text "Format:",205,10 125 20 8,tab 1002
edit "",206,10 133 210 11,tab 1002 autohs
text "Save in:",207,10 145 20 8,tab 1002
edit "",208,10 153 198 11,tab 1002 autohs
button "...",209,210 153 10 11,tab 1002
check "Send list on request",309,70 40 70 10,tab 1003
box "On request, send...",310,60 60 90 50,tab 1003
radio "Last updated index file",311,70 70 65 10,tab 1003
radio "Text index file",312,70 80 65 10,tab 1003
radio "Html index file",313,70 90 65 10,tab 1003
button "&Help!",2995,20 175 30 15
button "&Default",2990,55 175 30 15
button "&Save",2991,90 175 30 15
button "&1 dir index",2994,125 175 30 15
button "Full &Index!",2992,160 175 30 15
button "&Close",2993,195 175 30 15,cancel
}
ON *:DIALOG:_soundindex:*:*:{
var %d = $dname,%method,%file
if ($devent == init) {
_mdx.init $_icofile(mp3.ico,$scriptdir)
_dummy $_lang.loaddialog($dname,$dname,00086969,sound.lang,$scriptdir)
_sindex.init
}
elseif ($devent == sclick) {
var %d = $dname,%t
if ($istok(109 209,$did,32)) { .timer -o 1 0 _sindex.askfile %d $calc($did - 1) $did(%d,$calc($did - 1),1) }
elseif ($did == 2990) { _sindex.default }
elseif ($did == 2991) { _sindex.save }
elseif ($did == 2992) {
var %method = $iif($dialog(%d).tab == 1001,t,h),%file = $did(%d,$iif($dialog(%d).tab == 1001,108,208),1)
_sindex.save
.timer -o 1 0 _sindex.index %method %file
}
elseif ($did == 2994) {
var %method = $iif($dialog(%d).tab == 1001,t,h),%file = $did(%d,$iif($dialog(%d).tab == 1001,108,208),1),%dir = $sdir="Directory to index:" $_list.get(mp3dirs,1)
if ($isdir(%dir)) {
%method = %method $+ q
_sindex.save
%~sound.quickindexdir = %dir
.timer -o 1 0 _sindex.index %method %file
}
}
elseif ($did == 2995) { help sound indexing }
_setsetup mp3 onrequestsendlist $did(%d,309).state
if ($did(%d,312).state) { %t = text }
elseif ($did(%d,313).state) { %t = html }
else { %t = last }
_setsetup mp3 sendindex %t
}
}
alias _sindex.init {
var %d = _soundindex,%tfile = $_sound.tinifile,%win = @__soundindexinit,%t
_dialog.loadbufsection indexlist_textheader %d 102 %tfile
_dialog.loadbufsection indexlist_textfoot %d 104 %tfile
_openwins %win
loadbuf -tindexlist_textformat %win %tfile
if ($line(%win,1) != $null) { did -o %d 106 1 $ifmatch }
if ($_fixfilename($_getsetup(mp3,textindexfile),m) != $null) { did -o %d 108 1 $ifmatch }
_dialog.loadbufsection indexlist_htmlheader %d 202 %tfile
_dialog.loadbufsection indexlist_htmlfoot %d 204 %tfile
_openwins %win
loadbuf -tindexlist_htmlformat %win %tfile
if ($line(%win,1) != $null) { did -o %d 206 1 $ifmatch }
if ($_fixfilename($_getsetup(mp3,htmlindexfile),m) != $null) { did -o %d 208 1 $ifmatch }
close -@ %win
did $iif($_getsetup(mp3,onrequestsendlist),-c,-u) %d 309
%t = $_getsetup(mp3,sendindex)
if (%t == text) { did -c %d 312 }
elseif (%t == html) { did -c %d 313 }
else { did -c %d 311 }
.timer -o 1 0 did -c %d 1001
}
alias _sindex.save {
var %d = _soundindex,%t
.write -c " $+ $_sound.tinifile $+ "
_dummy $_did2filesection(%d,102,$_sound.tinifile,indexlist_textheader)
_dummy $_did2filesection(%d,104,$_sound.tinifile,indexlist_textfoot)
_dummy $_did2filesection(%d,106,$_sound.tinifile,indexlist_textformat)
_setsetup mp3 textindexfile $did(%d,108,1)
_dummy $_did2filesection(%d,202,$_sound.tinifile,indexlist_htmlheader)
_dummy $_did2filesection(%d,204,$_sound.tinifile,indexlist_htmlfoot)
_dummy $_did2filesection(%d,206,$_sound.tinifile,indexlist_htmlformat)
_setsetup mp3 htmlindexfile $did(%d,208,1)
}
alias _sindex.default {
var %d = _soundindex
did -r %d 102,104,106,202,204,206
did -o %d 102 1 -( <ME>'s files )-
did -o %d 102 2 Generated by aIRC <VERS> (<AIRCWEB>)
did -o %d 102 3 (last update: <$ASCTIME>)
did -o %d 102 4 <TOTALFILES> <$iif(<TOTALFILES> == 1,file,files)> - <$round($calc(<TOTALSIZE> / 1048576),2)> MB
did -o %d 102 5 <EMPTYLINE>
did -o %d 104 1 <EMPTYLINE>
did -o %d 104 2 EOL: <TOTALFILES> <$iif(<TOTALFILES> == 1,file,files)> - <$round($calc(<TOTALSIZE> / 1048576),2)> MB
did -o %d 104 3 Generated by aIRC <VERS> (<AIRCWEB>)
did -o %d 106 1 <FILE> <$str($chr(160),$calc(69 - <FILELEN>))> <$round($calc(<SIZE> / 1048576),2)> MB
did -o %d 202 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
did -o %d 202 2 <HTML>
did -o %d 202 3 <HEAD>
did -o %d 202 4 <TITLE><ME>'s mp3s</TITLE>
did -o %d 202 5 <META NAME="Generator" CONTENT="<VER>">
did -o %d 202 6 <META NAME="Author" CONTENT="<VER>">
did -o %d 202 7 <META NAME="Keywords" CONTENT="mp3">
did -o %d 202 8 <META NAME="Description" CONTENT="<ME>'s mp3s">
did -o %d 202 9 </HEAD>
did -o %d 202 10 <BODY>
did -o %d 202 11 <CENTER>
did -o %d 202 12 <FONT SIZE="7"><B><ME>'s mp3s</B></FONT><BR><BR>
did -o %d 202 13 Generated by aIRC <VERS> (<a href="<AIRCWEB>"><AIRCWEB></a>)<BR>
did -o %d 202 14 (last update: <$ASCTIME>)<BR>
did -o %d 202 15 <TOTALFILES> <$iif(<TOTALFILES> == 1,file,files)> - <$round($calc(<TOTALSIZE> / 1048576),2)> MB<BR>
did -o %d 202 16 </CENTER>
did -o %d 202 17 <HR>
did -o %d 202 18 <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
did -o %d 202 19 <TR><TH ALIGN="LEFT">#</TH><TH WIDTH="85%">File</TH><TH>Size</TH></TR>
did -o %d 204 1 </TABLE>
did -o %d 204 2 <HR>
did -o %d 204 3 <CENTER>
did -o %d 204 4 <TOTALFILES> <$iif(<TOTALFILES> == 1,file,files)> - <$round($calc(<TOTALSIZE> / 1048576),2)> MB<BR>
did -o %d 204 5 Generated by aIRC <VERS> (<a href="<AIRCWEB>"><AIRCWEB></a>)<BR>
did -o %d 204 6 </CENTER>
did -o %d 204 7 </BODY>
did -o %d 204 8 </HTML>
did -o %d 206 1 <TR><TD><FILENUM></TD><TD><FILE></TD><TD><$round($calc(<SIZE> / 1048576),2)> MB</TD></TR>
}
alias _sindex.askfile {
var %d = $1,%id = $2,%dir = $nofile($_fixfilename($3-)),%type = $iif(2* iswm %id,HTML,TXT),%wc = %dir $+ *. $+ $left($lower(%type),3),%file
if ($dialog(%d) == $null) { return }
%file = $$dir="Save index in:" %wc
if ($dialog(%d) == $null) { return }
did -o %d %id 1 $_fixfilename(%file,m)
dialog -v %d
}
alias _sindex.done { info.a Indexing completed: ' $+ $_fixfilename($1-) $+ ' }
alias _sound.isadvertchan {
if ($_getsetup(mp3,advertall)) { return 1 }
if ($istok($_fixchans($_getsetup(mp3,advertchannels)),$1,44)) { return 1 }
return 0
}
alias _sound.ad.msg {
if ($_evaltext($_sound.repeval($_getsetup(mp3,admsg))) != $null) { return $ifmatch }
}
;;
;
;
;;
alias _sound.repeval {
var %tmp = $1-
if (<MP3INDEXFILE> isin %tmp) || (<MP3INDEXSIZE> isin %tmp) {
var %indexfile = $_sound.indexfile,%indexsize = 0
if ($isfile(%indexfile)) { %indexsize = $file(%indexfile).size }
%indexfile = $nopath(%indexfile)
%tmp = $replace(%tmp,<MP3INDEXFILE>,%indexfile,<MP3INDEXSIZE>,%indexsize)
}
return $replace(%tmp,<MP3FILESNUM>,$_mp3.files.total(*.mp?,-),<SERVEDFILES>,$_sound.servedfiles,<SERVEDBYTES>,$_sound.servedbytes,<RECORDCPS>,$_sound.getrecordcps,<RECORDBY>,$_sound.getrecordby)
}
alias _soundsetup.askdir {
var %dname = _soundsetup,%id = 101,%dir,%tmp,%i,%line,%add
if ($dialog(%dname) == $null) { return }
var %dir = $sdir="Select MP3 directory:" $left($mircdir,3)
if ($dialog(%dname) == $null) { return }
if ($isdir(%dir)) {
if ($didwm(%dname,%id,%dir)) { did -c %dname %id $ifmatch }
else {
var %tmp = %dir $+ *,%add = 1
while ($didwm(%dname,%id,%tmp)) { did -d %dname %id $ifmatch }
%i = $did(%dname,%id).lines
while (%i) {
%line = $did(%dname,%id,%i)
if (%line $+ * iswm %dir) {
%add = 0
break
}
dec %i
}
if (%add) { did -ac %dname %id %dir }
}
}
did -z %dname 101
dialog -v %dname
}
alias _sound.indexfile {
var %rfile,%o = $_getsetup(mp3,sendindex),%filetext = $_fixfilename($_getsetup(mp3,textindexfile)),%filehtml = $_fixfilename($_getsetup(mp3,htmlindexfile))
if (%o == text) { %rfile = %filetext }
elseif (%o == html) { %rfile = %filehtml }
elseif ($file(%filehtml).mtime >= $file(%filetext).mtime) { %rfile = %filehtml }
else { %rfile = %filetext }
if ($isfile(%rfile)) { return %rfile }
}
alias _sound.dccsend {
var %nick = $1,%lfile = $2,%rfile = $3,%queue = $_dccsend(%nick,%lfile),%reply = _puthelp %nick & _qnotice %nick,%reject = $_not($_getsetup(script,quiet-reject)),%(send),%(queue)
%(send) = ( $+ $_dcctotal.send $+ / $+ $_getsetup(dcc,maxStotal) $+ )
%(queue) = ( $+ $_sendqueue.queues $+ / $+ $_getsetup(dcc,maxQtotal) $+ )
if (%queue == ERR_nofile) {
if (%reject) { %reply File not found: $^'(%rfile) }
}
elseif (%queue == ERR_insend) { %reply You are already getting: $^'(%rfile) }
elseif (%queue == ERR_inqueue) { %reply You already have $^'(%rfile) in my queue }
elseif (%queue == ERR_nocomchan) { %reply $1 Send slots full %(send) $+ . Queue slots available %(queue) but you must be in one of my channels in order to queue. }
elseif (%queue == ERR_maxQtotal) { %reply Queue slots full %(queue) }
elseif (%queue == ERR_maxQuser) { %reply You can't queue any more files. Your queues: ( $+ $_sendqueue.queues(%nick) $+ / $+ $_getsetup(dcc,maxQuser) $+ ) }
elseif (%queue == ERR_maxStotal) { %reply There are too many get sessions %(send) }
elseif (%queue == ERR_maxSuser) { %reply You have too many get sessions ( $+ $_dcctotal.send(%nick) $+ / $+ $_getsetup(dcc,maxSuser) $+ ) }
elseif (ERR_* iswm %queue) { %reply Unknown Error. Can't send you $^'(%rfile) }
elseif (%queue) { %reply Your request of $^'(%rfile) is now in my queue ( $+ %queue $+ / $+ $_getsetup(dcc,maxQtotal) $+ ) }
else { %reply Sending file: $^'(%rfile) $^p($_size($file(%lfile).size)) }
}
#_soundoffering off
ON *:JOIN:#:{
if ($nick == $me) { _sound.ad.chan $chan }
elseif ($_getsetup(mp3,advertonjoin)) && ($_sound.isadvertchan($chan)) && ($_sound.ad.msg != $null) { _automsghtchan $chan $nick _puthelp $nick & msg $nick $ifmatch }
}
alias _sound.ad.allchans {
.timer_soundadvert.* off
if ($_connected) && ($_getsetup(mp3,advertimerstatus)) {
var %i = $chan(0)
while (%i) {
_sound.ad.chan $chan(%i)
dec %i
}
}
}
alias _sound.ad.chan {
var %chan = $1,%int,%last
.timer_soundadvert. $+ %chan off
if ($_connected) && ($me ison %chan) && ($_getsetup(mp3,advertimerstatus)) && ($_sound.isadvertchan(%chan)) && ($_isint($calc($_getsetup(mp3,advertimertime) * 60))) {
%int = $ifmatch
%last = $_get(junk,sound.ad.last,%chan)
if (%last > $ctime) { %last = $ctime - 60 }
if (%last == $null) || ($calc(%last + %int) < $ctime) { _sound.ad.send %chan }
else { .timer_soundadvert. $+ %chan 1 $calc(%int - $ctime + %last) _sound.ad.send %chan }
}
}
alias _sound.ad.send {
var %chan = $1,%int,%last
.timer_soundadvert. $+ %chan off
if ($_connected) && ($me ison %chan) && ($_getsetup(mp3,advertimerstatus)) && ($_sound.isadvertchan(%chan)) {
if ($_sound.ad.msg != $null) {
_puthelp %chan c& msg %chan $ifmatch
if ($_getsetup(mp3,sendslotsctcp)) { _puthelp %chan c& .ctcp %chan slots $_fixint($_getsetup(dcc,maxStotal)) $_fixint($calc($_getsetup(dcc,maxStotal) - $_dcctotal.send)) $_dcc.verbosefirstsendfree $_fixint($_sendqueue.queues) $_fixint($_getsetup(dcc,maxQtotal)) $_sound.getrecordcps $_mp3.files.total(*.mp?,-) }
_setd junk sound.ad.last %chan $ctime
}
if ($_isint($calc($_getsetup(mp3,advertimertime) * 60))) { .timer_soundadvert. $+ %chan 1 $ifmatch _sound.ad.send %chan }
}
}
ON *:TEXT:$(! $+ $me *):#:{ _sound.!nickfile $2- }
#_soundoffering end
ON *:TEXT:@find *:#:{ _sound.@findlocator $nopath($strip($2-)) }
ON *:TEXT:@locator *:#:{ _sound.@findlocator $nopath($strip($2-)) }
ON *:TEXT:$(@ $+ $me):#:{ _sound.@sendlist }
ON *:TEXT:$(@ $+ $me $+ -cancel):#:{ _sound.@quecancel $strip($2-) }
ON *:TEXT:$(@ $+ $me $+ -remove):#:{ _sound.@quecancel $strip($2-) }
ON *:TEXT:$(@ $+ $me $+ -help):#:{ _sound.@help $strip($2-) }
alias _sound.ad.allchans { .timer_soundadvert.* off }
alias _sound.ad.chan { .timer_soundadvert.* off }
alias _sound.ad.send { .timer_soundadvert.* off }
ON *:GETFAIL:*.mp?:{
if (*.mp3 !iswm $filename) && (*.mp2 !iswm $filename) { return }
if ($_getsetup(mp3,resumeongetfail)) {
var %file = $nopath($filename),%comchan = $_aircpster.getcommonchan($nick),%msg = Failed get of ' $+ %file $+ ' from $nick
if (%comchan == ERR_DISCONNECTED) { info.a %msg - Can't request a resume! (You're not on IRC) }
elseif (%comchan == ERR_NONICK) { }
elseif (%comchan == ERR_YOU) { }
elseif (%comchan == ERR_NOCHANS) { info.a %msg - Can't request a resume! (couldn't find $nick $+ ) }
else {
var %secs = $rand(7,13)
.timer_soundgetfailrequest $+ $nick $+ %comchan 1 %secs _sound.getfailcheck $nick %comchan %file
info.a %msg - Requesting a resume in %secs seconds...
}
}
}
alias _sound.getfailcheck {
var %nick = $1,%chan = $2,%file = $3-
if (%nick ison %chan) { msg %chan ! $+ %nick %file }
elseif ($_aircpster.getcommonchan(%nick) ischan) { msg $ifmatch ! $+ %nick %file }
else { info.a Failed resume request of ' $+ %file $+ ' to %nick }
}
ON *:FILESENT:*.mp?:{
if (*.mp3 !iswm $filename) && (*.mp2 !iswm $filename) { return }
var %size = $file($filename).size,%sendnum = $send($nick,0),%ttf,%cps = 0
while (%sendnum) {
%ttf = $send($nick,%sendnum).path $+ $send($nick,%sendnum).file
if (%ttf = $filename) { %cps = $send($nick,%sendnum).cps }
dec %sendnum
}
_setsetup mp3 Dfiles $calc($_getsetup(mp3,Dfiles) + 1)
_setsetup mp3 Dbytes $calc($_getsetup(mp3,Dbytes) + %size)
_sound.toplist $filename
if (%cps > $_sound.getrecordcps) {
_setsetup mp3 recordcps %cps
_setsetup mp3 recordby $nick
}
}
alias _sound.toplist {
}
alias _sound.getrecordcps { return $_fixint($_getsetup(mp3,recordcps)) }
alias _sound.getrecordby {
if ($_getsetup(mp3,recordby) != $null) { return $ifmatch }
return ???
}
alias _sound.servedfiles { return $_fixint($_getsetup(mp3,Dfiles)) }
alias _sound.servedbytes { return $_fixint($_getsetup(mp3,Dbytes)) }
ON *:TEXT:$(! $+ $me *):*:{
;;;;; mIRC BUG ;;;;;
halt halt halt
}
alias -l _sound.!nickfile {
if ($_sound.@prot(0)) { halt }
var %lfile,%rfile = $_sound.parse($nopath($strip($1-))),%reply = _puthelp $nick & _qnotice $nick,%reject = $_not($_getsetup(script,quiet-reject))
if (%rfile == $null) { halt }
if (*.wav !iswm %rfile) && (*.mid !iswm %rfile) && (*.mp3 !iswm %rfile) {
;;; if (%reject) { %reply Unknown file type: ' $+ %rfile $+ ' }
halt
}
if (*.wav iswm %rfile) { %lfile = $wavedir $+ %rfile }
elseif (*.mid iswm %rfile) { %lfile = $mididir $+ %rfile }
else { %lfile = $_mp3.exists(%rfile) }
_sound.echo $^b($nick) requests sound file: ' $+ %rfile $+ '
_dummy $_sound.dccsend($nick,%lfile,%rfile)
;;;;; mIRC BUG ;;;;;
halt halt halt
}
alias -l _sound.@sendlist {
if ($_not($_getsetup(mp3,onrequestsendlist))) || ($_sound.@prot(0)) { return }
var %lfile = $_sound.indexfile,%rfile = $nopath(%lfile),%echo $^b($nick) requests your list
if ($isfile(%lfile)) {
_dummy $_sound.dccsend($nick,%lfile,%rfile)
%echo = %echo $+ . Sending...
}
else { %echo = %echo $+ , but I couldn't find it! }
_sound.echo %echo
}
alias -l _sound.@quecancel {
if ($_not($_getsetup(mp3,@find@locator))) || ($_sound.@prot(0)) { return }
var %n = $_sendqueue.removenick($nick,$1-),%left = $_sendqueue.queues($nick),%reply = _puthelp $nick & _qprivmsg $nick,%echo,%text,%tmp = << $+ $_randstring(15) $+ >>
%left = ( $+ $_nsingoplur(%left,file,files) left)
if (%n) {
if ($1- != $null) && ($_not($_isint($remove($1-,$chr(44),-)))) { %text = You removed $_nsingoplur(%n,file,files) matching ' $+ $1- $+ ' from your queue. %left }
else { %text = You removed $_nsingoplur(%n,file,files) from your queue. %left }
}
else {
%echo = $^b($nick) requests to remove some files from his/her queue but
if ($_isint($remove($1-,$chr(44),-))) { %text = $nick You didn't have queues: $1- }
elseif ($1- != $null) { %text = You didn't have any files matching ' $+ $1- $+ ' in your queue. }
else { %text = You didn't have any files in your queue }
}
%reply %text
_sound.echo %echo $replace(%text,$1-,%tmp,your,his/her,You,$^b($nick),%tmp,$1-)
}
alias -l _sound.@findlocator {
if ($1- == $null) || ($_not($_getsetup(mp3,@find@locator))) || ($_sound.@prot(0)) { return }
var %wc = $_mp3.parm2wc($1-),%wint = @__findlocatortmp,%found,%i = 1,%maxf = $_getsetup(mp3,@maxmatches),%reply = _puthelp $nick & _qprivmsg $nick,%echo
if ($len(%wc) <= 7) { return }
if ($_not($_isint(%maxf))) { %maxf = 6 }
%echo = Search request from $nick in $chan : " $+ $1- $+ "
_openwins %wint
%found = $_mp3.wc2win(%wc,%wint)
if (%found) {
if (%found > %maxf) { %echo = %echo - Found too many matches! ( $+ %found $+ ). Sending the first %maxf matches. }
else { %echo = %echo - Found $_nsingoplur(%found,match,matches) $+ . }
_dummy $_sound.sendfindlocator(%wint,%reply,$1-,%found,%maxf,$iif(%found > %maxf,$calc(%found - %maxf),0),1,$_getsetup(mp3,onrequestsendlist),$_sound.indexfile,$_getsetup(dcc,sendqueue),$_dcctotal.send,$_getsetup(dcc,maxStotal),$_sendqueue.queues,$_getsetup(dcc,maxQtotal))
_dummy $_sound.@prot(1)
}
else { %echo = %echo - No matches. }
_sound.echo %echo
close -@ %wint
}
alias -l _sound.sendfindlocator {
var %i = 1,%win = $1,%reply = $2,%match = $3,%found = $4,%maxf = $5,%more = $6,%reqon = $7,%sendlist = $8,%indexfile = $9,%queue = $10,%currsends = $11,%maxsends = $12,%currqueues = $13,%maxqueues = $14,%indexsize = 0
if ($isfile(%indexfile)) { %indexsize = $file(%indexfile).size }
%indexfile = $nopath(%indexfile)
var %recordby = $_sound.getrecordby,%recordcps = $_sound.getrecordcps,%servedbytes = $_sound.servedbytes,%servedfiles = $_sound.servedfiles,%mp3filesnum = $_mp3.files.total(*.mp?,-)
if ($_evaltext($replace($_getsetup(mp3,format.find.first),<CHAN>,$chan,<MP3INDEXSIZE>,%indexsize,<MP3INDEXFILE>,%indexfile,<SENDS_CURR>,%currsends,<SENDS_MAX>,%maxsends,<QUEUE_CURR>,%currqueues,<QUEUE_MAX>,%maxqueues,<MATCH_FOUND>,%found,<MATCH_STRING>,%match,<MATCH_CURR>,$null,<MATCH_MORE>,%more,<FILE>,$null,<PATHFILE>,$null,<TRIGGER>,$null,<MP3FILESNUM>,%mp3filesnum,<SERVEDFILES>,%servedfiles,<SERVEDBYTES>,%servedbytes,<RECORDCPS>,%recordcps,<RECORDBY>,%recordby)) != $null) { %reply $ifmatch }
while (%i <= %maxf) && (%i <= %found) {
var %pf = $line(%win,%i),%fl = $nopath(%pf),%trgr = ! $+ $me %fl
if ($_evaltext($replace($_getsetup(mp3,format.find.filel),<CHAN>,$chan,<MP3INDEXSIZE>,%indexsize,<MP3INDEXFILE>,%indexfile,<SENDS_CURR>,%currsends,<SENDS_MAX>,%maxsends,<QUEUE_CURR>,%currqueues,<QUEUE_MAX>,%maxqueues,<MATCH_FOUND>,%found,<MATCH_STRING>,%match,<MATCH_CURR>,%i,<MATCH_MORE>,%more,<FILE>,%fl,<PATHFILE>,%pf,<TRIGGER>,%trgr,<MP3FILESNUM>,%mp3filesnum,<SERVEDFILES>,%servedfiles,<SERVEDBYTES>,%servedbytes,<RECORDCPS>,%recordcps,<RECORDBY>,%recordby)) != $null) { %reply $ifmatch }
inc %i
}
if ($_evaltext($replace($_getsetup(mp3,$iif(%found > %maxf,format.find.lastm,format.find.lastn)),<CHAN>,$chan,<MP3INDEXSIZE>,%indexsize,<MP3INDEXFILE>,%indexfile,<SENDS_CURR>,%currsends,<SENDS_MAX>,%maxsends,<QUEUE_CURR>,%currqueues,<QUEUE_MAX>,%maxqueues,<MATCH_FOUND>,%found,<MATCH_STRING>,%match,<MATCH_CURR>,$null,<MATCH_MORE>,%more,<FILE>,$null,<PATHFILE>,$null,<TRIGGER>,$null,<MP3FILESNUM>,%mp3filesnum,<SERVEDFILES>,%servedfiles,<SERVEDBYTES>,%servedbytes,<RECORDCPS>,%recordcps,<RECORDBY>,%recordby)) != $null) { %reply $ifmatch }
}
alias -l _sound.@help {
if ($_not($_getsetup(mp3,@find@locator))) || ($_sound.@prot(0)) { return }
var %reply = _puthelp $nick & _qprivmsg $nick,%reject = $_not($_getsetup(script,quiet-reject))
%reply @find <string> or @locator <string> to search
if ($_getsetup(mp3,onrequestsendlist)) { %reply @ $+ $me $+ to send you my list }
%reply @ $+ $me $+ -cancel [string|N] to cancel queues
_sound.echo $^b($nick) requests help
}
;;
;
; -( Sound Targets )-
;
;;
alias soundtargets { .timer -o 1 0 _soundtargets }
alias _soundtargets { return $dialog(_soundtargets,_soundtargets,-4) }
dialog _soundtargets {
size -1 -1 100 173
option dbu
title "Sound Targets"
box "Channels",1001,3 1 94 40
radio "All",1002,7 10 25 8,group
radio "These:",1003,7 20 25 8
edit "",1004,35 18 58 10,autohs
radio "None",1005,7 30 35 8
box "Queries",1101,3 41 94 40
radio "All",1102,7 50 25 8,group
radio "These:",1103,7 60 25 8
edit "",1104,35 58 58 10,autohs
radio "None",1105,7 70 35 8
box "Chats",1201,3 81 94 40
radio "All",1202,7 90 25 8,group
radio "These:",1203,7 100 25 8
edit "",1204,35 98 58 10,autohs
radio "None",1205,7 110 35 8
box "Options",1301,3 121 94 30
check "Play in Status",1302,7 130 50 8,group
check "Send CTCPs",1303,7 140 50 8
button "Ok",2991,10 155 30 15,ok
button "Cancel",2992,60 155 30 15,cancel
edit "",2993,35 258 58 10,autohs hide result
}
ON *:DIALOG:_soundtargets:*:*:{
if ($devent == init) {
_mdx.init $_icofile(mp3.ico,$scriptdir)
_dummy $_lang.loaddialog($dname,$dname,00086969,sound.lang,$scriptdir)
_soundtargets.init
}
elseif ($devent == sclick) {
if ($did == 2991) { _soundtargets.ok }
}
}
alias -l _soundtargets.init {
var %d = $dname,%chans = $_getsetup(mp3,playto.chans),%queries = $_getsetup(mp3,playto.queries),%chats = $_getsetup(mp3,playto.chats)
did -o %d 1004 1 $_mychans
did -o %d 1104 1 $_myqueries
did -o %d 1204 1 $_chats
if (%chans == *) { did -c %d 1002 }
elseif (%chans != $null) {
did -o %d 1004 1 $ifmatch
did -c %d 1003
}
else { did -c %d 1005 }
if (%queries == *) { did -c %d 1102 }
elseif (%queries != $null) {
did -o %d 1104 1 $ifmatch
did -c %d 1103
}
else { did -c %d 1105 }
if (%chats == *) { did -c %d 1202 }
elseif (%chats != $null) {
did -o %d 1204 1 $ifmatch
did -c %d 1203
}
else { did -c %d 1205 }
did $iif($_getsetup(mp3,playto.status),-c,-u) %d 1302
did $iif($_getsetup(mp3,dontsendctcp),-u,-c) %d 1303
}
alias -l _soundtargets.ok {
var %d = $dname,%flags = _,%chans,%queries,%chats
if ($did(%d,1002).state) { %chans = * }
elseif ($did(%d,1003).state) { %chans = $_fixchans($did(%d,1004)) }
if ($did(%d,1102).state) { %queries = * }
elseif ($did(%d,1103).state) { %queries = $replace($did(%d,1104),$chr(32),$chr(44)) }
if ($did(%d,1202).state) { %chats = * }
elseif ($did(%d,1203).state) { %chats = $replace($did(%d,1204),$chr(32),$chr(44)) }
if ($did(%d,1302).state) { %flags = %flags $+ s }
if ($did(%d,1303).state) { %flags = %flags $+ t }
_setsetup mp3 playto.chans %chans
_setsetup mp3 playto.queries %queries
_setsetup mp3 playto.chats %chats
_setsetup mp3 playto.status $did(%d,1302).state
_setsetup mp3 dontsendctcp $_not($did(%d,1303).state)
if ($dialog(_soundsetup)) { did $iif($did(%d,1303).state,-c,-u) _soundsetup 210 }
did -o %d 2993 1 %flags $iif(%chans != $null,%chans,$null) $iif(%queries != $null,%queries,$null) $iif(%chats != $null,%chats,$null)
}
alias _windowsize.SoundServer { return C C 478 161 }
alias _windowopts.SoundServer { return 0 1 1 }
alias _onclosewin.SoundServer { .savebuf @SoundServer $_fixfilename($_logdir(@SoundServer.log),m) }