######################
#
#  HTTP Downloader v1.0
#  by blue-elf (belf@usa.net)
#
######################

=====
About
=====
As the name implies, this addon allows you to download files directly from within mIRC,
as long as you know the actual full address of a file.

The interface has been borrowed from the download program called Getright, and partly from
Internet Explorer download box.

For now, the only "extra" feature is that it allows multiple downloads. Some servers I haven't
figured out why they reject my requests, and sometimes, you'll get servers that use old or odd
HTTP protocol -- I actually saw HTTP/0.0 believe it or not. So there's no 100% guarantee that
it works on every server (least not yet).

This addon is useable, and if you decide you don't like it, use the Unload option from the
menubar, and it will clean up itself (remove variables).

============
Installation
============

Place the file http.mrc in any directory. And then from within mIRC, type
"/load -rs <path>http.mrc". For example, if you placed it in c:\mIRC\addons\
you would type:

  /load -rs c:\mirc\addons\http.mrc

And that's it.

======
Usage
======
Type /http <full url> or access from the menubar. For example:

/http mirc.stealth.net/addons/ajoin.mrc

If you type it from the command line, you will not be prompted for a download
directory but instead it will default to your download directory.


=====================
Notes and Limitations
=====================

Since this is version 1.0, there are still many things left to be desired. Here's a list
of the ones I can remember. I plan to add them later in case people would want to see
future versions of this thing.


1) It does not have good support for URL's that redirect. For example, those
   http://fly.to/ addresses.
2) No resume :( but that's because I'm not done reading the HTTP protocol. heh.
3) No main window. I plan to make a centralized window that will monitor/show
   all the downloads. In this way, I will also be able to add a feature to show and hide
   individual download windows.
4) Speaking of windows, I'll also add the ability to make them desktop windows, and
   switch from an mirc mdi window to a desktop window, vice-versa.
5) No "Save As" feature.
6) Not yet 'skinnable' (This is the easy part)
7) No clipboard monitoring as yet.
8) I can't remember the rest.

If you're wondering why I went on and released this even though there are still things
that need to be added, it's because I'm kinda busy these days.. school =/ and I wanted
to release something in the meantime.

But anyway, this thing should serve its purpose. And this is more of a scripting
exercise for me.

If you want to use this in your script or expand it and come up with your own version,
go ahead. Just give me proper credit.

If you still want to rip it, go ahead. I'll just come up with better ideas.

***************************************************************************************
If you're not a scripter, or you are an advanced scripter, or don't want to be bothered
what blue-elf is thinking, you can skip the part below. I know I'm full of b.s.
***************************************************************************************

Scripting notes:

I kinda liked the alias http.update.1 ;)

  %i = -1
  while ($width(%text,"MS Sans Serif",14,0,0) >= %len) {
    %text = $left(%text,%i)
    dec %i
  }

Don't you think it's neat? Heh. Instead of looping from $mid(text,1,1) onwards, I just
used a negative number and clipped the text from the right, one char at a time.

The http.cleanvars looks nice too IMHO.

  unset %http.*. [ $+ [ $1 ] ]

One line, but I would say it's nice. Putting a wildcard in between. =)

I think I some of the calculinification thingies in there (like getting the average cps)
were cool too. And only because $sock().rq did not seem to give what I wanted.

If and when I do update this addon, I'll try to use hash tables. That should make
it cleaner. Right now, the variable names are a pain to look at.

There's one bug I discovered: the $sock().swmsg returns the $sock().swerr number.

If you're learning picture windows, take a look inside, IMHO, you should be able to pick
up new things and be able to come up with alternative interfaces instead of plain dialogs.
In fact, I think that picture windows are more versatile in some ways.

And that's that. If you read everything, thank you. :) Rarely do I get users who actually
read documentation.

; EOF -- Now, would you complain there's not enough documentation? =P