function show_welcome($nick) { $location = get_location($nick); if ($location === False) { return; } $time = get_time($location); if ($time == "") { return; } $arr = convert_google_location_time($time); $data = process_weather($location, $nick, True); if ($data === False) { return; } if ($data["tempC"] === False or $data["tempF"] === False) { return; } privmsg("welcome {$nick}: " . trim($arr["location"]) . ", " . $data["tempC"] . "/" . $data["tempF"] . ", " . date("g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . ", " . date("l, j F Y", $arr["timestamp"])); }
privmsg("location \"{$trailing}\" deleted"); } else { if (trim($trailing) != "") { privmsg("location for \"{$trailing}\" not found"); } else { privmsg("syntax: ~time-del <name>"); } } break; case "~time": $loc = get_location($trailing, $nick); if ($loc === False) { if ($trailing == "") { privmsg("syntax: ~time location"); privmsg("time data courtesy of Google"); return; } $loc = $trailing; } term_echo("*** TIME LOCATION: {$loc}"); $result = get_time($loc); if ($result != "") { $arr = convert_google_location_time($result); #privmsg($result); privmsg(date("l, j F Y @ g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . " - " . $arr["location"]); } else { privmsg("location not found - UTC timestamp: " . date("l, j F Y, g:i a")); } break; } #####################################################################################################
privmsg("syntax: ~weather <location>"); } break; case "~weather-old": $data = process_weather_old($trailing, $nick); if (is_array($data) == False) { switch ($data) { case 1: privmsg("weather for \"{$trailing}\" not found. check spelling or try another nearby location."); break; case 2: privmsg("all stations matching \"{$trailing}\" are either inactive or have no data. check spelling or try another nearby location."); break; default: privmsg("syntax: ~weather location"); privmsg("weather data courtesy of the APRS Citizen Weather Observer Program (CWOP) @ http://weather.gladstonefamily.net/"); } } else { $time_str = $data["utc"] . " (UTC)"; $time = get_time($trailing); if ($time != "") { $arr = convert_google_location_time($time); $t = $arr["timestamp"] - $data["age_num"] * 60; $time_str = date("g:i a", $t) . " (" . $arr["timezone"] . ")"; } $color = "10"; privmsg("weather for " . chr(2) . chr(3) . $color . $data["name"] . chr(3) . chr(2) . " at {$time_str}" . $data["age"] . " temp: " . chr(2) . chr(3) . $color . $data["temp"] . chr(3) . chr(2) . ", dp: " . chr(2) . chr(3) . $color . $data["dewpoint"] . chr(3) . chr(2) . ", press: " . chr(2) . chr(3) . $color . $data["press"] . chr(3) . chr(2) . ", humid: " . chr(2) . chr(3) . $color . $data["humidity"] . chr(3) . chr(2) . ", wind: " . chr(2) . chr(3) . $color . $data["wind_speed"] . chr(3) . chr(2) . " @ " . chr(2) . chr(3) . $color . $data["wind_direction"] . chr(3) . chr(2)); } break; } #####################################################################################################