This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Worldtime1.3.tcl working, again.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

hm2k,
The major limitation was indeed in your script, as you discarded any DST-enabled records. The issue you mentioned from WikiPedia is in fact for timestamps in the past; the Trizone mentioned would in fact be the former Federal Republic of Germany (aka West Germany). Berlin, however, was located in then Deutsche Demokratische Republik or DDR (aka East Germany). Since neither West or East Germany exists since late 1989, this issue would be limited to the timespan of 1945 through 1989, and not related to current day time.

To your current implementation, be advised that tx:gethtp currently suffers from a "channel-leak", you open a new socket for each call to that proc, yet never close the previous one. Most systems limit the number of open channels (or file descriptors) around 1024, after which your script would be unable to open any further channel, such as userfile for saving or sharing.
NML_375
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Jeez, what got up your nose?

There was no limitation; it was simply a bug. I fixed that with the regex.

The tz database is still limited in the fact that it is not easily portable and only handles the locations in it's database.

With regards to that issue in Berlin; it seemed very coincidental. I usually go with if it quacks, it's probably a duck. It seemed like a duck and there was no citation to back it up. But it can be discarded now as I successfully identified the issue.

With regards to your "channel-leak" issue; I've not experienced this issue. As far as I am aware the socket should close once it reaches the end anyway, as per the RFC.

However, for arguments sake I will "close $s". Update to follow shortly.

Thanks for taking interest.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

My apologizes if I have offended you in any way. You asked for input, I provided mine.

You mentioned the limitation quoted from wikipedia, I simply pointed out that this was unrelated to the issue of current time in the Europe/Berlin timezone record. As you might also read, the DST-issue was not limited to Europe/Berlin either.

Regarding sockets, yes, the connection will usually be closed by the http server as the transaction ends (or after it times out). That, however, will not close the file descriptor (socket or channel, if you prefer), as this resource remains available for you to notice that the connection has been closed (using the eof command).

Also, I noticed that your newer release makes use of the http-package. In this case, you should use the http::cleanup function once the transaction is completed, in order to clean up memory (and under certain conditions, stray file descriptors).

I won't give you an argument that the timezone database has some portability issues, as well as a rather restrictive set of locations. Using google seems like an interresting idea.
NML_375
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

The good news is at present it all seems to work perfectly now.

Although it probably makes sense to use http::cleanup.

I expect I'll post an update tomorrow.

Cheers.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Latest, including some potential memory leak fixes can be found here:

Download: worldtime.tcl r145

I look forward to your feedback.

Thanks.
T
Torrevado
Op
Posts: 101
Joined: Wed Aug 02, 2006 6:29 pm

Post by Torrevado »

hm2k, I'm having an error msg for all unmatched locations
.tz canary

Tcl error [pub:tz]: missing operand at _@_
in expression "+_@_"

.tz canarias

Tcl error [pub:tz]: missing operand at _@_
in expression "_@_/1000"
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

T
Torrevado
Op
Posts: 101
Joined: Wed Aug 02, 2006 6:29 pm

Post by Torrevado »

Just a question hm2k...

*Only* for locations in Canary Islands I still receive error msgs. Which could be the reason?
.tz canarias

.tz tenerife

.tz gran canaria

Tcl error [pub:tz]: missing operand at _@_
in expression "_@_/1000"
Thanks.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Fixed in: worldtime.tcl r150
[06:02:54 pm] > .tz tenerife
[06:02:54 pm] <HM2K> Unable to find a match.
[06:03:03 pm] > .tz gran canaria
[06:03:04 pm] <HM2K> Unable to find a match.
[06:03:20 pm] > .tz canarias
[06:03:21 pm] <HM2K> Unable to find a match.
[06:04:41 pm] > .tz london
[06:04:41 pm] <HM2K> The time in Westminster, London, UK is Tue May 04 06:04:42 PM 2010 (GMT+1)
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

hm2k, it works great, thanks for this tcl, I needed it :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Hi,

How do I install the htmlparse package? I keep getting this: "can't find package htmlparse"
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

holycrap wrote:Hi,

How do I install the htmlparse package? I keep getting this: "can't find package htmlparse"
you need to install tcllib
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

spithash wrote:
holycrap wrote:Hi,

How do I install the htmlparse package? I keep getting this: "can't find package htmlparse"
you need to install tcllib
Actually, you don't. If you run one of my scripts that includes html decoding you already have this. Try this code below, if you use INCITH GOOGLE:

Code: Select all

Package provide htmlparse

namespace eval htmlparse {
  proc mapEscapes {text} {
    # wrapper for incith-google, emulates html-parse
    return [incith::google::descdecode $text]
  }
}
Try the code below, if you instead use my TWITTER script:

Code: Select all

Package provide htmlparse

