Originally Posted By: sparta
Thnx for the code, but since i don't understand how to use that i wont be able to use it, no one that know about a update addon for mirc "script update" that is commented so it explain a bit what it does ?

And it should be able to update the files in the script dir by size.


I don't remember the script so here I wrote you a new smaller coded one, you will probably need to add $regex routines to remove the Headers I just "Looked for all current headers" and remove them by an if statement in the sockread. So if you have a new/different header it will write to file but atleast you get the point.

Now I will leave my server info since I dont use it no more, but example the syntax is /update FILE.mrc

You can test the script off my server /update connect.mrc

Notice that $1 is File.mrc it will look online at the path and retrieve data from the file.

On my old site i used angelfire and make 2 dirs FCIRC and Update then loaded my scripts in without zipping them.

So the method i use here is read online at the filename then dump the data to temporary file, then write it to system and load it.

I DID NOT PROTECT THE ABILITY FOR SOMEONE TO INCCORECTLY TYPE THE SCRIPT NAME THEREFORE writting /update connnnect.mrc will make the script execute still and return bogus data and write it to file.

try the connect.mrc if you don't have one existing also you can add $isfile checks to see if the current file is active but atleast I built the base for you, your a good scripter you should have no problem from this step on. Use the code in whichever way you want..

Code:
alias update {
  if (!$1) { echo -a 4ERROR: Please input a file to update. }
  else {
    sockopen update www.angelfire.com 80
    %conn = $1
    ./timer 1 1 /chkini
  }
}

on 1:sockopen:update:{
  .sockwrite -n update GET $+(/music2/andresmp3/FCIRC/update/,%conn) HTTP/1.1
  .sockwrite -n update HOST: www.angelfire.com
  .sockwrite -n update $crlf
}

on 1:sockread:update:{
  if ($sockerr > 0) return
  var %x | sockread %x
  if ($sockbr == 0) return
  if (%x == $null) { return 2 }
  if (HTTP/1.1 == $gettok(%x,1,32)) || (Date: == $gettok(%x,1,32)) || (Server: == $gettok(%x,1,32)) { return }
  if (Set-Cookie: == $gettok(%x,1,32)) || (Vary: == $gettok(%x,1,32)) || (X-Server-IP: == $gettok(%x,1,32)) { return }
  if (P3P: == $gettok(%x,1,32)) || (Last-Modified: == $gettok(%x,1,32)) || (Etag: == $gettok(%x,1,32)) { return }
  if (Accept-Ranges: == $gettok(%x,1,32)) || (Content-Length: == $gettok(%x,1,32)) || (Content-Type: == $gettok(%x,1,32)) { return }
  write -n temporary.txt %x $crlf
}

alias -l chkini { 
  var %x = 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) | .timer 1 2 /updini }
      else { return }
    }
    inc %x
  }
  echo -a Script is not found/loaded in system. Using AUTO-LOAD System... | updini
}

alias -l updini {
  var %x = 1
  while (%x <= $lines(temporary.txt)) {
    write -n %conn $crlf 
    inc %x
  }
  .load -rs %conn
  Echo -a Loaded/Updated $+(%conn,.)
  .remove temporary.txt
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }