# HG changeset patch # User Matti Hamalainen # Date 1422008623 -7200 # Node ID f6dc673adfa1b74b007409feb5c62dbd9c5dbcaf # Parent 9cab9cec110d5714060b147a12899b37674cc262 weather: Reorder some function arguments. diff -r 9cab9cec110d -r f6dc673adfa1 weather.tcl --- a/weather.tcl Fri Jan 23 11:54:10 2015 +0200 +++ b/weather.tcl Fri Jan 23 12:23:43 2015 +0200 @@ -147,8 +147,8 @@ # Produce one location of weather data as a string -proc weather_get_data {ukey udata} { set str "\002[lindex $udata 0]\002, mitattu klo [weather_ctime [lindex $udata 2]]: \002[lindex $udata 3]°C\002" +proc weather_get_data {udata ukey} { if {[lindex $udata 1] == 0} { append str [weather_item $udata 5 ", @@"] append str [weather_item $udata 6 ", keli @@"] @@ -163,9 +163,9 @@ # Get data by location key -proc weather_get_key {ukey} { +proc weather_get_by_key {ukey} { global weather_data - return [weather_get_data $ukey $weather_data($ukey)] + return [weather_get_data $weather_data($ukey) $ukey] } @@ -392,18 +392,18 @@ foreach rarg $rarglist { if {$rarg == "min"} { # Min temp - set umin [weather_get_key "w_min"] + set umin [weather_get_by_key "w_min"] weather_msg $upublic $unick $uchan "Min: $umin" incr nresults } elseif {$rarg == "max"} { # Max temp - set umax [weather_get_key "w_max"] + set umax [weather_get_by_key "w_max"] weather_msg $upublic $unick $uchan "Max: $umax" incr nresults } elseif {$rarg == "minmax" || $rarg == "min max" || $rarg == "maxmin" || $rarg == "max min"} { # Min & Max temps - set umin [weather_get_key "w_min"] - set umax [weather_get_key "w_max"] + set umin [weather_get_by_key "w_min"] + set umax [weather_get_by_key "w_max"] weather_msg $upublic $unick $uchan "Min: $umin | Max: $umax" incr nresults } else { @@ -413,7 +413,7 @@ foreach {ukey uvalue} [array get weather_data] { if {![string match "w_*" $ukey] && [string match -nocase "*${rarg}*" $ukey]} { if {[llength $uvalue] > 0} { - weather_msg $upublic $unick $uchan [weather_get_data $ukey $uvalue] + weather_msg $upublic $unick $uchan [weather_get_data $uvalue $ukey] incr nresults } else { weather_msg $upublic $unick $uchan $weather_msg_no_results [list $ukey]