namespace eval htmlparse {
  proc mapEscapes {text} {
    # wrapper for twitter, emulates html-parse
    return [proc:twitter:descdecode [string map [list "\" "\\\"] $text]]
  }
}
This should eliminate the need to install tcl-lib at all. This will instead make his script think incith-google's decoder is tcl-lib's. This saves your bot RAM and resources, enjoy ;)

P.S. Hm2k, <3 ;)
Last edited by speechles on Mon Nov 08, 2010 6:43 pm, edited 1 time in total.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

holycrap wrote:Hi,

How do I install the htmlparse package? I keep getting this: "can't find package htmlparse"
Hi,

I though the instructions in the error were pretty clear...

Tcllib is required, see http://tcllib.sf.net/

It's a pretty widely used and well maintained TCL library, so you should probably get it.
User avatar
Thanhas
Op
Posts: 124
Joined: Sat Sep 02, 2006 11:14 am
Location: Ottawa, Canada

Re: Worldtime1.3.tcl working, again.

Post by Thanhas »

[17:30:31] Tcl error in file 'chat.conf':
[17:30:31] invalid command name "\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\f0\fs20 ####################################################################### \par
####################################################################### \par
# Worldtime by Murf # \par
# v1.1 # \par
# v1.2 (modified by LOQUILLO_) # \par
# v1.3 (updated by speechles) # \par
# --Purpose --------------------------------------------------------- # \par
# Gets the time from around the world from www.w





i guess its not working would u please tell me why?

LOQUILLO wrote:Hello everyone, I has solved the bug of
worldtime1.1.tcl script.
The author never responded to nobody, but I'm here for help.
This new worldtime1.2.tcl solves output problems such as:
<hanson_sp> The time in Lima,Peru is <font size="7">1:31 PM
and I have added all the cities and countries (some codes was changed) available in http://www.worldtimeserver.com
Added update by speechles

Code: Select all

#######################################################################
#######################################################################
#                       Worldtime by Murf                             #
#                            v1.1                                     #
#                            v1.2 (modified by LOQUILLO_)             #
#                            v1.3 (updated by speechles)              #
# --Purpose --------------------------------------------------------- #
#  Gets the time from around the world from www.worldtimeserver.com   #
#  Not much else to say, simple but handy.                            #
#                                                                     #
# --Usage ----------------------------------------------------------- #
#  .chanset #yourchan +worldtime                                      #
#  !tz <Any city[, Any country]>                                      #
#                                                                     #
# --Current info ---------------------------------------------------- #
#   For help with this script, use the following url:                 #
#   http://forum.egghelp.org/viewtopic.php?t=9255&start=15            #
#                                                                     #
# --Old, outdated info no longer relevant --------------------------- #
#   Latest version @ http://www.blueday.org                           #
#   Comments & Questions to murf@mindless.com                         #
#######################################################################
# -- tested on tcl v8.3 and eggdrop v1.6x using linux.                #
# -- tested on tcl v8.4 and eggdrop v1.6.17 using CYGWIN_NT (windrop) #
#######################################################################
#                                                                     #
#  Commands                                                           #
#                                                                     #
#          !tz <Any city[, Any country]>                              #
#        or                                                           #
#          /msg YourBot !tz <Any city[, Any country]>                 #
#                                                                     #
#        City and country list is somewhat limited to major cities    #
#        and countries.                                               #
#                                                                     #
#   Version                                                           #
#    v1.3 Nov 02 2007 updated by speechles                            #
#       -- Fixed the regexp scraper.                                  #
#       -- Added scraper for new info to display, exciting! :P        #
#       -- Added chanset ability .chanset #yourchan +worldtime        #
#       -- Added preliminary Multi-Language ability.                  #
#       -- Script now scrapes entire output line directly from the    #
#          webpage, and how it has multilanguage capability, default  #
#          at the moment is english.                                  #
#                                                                     #
#    v1.2 Mar 03 2005 modified by LOQUILLO_                           #
#       -- Solve output bug like:                                     #
#          <hanson_sp> The time in Lima,Peru is <font size="7">1:31PM #
#          and added all the cities and countries (somes codes was    #
#          changed) available in http://www.worldtimeserver.com       #
#                                                                     #
#    v1.1 Nov 01 2001                                                 #
#       --  Got rid of 'string equal' so people with old (v8.0) TCL   #
#           can run  (not really worthy of .1 but what the hell!)     #
#                                                                     #
#    v1.0 ??? ?? 2000                                                 #
#       -- first version and been running forever without problems or #
#          changes to the script.                                     #
#                                                                     #
#######################################################################
#######################################################################

###Nothing to setup or configure#####
# If you want something to set up or configure in this script, feel free
# to modify sections to make it happen, your destiny is in your hands.

#Set up the channel flag indicator
setudef flag worldtime

##########binds######################
bind pub - !tz pub_world_time
bind msg - !tz msg_world_time

##########Procs######################
proc pub_world_time {nick uhost handle chan location} {
  if {[lsearch -exact [channel info $chan] +worldtime] == -1} { return }
  regexp -nocase -- {\.(.+?)\s(.+?)$} $location - lang location
  if {![info exists lang]} {
     set lang "en" 
  }
  set loclist [get_tzloc $location $nick]
  if {$loclist == 0} {
     return
  }
  set url [lindex [split $loclist] 0]
  set temploc [lindex [split $loclist] 1]
  if {$temploc == "toilet"} {
     putserv "PRIVMSG $chan : If ya gotta crap goto the toilet. No one wants\
your stank around here!"
     return
  }
  if {$temploc == "kick"} {
     putkick $chan $nick "It's time to stop being so lame"
     return
  }
  set tztime [get_tztime $url $lang]
  regsub -all {_} $temploc { } outloc
  putserv "PRIVMSG $chan :$tztime"
 
}

proc msg_world_time {nick uhost handle location} {
  regexp -nocase -- {\.(.+?)\s(.+?)$} $location - lang location
  if {![info exists lang]} {
     set lang "en" 
  }
  set loclist [get_tzloc $location $nick]
  if {$loclist == 0} {
     return
  }
  set url [lindex [split $loclist] 0]
  set temploc [lindex [split $loclist] 1]
  if {$temploc == "toilet"} {
     putserv "NOTICE $nick : If ya gotta crap goto the toilet. No one wants\
your stank around here!"
     return
  }
  if {$temploc == "kick"} {
     putserv "NOTICE $nick : It's time to stop being so lame!"
     return
  }
  set tztime [get_tztime $url $lang]
  regsub -all {_} $temploc { } outloc
  putserv "NOTICE $nick :$tztime"
 
}

proc get_tztime {url lang} {
  set tzsock [socket -async www.worldtimeserver.com 80]
  puts $tzsock "GET $url HTTP/1.1"
  puts $tzsock "Host: www.worldtimeserver.com"
   puts $tzsock "Accept-Language: ${lang}-${lang},${lang};q=0.9,${lang};q=0.8,${lang};q=0.7,*;q=0.6"
   puts $tzsock "Connection: close"
   puts $tzsock "User-Agent: Tcl http client (TCL 8.4.7; worldtime 1.2; ${lang}-${lang}; CYGWIN_NT-5.1)"
   puts $tzsock ""
   flush $tzsock
   while {![eof $tzsock]} {
      append tzout [gets $tzsock]
   }
   close $tzsock

   set tztime ""

regexp {<div id="analog-digital">.+?<span class="font7">(.+?)<.+?\)</font> \-\-\>(.+?)<br.+?<span class="font1">(.+?)<} $tzout {} tztime tzdate tzzone
regexp {<td valign="top">.*?<div style="width.*?">(.+?)</div>} $tzout {} tztext
return [cleanthisstring "[string trim $tztext] [string trim $tzzone] @ [string trim $tzdate]"]
}

