XDCC Autoresume/Autoqueue Stealth Script — File Browser
XDCCAutoresumeAutoqueueStealthScriptv4.2.0 / XDCCAutoresumeAutoqueueStealthScriptv4.2.0 / XDCCStealth.mrc
XDCCStealth.mrc — 152.77 KB — Download this file
;-------------------------------------------------------------------------
;
; Name: XDCC Autoresume/Autoqueue Stealth Script
; File: XDCCStealth.mrc
; Version: 4.1.5
; Author: Werecow
; Date: 23-02-2005
;
; Contents: Most of the identifiers and aliases used in the XDCC Stealth Script, and the Loader
; initialisation commands.
;
;
; WARNING: many channels will ban you for using XDCC leech scripts. While this is a silly rule,
; it is your responsibility. Use this wisely. Don't use it in such channels, or don't get caught.
; And play nice for the other people that want to use the XDCCs! If you leech em dry other people
; may be unable to get on.
;
; And hey, the code may be unreadable by now, but it works fairly well. Msg me if you find any bugs or have
; suggestions. Oh, and thanx for the help to Matt and anyone else who helped me out }|;o).
;
; Possible future features (dare i dream):
; -Make settings for %ed2kpath file.
; -[23:10:19] <apocbeatz2> To request a file type:[/ctcp apocbeatz2 xdcc send Movies #<number>] <UPP>
; -[11:45:40] -MWXDC01- WARNING: Sorry you must be in at least one of the channels im serving in to access my XDCC
; -[18:07:09] -MWXDC01- You are already in my queue to get that file (currently number 3 in the queue), please wait your turn and it will be sent to you
; -[09:51:23] -shaKaZuZu{away}- ( removed all your queues )
; [09:51:02] -shaKaZuZu{away}- :::: ( Error ) ( invalid command: remove )
; [09:51:02] -shaKaZuZu{away}- ( Supported Commands: send|get|list|queues|sends|clr_queues ) :::: ( UPP ) ::::
; [12:20:19] -shaKaZuZu{away}- queueing [ Altered.States.1980.DVDRip.Xvid-Newblood.avi 700mb ] ( n/a ). it has been placed in queue slot [ 6 ], it will send when sends are available :::: ( UPP ) ::::
; -Make remove from remote queue network selective.
; -More shortcuts.
; -Variable shortcuts.
; -[16:07:00] -JCA_Home- (error) sorry, you can't queue more than [1] file .•«UPP»•.
; -[18:51:46] -JCA_Home- queueing [Simpsons.Gone.Wild.2004.DVDRip.XViD-IHQDR.avi 703mb] (Simpsons.Gone.Wild.2004.DVDRip.XViD-IHQDR). it has been placed in queue slot [8], it will send when sends are available .•«UPP»•.
; -[15:35:28] -saint- Sorry, that file already exists in queue slot #1 . Try and get another file next time. « Ë×Çü®§îöñ »
; -[13:59:25] -Gose_- Sending Eternal Evil Of Asia, The [Cant.& Eng. Sub.] (697MB). This file has been downloaded 1 time(s).
; -[09:02:22] -Gose- I have automatically requeued Eternal Evil Of Asia, The [Cant.& Eng. Sub.].avi for you. —I-n-v-i-s-i-o-n—
; -Hotlink on rar/tar/zip, dclick: ask to unrar. On incomplete dir, say incomplete file.
; -[18:25:20] -[xdcc]MC0031- *** All Slots Full, You are now in the bloody queue at pos 2. To Remove youself at a later time type "/msg [xdcc]MC0031 xdcc remove".
; -Make a menu (Old/New) item to show/hide advanced menu items such as filenames and timers.
; -When copying a nickname profile on nickchange, first remove old entries for $newnick (use /removeallwmatches).
; -On newnick, also check change from nick to known botnick.
; -Compensate for event sequence "$nick joins, timer starts, /rename $nick $nick2, timer ends, failed request".
; Simply copy the profile for nickname 1 to nickname 2, end the first timer and start a new one
; with time equal to the number of seconds that were left in the old one plus 3. - DONE. Testing.
; -Identifiers for all settings variables, so that a $null setting cannot occur. - DONE. Testing & Debugging.
; -Old/New Style menu items for %lastxdccsessiongetfile %lastxdccsessionsendfile %lastsessionfailfile
; %xdccsessionfailfile %xdcctotalgetfile %xdcctotalsendfile %totalfailfile
; -Use fpf files/etc. to automatically or manually add multi-source sources.
; -Somehow, check when an upload starts and add the started u/l to the failedsendsfile labelled as UnfinishedSend.
; -Make the refresh time for the transfer speeds stats dialog variable, and make it pretty.
; -In queue cycling: When not moving to next pack, delete bot from queue disabled file.
; -Use fpf to remove alternate bot queues on file completion, and guide the rotating queue function.
; - DONE, testing.
; -When a transfer starts, check if the fpf file is still correct, and if not, issue a warning that a
; transfering pack has most likely changed (and clear the fpf file, and modify the pff file by adding
; a warning in front of the pack).
; -[16:47:38] -Lair-U11- ** Closing Connection: You are no longer on a known channel
; -Add individual servers to the network hash.
; -USEFULL??: on 1:DCCSERVER:Send:echo $nick $address wants to send you $filename
; -Make the queue circulation optional (+menu items), and check if the circle has already been completed once
; (this session).
; -Add a small DCC server feature (silent) to combine with the auto resend.
; -Variable filenames for total get/sends files and joinchannel file.
; -Support for fserves in window @FSERVE_Info? (Yeah right!)
; -Add support for multiple triggers {HMC}raynev666:
; ...
; [10:44:38] <{HMC}RAYNEv666> [#5] [_53.5kB] - the_egyptian_book_of_the_dead [11 Gets]
; [10:44:40] <{HMC}RAYNEv666> Usage: /ctcp {HMC}RAYNEv666 XDCC GET BOOKS #<pack number>
; [10:44:45] <{HMC}RAYNEv666> [XDCC Active] - Sends:[1/1] - Queues:[3/10] - Record CPS:[15.9kB/s by aad] - Files Sent:[44] - Current Bandwidth:[13.2kB/s] - List Trigger:[/ctcp {HMC}RAYNEv666 XDCC LIST MOVIES] - SysReset 2.53
; [10:44:46] <{HMC}RAYNEv666> [#1] [700.7MB] - 28.Days.Later.DVDRip.XviD-DMT-VeN [10 Gets]
; [10:44:47] <{HMC}RAYNEv666> [#2] [346.5MB] - Blood - The Last Vampire [5 Gets]
; [10:44:49] <{HMC}RAYNEv666> [#3] [404.7MB] - Evil Dead II [11 Gets]
; [10:44:50] <{HMC}RAYNEv666> [#4] [606.1MB] - Evil Dead III - Army Of Darkness [8 Gets]
; [10:44:50] <{HMC}RAYNEv666> [#5] [682.8MB] - Hellraiser I [ ....
; ...
; [10:45:00] <{HMC}RAYNEv666> Usage: /ctcp {HMC}RAYNEv666 XDCC GET MOVIES #<pack number>
; ^^That gives annoying trigger updates and pack change warnings, and it makes one unable to
; request any packs from the first list.
; -[15:50:08] -`Naz- xdcc service »» You have entered a invalid pack. There are only 5 packs on this current xdcc server. Type: /msg `Naz xdcc list to get a current list.
; [15:50:07] EFnet: Starting queue for bot `Naz on EFnet. Single bot, no timer necessary. (2 items) (/msg `Naz xdcc send # or /ctcp `Naz xdcc send #4).
; [15:50:08] -`Naz- xdcc service »» You have entered a invalid pack. There are only 5 packs on this current xdcc server. Type: /msg `Naz xdcc list to get a current list.
; -Make it so that if %scon == $null > go to next bot (or connect to network in new window).
; -Make the auto send resume on start incorporate the bot's network (and maybe chan)
; -Make an option to do an automatic xdcc list for a bot if it advertises according to that principle.
; Make time interval about 5 mins +/- random of 2 or 3 mins (test on #punkmusic).
; -raw 401:*No such nick/channel*:/outputxdccinfo 4Request failed: Bot7 $2 is currently not connected to3 $network $+ .
; use that raw to keep better track of who's online and who isn't.
; -Check out possibilities of more raw and ctcp commands.
; -Make this less of a resource hog. - HOW? Reduce procedure calls, optimise inner loop. Optimise pack capture test. Reduce disk reads.
; -Make the script resume UPloads when a target person rejoins a channel.
; -Enhance the colour coding for messages (readability). - never DONE, but ok for now.
; -Enhance the help file. - never DONE, but improved.
; -Add a file settings help file.
; -Make an option for upper limit to number of retries per bot or recipient ($maxnumberresumes = Unlimited).
; Find a way to stop the script from requesting a file more than $maxnumberresumes times (otherwise temp
; queue may become troublesome. Increasing delay offset to 2000 should help though).
; -Enhance remove a pack from all queue files with pack comparisons instead of just filename (watch packchanges!).
; -Make colour codes variable. Nicklist especially. Add to settings dialog color tab.
; -Rename files where appropriate upon loading a profile.
; -Start timed b/w or d/l slot testing upon opening a profile if appropriate.
; -Add debugging statements. Use $scriptline when doing so.
; -Save nicklist size settings. - Impossible?
; -Add support for !XDCC list notices (and maybe the tv-central xdccfind, but that's just a bonus).
; -Make an option to colorise indexed bot nicknames in a CHANNEL nicklistbox.
; -Encode the chankey file with a simple algorithm for safety (will need to encode $network $chan before comparing).
; -Add dialog wizard items for min/max bandwidth/transfers, system connection bw, bot queue mode, testing setting.
; -Multi-source: If a bot goes offline, search other bots for the same pack and autoqueue (if option enabled).
; -Adapt the timed bandwidth checker to function as a statistics gatherer dialog that only starts bot queues if the
; test feature is enabled. Use statistics to draw a graphic b/w usage representation if possible.
; -Make the searches word order independent.
; -Make the script neater, for instance:
; -Write a single block of code for all aliases that use that block, where the code is now
; (more or less) copy/pasted.
; -Unset all local vars at the end of a method.
; -Reduce the /'s where possible; /window @XDCC_Info should just be window @XDCC_Info.
; -Create temp variables for String Tokens whereever they're used more than once.
; -Add line specific comments where appropriate.
; -Add comments on which aliases a part of the script call on, and which it was called by.
; -Replace the filename extensions by variables.
; -Make a lil scripted index that holds the linenumbers for each key part of the script relative to
; it's predecessor, but that's not something that's important right now (use $scriptline).
;
;
; ...but we'll see what the future brings. If anyone has any suggestions, feel free to /msg me.
;
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;--------------------------Identifiers Section----------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $replxdccfile($1-), $replxdccdir($1-), $replxdccpack($1-),
; $remvextent($1-), $remvall($1-), $removehotlink($1-), $remvallnonum($1-)
; and $remvqnotice($1-):
; $1-: String or filename.
; Do replacent/removal/codestripping on $1-.
;-------------------------------------------------------------------------
alias preventdoubleslash { return $replace($1-,$chr(92) $+ $chr(92),$chr(92),$chr(47) $+ $chr(47),$chr(47)) }
alias replxdccdir { return $replace($strip($1-,burc),|,_,*,_,?,_,",_,$chr(60),_,$chr(62),_) }
alias replxdccfile { return $replace($replxdccdir($1-),$chr(92),_,$chr(47),_) }
alias replxdccpack { return $replace($strip($1-,burc)," **, ,**,,$chr(35) $+ x,$chr(35),$chr(35) $+ $chr(60) $+ pack number $+ $chr(62),$chr(35),$chr(35) $+ <number>,$chr(35),$chr(58),,$chr(46),,•«UPP»•,,type,,",, ‹‹UPP››,, UPP ,) }
alias replaceallwishlist { return $replace($strip($1-,burc),$chr(32),*,_,*,$chr(32) $+ and,*,&,*) }
alias remvextentnodot { return $remove($strip($1-,burc),avi,asf,txt,mp3,mpg,mpeg,rar,tar,zip,mov,nfo,sfv,doc,mrc,exe,ini) }
alias remvextent { return $remove($strip($1-,burc),.avi,.asf,.txt,.mp3,.mpg,.mpeg,.rar,.tar,.zip,.mov,.nfo,.sfv,.doc,.mrc,.exe,.ini) }
alias remvallnonum { return $remove($remvextent($1-),$chr(32),???K,[,],<,>,$chr(35),$chr(40),$chr(41),_,$chr(47),$chr(92)) }
alias remvall { return $remove($remvallnonum($1-),1,2,3,4,5,6,7,8,9,0,n/a,MB,KB,GB,BYTE) }
alias remvqnotice { return $remove($remvextent($1-),",$chr(44)) }
alias removehotlink { return $remove($1,$preventdoubleslash($xdccdir $+ \),.pff.old,.pff,.q,.fpf,$chr(46),$chr(44),$chr(40),$chr(41),:,;,\,/,") }
alias replallnum { $replace($1,1,¦,2,¦,3,¦,4,¦,5,¦,6,¦,7,¦,8,¦,9,¦,0,¦) }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removeallwmatches $1 $2-:
; $1: Filename.
; $2-: Wildcard string.
; Remove all wildcard matches with $2- from file $1.
;-------------------------------------------------------------------------
alias removeallwmatches {
var %i = 1
var %llen = $lines($1)
while (%i <= %llen && $read($1,wnt,$2-)) {
/write -dw" $+ $2- $+ " $1
dec %llen
inc %i
}
}
;-------------------------------------------------------------------------
; /removeallsmatches $1 $2-:
; $1: Filename.
; $2-: Starts with string.
; Remove all matches starting with $2- from file $1.
;-------------------------------------------------------------------------
alias removeallsmatches {
var %i = 1
var %llen = $lines($1)
while (%i <= %llen && $read($1,snt,$2-)) {
/write -ds" $+ $2- $+ " $1
dec %llen
inc %i
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $getnormfilesize($1):
; $1: A file size in bytes.
; Returns a normalized filesize.
;-------------------------------------------------------------------------
alias getnormfilesize {
var %normsize = $1
if ($1 >= $calc(1024^6)) { set %normsize $round($calc($1 / (1024^6)),2) HB }
elseif ($1 >= $calc(1024^5)) { set %normsize $round($calc($1 / (1024^5)),2) PB }
elseif ($1 >= $calc(1024^4)) { set %normsize $round($calc($1 / (1024^4)),2) TB }
elseif ($1 >= $calc(1024^3)) { set %normsize $round($calc($1 / (1024^3)),2) GB }
elseif ($1 >= $calc(1024^2)) { set %normsize $round($calc($1 / (1024^2)),2) MB }
elseif ($1 >= 1024) { set %normsize $round($calc($1 / 1024),2) KB }
else { set %normsize %normsize bytes }
return %normsize
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $checkFPF($1, $2, $3)
; $1: Network.
; $2: Nick.
; $3: Pack num.
; Returns true if a file is transfering, false if not (or unknown).
;-------------------------------------------------------------------------
alias checkFPF {
if ($exists($getfpffilenm($1,$2)) && ($read($getfpffilenm($1,$2),snt,$3) != $null) && (Unknown File $chr(35) $+ * !iswm $read($getfpffilenm($1,$2),snt,$3))) {
var %i = 1
var %file = $read($getfpffilenm($1,$2),snt,$3)
while (%i <= $get(0)) {
if ($get(%i).file == %file) { return true }
inc %i
}
}
return false
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $botliston:
; Returns TRUE if the @XDCC_Info nick list currently exists.
;-------------------------------------------------------------------------
alias botliston {
if ($showbotlist == on && ($infochoise == special window || $infochoise == both active and special windows) && $window(@XDCC_Info) != $null) { return TRUE }
else { return $null }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $botqueue.exists:
; Returns TRUE if a bot queue or temporary bot queue exists.
;-------------------------------------------------------------------------
alias botqueue.exists {
if (($exists($botqueuefile) && $lines($botqueuefile) > 0) || ($exists($tempbotqueuefile) && $lines($tempbotqueuefile) > 0)) {
return TRUE
}
else { return $null }
}
;-------------------------------------------------------------------------
; $shouldstartmaxbotq:
; Returns TRUE if a new bot queue can be started on grounds of the maximum
; number of transfers (used by getfails, filercvds, etc.).
;-------------------------------------------------------------------------
alias shouldstartmaxbotq {
if ($botqueuemode == number of transfers && ($maxtransfers == unlimited || $maxtransfers == 0 || $calc($activesends + $activeautoresumesends) < $maxtransfers)) { return TRUE }
elseif ($botqueuemode == bandwidth) {
var %averagebw = 0
var %totalbytes = 0
var %oldtotalbytes = 0
if ($exists($statsfile(2))) {
var %z = 1
while (%z <= $lines($statsfile(2))) {
if ($get($gettok($read($statsfile(2),%z),1,32)).status == active) { set %oldtotalbytes $calc(%oldtotalbytes + $gettok($read($statsfile(2),%z),2,32)) }
inc %z
}
}
var %newtotalbytes = 0
if ($exists($statsfile(1))) {
var %z = 1
while (%z <= $get(0)) {
set %newtotalbytes $calc(%newtotalbytes + $get(%z).rcvd)
inc %z
}
}
set %averagebw $calc($calc(%totalbytes / $calc($statisticstime - $1)) / 1024)
set %totalbytes $calc(%newtotalbytes - %oldtotalbytes)
var %totaltimers = 0
var %timeroverhead = 0
var %z = 1
while (%z <= $timer(0)) {
if ($isXDCCTimer(%z) == TRUE) {
inc %totaltimers
set %timeroverhead $calc(%timeroverhead + $calc($calc(10 * $sqrt($connectionbandwidth)) / $sqrt($timer(%z).secs)))
}
inc %z
}
if ($calc(%averagebw + %timeroverhead) <= $maxbandwidth) { return TRUE }
else {
;/outputxdccinfo not starting max bot queue bw: %averagebw timers: %timeroverhead total: $calc(%averagebw + %timeroverhead) <= $minbandwidth) min: $minbandwidth
return $null
}
}
}
;-------------------------------------------------------------------------
; $shouldstartminbotq:
; Returns TRUE if a new bot queue can be started on grounds of the minimum
; number of transfers (used by timed test).
;-------------------------------------------------------------------------
alias shouldstartminbotq {
if ($botqueuemode == number of transfers && ($mintransfers != unlimited && $mintransfers != 0 && $calc($activesends + $activeautoresumesends) < $mintransfers)) { return TRUE }
elseif ($botqueuemode == bandwidth) {
var %averagebw = 0
var %totalbytes = 0
var %oldtotalbytes = 0
if ($exists($statsfile(2))) {
var %z = 1
while (%z <= $lines($statsfile(2))) {
if ($get($gettok($read($statsfile(2),%z),1,32)).status == active) { set %oldtotalbytes $calc(%oldtotalbytes + $gettok($read($statsfile(2),%z),2,32)) }
inc %z
}
}
var %newtotalbytes = 0
if ($exists($statsfile(1))) {
var %z = 1
while (%z <= $get(0)) {
set %newtotalbytes $calc(%newtotalbytes + $get(%z).rcvd)
inc %z
}
}
set %averagebw $calc($calc(%totalbytes / $calc($statisticstime - $1)) / 1024)
set %totalbytes $calc(%newtotalbytes - %oldtotalbytes)
var %totaltimers = 0
var %timeroverhead = 0
var %z = 1
while (%z <= $timer(0)) {
if ($isXDCCTimer(%z) == TRUE) {
inc %totaltimers
set %timeroverhead $calc(%timeroverhead + $calc($calc(10 * $sqrt($connectionbandwidth)) / $sqrt($timer(%z).secs)))
}
inc %z
}
if ($calc(%averagebw + %timeroverhead) <= $minbandwidth) { return TRUE }
else {
;/outputxdccinfo not starting bot queue bw: %averagebw timers: %timeroverhead total: $calc(%averagebw + %timeroverhead) <= $minbandwidth) min: $minbandwidth
return $null
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $activesends:
; Returns the number of active incoming transfers.
;-------------------------------------------------------------------------
alias activesends {
var %activesends = 0
var %m = 1
while (%m <= $get(0)) {
if ($get(%m).status == active) { inc %activesends }
inc %m
}
return %activesends
}
;-------------------------------------------------------------------------
; $activeautoresumesends:
; Returns the number of active pack request timers.
;-------------------------------------------------------------------------
alias activeautoresumesends {
var %activeautoresumesends = 0
var %n = 1
while (%n <= $timer(0)) {
if ($isXDCCTimer(%n)) { inc %activeautoresumesends }
inc %n
}
return %activeautoresumesends
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $isXDCCTimer($1):
; $1: Timer number.
; Returns TRUE if timer is a timer to start a bot, $null if otherwise.
;-------------------------------------------------------------------------
alias isXDCCTimer {
if (xdccautoresume isin $timer($1) || xdccstartq isin $timer($1) || xdccstartbotq isin $timer($1) || xdccjoin isin $timer($1) || xdccnonewconnect isin $timer($1)) { return TRUE }
else { return $null }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $averagexdcccps($1), $estimatedxdcccompltime($1):
; $1: $nick of active transfer.
; Returns average CPS of the current transfer or estimated time untill the
; transfer is completed respectively.
;-------------------------------------------------------------------------
alias averagexdcccps { return $int($calc($calc($get($1).rcvd - $get($1).resume) / $get($1).secs)) }
alias averagesendcps { return $int($calc($calc($send($1).sent - $send($1).resume) / $send($1).secs)) }
;-------------------------------------------------------------------------
alias estimatedxdcccompltime {
var %totsecs = $ceil($calc($calc($get($1).size - $get($1).rcvd) / $averagexdcccps($1)))
var %totmins = $floor($calc(%totsecs / 60))
var %tothours = $floor($calc(%totmins / 60))
var %totdays = $floor($calc(%tothours / 24))
var %daysleft = $floor(%totdays)
var %hoursleft = $floor($calc(%tothours - $calc(%totdays * 24)))
var %minsleft = $floor($calc(%totmins - $calc(%tothours * 60)))
var %secsleft = $ceil($calc(%totsecs - $calc(%totmins * 60)))
var %estimatedxdcccompltime = $null
if (%daysleft > 0) {
set %estimatedxdcccompltime 4 $+ %daysleft $+ 5d4 $+ %hoursleft $+ 5h4 $+ %minsleft $+ 5m4 $+ %secsleft $+ 5s
}
elseif (%hoursleft > 0) {
set %estimatedxdcccompltime 4 $+ %hoursleft $+ 5h4 $+ %minsleft $+ 5m4 $+ %secsleft $+ 5s
}
elseif (%minsleft > 0) {
set %estimatedxdcccompltime 4 $+ %minsleft $+ 5m4 $+ %secsleft $+ 5s
}
else {
set %estimatedxdcccompltime 4 $+ %secsleft $+ 5s
}
return %estimatedxdcccompltime
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias estimatedsendcompltime {
var %totsecs = $ceil($calc($calc($send($1).size - $send($1).sent) / $averagesendcps($1)))
var %totmins = $floor($calc(%totsecs / 60))
var %tothours = $floor($calc(%totmins / 60))
var %totdays = $floor($calc(%tothours / 24))
var %daysleft = $floor(%totdays)
var %hoursleft = $floor($calc(%tothours - $calc(%totdays * 24)))
var %minsleft = $floor($calc(%totmins - $calc(%tothours * 60)))
var %secsleft = $ceil($calc(%totsecs - $calc(%totmins * 60)))
var %estimatedxdcccompltime = $null
if (%daysleft > 0) {
set %estimatedxdcccompltime 4 $+ %daysleft $+ 5d4 $+ %hoursleft $+ 5h4 $+ %minsleft $+ 5m4 $+ %secsleft $+ 5s
}
elseif (%hoursleft > 0) {
set %estimatedxdcccompltime 4 $+ %hoursleft $+ 5h4 $+ %minsleft $+ 5m4 $+ %secsleft $+ 5s
}
elseif (%minsleft > 0) {
set %estimatedxdcccompltime 4 $+ %minsleft $+ 5m4 $+ %secsleft $+ 5s
}
else {
set %estimatedxdcccompltime 4 $+ %secsleft $+ 5s
}
return %estimatedxdcccompltime
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $timepassed($1, $2):
; $1: Date $asctime([dd/mm/yyyy][HH:nn:ss]).
; $2: Date $asctime([dd/mm/yyyy][HH:nn:ss]).
; Returns the time difference in secs between two received file dates.
;-------------------------------------------------------------------------
alias timepassed {
var %date1 = $ctime($replace($1,][,$chr(32),[,,],))
var %date2 = $ctime($replace($2,][,$chr(32),[,,],))
if (%date1 > %date2) { var %timediffsecs = $calc(%date1 - %date2) }
else { var %timediffsecs = $calc(%date2 - %date1) }
return %timediffsecs
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; $asctimepassed($1, $2):
; $1: Date $asctime([dd/mm/yyyy][HH:nn:ss]).
; $2: Date $asctime([dd/mm/yyyy][HH:nn:ss]).
; Returns the time in formatted time for number of secs.
;-------------------------------------------------------------------------
alias asctimepassed {
var %totsecs = $timepassed($1,$2)
var %totmins = $floor($calc(%totsecs / 60))
var %tothours = $floor($calc(%totmins / 60))
var %totdays = $floor($calc(%tothours / 24))
var %totweeks = $floor($calc(%totdays / 7))
var %totmonths = $floor($calc(%totdays / 30.5))
var %totyears = $floor($calc(%totdays / 365))
var %yearsleft = $floor($calc(%totdays / 365))
var %monthsleft = $floor($calc($calc(%totdays - $calc(%yearsleft * 365)) / 30.5))
var %weeksleft = $floor($calc($calc(%totdays - $calc($calc(%yearsleft * 365) + $calc(%monthsleft * 30.5))) / 7))
var %daysleft = $floor($calc(%totdays - $calc(%totweeks * 7)))
var %hoursleft = $floor($calc(%tothours - $calc(%totdays * 24)))
var %minsleft = $floor($calc(%totmins - $calc(%tothours * 60)))
var %secsleft = $ceil($calc(%totsecs - $calc(%totmins * 60)))
var %timediff = 4 $+ $iif(%yearsleft > 0,%yearsleft $+ 5yr4) $+ $iif(%monthsleft > 0,%monthsleft $+ 5mnth4) $+ $iif(%weeksleft > 0,%weeksleft $+ 5wk4) $+ $iif(%daysleft > 0,%daysleft $+ 5d4) $+ $iif(%hoursleft > 0,%hoursleft $+ 5h4) $+ $iif(%minsleft > 0,%minsleft $+ 5m4) $+ $iif(%secsleft > 0,%secsleft $+ 5s)
return %timediff
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;----------------------------Aliases Section------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /makexdccwindow:
; Makes a status window to print xdcc info to.
;-------------------------------------------------------------------------
alias makexdccwindow {
if ($showbotlist == ON) {
if (!$window(@XDCC_Info)) {
window -ak0mnel17S @XDCC_Info
font $xdccfont
var %i = 1
var %llen = $triggerHash.items
while (%i <= %llen) {
if ($me ison $triggerHash.item.chan(%i) && $triggerHash.item.nick(%i) ison $triggerHash.item.chan(%i)) { aline -lnc7 @XDCC_Info $triggerHash.item.nick(%i) }
elseif ($me ison $triggerHash.item.chan(%i)) { aline -lnc10 @XDCC_Info $triggerHash.item.nick(%i) }
else { aline -lnc14 @XDCC_Info $triggerHash.item.nick(%i) }
inc %i
}
}
window -S @XDCC_Info
}
else {
if (!$window(@XDCC_Info)) {
window -ak0mne @XDCC_Info
font $xdccfont
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /debuglog $1-:
; $1-: Information on XDCC script workings and xdcc pack finds.
; Outputs $1- to a log file.
;-------------------------------------------------------------------------
alias debuglog {
if ($debugxdccinfo == on) {
/write -a $xdccdebugfile $asctime([HH:nn:ss]) $1-
}
}
;-------------------------------------------------------------------------
alias debuglog.sessionstart {
/debuglog
/debuglog ----------------------------------------------------------------
/debuglog ----------- Session start $date(<dddd mmmm d yyyy>) -----------
/debuglog ----------------------------------------------------------------
/debuglog
}
;-------------------------------------------------------------------------
alias debuglog.sessionend {
/debuglog
/debuglog ****************************************************************
/debuglog *********** Session end $date(<dddd mmmm d yyyy>) **************
/debuglog ****************************************************************
/debuglog
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /outputxdccinfo $1-:
; $1-: Information on XDCC script workings and xdcc pack finds.
; Outputs $1- to the prefered window.
;-------------------------------------------------------------------------
alias outputxdccinfo {
var %msg = $1-
if ($infochoise == special window) {
/makexdccwindow
//aline -hp @XDCC_Info $asctime([HH:nn:ss]) %msg
}
elseif ($infochoise == active window) { //echo -a %msg }
elseif ($infochoise == server status window) { //echo -s %msg }
elseif ($infochoise == both active and special windows ) {
/makexdccwindow
//aline -hp @XDCC_Info $asctime([HH:nn:ss]) %msg
//echo -a %msg
}
/debuglog $scriptline $+ : ALIAS OUTPUTXDCCINFO: %msg
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; Sets the font and fontsize for the separate output window.
;-------------------------------------------------------------------------
alias setxdccfont {
/makexdccwindow
window -a @XDCC_Info
font
if ($window(@XDCC_Info).fontbold) { $xdccfont = -b @XDCC_Info $window(@XDCC_Info).fontsize $window(@XDCC_Info).font }
else { $xdccfont = @XDCC_Info $window(@XDCC_Info).fontsize $window(@XDCC_Info).font }
/outputxdccinfo 14XDCC Info window font set to $xdccfont $+ .
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /checknewversion:
; Checks for new versions with me, the author.
;-------------------------------------------------------------------------
alias checknewversion {
.enable #groupcheckversion
.notice $xdccscriptauthor Script versioncheck $xdccscriptversion
.timerxdcccheckversion 1 90 .disable #groupcheckversion
/outputxdccinfo 14Checking for new XDCC script version... (Timeout 90 seconds).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /versioninfo:
; Short info about the script.
;-------------------------------------------------------------------------
alias versioninfo {
/outputxdccinfo 5Name: XDCC Autoresume/Autoqueue Stealth Script
/outputxdccinfo 5File: $script
/outputxdccinfo 5Version: $xdccscriptversion
/outputxdccinfo 5Author: $xdccscriptauthor
/outputxdccinfo 5Release Date: 23/02/2005
/outputxdccinfo 5Installation date: $installdate
/outputxdccinfo 5XDCC directory used: $xdccdir
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /xdccgetstats:
; Retrieve the number of known bots and packs.
;-------------------------------------------------------------------------
alias xdccgetstats {
var %numofpackslisted = 0
var %maxnumpacks = 0
var %maxnick = $null
var %unknownpacks = 0
var %llen = $triggerHash.items
var %i = 1
while (%i <= %llen) {
var %botpacknum = $lines($getpfffilenm($triggerHash.item.network(%i), $triggerHash.item.nick(%i)))
set %numofpackslisted $calc(%numofpackslisted + %botpacknum)
if (%maxnumpacks < %botpacknum) {
set %maxnumpacks %botpacknum
set %maxnick $triggerHash.item.nick(%i)
}
var %j = 1
var %llenj = $lines($getpfffilenm($triggerHash.item.network(%i), $triggerHash.item.nick(%i)))
while (%j <= %llenj) {
if (*Unknown Pack $chr(35) $+ * iswm $read($getpfffilenm($triggerHash.item.network(%i), $triggerHash.item.nick(%i)),nt,%j)) { inc %unknownpacks }
inc %j
}
inc %i
}
var %totalgetsize = 0
var %totalsendsize = 0
var %j = 1
while (%j <= $lines($xdcctotalgetfile)) {
set %totalgetsize $calc(%totalgetsize + $gettok($read($xdcctotalgetfile,nt,%j),1,32))
inc %j
}
var %j = 1
while (%j <= $lines($xdcctotalsendfile)) {
set %totalsendsize $calc(%totalsendsize + $gettok($read($xdcctotalsendfile,nt,%j),1,32))
inc %j
}
var %ratio = 0
if (%totalsendsize == %totalgetsize) { set %ratio 15 :4 1 }
elseif (%totalsendsize == 0) { set %ratio 05 :4 %totalgetsize }
elseif (%totalgetsize == 0) { set %ratio %totalsendsize 5:4 0 }
elseif (%totalgetsize > %totalsendsize) { set %ratio 1 5:4 $round($calc(%totalgetsize / %totalsendsize),2) }
else { set %ratio $round($calc(%totalsendsize / %totalgetdsize),2) 5:4 1 }
var %avgulfilesize = $round($calc(%totalsendsize / $lines($xdcctotalsendfile)),0)
var %avgdlfilesize = $round($calc(%totalgetsize / $lines($xdcctotalgetfile)),0)
var %sendfilemintime = $gettok($read($xdcctotalsendfile,nt,1),$numtok($read($xdcctotalsendfile,nt,1),32),32)
var %sendfilemaxtime = $gettok($read($xdcctotalsendfile,nt,$lines($xdcctotalsendfile)),$numtok($read($xdcctotalsendfile,nt,$lines($xdcctotalsendfile)),32),32)
var %getfilemintime = $gettok($read($xdcctotalgetfile,nt,1),$numtok($read($xdcctotalgetfile,nt,1),32),32)
var %getfilemaxtime = $gettok($read($xdcctotalgetfile,nt,$lines($xdcctotalgetfile)),$numtok($read($xdcctotalgetfile,nt,$lines($xdcctotalgetfile)),32),32)
if ($ctime($replace(%sendfilemintime,][,$chr(32),[,,],)) < $ctime($replace(%getfilemintime,][,$chr(32),[,,],))) { var %statsmintime = %sendfilemintime }
else { var %statsmintime = %getfilemintime }
if ($ctime($replace(%sendfilemaxtime,][,$chr(32),[,,],)) > $ctime($replace(%getfilemaxtime,][,$chr(32),[,,],))) { var %statsmaxtime = %sendfilemaxtime }
else { var %statsmaxtime = %getfilemaxtime }
/outputxdccinfo 13 $+ %numofpackslisted 5packs listed on7 $triggerHash.items 5XDCC Bots known in library.
/outputxdccinfo 5Bot7 %maxnick 5has the highest number of packs (13 $+ %maxnumpacks $+ 5). The average number of packs per bot is6 $round($calc(%numofpackslisted / $triggerHash.items),0) $+ 5.
/outputxdccinfo 4 $+ %unknownpacks 5packs have not been captured yet because you entered a room while they were halfway through their listing, or have failed to be captured because of overlapping bot pack schemes and are marked as unknown (12 $+ $round($calc($calc(%unknownpacks / %numofpackslisted) * 100),4) $+ $chr(37) $+ ).
/outputxdccinfo 5 $+ $filesgettotal files received ( $+ $getnormfilesize(%totalgetsize) in $lines($xdcctotalgetfile) file(s) in statistics file) and $filessenttotal files sent ( $+ $getnormfilesize(%totalsendsize) in $lines($xdcctotalsendfile) file(s) in statistics file) since last script version install ( $+ $installdate $+ ).
/outputxdccinfo 5That makes your documented 3Up5load/4Down5load bytes ratio3 %ratio $+ 5.
/outputxdccinfo 5The average size of your downloaded packs is2 $getnormfilesize(%avgdlfilesize) $+ 5, and the average size of your uploaded packs is2 $getnormfilesize(%avgulfilesize) $+ 5.
/outputxdccinfo 5The total recorded time in the transfer stats files is10 $asctimepassed(%statsmintime,%statsmaxtime) $+ 5.
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /showbotinfo $1:
; $1: Botnick.
; Get info on a specific bot.
;-------------------------------------------------------------------------
alias showbotinfo {
var %botnetwork = $null
if ($triggerHash.exists($network,$1)) {
set %botnetwork $network
}
elseif ($triggerHash.findNetwork($1 *)) {
set %botnetwork $triggerHash.findNetwork($1 *)
}
var %timerautoresume = $null
var %timerautojoin = $null
var %timerstartbotq = $null
var %i = 1
while (%i <= $timer(0)) {
if (xdccautoresume $+ $1 $+ ? iswm $timer(%i)) { set %timerautoresume 1 }
if (xdccjoin $+ $1 $+ ? iswm $timer(%i)) { set %timerautojoin 1 }
if (xdccstartbotq $+ $1 $+ ? iswm $timer(%i)) { set %timerstartbotq 1 }
inc %i
}
var %i = 1
var %botinnetworkfile = $null
while (%i <= $findfile($xdccdir,*.apq,0)) {
if ($read($findfile($xdccdir,*.apq,%i),wnt,* $1 *)) { set %botinnetworkfile 1 }
inc %i
}
var %botstatus = $null
if (($exists($xdccsinprogress) && $read($xdccsinprogress,snt,$1)) || %botinnetworkfile == 1) {
if ($get($1).status == active && $send($1).status == active) { set %botstatus 9Transfering: Sending and Receiving }
elseif ($get($1).status == active) { set %botstatus 9Transfering: Sending }
elseif ($send($1).status == active) { set %botstatus 9Transfering: Receiving }
elseif ($exists($xdccqueueposfile) && $read($xdccqueueposfile,wnt,$1 $+ ¦*)) { set %botstatus 3Remotely Queued }
elseif (%timerautojoin != $null) { set %botstatus 5On Timer for (Re-)Request (For Channel Join request) }
elseif (%timerautoresume != $null) { set %botstatus 5On Timer for Resume Request (For Queue Full or Auto-Resume) }
elseif (%timerstartbotq != $null) { set %botstatus 5On Timer for Request (For Bot Queue Activation) }
elseif ($exists($autoresumedisablefile) && $read($autoresumedisablefile,wnt,$1 $+ ¦ $+ %botnetwork)) { set %botstatus 2Temporarily Disabled }
else { set %botstatus 12Remotely Queued or Offline and Waiting }
}
elseif ($exists($tempbotqueuefile) && $read($tempbotqueuefile,wnt,$1 $+ *)) { set %botstatus 11Locally Priority Queued In Temp Bot Queue in position $readn }
elseif ($exists($botqueuefile) && $read($botqueuefile,wnt,$1 $+ *)) { set %botstatus 10Locally Queued in Bot Queue in position $readn }
elseif ($exists($getqfilenm(%botnetwork,$1)) && $lines($getqfilenm(%botnetwork,$1)) > 0) { set %botstatus 13Inactive, but packs are passively queued. }
elseif ($exists($autoresumedisablefile) && $read($autoresumedisablefile,wnt,$1 $+ ¦ $+ %botnetwork)) { set %botstatus 14Permanently Disabled }
else { set %botstatus Inactive }
if (%botnetwork != $null) {
/outputxdccinfo Bot7 $1 info:
$iif($get($1),/outputxdccinfo Bot is currently active and 9sending to you.)
$iif($send($1),/outputxdccinfo Bot is currently active and 3receiving from you.)
/outputxdccinfo 14Nickname:7 $triggerHash.getNick(%botnetwork,$1)
/outputxdccinfo 14Network:3 %botnetwork
/outputxdccinfo 14Channel:12 $triggerHash.getChan(%botnetwork, $1)
/outputxdccinfo 14Status:12 %botstatus
/outputxdccinfo 14Trigger:5 $triggerHash.getTrigger(%botnetwork, $1)
/outputxdccinfo 14Pack scheme type nr: $triggerHash.getPsnr(%botnetwork, $1)
/outputxdccinfo 14Trigger scheme type nr.: $triggerHash.getTsnr(%botnetwork, $1)
/outputxdccinfo 14Nr. of packs in pack library file10 " $+ $getpfffilenm(%botnetwork, $1) $+ "14:13 $lines($getpfffilenm(%botnetwork, $1)) $iif($exists($getpfffilenm(%botnetwork, $1)), 14 $+ $chr(40) $+ Last updated: $asctime($file($getpfffilenm(%botnetwork, $1)).mtime) $+ $chr(41) $+ .,14 $+ $chr(40) $+ No .pff File found $+ $chr(41) $+ .)
/outputxdccinfo 14Nr. of queued packs in queue library file10 " $+ $getqfilenm(%botnetwork, $1) $+ "14:13 $lines($getqfilenm(%botnetwork, $1)) $iif($exists($getqfilenm(%botnetwork, $1)),14 $+ $chr(40) $+ Last updated: $asctime($file($getqfilenm(%botnetwork, $1)).mtime) $+ $chr(41) $+ .,14 $+ $chr(40) $+ No .q File found $+ $chr(41) $+ .)
/outputxdccinfo ---End of bot info---
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /movexdccdir & /movexdccdir $1:
; $1: New directory.
; This moves all files to the newly entered directory and then removes the
; old copies of those files, and the old directory. It also sets the
; %XDCCdir variable.
;-------------------------------------------------------------------------
alias movexdccdir { movexdccdir2 $sdir($xdccdir, Select directory to be used for XDCC script) }
;-------------------------------------------------------------------------
alias movexdccdir2 {
/pleasewaitdialog
var %tempname = $1
if (%tempname != $null && $replxdccdir(%tempname) != $xdccdir) {
var %newdirname = $replxdccdir(%tempname)
if ($chr(92) isin %newdirname) {
if ($chr(47) !isin %newdirname && $isdir($remove(%newdirname,$gettok(%newdirname, $numtok(%newdirname,92),92)))) {
.mkdir %newdirname
}
else {
/outputxdccinfo 4Creating directory failed:14 Cannot created nested directory, " $+ $chr(92) $+ " or " $+ $chr(47) $+ " in input:2 %newdirname $+ .
}
}
elseif ($chr(47) isin %newdirname) {
if ($chr(92) !isin %newdirname && $isdir($remove(%newdirname,$gettok(%newdirname, $numtok(%newdirname,47),47)))) {
.mkdir %newdirname
}
else {
/outputxdccinfo 4Creating directory failed:14 Cannot created nested directory, " $+ $chr(47) $+ " or " $+ $chr(92) $+ " in input:2 %newdirname $+ .
}
}
else {
.mkdir %newdirname
}
if ($isdir(%newdirname)) {
var %i = 1
var %olddirname = $XDCCdir
/outputxdccinfo 2Directory %newdirname 14created succesfully. Starting file transfer, please wait5...
while ($findfile(%olddirname,*,%i,1)) {
.copy -o $findfile(%olddirname,*,%i,1) %newdirname $+ \ $+ $nopath($findfile(%olddirname,*,%i,1))
inc %i
}
/outputxdccinfo 3Copied14 %i files from %olddirname to %newdirname $+ , deleting old files...
set %XDCCdir %newdirname
var %j = 1
while ($findfile(%olddirname,*,%j,1)) {
if ($exists(%newdirname $+ \ $+ $nopath($findfile(%olddirname,*,%j,1)))) {
.remove $findfile(%olddirname,*,%j,1)
}
else {
/outputxdccinfo 4Not deleting old file:14 File does not exist, %newdirname $+ \ $+ $nopath($findfile(%olddirname,*,%j,1)) $+ .
inc %j
}
}
/outputxdccinfo 4Removed14 $calc($calc(%i - %j) + 1) files from %olddirname $+ , deleting old directory %olddirname $+ ...
if ($findfile(%olddirname,*,0) == 0) {
rmdir %olddirname
/outputxdccinfo 14Directory 4Deleted14, files 3moved14. New directory name is now2 %newdirname $+ .
}
else { /outputxdccinfo 14Directory 4Could not be deleted14 because it is not empty (Possible cause: New dir is nested in old dir?). Files 3moved14. New working directory name is now2 %newdirname $+ . }
}
else { /outputxdccinfo 4ERROR:14 Directory creation failed ( $+ %newdirname $+ ). }
}
else { /outputxdccinfo 4ERROR:14 No name entered, new directory is the same as old directory or directory renaming cancelled. }
/outputxdccinfo
/closewaitdialog
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /timeoff $1 $2
; $1: Botnick.
; $2: Botnetwork.
; Stops requests for bots that appear to already have an item queued.
;-------------------------------------------------------------------------
alias timeoff {
.timerxdccautoresume $+ $1 $+ ? off
.timerxdccautoresume $+ $2 $+ $1 $+ ? off
.timerxdccstartbotq $+ $1 $+ ? off
.timerxdccstartq $+ $1 $+ ? off
.timerxdccnonewconnect $+ $1 $+ ? off
.timerxdccjoin $+ $1 $+ * off
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /triggercapture $1 $2 $3 $4 $5-
; $1: $network.
; $2: $nick.
; $3: $chan.
; $4: triggerscheme number.
; $5-: trigger (%xdccfilegetcommand).
; This alias is called from text triggers that respond to text patterns
; that appear to be XDCC trigger ads.
; The triggers are written to $triggerHash together with bot nick and
; network.
;-------------------------------------------------------------------------
alias triggercapture {
if ($5- != $null) {
if ($triggerHash.exists($1, $2) == $null) {
/triggerHash.add $1 $2 $3 $4 default $5-
if ($showbotlist == ON) { /aline -lnc7 @XDCC_Info $2 }
/outputxdccinfo 4 $+ $triggerHash.items $+ : Added "3 $+ $1 7 $+ $2 $+ 12 $3 ||5 $5- $+ " to $triggerHash 14(Trigger Scheme $4 $+ ).
/outputxdccinfo
}
elseif ($triggerHash.getTrigger($1, $2) != $5-) {
if ($3 !isin $triggerHash.getChans($1, $2)) {
if ($triggerHash.getPsnr($1, $2) != $null) { /triggerHash.add $1 $2 $triggerHash.getChans($1, $2) $+ $+ $3 $4 $triggerHash.getPsnr($1, $2) $5- }
else { /triggerHash.add $1 $2 $triggerHash.getChans($1, $2) $+ $+ $3 $4 default $5- }
}
else {
if ($triggerHash.getPsnr($1, $2) != $null) { /triggerHash.add $1 $2 $3 $4 $triggerHash.getPsnr($1, $2) $5- }
else { /triggerHash.add $1 $2 $3 $4 default $5- }
}
/outputxdccinfo Updated trigger for "3 $+ $1 7 $+ $2 $+ 12 $3 ||5 $5- $+ " 14(Trigger Scheme $4 $+ ).
/outputxdccinfo
}
elseif ($3 !isin $triggerHash.getChans($1, $2)) {
if ($triggerHash.getChans($1, $2) != $null && $triggerHash.getChans($1, $2) != |UNKNOWN|) {
if ($triggerHash.getPsnr($1, $2) != $null) { /triggerHash.add $1 $2 $triggerHash.getChans($1, $2) $+ $+ $3 $4 $triggerHash.getPsnr($1, $2) $5- }
else { /triggerHash.add $1 $2 $triggerHash.getChans($1, $2) $+ $+ $3 $4 default $5- }
}
else {
if ($triggerHash.getPsnr($1, $2) != $null) { /triggerHash.add $1 $2 $3 $4 $triggerHash.getPsnr($1, $2) $5- }
else { /triggerHash.add $1 $2 $3 $4 default $5- }
}
/outputxdccinfo Updated channel for "3 $+ $1 7 $+ $2 $+ 12 $triggerHash.getChans($1, $2) ||5 $5- $+ " 14(Trigger Scheme $4 $+ ).
/outputxdccinfo
}
elseif ($triggerHash.getTsnr($1, $2) != $4) {
if ($3 !isin $triggerHash.getChans($1, $2)) {
if ($triggerHash.getPsnr($1, $2) != $null) { /triggerHash.add $1 $2 $triggerHash.getChans($1, $2) $+ $+ $3 $4 $triggerHash.getPsnr($1, $2) $5- }
else { /triggerHash.add $1 $2 $triggerHash.getChans($1, $2) $+ $+ $3 $4 default $5- }
}
else {
if ($triggerHash.getPsnr($1, $2) != $null) { /triggerHash.add $1 $2 $3 $4 $triggerHash.getPsnr($1, $2) $5- }
else { /triggerHash.add $1 $2 $3 $4 default $5- }
}
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
#grouppackcapture on
;-------------------------------------------------------------------------
; /packcapture $1 $2 $3 $4 $5-:
; $1: $network.
; $2: $nick.
; $3: $chan.
; $4: Packscheme number.
; $5: Packnumber token number (mostly 1).
; $6-: Text Pack description input.
; This alias is called from text triggers that respond to text patterns
; that appear to be XDCC pack listings.
; The pack listings are written to a specific file for each bot, with
; a NETWORK¦BOTNICK.pff filename scheme (the same is used for queue
; <*.q> files).
;-------------------------------------------------------------------------
alias packcapture {
if ($triggerHash.exists($1, $2) != $null) {
var %packnum = $int($remove($strip($gettok($6-,$5,32),burc),$chr(35),[,],$chr(41),$chr(40),$chr(46)))
if (%packnum isnum && %packnum > 0) {
/matchwishlistpack $2 $1 $3 $6-
if (%packnum == 1) {
if ($exists($getpfffilenm($1, $2))) {
if ($timer(packcapturetest $+ $2) == $null) {
.copy -o $getpfffilenm($1, $2) $getoldfilenm($1, $2)
.remove $getpfffilenm($1, $2)
}
else { .timerpackcapturetest $+ $2 off }
if ($comparepacks == on) {
.timerpackcapturetest $+ $2 1 $packchangechecktime /comparepackfiles $getpfffilenm($1, $2) $getoldfilenm($1, $2)
}
}
else {
if ($comparepacks == on) {
.timerpackcapturetest $+ $2 1 $packchangechecktime /comparepackfiles $getpfffilenm($1, $2) $getpfffilenm($1, $2)
}
/outputxdccinfo 13First pack capture 14just started for bot3 $1 $+ ¦7 $+ $2 $+ 14 (Bot is using Pack Scheme $4 $+ ).
/outputxdccinfo
}
}
elseif ($comparepacks == on) {
if ($timer(packcapturetest $+ $2) == $null && $exists($getpfffilenm($1, $2))) { .copy -o $getpfffilenm($1, $2) $getoldfilenm($1, $2) }
else { .timerpackcapturetest $+ $2 off }
.timerpackcapturetest $+ $2 1 $packchangechecktime /comparepackfiles $getpfffilenm($1, $2) $getoldfilenm($1, $2)
}
if ($triggerHash.getPsnr($network, $nick) != $4 && $4 != default) { /triggerHash.updatePackSchemeNr $1 $2 $4 }
if ($4 == default) {
if ($3 !isin $6-) { //write -a $getpfffilenm($1, $2) %packnum $strip($6-, burc) $asctime(14[dd/mm/yy]) }
else {
/outputxdccinfo 4ERROR:12 $3 in packname while using default packscheme? %packnum $strip($6-, burc) $+ .
/debuglog $scriptline $+ : ALIAS PACKCAPTURE: 4ERROR:12 $3 in packname while using default packscheme? %packnum $strip($6-, burc) $+ .
}
}
else {
if ($exists($getpfffilenm($network, $nick))) { var %k = $lines($getpfffilenm($network, $nick)) }
else { var %k = 0 }
var %llen = $calc(%packnum - 1)
if (%k < %llen) {
while (%k < %llen) {
inc %k
//write -a $getpfffilenm($network, $nick) %k Unknown Pack $chr(35) $+ %k
}
}
//write -l $+ %packnum $getpfffilenm($network, $nick) %packnum $strip($6-, burc) $asctime(14[dd/mm/yy])
}
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
#grouppackcapture end
;-------------------------------------------------------------------------
; /cleanxdcclib:
; Should remove xdcc library entries older than $liblimitdate days.
;-------------------------------------------------------------------------
alias cleanxdcclib {
/outputxdccinfo 4Cleaning XDCC library, please wait (this can take a while)5...
var %h = 0
var %i = 1
var %j = 0
var %l = 0
var %expirationtime = $calc($ctime - $calc(3600 * 24 * $liblimitdate))
while ($findfile($xdccdir,*.pff,%i) && %h < 1000000000) {
var %currentfile = $findfile($xdccdir,*.pff,%i)
if ($file(%currentfile).mtime < %expirationtime) {
if (!$exists($replace(%currentfile,.pff,.q))) {
.remove %currentfile
/triggerHash.del $remove($gettok(%currentfile,1,166),.pff) $remove($gettok(%currentfile,2,166),.pff)
dec %i
inc %j
}
else { inc %l }
}
inc %i
inc %h
}
var %h = 0
var %i = 1
var %k = 0
var %m = 0
while ($findfile($xdccdir,*.pff.old,%i) && %h < 1000000000) {
var %currentfile = $findfile($xdccdir,*.pff.old,%i)
if ($timer(packcapturetest $+ $gettok($remove(%currentfile,.pff.old),2,166)) == $null) {
.remove %currentfile
dec %i
inc %k
}
else { inc %m }
inc %i
inc %h
}
/outputxdccinfo 4Removed %j 14.pff files older than $liblimitdate days ( $+ $calc(3600 * 24 * $liblimitdate) secs) and %k 14.old files from library. %l 14.pff files were not removed because they had a queue file and %m 14.old files were not removed because a pack capture test was pending.
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removebot:
; $1: botnick.
; $2: botnetwork.
; This removes a bot from the trigger file and autoresume files, and
; deletes it's pack and queue files. Uses one yes/no querybox.
;-------------------------------------------------------------------------
alias removebot {
if ($triggerHash.exists($2, $1) != $null) {
.remove $getpfffilenm($2, $1)
.remove $getoldfilenm($2, $1)
.remove $getqfilenm($2, $1)
/triggerhash.del $2 $1
if ($read($xdccsinprogress, wnt, $1 *)) { .write -ds $+ $1 $xdccsinprogress }
if ($read($networkfile($2), wn, * $1 *)) {
if ($lines($networkfile($2)) <= 1) { .remove $networkfile($2) }
else { /write -dw"* $1 *" $networkfile($2) }
}
/outputxdccinfo 4Bot3 $2 $+ ¦7 $+ $1 4removed from triggerfile. Packs and queues removed. Autoresume entries removed.
}
else {
if ($botliston == TRUE) {
var %nicklistline = $fline(@XDCC_Info,$1,1,1)
/outputxdccinfo Removing line %nicklistline $1 from the nicklistbox.
//dline -l @XDCC_Info %nicklistline $+ - $+ %nicklistline
}
/outputxdccinfo Bot not listed (3 $+ $2 $+ ¦7 $+ $1 $+ ).
}
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /joinnetwork $1:
; $1: A network name.
; Connect to a bot's network.
;-------------------------------------------------------------------------
alias joinnetwork {
var %j = 0
var %con = $null
while (%con == $null && %j < 1000) {
if ($scon(%j).network == $1) { set %con %j }
inc %j
}
if (%con == $null) {
/outputxdccinfo 14Connecting to network $1
/server -m $1
/outputxdccinfo
}
else {
/outputxdccinfo 14Already connected to network $1
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /joinchan $1:
; $1: A bot nickname.
; Attempt to join a bot's channel.
;-------------------------------------------------------------------------
alias joinchan {
if ($triggerHash.exists($network, $1)) { var %botnetwork = $network }
elseif ($triggerHash.findNetwork($1 *)) { var %botnetwork = $triggerHash.findNetwork($1 *) }
else { unset %botnetwork }
if (%botnetwork != $null) {
var %j = 0
var %con = $null
while (%con == $null && %j < 1000) {
if ($scon(%j).network == %botnetwork) { set %con %j }
inc %j
}
if (%con != $null) {
var %botchan = $triggerHash.getChan(%botnetwork, $1)
/outputxdccinfo Joining channel12 %botchan on network3 %botnetwork $+ .
if ($read($chankeyfile,snt,%botnetwork %botchan)) {
set %botchan $triggerHash.getChan(%botnetwork, $1) $read($chankeyfile,snt,%botnetwork %botchan)
/outputxdccinfo 12Using channel key found in channel key file.
}
/scon %con /join -n %botchan
}
elseif ($?!="You need to connect to the %botnetwork network before you can join this channel. Connect now?") {
/outputxdccinfo 4You are not yet connected to the3 %botnetwork 4network. Connecting now...
if (!$read($joinchansfile(%botnetwork),wnt,%botchan)) { /write -a $joinchansfile(%botnetwork) %botchan }
/joinnetwork %botnetwork
}
else {
/outputxdccinfo 4You are not yet connected to the3 %botnetwork 4network. Please connect before trying to join.
}
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /findpack $1-:
; $1-: search string of one or more (partial) words.
; Finds all packs with the listed words in specific order and echoes them
; to the chosen window(s).
;-------------------------------------------------------------------------
alias findpack {
/outputxdccinfo 5Starting new searchstring pack search for "10 $+ $1- $+ 5": 4....
var %i = 1
var %foundpacks = 1
while (%i <= $triggerHash.items) {
var %j = 1
var %botnetwork = $triggerHash.item.network(%i)
var %botnick = $triggerHash.item.nick(%i)
var %botchan = $triggerHash.item.chan(%i)
var %botpacksnum = $lines($getpfffilenm(%botnetwork, %botnick))
while (%j <= %botpacksnum) {
var %matchpack = $read($getpfffilenm(%botnetwork, %botnick), %j)
if (* $+ $replace($1-,$chr(32),*) $+ * iswm $strip(%matchpack,burc)) {
/outputxdccinfo 10Match found:4 %foundpacks $+ 3 %botnetwork $+ 12 %botchan $+ 7 %botnick $+ $replace(%matchpack, $1-, 12 $+ $1- $+ )
inc %foundpacks
}
inc %j
}
inc %i
}
dec %foundpacks
if (%foundpacks == 0) { /outputxdccinfo 5No matches found for "10 $+ $1- $+ 5" (Searched $triggerHash.items XDCC Bots) (N.B.: 10The packfinder is sensitive to word order5). }
elseif (%foundpacks == 1) { /outputxdccinfo 5 $+ %foundpacks match found for "10 $+ $1- $+ 5" (4Caution:5 information in the library may be outdated). }
else { /outputxdccinfo 5 $+ %foundpacks matches found for "10 $+ $1- $+ 5" (4Caution:5 information in the library may be outdated). }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /botpacks $1 $2:
; $1: botnetwork.
; $2: botnick.
; Finds all packs for that bot on that network and echoes them to the
; chosen window(s).
;-------------------------------------------------------------------------
alias botpacks {
/outputxdccinfo 5Starting new bot packs search for7 $2 5on3 $1 $+ 5: 4....
if ($exists($getpfffilenm($1, $2))) {
var %j = 1
/outputxdccinfo 5Searching bot7 $2 5on network3 $1 5( $+ $getpfffilenm($1, $2) $+ ).
while (%j <= $lines($getpfffilenm($1, $2))) {
/outputxdccinfo 10Match found:4 %j $+ 3 $1 $+ 7 $2 $+ $read($getpfffilenm($1, $2), %j)
inc %j
}
dec %j
if (%j == 0) { /outputxdccinfo 5No matches found for3 $1 7 $+ $2- 5(Note: The script needs to catch the bot's ad before it can search the bot). }
elseif (%j == 1) { /outputxdccinfo 5 $+ %j match found for3 $1 7 $+ $2- 5(4Caution:5 information in the library may be outdated). }
else { /outputxdccinfo 5 $+ %j matches found for3 $1 7 $+ $2- 5(4Caution:5 information in the library may be outdated). }
}
else { /outputxdccinfo 5No matches found for3 $1 7 $+ $2- 5(Note: The script needs to catch the bot's ad before it can search the bot). }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /chanpacks $1 $2:
; $1: botnetwork.
; $2: botchan.
; Finds all packs for all bots on that chan on that network and echoes
; them to the chosen window(s). Uses one yes/no querybox.
;-------------------------------------------------------------------------
alias chanpacks {
if ($?!="List all packs for channel $2 $+ ? (Warning: The listing for an entire channel can be huge)") {
var %foundpacks = 1
/outputxdccinfo 5Starting new channel packs search for channel12 $2 5on network3 $1 $+ 5: 4....
var %i = 1
while (%i <= $triggerHash.items) {
var %botnick = $triggerHash.item.nick(%i)
var %botchan = $triggerHash.item.chan(%i)
var %botnetwork = $triggerHash.item.network(%i)
if (%botnetwork %botchan == $1 $2 && $exists($getpfffilenm($1, %botnick))) {
var %j = 1
while (%j <= $lines($getpfffilenm($1, %botnick))) {
/outputxdccinfo 10Match found:4 %foundpacks $+ 3 $1 $+ 7 %botnick $+ $read($getpfffilenm($1, %botnick), %j)
inc %foundpacks
inc %j
}
}
inc %i
}
dec %foundpacks
if (%foundpacks == 0) { /outputxdccinfo 5No matches found for3 $1 12 $+ $2- 5(Note: The script needs to catch the bot's ad before it can search the bot) }
elseif (%foundpacks == 1) { /outputxdccinfo 5 $+ %foundpacks match found for3 $1 12 $+ $2- 5(4Caution:5 information in the library may be outdated) }
else { /outputxdccinfo 5 $+ %foundpacks matches found for3 $1 12 $+ $2- 5(4Caution:5 information in the library may be outdated) }
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /networkpacks $1:
; $1: botnetwork.
; Finds all packs for all bots on that network and echoes them to the
; chosen window(s). Uses one yes/no querybox.
;-------------------------------------------------------------------------
alias networkpacks {
if ($?!="List all packs for network $1 $+ ? (Warning: The listing for an entire network can be huge)") {
var %i = 1
var %foundpacks = 1
/outputxdccinfo 5Starting new network packs search for network3 $1 $+ 5: 4....
while (%i <= $triggerHash.items) {
if ($triggerHash.item.network(%i) == $1) {
var %botnick = $triggerHash.item.nick(%i)
if ($exists($getpfffilenm($1, %botnick))) {
var %j = 1
while (%j <= $lines($getpfffilenm($1, %botnick))) {
/outputxdccinfo 10Match found:4 %foundpacks $+ 3 $1 $+ 7 %botnick $+ $read($getpfffilenm($1, %botnick), %j)
inc %foundpacks
inc %j
}
}
}
inc %i
}
dec %foundpacks
if (%foundpacks == 0) { /outputxdccinfo 5No matches found for3 $1- 5(Note: The script needs to catch the bot's ad before it can search the bot). }
elseif (%foundpacks == 1) { /outputxdccinfo 5 $+ %foundpacks match found for3 $1- 5(4Caution:5 information in the library may be outdated). }
else { /outputxdccinfo 5 $+ %foundpacks matches found for3 $1- 5(4Caution:5 information in the library may be outdated). }
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /showqueues:
; Shows all queues for all bots in number list form.
;-------------------------------------------------------------------------
alias showqueues {
var %i = 1
var %k = 0
/outputxdccinfo 5You have the following queue files listed:
while ($findfile($xdccdir,*.q,%i) && %i <= 10000) {
var %filenm = $nopath($findfile($xdccdir,*.q,%i))
var %j = 0
var %queue = $null
while (%j <= $lines($xdccdir $+ \ $+ %filenm)) {
set %queue %queue $read($xdccdir $+ \ $+ %filenm, %j)
inc %j
inc %k
}
dec %k
if ($calc(%j - 1) == 1) { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) item):13 %queue }
else { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) items):13 %queue }
inc %i
}
dec %i
if (%i == 1) {
if (%k == 1) { /outputxdccinfo 5 $+ %i queue listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ %i queue listed ( $+ %k items). }
}
else {
if (%k == 1) { /outputxdccinfo 5 $+ %i queues listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ %i queues listed ( $+ %k items). }
}
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /showdetailedqueues:
; Shows all queues for all bots in number form and in detailed pack
; description form.
;-------------------------------------------------------------------------
alias showdetailedqueues {
var %i = 1
var %k = 0
/outputxdccinfo 5You have the following queue files listed:
while ($findfile($xdccdir,*.q,%i) && %i <= 10000) {
var %filenm = $nopath($findfile($xdccdir,*.q,%i))
var %j = 0
var %queue = $null
while (%j <= $lines($xdccdir $+ \ $+ %filenm)) {
set %queue %queue $read($xdccdir $+ \ $+ %filenm, %j)
inc %j
inc %k
}
dec %k
if (%j == 2) { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) item):13 %queue }
else { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) items):13 %queue }
var %j = 0
while (%j < $lines($xdccdir $+ \ $+ %filenm)) {
/outputxdccinfo 4 $calc(%j + 1) 3 $+ $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) $+ :13 $read($getqtopfffilenm(%filenm), snt, $gettok($read($xdccdir $+ \ $+ %filenm,%j),1,32))
inc %j
}
inc %i
}
if (%i == 2) {
if (%k == 1) { /outputxdccinfo 5 $+ $calc(%i - 1) queue listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ $calc(%i - 1) queue listed ( $+ %k items). }
}
else {
if (%k == 1) { /outputxdccinfo 5 $+ $calc(%i - 1) queues listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ $calc(%i - 1) queues listed ( $+ %k items). }
}
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /showdetailedchanqueues:
; $1: Network.
; $2: Channel.
; Shows all queues for all bots in channel in number form and in detailed
; pack description form.
;-------------------------------------------------------------------------
alias showdetailedchanqueues {
var %i = 1
var %l = 0
var %k = 0
/outputxdccinfo 5You have the following queue files listed for channel12 $2 5on network3 $1 $+ :
while ($findfile($xdccdir,*.q,%i) && %i <= 10000) {
var %filenm = $nopath($findfile($xdccdir,*.q,%i))
if ($replxdccfile($1) == $replace($gettok(%filenm,1,166),.q,) && $2 isin $triggerHash.findChans($replace($gettok(%filenm,2,166),_,*,.q,) $replace($gettok(%filenm,1,166),_,*,.q,) *)) {
var %j = 0
var %queue = $null
while (%j <= $lines($xdccdir $+ \ $+ %filenm)) {
set %queue %queue $read($xdccdir $+ \ $+ %filenm, %j)
inc %j
inc %k
}
dec %k
if (%j == 2) { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) item):13 %queue }
else { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) items):13 %queue }
var %j = 0
while (%j < $lines($xdccdir $+ \ $+ %filenm)) {
/outputxdccinfo 4 $calc(%j + 1) 3 $+ $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) $+ :13 $read($getqtopfffilenm(%filenm), snt, $gettok($read($xdccdir $+ \ $+ %filenm,%j),1,32))
inc %j
}
inc %l
}
inc %i
}
if (%i == 2) {
if (%k == 1) { /outputxdccinfo 5 $+ $calc(%i - 1) queue listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ $calc(%i - 1) queue listed ( $+ %k items). }
}
else {
if (%k == 1) { /outputxdccinfo 5 $+ %l queues listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ %l queues listed ( $+ %k items). }
}
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /showdetailednetworkqueues:
; $1: Network.
; Shows all queues for all bots on network in number form and in detailed
; pack description form.
;-------------------------------------------------------------------------
alias showdetailednetworkqueues {
var %i = 1
var %k = 0
/outputxdccinfo 5You have the following queue files listed for network3 $1 $+ :
while ($findfile($xdccdir,*.q,%i) && %i <= 10000) {
var %filenm = $nopath($findfile($xdccdir,*.q,%i))
if ($replxdccfile($1) == $replace($gettok(%filenm,1,166),.q,)) {
var %j = 0
var %queue = $null
while (%j <= $lines($xdccdir $+ \ $+ %filenm)) {
set %queue %queue $read($xdccdir $+ \ $+ %filenm, %j)
inc %j
inc %k
}
dec %k
if (%j == 2) { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) item):13 %queue }
else { /outputxdccinfo 10Queue exists for bot3 $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) ( $+ $calc(%j - 1) items):13 %queue }
var %j = 0
while (%j < $lines($xdccdir $+ \ $+ %filenm)) {
/outputxdccinfo 4 $calc(%j + 1) 3 $+ $replace($gettok(%filenm,1,166),.q,) $+ ¦7 $+ $replace($gettok(%filenm,2,166),.q,) $+ :13 $read($getqtopfffilenm(%filenm), snt, $gettok($read($xdccdir $+ \ $+ %filenm,%j),1,32))
inc %j
}
}
inc %i
}
if (%i == 2) {
if (%k == 1) { /outputxdccinfo 5 $+ $calc(%i - 1) queue listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ $calc(%i - 1) queue listed ( $+ %k items). }
}
else {
if (%k == 1) { /outputxdccinfo 5 $+ $calc(%i - 1) queues listed ( $+ %k item). }
else { /outputxdccinfo 5 $+ $calc(%i - 1) queues listed ( $+ %k items). }
}
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /showdetailedqueue:
; Shows all queues for a single bot in number form and in pack description
; form. Uses one popup editbox if no nickname is selected.
;-------------------------------------------------------------------------
alias showdetailedqueue {
var %k = 0
var %j = 0
if ($1 == $null) { var %botnick = $$?="Enter the bot's nick (Ex: XDCC|DCC01)." }
else { var %botnick = $1 }
var %botnetwork = $triggerHash.network(%botnick)
if (%botnetwork != $null) {
/outputxdccinfo Bot7 %botnick in database at network3 %botnetwork $+ .
var %filenm = $getqfilenm(%botnetwork, %botnick)
if ($exists(%filenm) && $lines(%filenm) > 0) {
/outputxdccinfo 5You have the following queue listed for3 %botnetwork $+ ¦7 $+ %botnick $+ :
while (%j < $lines(%filenm)) {
/outputxdccinfo 4 $calc(%j + 1) 3 $+ %botnetwork $+ ¦7 $+ %botnick $+ :13 $read($replace(%filenm,.q,.pff), snt, $gettok($read(%filenm,%j),1,32))
inc %j
}
if (%j == 1) { /outputxdccinfo 5Queue listed ( $+ %j item). }
else { /outputxdccinfo 5Queue listed ( $+ %j items). }
}
else { /outputxdccinfo 5No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ . }
}
else { /outputxdccinfo Bot not listed (7 $+ %botnick $+ ). }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /viewbotqueues:
; Lists the current Bot Queue file.
;-------------------------------------------------------------------------
alias viewbotqueues {
/outputxdccinfo 5Starting listing of Bot Queues...
var %i = 0
if ($exists($tempbotqueuefile) && $lines($tempbotqueuefile) > 0) {
while (%i < $lines($tempbotqueuefile)) {
inc %i
/outputxdccinfo 4 %i 10Temporary Priority Bot Queue 10found:7 $read($tempbotqueuefile, %i)
}
if (%i == 1) { /outputxdccinfo 5 $+ %i Temporary Priority Bot Queue found. }
else { /outputxdccinfo 5 $+ %i Temporary Priority Bot Queues found. }
}
else { /outputxdccinfo 5No Temporary Priority Bot Queue found. }
var %i = 0
if ($exists($botqueuefile) && $lines($botqueuefile) > 0) {
while (%i < $lines($botqueuefile)) {
inc %i
/outputxdccinfo 4 %i 10Bot Queue 10found:7 $read($botqueuefile, %i)
}
if (%i == 1) { /outputxdccinfo 5 $+ %i Bot Queue found. }
else { /outputxdccinfo 5 $+ %i Bot Queues found. }
}
else { /outputxdccinfo 5No Bot Queue found. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getxdccsending:
; Lists all bots and packs currently transfering.
;-------------------------------------------------------------------------
alias getxdccsending {
if ($get(0) != 0) {
/outputxdccinfo 5Listing currently active download bots...
var %i = 1
var %avtransfcps = 0
while (%i <= $get(0)) {
if ($get(%i).status == active) {
inc %avtransfcps $round($calc($averagexdcccps($get(%i)) / 1024), 2)
/outputxdccinfo 4 $+ %i 10Bot7 $get(%i) 10is active 14(Current: Downloading:4 $asctimepassed($asctime([dd/mm/yyyy][HH:nn:ss]),$asctime($calc($ctime - $get(%i).secs),[dd/mm/yyyy][HH:nn:ss])) $+ ,4 $get(%i).cps 14cps,4 $getnormfilesize($get(%i).rcvd) 14rcvd,3 $getnormfilesize($calc($get(%i).size - $get(%i).rcvd)) 14cmpl,4 $get(%i).pc $+ $chr(37) 14done,4 $round($calc($averagexdcccps($get(%i)) / 1024), 2) $+ 14 kbps avg,4 $estimatedxdcccompltime($get(%i)) $+ 14 left)10 for pack number13 $read($xdccsinprogress,snt,$get(%i)) 10(2 $+ $get(%i).file $+ 10, completed file size:4 $getnormfilesize($get(%i).size) $+ 10)
}
else {
/outputxdccinfo 10Bot7 $send(%i) 10is waiting or failed.
}
inc %i
}
/outputxdccinfo 5Total average inbound transfer speed over $get(0) files: %avtransfcps kbps
}
else { /outputxdccinfo 5No incoming transfers at this time... }
if ($send(0) != 0) {
/outputxdccinfo 5Listing currently active upload bots...
var %i = 1
var %avtransfcps = 0
while (%i <= $send(0)) {
if ($send(%i).status == active) {
inc %avtransfcps $round($calc($averagesendcps($send(%i)) / 1024), 2)
/outputxdccinfo 4 $+ %i 10Target 7 $send(%i) 10is active 14(Current: Uploading:4 $asctimepassed($asctime([dd/mm/yyyy][HH:nn:ss]),$asctime($calc($ctime - $send(%i).secs),[dd/mm/yyyy][HH:nn:ss])) $+ ,4 $send(%i).cps 14cps,4 $getnormfilesize($send(%i).sent) 14sent,3 $getnormfilesize($calc($send(%i).size - $send(%i).rcvd)) 14cmpl,4 $send(%i).pc $+ $chr(37) 14done,4 $round($calc($averagesendcps($send(%i)) / 1024), 2) $+ 14 kbps avg,4 $estimatedsendcompltime($send(%i)) $+ 14 left)10 for pack2 $send(%i).file $+ 10, completed file size:4 $getnormfilesize($send(%i).size) $+ 10
}
else {
/outputxdccinfo 10Bot7 $send(%i) 10is waiting or failed.
}
inc %i
}
/outputxdccinfo 5Total average outbound transfer speed over $send(0) files: %avtransfcps kbps
}
else { /outputxdccinfo 5No outgoing transfers at this time... }
/outputxdccinfo
}
;-------------------------------------------------------------------------
; /getxdccactive:
; Lists all bots and packs listed in the active transfer files. These are
; the bots that the script will auto resume or process the queue from.
;-------------------------------------------------------------------------
alias getxdccactive {
var %i = 0
/outputxdccinfo 5Listing currently active bots (sends, queues and offline bots)...
if ($exists($xdccsinprogress) && $lines($xdccsinprogress) > 0) {
while (%i < $lines($xdccsinprogress)) {
inc %i
if ($get($gettok($read($xdccsinprogress, %i),1,32)).status == active) {
/outputxdccinfo 10Bot7 $gettok($read($xdccsinprogress, %i),1,32) 10is active 14(transfering:4 $get($gettok($read($xdccsinprogress, %i),1,32)).secs 14secs,4 $get($gettok($read($xdccsinprogress, %i),1,32)).cps 14cps,4 $get($gettok($read($xdccsinprogress, %i),1,32)).rcvd 14bytes rcvd,4 $get($gettok($read($xdccsinprogress, %i),1,32)).pc $+ $chr(37) 14done,4 $round($calc($averagexdcccps($gettok($read($xdccsinprogress, %i),1,32)) / 1024), 2) $+ 14 kbps avg,4 $estimatedxdcccompltime($gettok($read($xdccsinprogress, %i),1,32)) $+ 14 left)10 for pack number13 $gettok($read($xdccsinprogress, %i),2,32)
}
else {
/outputxdccinfo 10Bot7 $gettok($read($xdccsinprogress, %i),1,32) 10is active 14(queued, failed, or offline and waiting)10 for pack number13 $gettok($read($xdccsinprogress, %i),2,32)
}
}
}
var %sendsactive = %i
if ($exists($networksendfile) && $lines($networksendfile) > 0) {
var %i = 1
while (%i <= $lines($networksendfile)) {
if ($exists($networkfile($read($networksendfile,%i))) && $lines($networkfile($read($networksendfile,%i))) > 0) {
var %j = 0
var %l = 0
while (%j < $lines($networkfile($read($networksendfile,%i)))) {
inc %j
if (!$read($xdccsinprogress, snt, $gettok($read($networkfile($read($networksendfile,%i)), %j),2,32))) {
inc %l
if ($get($gettok($read($networkfile($read($networksendfile,%i)), %j),2,32)).status == active) {
/outputxdccinfo 10Bot7 $gettok($read($networkfile($read($networksendfile,%i)), %j),2,32) 10is active 14(transfering:4 $get($gettok($read($networkfile($read($networksendfile,%i)), %j),2,32)).secs 14secs,4 $get($gettok($read($networkfile($read($networksendfile,%i)), %j),2,32)).cps 14cps,4 $get($gettok($read($networkfile($read($networksendfile,%i)), %j),2,32)).rcvd 14bytes rcvd,4 $get($gettok($read($networkfile($read($networksendfile,%i)), %j),2,32)).pc $+ $chr(37) 14done)10 for pack number13 $&
$replace($gettok($read($networkfile($read($networksendfile,%i)), %j),$numtok($networkfile($read($networksendfile,%i)), %j),32),$chr(35),)
}
else {
/outputxdccinfo 10Bot7 $gettok($read($networkfile($read($networksendfile,%i)), %j),2,32) 10is active 14(queued, failed, or offline and waiting)10 for pack number13 $replace($gettok($read($networkfile($read($networksendfile,%i)), %j),$numtok($read($networkfile($read($networksendfile,%i)), %j),32),32),$chr(35),)
}
}
}
set %sendsactive $calc(%sendsactive + %l)
}
inc %i
}
}
if (%sendsactive == 0) { /outputxdccinfo 5There are no active or waiting transfers at this time. }
elseif (%sendsactive == 1) { /outputxdccinfo 5Found %sendsactive entry in sends file(s). }
else { /outputxdccinfo 5Found %sendsactive entries in sends file(s). }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getsessiongets:
; Shows all completed downloads since the last IRC start (including those
; not handled by this script).
;-------------------------------------------------------------------------
alias getsessiongets {
var %i = 1
if ($lines($xdccsessiongetfile) < 1) {
/outputxdccinfo 5No files received so far this session.
}
else {
var %filesize = 0
var %totalsize = 0
/outputxdccinfo 5So far you have received the following files since the last IRC restart ( $+ $lines($xdccsessiongetfile) $+ )5:
while (%i <= $lines($xdccsessiongetfile)) {
set %filesize $getnormfilesize($gettok($read($xdccsessiongetfile,nt,%i),1,32))
/outputxdccinfo %i $gettok($read($xdccsessiongetfile,nt,%i),2-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($xdccsessiongetfile,nt,%i),1,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($xdccsessiongetfile) packs in total (including non-XDCC sends) ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getprevsessiongets:
; Shows all completed downloads since the last IRC start (including those
; not handled by this script).
;-------------------------------------------------------------------------
alias getprevsessiongets {
var %i = 1
if ($lines($lastxdccsessiongetfile) < 1) {
/outputxdccinfo 5No files received during last session.
}
else {
var %filesize = 0
var %totalsize = 0
/outputxdccinfo 5You received the following files during the last XDCC session ( $+ $lines($lastxdccsessiongetfile) $+ )5:
while (%i <= $lines($lastxdccsessiongetfile)) {
set %filesize $getnormfilesize($gettok($read($lastxdccsessiongetfile,nt,%i),1,32))
/outputxdccinfo %i $gettok($read($lastxdccsessiongetfile,nt,%i),2-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($lastxdccsessiongetfile,nt,%i),1,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($lastxdccsessiongetfile) packs in total (including non-XDCC sends) ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getsessionsends:
; Shows all completed uploads since the last IRC start (including those
; not handled by this script).
;-------------------------------------------------------------------------
alias getsessionsends {
var %i = 1
if ($lines($xdccsessionsendfile) < 1) {
/outputxdccinfo 5No files sent so far this session.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5So far you have sent the following files since the last IRC restart ( $+ $lines($xdccsessionsendfile) $+ )5:
while (%i <= $lines($xdccsessionsendfile)) {
set %filesize $getnormfilesize($gettok($read($xdccsessionsendfile,nt,%i),1,32))
/outputxdccinfo %i $gettok($read($xdccsessionsendfile,nt,%i),2-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($xdccsessionsendfile,nt,%i),1,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($xdccsessionsendfile) sends in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getprevsessionsends:
; Shows all completed uploads since the last IRC start (including those
; not handled by this script).
;-------------------------------------------------------------------------
alias getprevsessionsends {
var %i = 1
if ($lines($lastxdccsessionsendfile) < 1) {
/outputxdccinfo 5No files sent during last session.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5You sent the following files during the last IRC session ( $+ $lines($lastxdccsessionsendfile) $+ )5:
while (%i <= $lines($lastxdccsessionsendfile)) {
set %filesize $getnormfilesize($gettok($read($lastxdccsessionsendfile,nt,%i),1,32))
/outputxdccinfo %i $gettok($read($lastxdccsessionsendfile,nt,%i),2-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($lastxdccsessionsendfile,nt,%i),1,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($lastxdccsessionsendfile) sends in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /gettotalsends:
; Shows all completed uploads since the last total file reset (including
; those not handled by this script).
;-------------------------------------------------------------------------
alias gettotalsends {
var %i = 1
if ($lines($xdcctotalsendfile) < 1) {
/outputxdccinfo 5No files sent so far since last total filesends file reset.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5So far you have sent the following files since the last total send transfers file reset ( $+ $lines($xdccsessionsendfile) $+ )5:
while (%i <= $lines($xdcctotalsendfile)) {
set %filesize $getnormfilesize($gettok($read($xdcctotalsendfile,nt,%i),1,32))
/outputxdccinfo %i $gettok($read($xdcctotalsendfile,nt,%i),2-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($xdcctotalsendfile,nt,%i),1,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($xdcctotalsendfile) sends in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /gettotalgets:
; Shows all completed downloads since the last total file reset (including
; those not handled by this script).
;-------------------------------------------------------------------------
alias gettotalgets {
var %i = 1
if ($lines($xdcctotalgetfile) < 1) {
/outputxdccinfo 5No files received so far since last total received transfers file reset.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5So far you have received the following files since the last total filegets file reset ( $+ $lines($xdcctotalgetfile) $+ )5:
while (%i <= $lines($xdcctotalgetfile)) {
set %filesize $getnormfilesize($gettok($read($xdcctotalgetfile,nt,%i),1,32))
/outputxdccinfo %i $gettok($read($xdcctotalgetfile,nt,%i),2-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($xdcctotalgetfile,nt,%i),1,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($xdcctotalgetfile) gets in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getsessionfails:
; Shows all completed uploads since the last IRC start (including those
; not handled by this script).
;-------------------------------------------------------------------------
alias getsessionfails {
var %i = 1
if ($lines($xdccsessionfailfile) < 1) {
/outputxdccinfo 5No incomplete failed transfers this session.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5So far, the following transfers have failed during this session and have not yet been completed ( $+ $lines($xdccsessionfailfile) $+ )5:
while (%i <= $lines($xdccsessionfailfile)) {
set %filesize $getnormfilesize($gettok($read($xdccsessionfailfile,nt,%i),2,32))
var %failtype = $gettok($read($xdccsessionfailfile,nt,%i),1,32)
/outputxdccinfo %i $iif(%failtype == GetFail,4Get Fail:,5Send Fail:) $gettok($read($xdccsessionfailfile,nt,%i),3-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($xdccsessionfailfile,nt,%i),2,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($xdccsessionfailfile) transfers in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /getprevsessionfails:
; Shows all completed uploads since the last IRC start (including those
; not handled by this script).
;-------------------------------------------------------------------------
alias getprevsessionfails {
var %i = 1
if ($lines($lastsessionfailfile) < 1) {
/outputxdccinfo 5No incomplete failed transfers during last session.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5The following transfers failed during the last IRC session and have not been completed since ( $+ $lines($lastsessionfailfile) $+ )5:
while (%i <= $lines($lastsessionfailfile)) {
set %filesize $getnormfilesize($gettok($read($lastsessionfailfile,nt,%i),2,32))
var %failtype = $gettok($read($lastsessionfailfile,nt,%i),1,32)
/outputxdccinfo %i $iif(%failtype == GetFail,4Get Fail:,5Send Fail:) $gettok($read($lastsessionfailfile,nt,%i),3-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($lastsessionfailfile,nt,%i),2,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($lastsessionfailfile) transfers in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /gettotalfails:
; Shows all incomplete failed transfers since the script was installed.
;-------------------------------------------------------------------------
alias gettotalfails {
var %i = 1
if ($lines($totalfailfile) < 1) {
/outputxdccinfo 5No incomplete failed transfers during last session.
}
else {
var %totalsize = 0
var %filesize = 0
/outputxdccinfo 5The following transfers failed at some point and have not been completed since ( $+ $lines($totalfailfile) $+ )5:
while (%i <= $lines($totalfailfile)) {
set %filesize $getnormfilesize($gettok($read($totalfailfile,nt,%i),2,32))
var %failtype = $gettok($read($totalfailfile,nt,%i),1,32)
/outputxdccinfo %i $iif(%failtype == GetFail,4Get Fail:,5Send Fail:) $gettok($read($totalfailfile,nt,%i),3-,32) ( $+ %filesize $+ )
set %totalsize $calc(%totalsize + $gettok($read($totalfailfile,nt,%i),2,32))
inc %i
}
}
/outputxdccinfo 5 $+ $lines($totalfailfile) transfers in total ( $+ $getnormfilesize(%totalsize) $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /addtoq $1 $2 $3:
; $1: xdcc bot nick.
; $2: network.
; $3: packnr.
; No longer used. Queues one pack at a time on a specific bot on a specific
; network.
;-------------------------------------------------------------------------
alias addtoq { //write -a $getqfilenm($2, $1) $3 }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removefromq $1 $2 $3:
; $1: xdcc bot nick.
; $2: network.
; $3: packnr.
; Removes one pack at a time from queue of a specific bot on a specific
; network.
;-------------------------------------------------------------------------
alias removefromq {
if ($read($getqfilenm($2, $1), wnt, $3)) {
if ($lines($getqfilenm($2, $1)) <= 1) {
.remove $getqfilenm($2, $1)
/outputxdccinfo Packnumber $3 6dequeued for3 $2 $+ ¦7 $+ $1 ( $+ $3 $+ ) (Either you removed the queue entry or a transfer was completed). No more packs queued for $1 $+ . Auto resumes suspended.
}
else {
//write -dw $+ $3 $getqfilenm($2, $1)
/outputxdccinfo Packnumber13 $3 6dequeued for3 $2 $+ ¦7 $+ $1 ( $+ $3 $+ ) (Either you removed the queue entry or a transfer was completed).
}
}
else { /outputxdccinfo 6Dequeue: No such packnumber queued for3 $2 $+ ¦7 $+ $1 ( $+ $3 $+ ). }
if ($read($xdccsinprogress, wnt,$1 $3)) {
/write -dw" $+ $1 $3 $+ " $xdccsinprogress
}
elseif ($read($xdccsinprogress, wnt,$1)) {
/write -dw" $+ $1 $+ " $xdccsinprogress
}
if ($read($networkfile($2), wnt, * $1 * $+ $3)) {
/write -dw" $+ * $1 * $+ $3 $+ " $networkfile($2)
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /addrequest $1 & /addrequest2 $1:
; $1: xdcc bot nick.
; Queues multiple packs at a time on a specific bot on a specific network.
; Can be triggered from the channel and nicklist menus. Uses 1 or 2 popup
; editboxes.
;-------------------------------------------------------------------------
alias addrequest {
if ($1 == $null) { var %botnick = $$?="Enter the bot's nick (Ex: XDCC|DCC01)." }
else { var %botnick = $1 }
var %botnetwork = $triggerHash.network(%botnick)
if (%botnetwork != $null && %botnick != $null) {
if ($triggerHash.exists(%botnetwork, %botnick) != $null) {
/outputxdccinfo Bot7 %botnick in database at network3 %botnetwork $+ .
var %packnum = $$?="Enter packnumbers for %botnetwork $+ ¦ $+ %botnick (Ex: 1 3 5-8 10)."
var %i = 1
while (%i <= $numtok(%packnum,32)) {
if ($gettok(%packnum, %i, 32) isnum) {
if ($exists($getpfffilenm(%botnetwork, %botnick))) {
if (!$read($getqfilenm(%botnetwork, %botnick), wnt, $gettok(%packnum, %i, 32))) {
if ($read($getpfffilenm(%botnetwork, %botnick), snt, $gettok(%packnum, %i, 32))) {
/write -a $getqfilenm(%botnetwork, %botnick) $gettok(%packnum, %i, 32)
}
else {
if ($?!="Pack $gettok(%packnum, %i, 32) does not appear to be a valid pack for %botnetwork $+ ¦ $+ %botnick $+ . Add anyway (WARNING: Requesting invalid packs may get you banned)? (NOTE: if you're sure this pack is valid, this message could be caused when the script is updating the bot's packfile.)") {
/write -a $getqfilenm(%botnetwork, %botnick) $gettok(%packnum, %i, 32)
/outputxdccinfo 4Warning: Pack13 $gettok(%packnum, %i, 32) is not a valid pack for3 %botnetwork $+ ¦7 $+ %botnick (Pack added anyway).
}
else { /outputxdccinfo Pack13 $gettok(%packnum, %i, 32) does not appear to be a valid pack for3 %botnetwork $+ ¦7 $+ %botnick (Pack not added). }
}
}
else { /outputxdccinfo Pack13 $gettok(%packnum, %i, 32) already in queue for3 %botnetwork $+ ¦7 $+ %botnick (Pack not added). }
}
else {
if (!$read($getqfilenm(%botnetwork, %botnick), wnt, $gettok(%packnum, %i, 32))) {
/write -a $getqfilenm(%botnetwork, %botnick) $gettok(%packnum, %i, 32)
/outputxdccinfo 4Warning: No pack file for3 %botnetwork $+ ¦7 $+ %botnick $+ , unable to validate pack13 $gettok(%packnum, %i, 32) (Pack added).
}
else { /outputxdccinfo Pack13 $gettok(%packnum, %i, 32) already in queue for3 %botnetwork $+ ¦7 $+ %botnick $+ . Pack not added. }
}
}
elseif (- isin $gettok(%packnum, %i, 32) && $gettok($gettok(%packnum, %i, 32), 1, 45) isnum && $gettok($gettok(%packnum, %i, 32), 2, 45) isnum) {
var %j = $gettok($gettok(%packnum, %i, 32), 1, 45)
while (%j <= $gettok($gettok(%packnum, %i, 32), 2, 45)) {
if ($exists($getpfffilenm(%botnetwork, %botnick))) {
if (!$read($getqfilenm(%botnetwork, %botnick), wnt, %j)) {
if ($read($getpfffilenm(%botnetwork, %botnick), snt, %j)) {
/write -a $getqfilenm(%botnetwork, %botnick) %j
}
else {
if ($?!="Pack %j is not a valid pack for %botnetwork $+ ¦ $+ %botnick $+ . Add anyway (WARNING: Requesting invalid packs may get you banned)? (NOTE: if you're sure this pack is valid, this message could be caused when the script is updating the bot's packfile.)") {
/write -a $getqfilenm(%botnetwork, %botnick) %j
/outputxdccinfo 4Warning: Pack13 %j does not appear to be a valid pack for3 %botnetwork $+ ¦7 $+ %botnick (Pack added anyway).
}
else {
/outputxdccinfo Pack13 %j does not appear to be a valid pack for3 %botnetwork $+ ¦7 $+ %botnick (Pack not added).
}
}
}
else { /outputxdccinfo Pack13 %j already in queue for3 %botnetwork $+ ¦7 $+ %botnick (Pack not added). }
}
else {
if (!$read($getqfilenm(%botnetwork, %botnick), wnt, %j)) {
/write -a $getqfilenm(%botnetwork, %botnick) %j
/outputxdccinfo 4Warning: No pack file for3 %botnetwork $+ ¦7 $+ %botnick $+ , unable to validate pack13 %j (Pack added).
}
else { /outputxdccinfo Pack13 %j already in queue for3 %botnetwork $+ ¦7 $+ %botnick $+ . }
}
inc %j
}
}
else { /outputxdccinfo Invalid input ( $+ $gettok(%packnum, %i, 32) $+ ). }
inc %i
}
/outputxdccinfo 6Queued up packs on bot3 %botnetwork $+ ¦7 $+ %botnick (Pack Number(s):13 %packnum $+ ).
}
else {
var %trigger = $$?="Unknown bot or not a bot ( $+ %botnick $+ ). Enter bot's EXACT trigger or cancel and wait for bot ads to reach the script's awareness. (Ex.: /msg %botnick xdcc send $chr(35) $+ ). $crlf $+ $crlf $+ WARNING: It is not adviced to enter a trigger manually. If you enter the wrong trigger the script will not correct this and you will have to remove the bot to remove the error. Proceed ONLY if you know how to enter the bot trigger correctly! Proceed ONLY if %botnick is an XDCC bot!"
if (%trigger != $null) {
if ($?!="Add %botnetwork %botnick ¦ %trigger to $triggerHash $+ , IS THIS INFORMATION CORRECT AND 100 $+ $chr(37) CERTAIN?") {
if ($chan != $null) { var %botchan = $chan }
else { var %botchan = unknown }
/triggerHash.add %botnetwork %botnick %botchan default default %trigger
/outputxdccinfo Added "4 $+ %botnetwork 7 $+ %botnick ||5 %trigger $+ " to $triggerHash $+ .
/addrequest2 %botnick
}
else { /outputxdccinfo Unknown Bot or not a bot (7 $+ %botnick $+ ). Manual entry aborted. }
}
else { /outputxdccinfo Unknown Bot or not a bot (7 $+ %botnick $+ ). Manual entry aborted. }
}
}
else { /outputxdccinfo Bot not listed (7 $+ %botnick $+ ). }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias addrequest2 { /addrequest $1- }
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removerequest $1:
; $1: xdcc bot nick.
; Dequeues multiple packs at a time from a specific bot on a specific
; network. Can be triggered from the channel and nicklist menus. Uses 1 or
; 2 popup editboxes.
;-------------------------------------------------------------------------
alias removerequest {
if ($1 == $null) { var %botnick = $$?="Enter the bot's nick (Ex: XDCC|DCC01)." }
else { var %botnick = $1 }
var %botnetwork = $triggerHash.network(%botnick)
if (%botnetwork != $null && %botnick != $null) {
if ($exists($getqfilenm(%botnetwork, %botnick))) {
/outputxdccinfo Bot7 %botnick in database at network3 %botnetwork $+ .
var %packnum = $$?="Enter packnumbers to remove (Ex: 1 3 5-8 10)."
var %i = 1
if ($?!="Remove pack(s) %packnum from bot %botnick queue $+ ?") {
while (%i <= $numtok(%packnum,32)) {
if ($gettok(%packnum, %i, 32) isnum) {
if ($read($getqfilenm(%botnetwork, %botnick), wnt, $gettok(%packnum, %i, 32))) {
/removefromq %botnick %botnetwork $gettok(%packnum, %i, 32)
}
else { /outputxdccinfo Pack13 $gettok(%packnum, %i, 32) not in queue for3 %botnetwork $+ ¦7 $+ %botnick (Pack not removed). }
}
elseif (- isin $gettok(%packnum, %i, 32) && $gettok($gettok(%packnum, %i, 32), 1, 45) isnum && $gettok($gettok(%packnum, %i, 32), 2, 45) isnum) {
var %j = $gettok($gettok(%packnum, %i, 32), 1, 45)
while (%j <= $gettok($gettok(%packnum, %i, 32), 2, 45)) {
if ($read($getqfilenm(%botnetwork, %botnick), wnt, %j)) {
/removefromq %botnick %botnetwork %j
}
else { /outputxdccinfo Pack13 %j not in queue for3 %botnetwork $+ ¦7 $+ %botnick (Pack not removed). }
inc %j
}
}
else { /outputxdccinfo Invalid input ( $+ $gettok(%packnum, %i, 32) $+ ). }
inc %i
}
/outputxdccinfo 6Removed packs from bot3 %botnetwork $+ ¦7 $+ %botnick (Pack Number(s):13 %packnum $+ ).
}
else { /outputxdccinfo Remove specific pack operation aborted. }
}
else { /outputxdccinfo No queue file for bot3 %botnetwork $+ ¦7 $+ %botnick $+ . }
}
else { /outputxdccinfo Bot7 $nick not listed. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /clrq $1:
; $1: xdcc bot nick.
; Removes queue file for a specific bot on a specific network.
; Can be triggered from the nicklist menu. Uses 1 popup editbox if no nick
; is selected and one popup yes/no querybox.
;-------------------------------------------------------------------------
alias clrq {
if ($1 == $null) { var %botnick = $$?="Enter the bot's nick (Ex: XDCC|DCC01)." }
else { var %botnick = $1 }
var %botnetwork = $triggerHash.network(%botnick)
if (%botnetwork != $null) {
if ($exists($getqfilenm(%botnetwork, %botnick))) {
if ($?!="Clear XDCC queue for %botnick $+ ?") {
.remove $getqfilenm(%botnetwork, %botnick)
/outputxdccinfo Cleared XDCC request queue for7 %botnick on3 %botnetwork $+ and suspended auto resumes.
}
}
else { /outputxdccinfo No such queue exists (3 $+ %botnetwork $+ ¦7 $+ %botnick $+ ). }
if ($read($xdccsinprogress, wnt,$1 *) || $read($xdccsinprogress, wnt,$1)) { /write -ds" $+ $1 $+ " $xdccsinprogress }
if ($read($networkfile(%botnetwork), wnt, * $1 *)) { /write -dw"* $1 *" $networkfile(%botnetwork) }
}
else { /outputxdccinfo Bot7 %botnick not listed. }
if ($read($botqueuefile,wnt,$1) && $?!="Remove Bot from Bot Queue File?") { /removebotqueue $1 }
else { /outputxdccinfo }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removepackfromallbots $1 $2 $3-:
; $1: $replace($nick, ....).
; $2: $replace($network, ...).
; $3-: $filename.
; Tries to match a completed filename to pack descriptions in the pff file
; entry matching each q file entry. If a match is found, the appropriate
; pack should be removed from the queue
;-------------------------------------------------------------------------
alias removepackfromallbots {
var %searchpack = $remvallnonum($replace($nopath($3-),$chr(46),$chr(32),_,$chr(32),-,$chr(32)))
var %h = 0
var %g = 1
/outputxdccinfo 6Clearing Pack13 %searchpack (3 $+ $2 $+ ¦7 $+ $1 $+ .q) from All Bot Queues...
while ($findfile($xdccdir,*.q,%g)) {
var %currentqfile = $findfile($xdccdir,*.q,%g)
if ($nopath(%currentqfile) != $nopath($getqfilenm($2, $1))) {
var %f = 0
while (%f <= $lines(%currentqfile)) {
if ($exists($replace(%currentqfile,.q,.fpf))) {
if ($read($replace(%currentqfile,.q,.fpf),snt,$read(%currentqfile,nt,%f)) == $nopath($3-)) {
/outputxdccinfo 3 $+ $gettok($strip($remove($nopath(%currentqfile),.q),burc),1,166) $+ ¦7 $+ $gettok($strip($remove($nopath(%currentqfile),.q),burc),2,166) $+ .q:4 FPF File2 $read($replace(%currentqfile,.q,.fpf),snt,$read(%currentqfile,nt,%f)) matches completed file13 %searchpack $+ ,4 removing pack $gettok($strip($read($replace(%currentqfile,.q,.pff), nt, $read(%currentqfile, nt, %f)),burc),1,32) from queue file.
.removefromq $gettok($strip($remove($nopath(%currentqfile),.q),burc),2,166) $gettok($strip($remove($nopath(%currentqfile),.q),burc),1,166) $read(%currentqfile,nt,%f)
}
}
var %ntoks = $calc($numtok($strip($read($replace(%currentqfile,.q,.pff), nt, $read(%currentqfile, nt, %f)),burc),32) - 1)
var %matchpack = $remvallnonum($replace($gettok($read($replace(%currentqfile,.q,.pff), nt, $read(%currentqfile, nt, %f)),3- $+ %ntoks,32),$chr(46),$chr(32),_,$chr(32),-,$chr(32)))
if (* $+ %searchpack $+ * iswm %matchpack) {
/outputxdccinfo 3 $+ $gettok($nopath(%currentqfile),1,166) $+ ¦7 $+ $remove($gettok($nopath(%currentqfile),2,166),.q) $+ .q:4 Filename2 %searchpack 4matches pack description13 %matchpack $+ 4, removing pack $gettok($strip($read($replace(%currentqfile,.q,.pff), nt, $read(%currentqfile, nt, %f)),burc),1,32) from queue file.
.removefromq $gettok($strip($remove($nopath(%currentqfile),.q),burc),2,166) $gettok($strip($remove($nopath(%currentqfile),.q),burc),1,166) $gettok($strip($read($replace(%currentqfile,.q,.pff), nt, $read(%currentqfile, nt, %f)),burc),1,32)
dec %g
inc %h
}
inc %f
}
}
inc %g
}
if (%h == 0) { /outputxdccinfo 5Found no packs in other bot queues matching %searchpack $+ . }
elseif (%h == 1) { /outputxdccinfo 5Found and removed %h pack in other bot queues matching %searchpack $+ . }
else { /outputxdccinfo 5Found and removed %h packs in other bot queues matching %searchpack $+ . }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /startqueue $1-:
; $1: String of one or more individual botnames.
; Starts handeling the queue for one or more given bots, if such queues
; exist.
;-------------------------------------------------------------------------
alias startqueue {
if ($1- != $null) { var %xdccnickstring = $1- }
else { var %xdccnickstring = $?="Enter XDCC bot nicks to start queue for:" }
if (%xdccnickstring == $null) { /outputxdccinfo No bots entered. }
if ($numtok(%xdccnickstring, 32) == 1 || $?!="WARNING: you have entered more than 1 bot to start queues for at the same time. This may result in detection and is not recommended. Proceed?") {
var %i = 1
while (%i <= $numtok(%xdccnickstring, 32)) {
var %botnick = $gettok(%xdccnickstring, %i, 32)
var %botnetwork = $triggerHash.network(%botnick)
var %packnum = $read($getqfilenm(%botnetwork, %botnick), t, 0)
if ($triggerHash.exists(%botnetwork,%botnick)) { var %trigger = $triggerHash.getTrigger(%botnetwork, %botnick) $+ %packnum }
else { var %trigger = $null }
if (%trigger != $null) {
if ($checkFPF(%botnetwork, %botnick, %packnum) == false && $get(%botnick) != active) {
if ($read($autoresumedisablefile, wnt, %botnick $+ ¦ $+ %botnetwork)) {
/write -dw" $+ %botnick $+ ¦ $+ %botnetwork $+ " $autoresumedisablefile
}
if ($exists($getqfilenm(%botnetwork, %botnick))) {
var %upperbound = $calc($numtok(%xdccnickstring, 32) * 30)
var %j = 0
var %con = $null
while (%con == $null && %j < 1000) {
if ($scon(%j).network == %botnetwork) { set %con %j }
inc %j
}
if (%con != $null) {
if ($xdccpreemptivejoin == on) { /scon %con /preemptiveJoin %botnetwork %botnick }
if ($numtok(%xdccnickstring, 32) == 1) {
var %bt.rand = 3
/outputxdccinfo 3 $+ %botnetwork $+ : 5Starting queue for bot7 %botnick on3 $scon(%con).network $+ . Single bot, no timer necessary. ( $+ $lines($getqfilenm(%botnetwork, %botnick)) items) ( $+ %trigger $+ ).
}
else {
var %bt.rand = $rand(1,%upperbound)
/outputxdccinfo 3 $+ %botnetwork $+ : 5Starting queue for bot7 %botnick on3 $scon(%con).network $+ . Multiple bots: Bot on %bt.rand sec timer, ( $+ $lines($getqfilenm(%botnetwork, %botnick)) items) ( $+ %trigger $+ ).
}
if ($exists($dccallownetworkfile) && $read($dccallownetworkfile,wnt,%botnetwork)) { /scon %con /DCCALLOW + $+ %botnick }
if ($exists($alternatedccserverfile) && $read($alternatedccserverfile,snt,%botnick)) { $read($alternatedccserverfile,snt,%botnetwork %botnick) }
if ($gettok(%trigger, 1, 32) == /msg) { /scon %con .timerxdccstartq $+ %botnick $+ %i 1 %bt.rand /msg $gettok(%trigger, 2-, 32) }
elseif ($gettok(%trigger, 1, 32) == /ctcp) { /scon %con .timerxdccstartq $+ %botnick $+ %i 1 %bt.rand /ctcp $gettok(%trigger, 2-, 32) }
elseif ($gettok(%trigger, 1, 32) == /notice) { /scon %con .timerxdccstartq $+ %botnick $+ %i 1%bt.rand /notice $gettok(%trigger, 2-, 32) }
else { /outputxdccinfo 4ERROR: Unknown trigger type (7 $+ %botnick $+ ). }
if ($read($tempbotqueuefile,s,%botnick)) { /write -ds $+ %botnick $tempbotqueuefile }
if ($read($xdccsinprogress, s, %botnick)) { /write -ds $+ %botnick $xdccsinprogress }
if ($read($networkfile(%botnetwork), wn, * %botnick *)) { /write -dw"* %botnick *" $networkfile(%botnetwork) }
if (!$read($xdccsinprogress, wnt, %botnick $read($getqfilenm(%botnetwork, %botnick), 0))) {
//write -a $xdccsinprogress %botnick $read($getqfilenm(%botnetwork, %botnick), 0)
}
if ($exists($tempbotqueuefile) && $read($tempbotqueuefile,snt,%botnick)) {
/write -ds $+ %botnick $tempbotqueuefile
}
}
else { /outputxdccinfo You are not connected to the3 %botnetwork network. }
}
else {
if ($shouldstartmaxbotq != $null) {
if ($botqueuehandling == on) {
/removebotqueue $1
if ($read($tempbotqueuefile,nt,1) != $null) {
/outputxdccinfo No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ . Moving to next bot in Temporary Bot Queue file (7 $+ $read($tempbotqueuefile, 1) $+ ).
/startbotqueues 1
}
elseif ($exists($botqueuefile)) {
var %rand.bt = $rand($minautoqdelay, $maxautoqdelay);
/outputxdccinfo No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ . Moving to next bot in Bot Queue file (7 $+ $read($botqueuefile, 1) $+ ).
.timerxdccstartq $+ $read($botqueuefile, 1) $+ 2 1 3 /startqueue $read($botqueuefile, 1)
}
else {
/outputxdccinfo No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ . No Bot Queue file exists.
}
}
else { /outputxdccinfo No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ . 4Bot Queue Handling OFF. }
}
else { /outputxdccinfo No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ . 4Maximum number of simultaneous transfers or Maximum bandwidth reached: Not moving to Bot Queue until next incoming transfer completion. }
}
}
elseif (($lines($getqfilenm(%botnetwork,%botnick)) > 1) && $botqueuehandling == on && $get(%botnick).status != active) {
var %upperbound = $calc($numtok(%xdccnickstring, 32) * 30)
var %bt.rand = $rand(1,%upperbound)
var %j = 0
var %con = $null
while (%con == $null && %j < 1000) {
if ($scon(%j).network == %botnetwork) { set %con %j }
inc %j
}
if (%con != $null) {
if ($xdccpreemptivejoin == on) { /scon %con /preemptiveJoin %botnetwork %botnick }
/write -a $getqfilenm(%botnetwork,%botnick) $read($getqfilenm(%botnetwork,%botnick),nt,1)
/write -dl1 $getqfilenm(%botnetwork,%botnick)
/write -i1 $tempbotqueuefile %botnick $read($getqfilenm(%botnetwork,%botnick),nt,1)
/write -dw $+ %botnick $+ ¦ $+ %botnetwork $autoresumedisablefile
/outputxdccinfo File is 9already transfering for3 %botnetwork $+ ¦7 $+ %botnick pack13 %packnum $+ . Moving to next pack in queue in %bt.rand seconds.
/scon %con .timerxdccstartq $+ %botnick $+ %i 1 %bt.rand /startbotqueues 1
/outputxdccinfo
}
}
else {
if (!$read($xdccsinprogress,snt,%botnick)) { //write -a $xdccsinprogress %botnick %packnum }
/outputxdccinfo File is 9already transfering for3 %botnetwork $+ ¦7 $+ %botnick pack13 %packnum $+ .
/outputxdccinfo
}
}
else { /outputxdccinfo Unknown bot or not a bot (7 $+ %botnick $+ ). }
inc %i
}
}
/outputxdccinfo
/removebotqueue $1
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /stopxdccqueue $1:
; $1: botnick.
; Removes a bot from the currently active transfers files, resulting in a
; deactivated queue for that bot. The pack will not be removed from queue,
; however, and starting the queue for this bot will reactivate the auto
; resume and auto queue options (if active).
;-------------------------------------------------------------------------
alias stopxdccqueue {
if ($1 != $null) { var %botnick = $1 }
else { var %botnick = $?="Enter bot nick for which to suspend queue processing." }
var %botnetwork = $triggerHash.network(%botnick)
.timeoff %botnick %botnetwork
if (%botnick != $null && $?!="Suspend auto re-request and auto queue processing for %botnick $+ ? (NOTE: The current send will not be removed from queue, and features will be reactivated when the queue is manually restarted.)") {
if ($read($xdccsinprogress, wnt, %botnick *) || $read($xdccsinprogress, wnt, %botnick)) {
/outputxdccinfo 14Found entry for bot7 $1 14in general active sends file, deleting.
.write -ds $+ %botnick $xdccsinprogress
}
else { /outputxdccinfo 14No entry found for bot7 %botnick 14in general active sends file. }
if (%botnetwork != $null) {
if ($exists($networkfile(%botnetwork)) && $read($networkfile(%botnetwork),wnt,* %botnick *)) {
/outputxdccinfo 14Found entry for bot7 %botnick 14on network3 %botnetwork 14active sends file, deleting.
.write -dw $+ "* %botnick *" $networkfile(%botnetwork)
}
else { /outputxdccinfo 14No entry found for bot7 $1 14on network3 %botnetwork 14active sends file. }
}
if (!$read($autoresumedisablefile, wnt, %botnick $+ ¦ $+ %botnetwork)) {
/write -a $autoresumedisablefile %botnick $+ ¦ $+ %botnetwork
}
if ($exists($tempbotqueuefile) && $read($tempbotqueuefile,snt,%botnick)) {
/write -ds $+ %botnick $tempbotqueuefile
}
if ($exists($botqueuefile) && $read($botqueuefile,snt,%botnick)) {
/write -ds $+ %botnick $botqueuefile
}
if ($botliston == TRUE) { //cline -lc2 @XDCC_Info $fline(@XDCC_Info,%botnick,1,1) }
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias haltDownloads {
/outputxdccinfo 4Halting downloads for7 $1 $+ .
close -g $1
if ($get($1).status != active && $botliston == TRUE) { //cline -lc7 @XDCC_Info $fline(@XDCC_Info,$1,1,1) }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias haltUploads {
/outputxdccinfo 4Halting uploads for7 $1 $+ .
close -s $1
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /queuefullrerequest $1 $2:
; $1: $network.
; $2: $nick.
; This will react to a msg send by an XDCC bot that it's queue is full, by
; re-requesting the first pack in it's queue (if any).
;-------------------------------------------------------------------------
alias queuefullrerequest {
if ($exists($getqfilenm($1, $2))) {
var %packnum = $read($getqfilenm($1, $2), tn, 1)
var %trigger = $triggerHash.getTrigger($1, $2) $+ %packnum
var %bt.rand = $rand($minqfulldelay, $maxqfulldelay)
if ($checkFPF($1, $2, %packnum) == false && $get($2) != active) {
/outputxdccinfo 13Queue full for bot3 $1 $+ ¦7 $+ $2 $+ , 3auto re-requesting in %bt.rand seconds. (Pack number had to be guessed from queue file and is set to $read($getqfilenm($1, $2), tn, 1) $+ ).
if ($gettok(%trigger, 1, 32) == /msg) { /timerxdccautoresume $+ $2 $+ 3 1 %bt.rand /msg $gettok(%trigger, 2-, 32) }
elseif ($gettok(%trigger, 1, 32) == /ctcp) { /timerxdccautoresume $+ $2 $+ 3 1 %bt.rand /ctcp $gettok(%trigger, 2-, 32) }
elseif ($gettok(%trigger, 1, 32) == /notice) { /timerxdccautoresume $+ $2 $+ 3 1 %bt.rand /notice $gettok(%trigger, 2-, 32) }
else { /outputxdccinfo 4ERROR: Unknown trigger type ( $+ %trigger $+ ). }
if ($exists($tempbotqueuefile) && $read($tempbotqueuefile,snt,$2)) {
/write -ds $+ $2 $tempbotqueuefile
}
}
elseif (($lines($getqfilenm($1,$2)) > 1) && $botqueuehandling == on && $get($2).status != active) {
if ($xdccpreemptivejoin == on) { /preemptiveJoin %botnetwork %botnick }
/write -a $getqfilenm($1,$2) $read($getqfilenm($1,$2),nt,1)
/write -dl1 $getqfilenm($1,$2)
/write -i1 $tempbotqueuefile %botnick $read($getqfilenm($1,$2),nt,1)
/write -dw $+ $2 $+ ¦ $+ $1 $autoresumedisablefile
/outputxdccinfo File is 9already transfering for3 $1 $+ ¦7 $+ $2 pack13 %packnum $+ . Moving to next pack in queue in %bt.rand seconds.
/timerxdccautoresume $+ $2 $+ 3 1 %bt.rand /startbotqueues 1
}
else {
if (!$read($xdccsinprogress,snt,$2)) { //write -a $xdccsinprogress $2 %packnum }
/outputxdccinfo File is 9already transfering for3 $1 $+ ¦7 $+ $2 pack13 %packnum $+ .
}
}
else {
/outputxdccinfo 4ERROR: Can't auto re-request pack for3 $1 $+ ¦7 $+ $2 $+ . Pack number unknown.
}
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /cropbotqueue:
; Removed queue-less bots from the bot queue.
;-------------------------------------------------------------------------
alias cropbotqueue {
/outputxdccinfo 5Removing all bots without .q File from the main Bot Queue.
var %i = 1
var %count = 0
var %llen = $lines($botqueuefile)
while (%i <= %llen) {
var %botnick = $read($botqueuefile,nt,%i)
var %botnetwork = $triggerHash.network(%botnick)
if (!$exists($getqfilenm(%botnetwork,%botnick)) || $lines($getqfilenm(%botnetwork,%botnick)) == 0) {
/outputxdccinfo No queue file for3 %botnetwork $+ ¦7 $+ %botnick $+ , removed bot from main bot queue.
/write -dl $+ %i $botqueuefile
inc %count
dec %i
dec %llen
}
inc %i
}
/outputxdccinfo 5Removed %count bots from the main Bot Queue.
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /addbotqueue $1:
; $1: botnick.
; Adds a bot to the back of the bot queue.
;-------------------------------------------------------------------------
alias addbotqueue {
var %botnetwork = $triggerHash.network($1)
if (%botnetwork != $null) {
if (!$read($botqueuefile, w, $1)) {
/write -a $botqueuefile $1
/outputxdccinfo Added7 $1 to the bot queue for network3 %botnetwork in position $lines($botqueuefile) $+ .
}
else {
/outputxdccinfo Did not add7 $1 to the bot queue. Bot already in queue file.
}
}
else { /outputxdccinfo Bot7 $1 not listed in bot library. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removebotqueue $1:
; $1: botnick.
; Removes a specified bot from the bot queue if it is in there.
;-------------------------------------------------------------------------
alias removebotqueue {
var %botnetwork = $triggerHash.network($1)
if (%botnetwork != $null) {
if ($exists($botqueuefile) && $read($botqueuefile, w, $1)) {
if ($lines($botqueuefile) <= 1) { .remove $botqueuefile }
else { /write -dw $+ $1 $botqueuefile }
/outputxdccinfo Removed7 $1 from the bot queue for network3 %botnetwork $+ .
/outputxdccinfo
}
}
else {
/outputxdccinfo Bot7 $1 not listed in bot library.
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /clrbotq:
; Clears the Bot Queue file by deleting it. Uses one yes/no querybox.
;-------------------------------------------------------------------------
alias clrbotq {
if ($?!="Clear entire Bot Queue file?") {
if ($botqueuefile) { .remove $botqueuefile }
/outputxdccinfo 14Cleared all queues for Bot Queue file.
}
else { /outputxdccinfo 14Cancelled clearing of Bot Queue file. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /startbotqueues $1:
; $1: number of botqueues to start.
; This should start processing the queues of the first $1 queued bots.
;-------------------------------------------------------------------------
alias startbotqueues {
if ($1 != $null && $1 > 0 && $1 isnum) {
var %botnames = $null
var %j = 0
var %k = 1
while ($read($tempbotqueuefile, nt, 1) != $null && %j < $1 && %k <= $lines($tempbotqueuefile)) {
if (!$read($autoresumedisablefile, wnt,$gettok($read($tempbotqueuefile, nt, 1),1,32) $+ ¦ $+ *)) {
inc %j
var %rand.bt = $rand($minautoqdelay, $maxautoqdelay)
set %botnames %botnames $+ |7 $gettok($read($tempbotqueuefile, nt, 1),1,32) 14( $+ %rand.bt second delay) |
.timerxdccstartbotq $+ $gettok($read($tempbotqueuefile, nt, 1),1,32) $+ %j 1 %rand.bt /startqueue $gettok($read($tempbotqueuefile, 1),1,32)
if (!$read($xdccsinprogress,snt,$gettok($read($tempbotqueuefile, nt, 1),1,32))) { /write -a $xdccsinprogress $read($tempbotqueuefile, nt, 1) }
/write -dl1 $tempbotqueuefile
}
else {
/outputxdccinfo 4Cannot start queue for $gettok($read($tempbotqueuefile, nt, 1),1,32) $+ : 5 Autoresume is temporarily disabled for this bot. To restart the bot now, choose Start XDCC Queue in the menu to resume the transfer.
/outputxdccinfo
var %tempbotqstring = $read($tempbotqueuefile, nt, 1)
/write -dl1 $tempbotqueuefile
/write -a $tempbotqueuefile %tempbotqstring
inc %k
}
}
var %i = 1
while (%i <= $calc($1 - %j) && %i <= $lines($botqueuefile)) {
var %rand.bt = $rand($minautoqdelay, $maxautoqdelay)
.timerxdccstartbotq $+ $read($botqueuefile, %i) $+ %i 1 %rand.bt /startqueue $read($botqueuefile, %i)
set %botnames %botnames $+ |7 $read($botqueuefile, %i) 14( $+ %rand.bt second delay) |
inc %i
}
if (%j > 0 || %i > 1) {
/outputxdccinfo 14Starting queue processing for first $1 bots listed in Temp Bot Queue or Bot Queue file ( $+ %botnames $+ 14).
/outputxdccinfo
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /alternatesendcheck $1:
; $1: Network.
; $2: Nick.
; Checks the alternate DCC send method file for a dccserver command and
; executes it, and starts queue for $1, if a command is found.
;-------------------------------------------------------------------------
alias alternatesendcheck {
if ($exists($alternatedccserverfile) && $read($alternatedccserverfile,snt,$1 $2) && $get($1).status != active) {
if (!$read($autoresumedisablefile,wnt,$2 $+ ¦ $+ $1)) {
/outputxdccinfo 3Retrying XDCC download for7 $2 on3 $1 with alternate DCC send method ( $+ $read($alternatedccserverfile,snt,$1 $2) $+ ).
$read($alternatedccserverfile,snt,$1 $2)
/startqueue $2
}
else {
/outputxdccinfo 4Not retrying XDCC download for7 $2 on3 $1 with alternate DCC send method.
/outputxdccinfo
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /timexdcctransferstest & /timexdcctransferstestoff:
; /timexdcctransferstest initiates one out of two unlimited timers if
; botqueueing is on.
; The first starts a cycle that checks the need for new bot queue starts
; on the basis of bandwidth statistics of a chosen time interval.
; The second starts a cycle that checks the need for new bot queue starts
; on the basis of the number of active and presently requested transfers.
; /timexdcctransferstestoff switches both these timers off.
;-------------------------------------------------------------------------
alias timexdcctransferstest {
;var %xtt = $timer(xdccstatistics).secs
.timexdcctransferstestoff
if ($botqueuehandling == on) {
if ($botqueuemode == bandwidth) { .timerxdccstatistics -o 0 $statisticstime /calcxdccstats 0 }
elseif ($botqueuemode == number of transfers) { .timerxdcctransferstest -o 0 $statisticstime /checktransfernumber }
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias timexdcctransferstestoff {
.timerxdccstatistics off
.timerxdcctransferstest off
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /checktransfernumber:
; This is triggered every $statisticstime seconds if botqueueing and
; testing are switched on.
; It activates a new botqueue, if one exists, if it detects that the
; number of bots + xdcctimers is less than the minimum number of transfers
; setting.
;-------------------------------------------------------------------------
alias checktransfernumber {
if ($shouldstartminbotq && $botqueue.exists) {
/outputxdccinfo 3Number of transfers is lower than $mintransfers $+ . Starting $calc($mintransfers - $calc($activeautoresumesends + $activesends)) new bot(s).
/startbotqueues $calc($mintransfers - $calc($activeautoresumesends + $activesends))
}
else { /debuglog CHECKTRANSFERNUMBER: Number of transfers lower than $mintransfers $+ . No bots to start. }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /checktransfernumber:
; This is triggered every $statisticstime seconds if botqueueing and
; testing are switched on.
; It activates a new botqueue, if one exists, if it detects that the
; average bandwidth over the last $statisticstime seconds + (number of
; active xdcctimers * square root of the system's maximum bandwidth) is
; less than the minimum bandwidth setting. The timer for this one should
; be reset whenever a new transfer starts, or a transfer finishes or
; fails.
;-------------------------------------------------------------------------
alias calcxdccstats {
var %averagebw = 0
var %z = 1
while (%z <= $get(0)) {
if ($get(%z).status == active) {
write -a $statsfile(1) $get(%z) $get(%z).rcvd
}
inc %z
}
var %oldtotalbytes = 0
if ($exists($statsfile(2))) {
var %z = 1
while (%z <= $lines($statsfile(2))) {
/debuglog CALC OLDSTATS: %z $gettok($read($statsfile(2),%z),2,32)
if ($get($gettok($read($statsfile(2),%z),1,32)).status == active) { set %oldtotalbytes $calc(%oldtotalbytes + $gettok($read($statsfile(2),%z),2,32)) }
inc %z
}
}
var %newtotalbytes = 0
if ($exists($statsfile(1))) {
var %z = 1
while (%z <= $lines($statsfile(1))) {
/debuglog CALC NEWSTATS: %z $gettok($read($statsfile(1),%z),2,32)
set %newtotalbytes $calc(%newtotalbytes + $gettok($read($statsfile(1),%z),2,32))
inc %z
}
}
var %totalbytes = $calc(%newtotalbytes - %oldtotalbytes)
var %averagebw = $calc($calc(%totalbytes / $calc($statisticstime - $1)) / 1024)
var %totaltimers = 0
var %timeroverhead = 0
var %z = 1
while (%z <= $timer(0)) {
if ($isXDCCTimer(%z) == TRUE) {
inc %totaltimers
set %timeroverhead $calc(%timeroverhead + $calc($calc(10 * $sqrt($connectionbandwidth)) / $sqrt($timer(%z).secs)))
}
inc %z
}
/debuglog CALC TIMEROVERHEADSTATS: ( $+ %totaltimers $+ *(10* $+ $sqrt($connectionbandwidth) $+ )/ $+ $sqrt($timer(%z).secs) $+ ) %timeroverhead $calc(%totaltimers * $calc(2 * $sqrt($connectionbandwidth)))
/debuglog CALC BANDWIDTH: %totalbytes $calc(2 * $sqrt($connectionbandwidth)) %newtotalbytes %oldtotalbytes Average bandwidth use for last $calc($statisticstime - $1) seconds: %averagebw + %timeroverhead $+ .
if ($calc(%averagebw + %timeroverhead) <= $minbandwidth && $calc(%averagebw + %timeroverhead) >= 0 && $botqueue.exists == TRUE) {
/outputxdccinfo Average bandwidth for last $calc($statisticstime - $1) seconds ( $+ %averagebw KByte) plus estimated timer overhead ( $+ %timeroverhead KByte over %totaltimers request timers), $calc(%averagebw + %timeroverhead) KByte estimated total, is lower than minimum bandwidth setting ( $+ $minbandwidth KByte). Bot Queue exists. Starting new Bot Queue.
/outputxdccinfo
/startbotqueues 1
}
elseif (%averagebw <= $minbandwidth) { /debuglog STATS: NO BOT QUEUES FOUND: Average bandwidth for last $calc($statisticstime - $1) seconds ( $+ %averagebw KByte) plus estimated timer overhead ( $+ %timeroverhead KByte over %totaltimers request timers) is lower than minimum bandwidth setting ( $+ $minbandwidth KByte). No Bots In Bot Queues. }
else { /debuglog STATS: AVERAGE EXCEEDS MAXIMUM: Average bandwidth for last $calc($statisticstime - $1) seconds ( $+ %averagebw KByte) plus estimated timer overhead ( $+ %timeroverhead KByte over %totaltimers request timers) is higher than minimum bandwidth setting ( $+ $minbandwidth KByte). Not starting Bot Queues. }
if ($exists($statsfile(2))) { .remove $statsfile(2) }
if ($exists($statsfile(1))) { .rename $statsfile(1) $statsfile(2) }
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /addtoxdccwishlist $1-:
; $1-: Searchstring.
; This searches all packs for a string, then adds it to the wishlist if
; it wasn't in there already.
;-------------------------------------------------------------------------
alias addtoxdccwishlist {
if ($1- != $null) {
findpack $replaceallwishlist($1-)
if (!$read($xdccwishlist,wnt,$1-)) {
/write -a $xdccwishlist $1-
/outputxdccinfo 11Added $1- 14to your wishlist.
}
else { /outputxdccinfo 14You already have that item in your wishlist ( $+ $1- $+ ). }
}
else { /outputxdccinfo 14No searchstring entered. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /removefromxdccwishlist $1-:
; $1-: Searchstring.
; This removes an item from the wishlist.
;-------------------------------------------------------------------------
alias removefromxdccwishlist {
if ($1- != $null) {
if ($read($xdccwishlist,wnt,$1-)) {
/write -dw" $+ $1- $+ " $xdccwishlist
/outputxdccinfo 10Removed item $1- 14from your wishlist.
}
else { /outputxdccinfo 14No such item in wishlist ( $+ $1- $+ ). }
}
else { /outputxdccinfo 14No searchstring entered. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /matchwishlistpack $1 $2 $3 $4-:
; $1: Nick.
; $2: Network.
; $3: Channel.
; $4-: Pack string.
; This matches a pack to any items in the wishlist and reports a match if
; one was found.
;-------------------------------------------------------------------------
alias matchwishlistpack {
if ($exists($xdccwishlist)) {
if ($read($xdccwishlist,wnt,$4-)) {
/outputxdccinfo 11Wishlist item found: Exact Match: Bot7 $1 on network3 $2 (12 $+ $3 $+ ) just listed 13" $+ $strip($4-,burc) $+ " for packlisting, which partially matches your wishlist entry 11" $+ $read($xdccwishlist, $readn) $+ ".
/outputxdccinfo
}
elseif ($read($xdccwishlist,wnt,* $+ $replaceallwishlist($4-) $+ *)) {
/outputxdccinfo 11Possible wishlist item found: Partial Match: Bot7 $1 on network3 $2 (12 $+ $3 $+ ) just listed 13" $+ $strip($4-,burc) $+ " for packlisting, which partially matches your wishlist entry 11" $+ $read($xdccwishlist, $readn) $+ ".
/outputxdccinfo
}
else {
var %a = 1
while (%a <= $lines($xdccwishlist)) {
if (* $+ $replaceallwishlist($read($xdccwishlist, nt, %a)) $+ * iswm $replaceallwishlist($4-)) {
/outputxdccinfo 11Possible wishlist item found: Normal Match: Bot7 $1 on network3 $2 (12 $+ $3 $+ ) just listed 13" $+ $strip($4-,burc) $+ " for packlisting, which partially matches your wishlist entry 11" $+ $read($xdccwishlist, $readn) $+ ".
/outputxdccinfo
}
inc %a
}
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /comparepackfiles $1 $2
; $1: New pack file filename.
; $2: Old pack file filename.
; This should compare pack files to detect changes in a bot's
; packlistings. If the listing is changed it notifies the script user and
; warns if a queue exists for the changed bot. It only compares by
; checking list length, because checking actual pack changes would be too
; hard because of the fact that bots often add their number of packet gets
; to their ads.
;-------------------------------------------------------------------------
alias comparepackfiles {
if ($comparepacks == on && $1 != $2 && $lines($2) > 0 && $lines($1) > 0) {
var %changedpacks = $null
if ($lines($2) <= $lines($1)) {
var %i = 1
var %llen = $lines($2)
while (%i <= %llen) {
var %k = $matchtok($read($2, %i),14, 0, 32)
if ($remvall($read($2, %i)) != $remvall($read($1, %i)) && $gettok($read($2, %i),1,32) == $gettok($read($1, %i),1,32) && $gettok($read($1, %i),2-3,32) != Unknown Pack && $gettok($read($2, %i),2-3,32) != Unknown Pack) {
/outputxdccinfo 4Old pack14 $strip($read($2, %i),burc) 15( $+ $remvall($read($2, %i)) $+ )4 is not the same as new pack 14 $+ $strip($read($1, %i),burc) 15( $+ $remvall($read($1, %i)) $+ ).
//write -l $+ $gettok($read($1,nt,%i),1,32) $replace($1,.pff,.fpf) %i Unknown File $chr(35) $+ %i
set %changedpacks %changedpacks %i
}
inc %i
}
if ($lines($2) < $lines($1)) {
if ($calc($lines($1) - $lines($2)) == 1) { set %changedpacks %changedpacks Packnumber added: $lines($1) }
else { set %changedpacks %changedpacks Packnumbers added: $calc($lines($2) + 1) $+ - $+ $lines($1) }
}
}
if ($lines($1) < $lines($2)) {
var %i = 1
var %llen = $lines($1)
while (%i <= %llen) {
var %k = $matchtok($read($2, %i),14, 0, 32)
if ($remvall($read($2, %i)) != $remvall($read($1, %i)) && $gettok($read($2, %i),1,32) == $gettok($read($1, %i),1,32) && $gettok($read($1, %i),2-3,32) != Unknown Pack && $gettok($read($2, %i),2-3,32) != Unknown Pack) {
/outputxdccinfo 4Old pack14 $strip($read($2, %i),burc) 15( $+ $remvall($read($2, %i)) $+ )4 is not the same as new pack 14 $+ $strip($read($1, %i),burc) 15( $+ $remvall($read($1, %i)) $+ ).
//write -l $+ $gettok($read($1,nt,%i),1,32) $replace($1,.pff,.fpf) %i Unknown File $chr(35) $+ %i
set %changedpacks %changedpacks %i
}
inc %i
}
if ($calc($lines($2) - $lines($1)) == 1) { set %changedpacks %changedpacks Packnumber removed: $lines($2) }
else { set %changedpacks %changedpacks Packnumbers removed: $calc($lines($1) + 1) $+ - $+ $lines($2) }
}
if (%changedpacks != $null) {
if ($exists($replace($1,.pff,.q))) {
/outputxdccinfo 14(NOTE: This message was delayed $packchangechecktime seconds.) Packfile most likely changed for2 $1 $+ 14, or bot went offline during listing, or interval between pack ad listing lines was longer than $packchangechecktime seconds. 4Warning: you have packs queued for this bot, make sure the right packs are queued (Old packfile: $lines($2) lines. New packfile: $lines($1) lines. Packnumber(s) changed:13 %changedpacks $+ 14).
}
else { /outputxdccinfo 14(NOTE: This message was delayed $packchangechecktime seconds.) Packfile most likely changed for2 $1 $+ 14, or bot went offline during listing, or interval between pack ad listing lines was longer than $packchangechecktime seconds (Old packfile: $lines($2) lines. New packfile: $lines($1) lines. Packnumber(s) changed:13 %changedpacks $+ 14). }
/outputxdccinfo
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /preemptiveJoin:
; $1: botnetwork.
; $2: botnick.
;-------------------------------------------------------------------------
alias preemptiveJoin {
var %chan = $null
if ($triggerHash.exists($1,$2)) { var %chan = $triggerHash.getChan($1,$2) }
if (%chan != $null && $me !ison %chan) {
/outputxdccinfo Doing a preemptive join on channel12 %chan on network3 $1 $+ ...
/join -n %chan
/outputxdccinfo
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /timejoin1 & /timejoin2:
; $1: botnick.
; $2: botnetwork.
; Sets timers for the autojoin script. This was triggered by a timer in
; the ON NOTICE trigger. The first alias triggers the second one after a
; few seconds. The second sets timers to re-request a pack.
;-------------------------------------------------------------------------
alias timejoin1 {
if ($read($chankeyfile,wnt,$network $triggerHash.getChan($2, $1) *)) {
/join -n $gettok($read($chankeyfile,wnt,$network $triggerHash.getChan($2, $1) *),2-,32)
/outputxdccinfo 12Channel requires key... 5Trying key found in channel key file.
.timerxdccjoin $+ $1 $+ 3 1 10 /timejoin2 $1 $2
}
else {
/join -n $triggerHash.getChan($2, $1)
.timerxdccjoin $+ $1 $+ 3 1 5 /timejoin2 $1 $2
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias timejoin2 {
if ($me ison $triggerHash.getChan($2, $1)) {
var %packnum = $read($getqfilenm($2, $1), tn, 1)
var %trigger = $triggerHash.getTrigger($2, $1) $+ %packnum
var %bt.rand = $rand($minresumedelay, $maxresumedelay)
if ($checkFPF($2, $1, %packnum)) {
if ($exists($dccallownetworkfile) && $read($dccallownetworkfile,wnt,$2)) { /DCCALLOW + $+ $gettok(%trigger, 2-, 32) }
if ($exists($alternatedccserverfile) && $read($alternatedccserverfile,snt,$2 $gettok(%trigger, 2-, 32))) { $read($alternatedccserverfile,snt,$2 $gettok(%trigger, 2-, 32)) }
if ($get($1).status != active && $botliston == TRUE) { //cline -lc12 @XDCC_Info $fline(@XDCC_Info,$1,1,1) }
/outputxdccinfo 10Succesfully joined channel12 $triggerHash.getChan($2, $1) $+ . Retrying xdcc command for3 $2 $+ ¦7 $+ $1 in %bt.rand seconds ( $+ %trigger $+ ).
if ($gettok(%trigger, 1, 32) == /msg) { /timerxdccjoin $+ $1 $+ 2 1 %bt.rand /msg $gettok(%trigger, 2-, 32) }
elseif ($gettok(%trigger, 1, 32) == /ctcp) { /timerxdccjoin $+ $1 $+ 2 1 %bt.rand /ctcp $gettok(%trigger, 2-, 32) }
elseif ($gettok(%trigger, 1, 32) == /notice) { /timerxdccjoin $+ $1 $+ 2 1 %bt.rand /notice $gettok(%trigger, 2-, 32) }
else { /outputxdccinfo 4ERROR: Unknown trigger type ( $+ %trigger $+ ). }
}
elseif (($lines($getqfilenm($2,$1)) > 1) && $botqueuehandling == on && $get($1).status != active) {
/outputxdccinfo 10Succesfully joined channel12 $triggerHash.getChan($2, $1) $+ . Retrying xdcc command for3 $2 $+ ¦7 $+ $1 in %bt.rand seconds ( $+ %trigger $+ ).
/write -a $getqfilenm($2,$1) $read($getqfilenm($2,$1),nt,1)
/write -dl1 $getqfilenm($2,$1)
/write -i1 $tempbotqueuefile $1 $read($getqfilenm($2,$1),nt,1)
/write -dw $+ $1 $+ ¦ $+ $2 $autoresumedisablefile
/outputxdccinfo File is 9already transfering for3 $2 $+ ¦7 $+ $1 pack13 %packnum $+ . Moving to next pack in queue in %bt.rand seconds.
/timerxdccjoin $+ $1 $+ 2 1 %bt.rand /startbotqueues 1
}
else {
if (!$read($xdccsinprogress,snt,$1)) { //write -a $xdccsinprogress $1 %packnum }
/outputxdccinfo File is 9already transfering for3 $2 $+ ¦7 $+ $1 pack13 %packnum $+ .
}
}
else { /outputxdccinfo 4ERROR: Channel join command unsuccessful. }
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /timeversionrequest & $timeversionrequest2:
; $1: nick. Usually $xdccscriptauthor.
; Requests the latest script version. Uses one yes/no querybox.
;-------------------------------------------------------------------------
alias timeversionrequest {
set %versionrequest $?!="Get new XDCC script version?"
/timerxdccversionrequest 1 0 /timeversionrequest2 $1
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
alias timeversionrequest2 {
if (%versionrequest == $true) {
.notice $1 Requesting send of new XDCC script version.
/outputxdccinfo 14 $+ New version available. Requesting download.
}
else { /outputxdccinfo 14 $+ New version available but not downloaded. }
/outputxdccinfo
unset %versionrequest
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /colorchannicks $1:
; $1: chan.
; Colours the nicknames for a channel in the @XDCC_Info nicklist.
;-------------------------------------------------------------------------
alias colorchannicks {
if ($botliston == TRUE) {
var %f = 1
while (%f <= $triggerHash.items) {
if ($1 isin $triggerHash.item.chans(%f) && $triggerHash.item.network(%f) == $network && $triggerHash.item.nick(%f) ison $1 && $get($triggerHash.item.nick(%f)).status != active) { //cline -lc7 @XDCC_Info $fline(@XDCC_Info,$triggerHash.item.nick(%f),1,1) }
inc %f
}
}
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /unloadXDCCStealth:
; Unload all scripts in the XDCCStealth package.
;-------------------------------------------------------------------------
alias unloadXDCCStealth {
/unload -rs xdccscript.mrc
/unload -rs xdccmorebots.mrc
/unload -rs XDCCStealthMultiSource.mrc
/unload -rs XDCCStealthDialogs.mrc
/unload -rs XDCCStealthSettings.mrc
/unload -rs XDCCStealthHelp.mrc
/unload -rs XDCCStealthMenus.mrc
/unload -rs XDCCStealthListeners.mrc
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; If someone unloads this, automatically unload all the other scripts.
;-------------------------------------------------------------------------
on *:Unload:{
/unloadXDCCStealth
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; /initialiseXDCCStealth:
; Initialisation commands.
;-------------------------------------------------------------------------
alias initialiseXDCCStealth {
/unload -rs xdccscript.mrc
/unload -rs xdccmorebots.mrc
/load -rs XDCCStealthMultiSource.mrc
/load -rs XDCCStealthDialogs.mrc
/load -rs XDCCStealthSettings.mrc
/load -rs XDCCStealthHelp.mrc
/load -rs XDCCStealthMenus.mrc
/load -rs XDCCStealthListeners.mrc
/xdccinitwizard
/debuglog.sessionstart
/triggerHash.init
/networksTable.init
if ($exists($lastsessionfailfile)) { .remove $lastsessionfailfile }
if ($exists($xdccsessionfailfile)) {
.rename $xdccsessionfailfile $lastsessionfailfile
var %i = 1
while (%i <= $lines($lastxdccsessiongetfile)) {
.write -i $+ %i $replace($read($lastxdccsessiongetfile),UnfinishedGet,GetFail,UnfinishedSend,SendFail)
inc %i
}
}
if ($exists($lastxdccsessiongetfile)) { .remove $lastxdccsessiongetfile }
if ($exists($xdccsessiongetfile)) { .rename $xdccsessiongetfile $lastxdccsessiongetfile }
if ($exists($lastxdccsessionsendfile)) { .remove $lastxdccsessionsendfile }
if ($exists($xdccsessionsendfile)) { .rename $xdccsessionsendfile $lastxdccsessionsendfile }
set %xdccscriptversion 4.1.5
set %scriptauthor werecow
set %filessenttotal 0
set %filesgettotal 0
set %installdate $asctime(dd/mm/yyyy [HH:nn:ss])
/outputxdccinfo 15Succesfully set variables, timers, filenames and group settings. Created directory $xdccdir ( $+ $installdate $+ ).
/outputxdccinfo
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
; This sets some variables and creates a directory when the script is
; first loaded.
;-------------------------------------------------------------------------
on *:LOAD:{
/initialiseXDCCStealth
}
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------