I know that people have already asked about it.
I have a text file which I wanna download from my website in netfirm... 2 files actualy. The first file is an ini file and it seems to be OK. The other file is a hash table which was saved into a text file using hsave.
I did a search on the forum and I found a script that someone wrote which is supposed to download EXE files, but it has one major flaw (It doesn't matter in which server the files are located, it still happens):
The downloaded file has the HTTP/1.1 ...... which get the fire corrupted. The actual writting to the file should only begin after the other data that the server sends is over.
In the method suggested, it can not be removed IMO because it is using &binvar.
Since netfirms also has useless ads, then the ads are also being added to the file and corrupt it even more.
My solution off course was using sockread %temp and searching for "//start" and "//end" which I have added to the text file so I will know when it starts and when it ends:
on *:sockopen:getfile: {
if ($sockerr == 0 ) {
set %getfile = 0
write -c " $+ $scriptdirgetfile.tmp"
sockwrite -n $sockname GET / $+ %getfilename HTTP/1.1
sockwrite -n $sockname Host: %server $+ $str($crlf ,2)
.timerclosegetfile 1 60 sockclose getfile
}
else { sockclose getfile | halt }
}
on *:sockread:getfile: {
sockread %temp
if (%temp == //end) %getfile = 0
if (%getfile == 1) {
if (%temp != $null) write " $+ $scriptdirgetfile.tmp" %temp
else write " $+ $scriptdirgetfile.tmp" $crlf
}
if (%temp == //start) {
%getfile = 1
}
}
This way I get the file downloaded without the HTTP 1.1 .......... and the useless ads of netfirms.
I get the file, but it take about 5 seconds to download 1 9KB file and in all of this time mIRC doesn't react to commands (It is like it is locked up).
Furthermore, after I have loaded the hash table from the text file I downlaoded, I saw that one or more of the items got corrupted (It might have been because of the else write " $+ $scriptdirgetfile.tmp" $crlf)
I'm building a spam blocker, and I want it to be able to update itseld automatically whenever there is a update for the spam messages.
I'm using a hash table cause it works better (I don't have to use a while loop in order to search the hash table):
on *:TEXT:*:?: {
tokenize 32 $strip($1-)
if ($hfind(antispam,$1-,0,R).data > 0) {
echo 4 -s You probably got spammed by $nick $+ . $nick was added to your ignore list.
ignore $nick
close -m $nick
}
}
If I would use a text file, then i will have to use a loop which scan each line of the text file to see if it matches the text.
Can anyone suggest the bext solution for downloading the text file? (Or any file, but without getting it corrupted)??
Thank you