alias uu {
if (!$1) { echo -a 4ERROR: Please input a file to update. }
else {
sockopen uu HOSTGOESHERE 80
%conn = $1
./timer 1 1 /chkini
}
}
on 1:sockopen:uu:{
.sockwrite -n uu GET $+(/PATH/PATH/,%conn) HTTP/1.1
.sockwrite -n uu HOST: HOSTGOESHERE
.sockwrite -n uu $crlf
}
on *:sockread:uu:{
if $sockerr { echo -aci info * Update failed: $sock($sockname).wsmsg | return }
if $sock($sockname).mark { sockread -f &x | bwrite temporary.txt -1 -1 &x }
else { var %x | sockread %x | if !%x { sockmark $sockname 1 } }
}
alias -l chkini {
var %x = 1
%xi = 1
while (%x <= $ini(mirc.ini,rfiles,0)) {
if (%conn == $readini(mirc.ini,rfiles,$+(n,%x))) {
if ($input(Did you want to overwrite your current script?,y) == $true) { .unload -rs %conn | .rename %conn $+($left(%conn,-4),$time(hsns),.bck) | unset %xi | .timer 1 2 /updini }
else { return }
}
inc %x
}
.timer 1 4 /updtime
}
alias -l updini {
var %x = 1
while (%x <= $lines(temporary.txt)) {
write -n %conn $read(temporary.txt,n,%x) $crlf
inc %x
}
.load -rs %conn
Echo -a Loaded/Updated $+(%conn,.)
sockclose uu
.remove temporary.txt
}
alias -l updtime {
if (%xi) { echo -a Script is not found/loaded in system. Using AUTO-LOAD System... | updini }
}