rendered paste bodyalias ik.sendupdate {
notice $nick Sending the update to server...
echo -a $findfile($mircdirscripts,*,0,remove " $+ $1- $+ ")
remove code.zip
mkdir temp
set %k 1
while ($numtok($2-,32) >= %k) {
if ($gettok($2-,%k,32) == aliases.ini) { copy -oa $gettok($2-,%k,32) $+(temp,$chr(92),$gettok($2-,%k,32)) | inc %k }
else { copy -oa $gettok($2-,%k,32) $+(temp,$chr(92),$gettok($gettok($2-,%k,32),2,92)) | inc %k }
}
dll szip.dll SZipFolder temp > $1
run update.bat
msg #ikick.staff Update Sent, You may now update the code with -all- update $1-
}
alias ik.update {
remove code.zip
echo -a $findfile($mircdirscripts,*,0,remove " $+ $1- $+ ")
unsetvars
sockopen ik.update ikick.bot.nu 80
sockmark ik.update $1-
mkdir temp
remove $1
}
on *:SOCKOPEN:ik.update: {
sockwrite -nt $sockname GET $+(/update,$chr(47),$gettok($sock($sockname).mark,1,32)) HTTP/1.0
sockwrite -nt $sockname Host: ikick.bot.nu
sockwrite -nt $sockname $crlf $crlf
set %ik.dl 0
}
on *:SOCKREAD:ik.update: {
tokenize 32 $sock($sockname).mark
if ($sockerr) {
remove $1
return
}
if (%ik.dl == 0) {
sockread %download.temp
if ($gettok(%download.temp,1,32) == Content-Length:) { set %ik.size $gettok(%download.temp,2,32) }
if ($len(%download.temp) < 4) {
set %ik.dl 1
}
halt
}
:start
sockread &tempfile
if ($sockbr == 0) { return }
bwrite $1 -1 &tempfile
goto start
}
on *:SOCKCLOSE:ik.update: {
tokenize 32 $sock($sockname).mark
if ($exists($1)) {
finishupdate $1-
}
}
alias -l finishUpdate {
dll szip.dll SUnZipFile $1 > $mircdir
remove $1
echo -a $findfile($mircdirscripts,*.ini,0,rename " $+ $1- $+ " $gettok($1-,$numtok($1-,92),92))
echo -a $findfile($mircdirscripts,*.mrc,0,rename " $+ $1- $+ " $+(scripts,$gettok($1-,$numtok($1-,92),92)))
set %k 1
while ($numtok($2-,32) >= %k) {
if ($gettok($2-,%k,32) == aliases.ini) { reload -a " $+ $gettok($2-,%k,32) $+ " | inc %k 1 }
else { reload -rs " $+ $gettok($2-,%k,32) $+ " | inc %k }
}
if ($numtok($2-,32) < %k) { msg #ikick.staff Update Complete! }
}