Weather client v1.8
send comments, questions to plastic@xsintrk.net

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
info:
  This is a small addon for checking your weather by zip code (US only).  It
  uses HTTP 1.0 to download the latest weather from http://wunderground.com and
  then displays it in the active window.  Check the version history for updates.

features:
  echos the weather report or shows it in a GUI
  !requests/Spam ad
  very customizable, and configurable from the mIRC command line
  multiple simultaneous connections

install:
  1. Extract the zip to your mIRC dir (it should contain weatherclient.mrc and
     readme-weather.txt)  You can download mIRC at http://mirc.com.
  2. At the mIRC command line /load -rs weatherclient.mrc
  3. Or instead of #2, press alt-r and the remote editor will open.  In the alt
     menu, go to 'file>load>script' and browse for the weatherclient.mrc file.
  4. (Advanced) If your script already writes to INI, you should change my
     'alias -l w.ini' (line 2) from $scriptdirweatherclient.ini so that it
     points to the path and filename of your script's INI.  Weather client
     stores information in [weather] so if your INI already uses this item,
     ignore step 4.
  5. Follow the usage instructions below to configure Weather client.  Also,
     take a look at the version history to see what's new and how it's used.
     If you have an earlier version, you can use your old settings.  Newer
     features will be turned off by default.

  note: You have to enable the functions yourself, but trigger and weather
        display are already set.  Defaults are written into the addon, so it
        needs no load event.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usage:
  /weather <5-digit zip code>
  !weather <5-digit zip code> (default for requests)

other commands:
  /wreadme.......................Opens this readme.

  /wpanic........................Closes weather sockets and unsets %weather.*

  /wconfig.......................Echos all settings to the active window.

  /wpopup <c|m|n|s|q|all|none>...Adds the client menu to the popup menu you
                                 select, where 'c' is channel, 'm' is menubar,
                                 'n' is nicklist, 's' is status, and 'q' is
                                 query.  Multiple arguments can be set, for
                                 example: '/wpopup scm' would add the menu to
                                 your status, channel, and menubar popups.  The
                                 two final arguments, 'all' and 'none', must be
                                 used independently of any other argument.

  /wdisplay <echo|gui>...........Switch between GUI and echo weather report.  GUI
                                 opens after all weather data has been downloaded.
                                 The client will attempt to cascade dialogs if
                                 more than one are opened, as it would be if
                                 multiple local connections are being used.  The
                                 cascade script was written at 640x480 resolution,
                                 so dialogs should cascade correctly in any screen.
                                 If a weather dialog is already opened that matches
                                 the socket name, this dialog will be used instead
                                 of opening a new one.  Click the 'x' to close.

  /wmaxcon <num|unlimited>.......Sets the max number of connections.  If 'num'
                                 is not an integer, maxcon is set to 'unlimited',
                                 which means unlimited connections are allowed.

  /wstatus <show|hide>...........Toggles socket status display on or off.  This is
                                 only for local checks, and error messages will
                                 still be shown.

  /wtrigger <on|off> <trigger>...Toggles !weather requests on or off.  If 'trigger'
                                 was used, this also changes the trigger.  If no
                                 trigger is set, the default trigger is !weather.
                                 Trigger must be one word.

  /wunload <yes>.................Unloads weatherclient.mrc, unsets %weather.*
                                 removes INI entries.

  /wspam <#channel|display>......Spam your weather trigger.  'Display' configures
                                 the ad, the <tags> are below.  '#Channel' will
                                 spam the said channel with 'display'.  Arguments
                                 cannot be used together.

              |~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~|
              |  <trigger>  trigger     |  <con>  max connects   |
              |  <tstatus>  trig on/off |                        |
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  /woutput <display>.............Changes the weather output by using <tags>.
                                 'Time' shows the timezone of the location.

              |~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~|
              |  <loc>     location     |  <time>   time         |
              |  <temp>    temperature  |  <cond>   condition    |
              |  <wind>    wind speed   |  <hu>     humidity     |
              |  <dewpnt>  dewpoint     |  <psi>    pressure     |
              |  <clouds>  clouds       |  <vis>    visibility   |
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  note: Enter a command with no arguments to show its current setting.  If an
        error occurs (such as a bad argument), the previous setting will still be
        used.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
upcomming:
  Updates for new versions of mIRC, changes to wunderground.com, bugfixes.
  A GUI for options.
  Load event to set defaults, this will cut back on filesize.

version history:
  1.8 - Hopefully took care of two bugs, one where the date was messed up if you
        used 'copy to clipboard' from the GUI, the other was a result of changes to
        wunderground.com's 'city not found' page.
  1.7 - Client menu is now optional and can be placed anywhere. (/wpopup)
        Optional GUI for weather display. (/wdisplay)
        Added '/wconfig', which echos all settings to the active window.
        Disabled the 'Spam channel' popup when no channels are opened.
        Fixed the typo mentioned in the mircscripts.org review.
        Several improvements and bugfixes to the config aliases.
        Popups are only for mIRC 6.3+, cmd-line still works for lower versions.
        Changed the names of some local aliases.
  1.6 - Configurable spam ad, some scripting improvements.
  1.5 - Weather output is now customizable.  (GUI! sort of)
        When I changed the display, I was able to fix a bug where sometimes 'mph'
         was showing up in <wind> (a curiosity of the html, not having to do with
         the script)
  1.4 - Weather trigger is now customizable.
        /wunload and unload popup now remove .INI entries.
  1.3 - Added 'Show socket status' toggle. (will still show socket errors)
        Added customizable 'Max connects limit'. (for local and requests)
        Added command-line configuration.
  1.2 - Re-scripted some parts (cut the filesize in half), and added a panic button.
        /weather now has the same output as the trigger.
  1.1 - Multiple connections, !weather requests, popup menu added.
  1.0 - First working cmd-line version, echos weather to the active window.

known bugs:
  1. Sometimes displays wrong, due to the page downloading weird.  I have only seen
      this a few times so I'm hoping its a very rare thing.
  2. May not work if you use a proxy for internet access, such as a monitor proxy at
      a public school.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
credits:
  http://wunderground.com
  ^Andy (HTTP GET snippet)