proc cleanthisstring {input} {
  regsub -all -- {<(.+?)>} $input { } input 
  while {[string match "*  *" $input ]} {
    regsub -all -- {  } $input " " input 
  }
  return $input
}

proc get_tzloc {location nick} {
set city_list {
UTC:UTC/GMT
RU-KK&city=Abakan:Abakan,Russia
CI&city=Abidjan:Abidjan,Cote_D'Ivoire
AE&city=Abu_Dhabi:Abu_Dhabi,United_Arab_Emirates
NG&city=Abuja:Abuja,Nigeria
GH&city=Accra:Accra,Ghana
PN&city=Adamstown:Adamstown,Pitcairn
ET&city=Addis_Ababa:Addis_Ababa,Ethiopia
AU-SA&city=Adelaide:Adelaide,Australia
RU-AGB&city=Aginskoye:Aginskoye,Russia
KZ1&city=Aktau:Aktau,Kazakhstan
KZ2&city=Aktyubinsk:Aktyubinsk,Kazakhstan
US-NY&city=Albany:Albany,United_States
US-NM&city=Albuquerque:Albuquerque,United_States
DZ&city=Algiers:Algiers,Algeria
KZ&city=Almaty:Almaty,Kazakhstan
ID3&city=Ambon:Ambon,Indonesia
JO&city=Amman:Amman,Jordan
NL&city=Amsterdam:Amsterdam,Netherlands
RU-CHU&city=Anadyr':Anadyr',Russia
US-AK&city=Anchorage:Anchorage,United_States
AD&city=Andorra_La_Vella:Andorra_La_Vella,Andorra
TR&city=Ankara:Ankara,Turkey
US-MD&city=Annapolis:Annapolis,United_States
MG&city=Antananarivo:Antananarivo,Madagascar
WS&city=Apia:Apia,Samoa
RU-ARK&city=Arkhangelsk:Arkhangelsk,Russia
CA-NT2B&city=Arviat:Arviat,Canada
TM&city=Ashgabat:Ashgabat,Turkmenistan
ER&city=Asmara:Asmara,Eritrea
KZ&city=Astana:Astana,Kazakhstan
RU-AST&city=Astrakhan':Astrakhan',Russia
PY&city=Asuncion:Asuncion,Paraguay
GR&city=Athens:Athens,Greece
US-GA&city=Atlanta:Atlanta,United_States
KZ1&city=Atyrau:Atyrau,Kazakhstan
NZ&city=Auckland:Auckland,NewZealand
US-ME&city=Augusta:Augusta,United_States
US-TX&city=Austin:Austin,United_States
IQ&city=Baghdad:Baghdad,Iraq
AR-BA&city=Bahía_Blanca:Bahía_Blanca,Argentina
AZ&city=Baku:Baku,Azerbaijan
US-MB&city=Baltimore:Baltimore,United_States
ML&city=Bamako:Bamako,Mali
BN&city=Bandar_Seri_Begawan:Bandar_Seri_Begawan,Brunei_Darussalam
IN&city=Bangalore:Bangalore,India
TH&city=Bangkok:Bangkok,Thailand
CF&city=Bangui:Bangui,Central_African_Republic
ID2&city=Banjarmasin:Banjarmasin,Indonesia
GM&city=Banjul:Banjul,Gambia
ES&city=Barcelona:Barcelona,Spain
RU-ALT&city=Barnaul:Barnaul,Russia
KN&city=Basseterre:Basseterre,SaintKitts_and_Nevis
RU-SA2&city=Batagay:Batagay,Russia
CN&city=Beijing:Beijing,China
LB&city=Beirut:Beirut,Lebanon
BR-PA1&city=Belém:Belém,Brazil
GB&city=Belfast:Belfast,United_Kingdom
RU-BEL&city=Belgorod:Belgorod,Russia
CS&city=Belgrade:Belgrade,Serbia_and_Montenegro
BZ&city=Belize_City:Belize_City,Belize
BR-MG&city=Belo_Horizonte:Belo_Horizonte,Brazil
DE&city=Berlin:Berlin,Germany
CH&city=Bern:Bern,Switzerland
US-MT&city=Billings:Billings,United_States
GB&city=Birmingham:Birmingham,United_Kingdom
US-AL&city=Birmingham:Birmingham,United_States
RU-YEV&city=Birobidzhan:Birobidzhan,Russia
KG&city=Bishkek:Bishkek,Kyrgyzstan
US-ND&city=Bismarck:Bismarck,United_States
GW&city=Bissau:Bissau,Guinea-Bissau
RU-AMU&city=Blagoveshchensk:Blagoveshchensk,Russia
CO&city=Bogota:Bogota,Colombia
US-MA&city=Boise:Boise,United_States
DE&city=Bonn:Bonn,Germany
US-MA&city=Boston:Boston,United_States
BR-DF&city=Brasilia:Brasilia,Brazil
SK&city=Bratislava:Bratislava,Slovakia
RU-IRK&city=Bratsk:Bratsk,Russia
CG&city=Brazzaville:Brazzaville,Congo
RU-CT&city=Bridgeport:Bridgeport,United_States
BB&city=Bridgetown:Bridgetown,Barbados
AU-QLD&city=Brisbane:Brisbane,Australia
BE&city=Brussels:Brussels,Belgium
RU-BRY&city=Bryansk:Bryansk,Russia
RO&city=Bucharest:Bucharest,Romania
HU&city=Budapest:Budapest,Hungary
AR-DF&city=Buenos_Aires:Buenos_Aires,Argentina
US-NY&city=Buffalo:Buffalo,United_States
BI&city=Bujumbura:Bujumbura,Burundi
US-VT&city=Burlington:Burlington,United_States
EG&city=Cairo:Cairo,Egypt
IN&city=Calcutta:Calcutta,India
CA-AB&city=Calgary:Calgary,Canada
AU-ACT&city=Canberra:Canberra,Australia
ZACape&city=Town:Town,South_Africa
VE&city=Caracas:Caracas,Venezuela
GB&city=Cardiff:Cardiff,United_Kingdom
MA&city=Casablanca:Casablanca,Morocco
LC&city=Castries:Castries,Saint_Lucia
AR-CT&city=Catamarca:Catamarca,Argentina
GF&city=Cayenne:Cayenne,French_Guiana
US-WV&city=Charleston:Charleston,United_States
US-NC&city=Charlotte:Charlotte,United_States
RU-CU&city=Cheboksary:Cheboksary,Russia
RU-CHE&city=Chelyabinsk:Chelyabinsk,Russia
CN&city=Chengdu:Chengdu,China
IN&city=Chennai:Chennai,India
RU-KC&city=Cherkessk:Cherkessk,Russia
US-WY&city=Cheyenne:Cheyenne,United_States
US-IL&city=Chicago:Chicago,United_States
MD&city=Chisinau:Chisinau,Moldova,Republic_of
RU-CHI&city=Chita:Chita,Russia
CN&city=Chongqing:Chongqing,China
US-OH&city=Cincinnati:Cincinnati,United_States
MX2-3&city=Ciudad_Juárez:Ciudad_Juárez,Mexico
US-OH&city=Cleveland:Cleveland,United_States
LK&city=Colombo:Colombo,Sri_Lanka
US-SC&city=Columbia:Columbia,United_States
US-OH&city=Columbus:Columbus,United_States
GN&city=Conakry:Conakry,Guinea
US-NH&city=Concord:Concord,United_States
DK&city=Copenhagen:Copenhagen,Denmark
AR-CB&city=Córdoba:Córdoba,Argentina
AR-CN&city=Corrientes:Corrientes,Argentina
BJ&city=Cotonou:Cotonou,Benin
CA-BC1&city=Creston:Creston,Canada
MX2-2&city=Culiacán:Culiacán,Mexico
BR-PR&city=Curitiba:Curitiba,Brazil
SN&city=Dakar:Dakar,Senegal
US-TX&city=Dallas:Dallas,United_States
SY&city=Damascus:Damascus,Syrian_Arab_Republic
TZ&city=Dar_es_Salaam:Dar_es_Salaam,Tanzania,United_Republic_of
AU-NT&city=Darwin:Darwin,Australia
CA-BC1&city=Dawson_Creek:Dawson_Creek,Canada
CA-YT&city=Dawson:Dawson,Canada
ID2&city=Denpasar:Denpasar,Indonesia
US-CO&city=Denver:Denver,United_States
US-IA&city=Des_Moines:Des_Moines,United_States
US-MI&city=Detroit:Detroit,United_States
BD&city=Dhaka:Dhaka,Bangladesh
TL&city=Dili:Dili,Timor-Leste
DJ&city=Djibouti:Djibouti,Djibouti
QA&city=Doha:Doha,Qatar
US-DE&city=Dover:Dover,United_States
AE&city=Dubai:Dubai,United_Arab_Emirates
IE&city=Dublin:Dublin,Ireland
RU-TAY&city=Dudinka:Dudinka,Russia
TJ&city=Dushanbe:Dushanbe,Tajikistan
GB&city=Edinburgh:Edinburgh,United_Kingdom
CA-AB&city=Edmonton:Edmonton,Canada
US-TX1&city=ElPaso:ElPaso,United_States
RU-KL&city=Elista:Elista,Russia
MX3&city=Ensenada:Ensenada,Mexico
US-IN1&city=Evansville:Evansville,United_States
TK&city=Fakaofo:Fakaofo,Tokelau
US-ND&city=Fargo:Fargo,United_States
AR-FM&city=Formosa:Formosa,Argentina
US-IN&city=Fort_Wayne:Fort_Wayne,United_States
BR-CE&city=Fortaleza:Fortaleza,Brazil
DE&city=Frankfurt:Frankfurt,Germany
SL&city=Freetown:Freetown,SierraLeone
TV&city=Funafuti:Funafuti,Tuvalu
BW&city=Gaborone:Gaborone,Botswana
US-IN1&city=Gary:Gary,United_States
CH&city=Geneva:Geneva,Switzerland
GY&city=Georgetown:Georgetown,Guyana
GB&city=Glasgow:Glasgow,United_Kingdom
RU-AL&city=Gorno-Altaisk:Gorno-Altaisk,Russia
RU-CE&city=Groznyy:Groznyy,Russia
MX&city=Guadalajara:Guadalajara,Mexico
GT&city=Guatemala_City:Guatemala_City,Guatemala
NL&city=Hague:Hague,The,Netherlands
CA-NS&city=Halifax:Halifax,Canada
BM&city=Hamilton:Hamilton,Bermuda
VN&city=Hanoi:Hanoi,Viet_Nam
ZW&city=Harare:Harare,Zimbabwe
US-CT&city=Hartford:Hartford,United_States
CU&city=Havana:Havana,Cuba
FI&city=Helsinki:Helsinki,Finland
MX2A&city=Hermosillo:Hermosillo,Mexico
VN&city=Ho_Chi_Minh_City:Ho_Chi_Minh_City,Viet_Nam
AU-TAS&city=Hobart:Hobart,Australia
HK&city=HongKong:HongKong,HongKong
SB&city=Honiara:Honiara,Solomon_Islands
US-HI&city=Honolulu:Honolulu,United_States
US-TX&city=Houston:Houston,United_States
US-IN&city=Indianapolis:Indianapolis,United_States
RU-IRK&city=Irkutsk:Irkutsk,Russia
PK&city=Islamabad:Islamabad,Pakistan
TR&city=Istanbul:Istanbul,Turkey
RU-IVA&city=Ivanovo:Ivanovo,Russia
RU-UD&city=Izhevsk:Izhevsk,Russia
US-MS&city=Jackson:Jackson,United_States
US-FL&city=Jacksonville:Jacksonville,United_States
ID&city=Jakarta:Jakarta,Indonesia
ID3&city=Jayapura:Jayapura,Indonesia
IL&city=Jerusalem:Jerusalem,Israel
ZA&city=Johannesburg:Johannesburg,South_Africa
AR-JY&city=Jujuy:Jujuy,Argentina
US-AK&city=Juneau:Juneau,United_States
AF&city=Kabul:Kabul,Afghanistan
RU-KGD&city=Kaliningrad:Kaliningrad,Russia
RU-KLU&city=Kaluga:Kaluga,Russia
UG&city=Kampala:Kampala,Uganda
CD2&city=Kananga:Kananga,Congo,Democratic_Republic_of
NG&city=Kano:Kano,Nigeria
US-MO&city=Kansas_City:Kansas_City,United_States
PK&city=Karachi:Karachi,Pakistan
RU-TA&city=Kazan':Kazan',Russia
RU-KEM&city=Kemerovo:Kemerovo,Russia
RU-KHA&city=Khabarovsk:Khabarovsk,Russia
SD&city=Khartoum:Khartoum,Sudan
UA&city=Kiev:Kiev,Ukraine
RW&city=Kigali:Kigali,Rwanda
JM&city=Kingston:Kingston,Jamaica
VC&city=Kingstown:Kingstown,Saint_Vincent_and_The_Grenadines
CD&city=Kinshasa:Kinshasa,Congo,Democratic_Republic_of
RU-KIR&city=Kirov:Kirov,Russia
US-TN1&city=Knoxville:Knoxville,United_States
FM&city=Kolonia:Kolonia,Micronesia,Federated_States_Of
CD2&city=Kolwezi:Kolwezi,Congo,Democratic_Republic_of
KZ&city=Konstanai:Konstanai,Kazakhstan
PW&city=Koror:Koror,Palau
RU-KOS&city=Kostroma:Kostroma,Russia
RU-SA3&city=Kotenko:Kotenko,Russia
PL&city=Krakow:Krakow,Poland
RU-KDA&city=Krasnodar:Krasnodar,Russia
RU-KYA&city=Krasnoyarsk:Krasnoyarsk,Russia
MY&city=Kuala_Lumpur:Kuala_Lumpur,Malaysia
RU-KOP&city=Kudymkar:Kudymkar,Russia
ID2&city=Kupang:Kupang,Indonesia
RU-KGN&city=Kurgan:Kurgan,Russia
RU-KRS&city=Kursk:Kursk,Russia
KW&city=KuwaitCity:KuwaitCity,Kuwait
JP&city=Kyoto:Kyoto,Japan
RU-TY&city=Kyzyl:Kyzyl,Russia
KZ&city=Kyzylorda:Kyzylorda,Kazakhstan
BOLa&city=Paz:Paz,Bolivia
AR-BA&city=La_Plata:La_Plata,Argentina
AR-LR&city=La_Rioja:La_Rioja,Argentina
US-MI&city=Lansing:Lansing,United_States
US-NV&city=Las_Vegas:Las_Vegas,United_States
MX&city=León:León,Mexico
US-KY&city=Lexington:Lexington,United_States
GA&city=Libreville:Libreville,Gabon
MW&city=Lilongwe:Lilongwe,Malawi
PE&city=Lima:Lima,Peru
US-NE&city=Lincoln:Lincoln,United_States
RU-LIP&city=Lipetsk:Lipetsk,Russia
PT&city=Lisbon:Lisbon,Portugal
US-AR&city=Little_Rock:Little_Rock,United_States
SI&city=Ljubljana:Ljubljana,Slovenia
CA-SK1&city=Lloydminster:Lloydminster,Canada
TG&city=Lome:Lome,Togo
GB&city=London:London,United_Kingdom
US-CA&city=Los_Angeles:Los_Angeles,United_States
US-KY&city=Louisville:Louisville,United_States
AO&city=Luanda:Luanda,Angola
CD2&city=Lubumbashi:Lubumbashi,Congo,Democratic_Republic_of
ZM&city=Lusaka:Lusaka,Zambia
LU&city=Luxembourg:Luxembourg,Luxembourg
US-WI&city=Madison:Madison,United_States
ES&city=Madrid:Madrid,Spain
RU-MAG&city=Magadan:Magadan,Russia
MH&city=Majuro:Majuro,Marshall_Islands
ID2&city=Makassar:Makassar,Indonesia
RU-DA&city=Makhachkala:Makhachkala,Russia
GQ&city=Malabo:Malabo,EquatorialGuinea
MV&city=Male:Male,Maldives
NI&city=Managua:Managua,Nicaragua
BH&city=Manama:Manama,Bahrain
BR-AM&city=Manaus:Manaus,Brazil
PH&city=Manila:Manila,Philippines
MZ&city=Maputo:Maputo,Mozambique
AR-BA&city=Mar_del_Plata:Mar_del_Plata,Argentina
LS&city=Maseru:Maseru,Lesotho
RU-AD&city=Maykop:Maykop,Russia
SZ&city=Mbabane:Mbabane,Swaziland
CD2&city=Mbuji-Mayi:Mbuji-Mayi,Congo,Democratic_Republic_of
SA&city=Mecca:Mecca,Saudi_Arabia
ID&city=Medan:Medan,Indonesia
AU-VIC&city=Melbourne:Melbourne,Australia
US-TN&city=Memphis:Memphis,United_States
AR-MZ&city=Mendoza:Mendoza,Argentina
MX&city=Mexico_City:Mexico_City,Mexico
US-FL&city=Miami:Miami,United_States
IT&city=Milan:Milan,Italy
US-WI&city=Milwaukee:Milwaukee,United_States
US-MN&city=Minneapolis:Minneapolis,United_States
BY&city=Minsk:Minsk,Belarus
SO&city=Mogadishu:Mogadishu,Somalia
LR&city=Monrovia:Monrovia,Liberia
MX&city=Monterrey:Monterrey,Mexico
UY&city=Montevideo:Montevideo,Uruguay
US-AL&city=Montgomery:Montgomery,United_States
US-VT&city=Montpelier:Montpelier,United_States
CA-QC&city=Montreal:Montreal,Canada
KM&city=Moroni:Moroni,Comoros
RU-MOS&city=Moscow:Moscow,Russia
IN&city=Mumbai:Mumbai,India
RU-MUR&city=Murmansk:Murmansk,Russia
OM&city=Muscat:Muscat,Oman
KE&city=Nairobi:Nairobi,Kenya
RU-KB&city=Nal'chik:Nal'chik,Russia
RU-NEN&city=Nar'yan-Mar:Nar'yan-Mar,Russia
US-TN&city=Nashville:Nashville,United_States
BS&city=Nassau:Nassau,Bahamas
RU-IN&city=Nazran:Nazran,Russia
TD&city=N'Djamena:N'Djamena,Chad
AR-NQ&city=Neuquén:Neuquén,Argentina
IN&city=New_Delhi:New_Delhi,India
US-LA&city=New_Orleans:New_Orleans,United_States
US-NY&city=New_York:New_York,United_States
US-NJ&city=Newark:Newark,United_States
NE&city=Niamey:Niamey,Niger
CY&city=Nicosia:Nicosia,Cyprus
RU-KHM&city=Nizhnevartovsk:Nizhnevartovsk,Russia
RU-NIZ&city=Nizhniy_Novgorod:Nizhniy_Novgorod,Russia
US-AK&city=Nome:Nome,United_States
RU-TAY&city=Noril'sk:Noril'sk,Russia
MR&city=Nouakchott:Nouakchott,Mauritania
RU-NGR&city=Novgorod:Novgorod,Russia
RU-NVS&city=Novosibirsk:Novosibirsk,Russia
GL&city=Nuuk:Nuuk,Greenland
US-OK&city=Oklahoma_City:Oklahoma_City,United_States
US-NE&city=Omaha:Omaha,United_States
RU-OMS&city=Omsk:Omsk,Russia
RU-ORL&city=Orël:Orël,Russia
RU-ORE&city=Orenburg:Orenburg,Russia
US-FL&city=Orlando:Orlando,United_States
JP&city=Osaka:Osaka,Japan
NO&city=Oslo:Oslo,Norway
CA-ON&city=Ottawa:Ottawa,Canada
BF&city=Ouagadougou:Ouagadougou,BurkinaFaso
RU-KOR&city=Palana:Palana,Russia
FM&city=Palikir:Palikir,Micronesia,Federated_States_Of
PA&city=PanamaCity:PanamaCity,Panama
SR&city=Paramaribo:Paramaribo,Suriname
AR-ER&city=Paraná:Paraná,Argentina
FR&city=Paris:Paris,France
US-FL1&city=Pensacola:Pensacola,United_States
RU-PNZ&city=Penza:Penza,Russia
RU-PER&city=Perm:Perm,Russia
AU-WA&city=Perth:Perth,Australia
RU-KA&city=Petropavlovsk-Kamchatskiy:Petropavlovsk-Kamchatskiy,Russia
RU-KR&city=Petrozavodsk:Petrozavodsk,Russia
US-PA&city=Philadelphia:Philadelphia,United_States
KH&city=PhnomPenh:PhnomPenh,Cambodia
US-AZ&city=Phoenix:Phoenix,United_States
US-SD&city=Pierre:Pierre,United_States
US-PA&city=Pittsburgh:Pittsburgh,United_States
MU&city=Port_Louis:Port_Louis,Mauritius
PG&city=Port_Moresby:Port_Moresby,Papua_New_Guinea
FK&city=Port_Stanley:Port_Stanley,Falkland_Islands_(Malvinas)
HT&city=Port-au-Prince:Port-au-Prince,Haiti
US-OR&city=Portland:Portland,United_States
US-ME&city=Portland:Portland,United_States
BR-RS&city=Porto_Alegre:Porto_Alegre,Brazil
TT&city=Port-of-Spain:Port-of-Spain,Trinidad_and_Tobago
VU&city=Port-Vila:Port-Vila,Vanuatu
AR-MN&city=Posadas:Posadas,Argentina
CZ&city=Prague:Prague,CzechRepublic
CV&city=Praia:Praia,CapeVerde
ZA&city=Pretoria:Pretoria,SouthAfrica
US-RI&city=Providence:Providence,United_States
RU-PSK&city=Pskov:Pskov,Russia
MX&city=Puebla:Puebla,Mexico
KP&city=Pyongyang:Pyongyang,Korea,Democratic_People's_Republic_of
EC&city=Quito:Quito,Ecuador
MA&city=Rabat:Rabat,Morocco
US-NC&city=Raleigh:Raleigh,United_States
PS&city=Ramallah:Ramallah,PalestinianTerritory
MM&city=Rangoon:Rangoon,Myanmar
US-SD1&city=Rapid_City:Rapid_City,United_States
CK&city=Rarotonga:Rarotonga,CookIslands
AR-CH&city=Rawson:Rawson,Argentina
BR-PE&city=Recife:Recife,Brazil
CA-SK&city=Regina:Regina,Canada
US-NV&city=Reno:Reno,United_States
AR-CC&city=Resistencia:Resistencia,Argentina
IS&city=Reykjavik:Reykjavik,Iceland
US-VA&city=Richmond:Richmond,United_States
LV&city=Riga:Riga,Latvia
BR-RJ&city=Rio_de_Janeiro:Rio_de_Janeiro,Brazil
AR-SC&city=Rio_Gallegos:Rio_Gallegos,Argentina
SA&city=Riyadh:Riyadh,Saudi_Arabia
IT&city=Rome:Rome,Italy
AR-SF&city=Rosario:Rosario,Argentina
DM&city=Roseau:Roseau,Dominica
RU-ROS&city=Rostov-na-Donu:Rostov-na-Donu,Russia
RU-RYA&city=Ryazan':Ryazan',Russia
US-CA&city=Sacramento:Sacramento,United_States
GD&city=Saint_George's:Saint_George's,Grenada
RU-YAN&city=Salekhard:Salekhard,Russia
US-OR&city=Salem:Salem,United_States
US-UT&city=Salt_Lake_City:Salt_Lake_City,United_States
AR-SA&city=Salta:Salta,Argentina
BR-BA&city=Salvador:Salvador,Brazil
AT&city=Salzburg:Salzburg,Austria
RU-SAM&city=Samara:Samara,Russia
US-TX&city=San_Antonio:San_Antonio,United_States
US-CA&city=San_Diego:San_Diego,United_States
US-CA&city=San_Francisco:San_Francisco,United_States
CR&city=San_Jose:San_Jose,Costa_Rica
AR-SJ&city=San_Juan:San_Juan,Argentina
PR&city=San_Juan:San_Juan,Puerto_Rico
MX2&city=San_Lucas:San_Lucas,Mexico
AR-SL&city=San_Luis:San_Luis,Argentina
SV&city=San_Salvador:SanSalvador,El_Salvador
YE&city=Sanaa:Sanaa,Yemen
AR-SF&city=Santa_Fe:Santa_Fe,Argentina
AR-LP&city=Santa_Rosa:Santa_Rosa,Argentina
AR-SE&city=Santiago_del_Estero:Santiago_del_Estero,Argentina
CL&city=Santiago:Santiago,Chile
DO&city=Santo_Domingo:Santo_Domingo,Dominican_Republic
BR-SP&city=Sao_Paulo:Sao_Paulo,Brazil
BA&city=Sarajevo:Sarajevo,Bosnia_and_Herzegovina
RU-MO&city=Saransk:Saransk,Russia
RU-SAR&city=Saratov:Saratov,Russia
CA-SK&city=Saskatoon:Saskatoon,Canada
GL3&city=Scoresbysund:Scoresbysund,Greenland
US-WA&city=Seattle:Seattle,United_States
KR&city=Seoul:Seoul,Korea,Republicof
CN&city=Shanghai:Shanghai,China
SG&city=Singapore_City:Singapore_City,Singapore
US-SD&city=Sioux_Falls:Sioux_Falls,United_States
MK&city=Skopje:Skopje,Macedonia,The_Former_Yugoslav_Republic_Of
RU-SMO&city=Smolensk:Smolensk,Russia
BG&city=Sofia:Sofia,Bulgaria
US-IL&city=Springfield:Springfield,United_States
AG&city=St._John's:St._John's,Antigua_and_Barbuda
CA-NF&city=St._John's:St._John's,Canada
US-MO&city=St._Louis:St._Louis,United_States
US-MN&city=St._Paul:St._Paul,United_States
RU-LEN&city=St._Petersburg:St._Petersburg,Russia
RU-STA&city=Stavropol':Stavropol',Russia
SE&city=Stockholm:Stockholm,Sweden
ID&city=Surabaya:Surabaya,Indonesia
FJ&city=Suva:Suva,Fiji
AU-NSW&city=Sydney:Sydney,Australia
RU-KO&city=Syktyvkar:Syktyvkar,Russia
TW&city=Taipei:Taipei,Taiwan
US-FL&city=Tallahassee:Tallahassee,United_States
EE&city=Tallinn:Tallinn,Estonia
RU-TAM&city=Tambov:Tambov,Russia
MA&city=Tangier:Tangier,Morocco
UZ&city=Tashkent:Tashkent,Uzbekistan
GE&city=Tbilisi:Tbilisi,Georgia
HN&city=Tegucigalpa:Tegucigalpa,Honduras
IR&city=Tehran:Tehran,Iran,Islamic_Republic_of
IL&city=Tel_Aviv:Tel_Aviv,Israel
MX2-1&city=Tepic:Tepic,Mexico
US-IN&city=Terre_Haute:Terre_Haute,United_States
BT&city=Thimphu:Thimphu,Bhutan
GL2&city=Thule:Thule,Greenland
MX3&city=Tijuana:Tijuana,Mexico
AL&city=Tirane:Tirane,Albania
JP&city=Tokyo:Tokyo,Japan
RU-TOM&city=Tomsk:Tomsk,Russia
US-KS&city=Topeka:Topeka,United_States
CA-ON&city=Toronto:Toronto,Canada
US-NJ&city=Trenton:Trenton,United_States
LY&city=Tripoli:Tripoli,Libyan_Arab_Jamahiriya
US-AZ&city=Tucson:Tucson,United_States
AR-TM&city=Tucumán:Tucumán,Argentina
RU-TUL&city=Tula:Tula,Russia
TN&city=Tunis:Tunis,Tunisia
RU-EVE&city=Tura:Tura,Russia
RU-TVE&city=Tver':Tver',Russia
RU-TYU&city=Tyumen':Tyumen',Russia
RU-BA&city=Ufa:Ufa,Russia
MN&city=Ulaanbaatar:Ulaanbaatar,Mongolia
RU-BU&city=Ulan-Ude:Ulan-Ude,Russia
RU-ULY&city=Ul'yanovsk:Ul'yanovsk,Russia
KZ1&city=Uralsk:Uralsk,Kazakhstan
AR-TF&city=Ushuaia:Ushuaia,Argentina
RU-UOB&city=Ust'-Ordynskiy:Ust'-Ordynskiy,Russia
LI&city=Vaduz:Vaduz,Liechtenstein
MT&city=Valletta:Valletta,Malta
CA-BC&city=Vancouver:Vancouver,Canada
CA-BC&city=Victoria:Victoria,Canada
SC&city=Victoria:Victoria,Seychelles
AR-RN&city=Viedma:Viedma,Argentina
AT&city=Vienna:Vienna,Austria
LA&city=Vientiane:Vientiane,Lao_People's_Democratic_Republic
LT&city=Vilnius:Vilnius,Lithuania
US-VA&city=Virginia_Beach:Virginia_Beach,United_States
RU-SE&city=Vladikavkaz:Vladikavkaz,Russia
RU-VLA&city=Vladimir:Vladimir,Russia
RU-PRI&city=Vladivostok:Vladivostok,Russia
RU-VGG&city=Volgograd:Volgograd,Russia
RU-VLG&city=Vologda:Vologda,Russia
RU-KO&city=Vorkuta:Vorkuta,Russia
RU-VOR&city=Voronezh:Voronezh,Russia
PL&city=Warsaw:Warsaw,Poland
US-DC&city=Washington:Washington,United_States
NZ&city=Wellington:Wellington,NewZealand
US-KS&city=Wichita:Wichita,United_States
US-DE&city=Wilmington:Wilmington,United_States
NA&city=Windhoek:Windhoek,Namibia
CA-MB&city=Winnipeg:Winnipeg,Canada
CN&city=Wuhan:Wuhan,China
RU-SA&city=Yakutsk:Yakutsk,Russia
CM&city=Yaounde:Yaounde,Cameroon
RU-YAR&city=Yarolavl':Yarolavl',Russia
RU-SVE&city=Yekaterinburg:Yekaterinburg,Russia
AM&city=Yerevan:Yerevan,Armenia
JP&city=Yokohama:Yokohama,Japan
RU-ME&city=Yoshkar-Ola:Yoshkar-Ola,Russia
RU-SAK&city=Yuzhno-Sakhalinsk:Yuzhno-Sakhalinsk,Russia
HR&city=Zagreb:Zagreb,Croatia
CH&city=Zurich:Zurich,Switzerland
}
  set itmatched 0

  if {$location == ""} {
     putserv "NOTICE $nick :\002\037Worldtime.tcl 1.3 Help\037:\002"
     putserv "NOTICE $nick :USAGE: \002!tz\002 <city|country|city,country>"
     putserv "NOTICE $nick :Cities are listed alphabetically, so if you enter\
a country, you will get the first city in the list for that country"
     putserv "NOTICE $nick :\002\eg1 :\002 !tz Lima,Peru"
     putserv "NOTICE $nick :\002\eg2 :\002 !tz Lima"
     putserv "NOTICE $nick :\002\037End of Worldtime.tcl Help\037\002"
     return 0
  }
  set inloc [string trim [string tolower $location]]
  regsub  -all { } $inloc {_} tloc
  foreach i $city_list {
     set tempurl [lindex [split $i :] 0]
     set temploc [lindex [split $i :] 1]
     if {[string first $tloc [string tolower $temploc]] != -1} {
        set itmatched 1
        break
     }
  }
  if {[string first mcmurdo $tloc] !=-1} {
     set tempurl NZ&city=Wellington
     set temploc Mcmurdo_Station,Antarctica
     set itmatched 1
  }
  if {[string first south_pole $tloc] !=-1} {
     set tempurl NZ&city=Wellington
     set temploc South_Pole,Antarctica
     set itmatched 1
  }
  if {[lsearch -exact {[censored] poo crap} $tloc] != -1} {
     set tempurl UTC
     set temploc toilet
     set itmatched 1
  }
  if {[lsearch -exact {[censored] nigger asshole} $tloc] != -1} {
     set tempurl UTC
     set temploc kick
     set itmatched 1
  }
  if {$itmatched == 0} {
     putserv "NOTICE $nick :Sorry no match on $inloc, try a different city"
     return 0
  }
  if {[string compare [lindex [split $temploc ,] 1] United_States] == 1} {
     set temploc [lindex [split $temploc ,] 0]
  }
set tempurl [split $tempurl &]
  set url "/current_time_in_[lindex $tempurl 0].aspx?[lindex $tempurl 1]"
  return "$url $temploc"
}

putlog "WorldTime v1.3 by Murf (modified by LOQUILLO_/updated by speechles) loaded"
[/b]
Post Reply