]> git.donarmstrong.com Git - infobot.git/commitdiff
metar
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 Jul 2004 20:35:55 +0000 (20:35 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 Jul 2004 20:35:55 +0000 (20:35 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@984 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/Modules/Weather.pl

index 261da67e877c482d2b7272dd6b022845931b4741..5bedd95a17d7d34397ddd265c3276102b65d5cb6 100644 (file)
@@ -229,6 +229,9 @@ sub parseCmdHook {
 &addCmdHook("extra", 'weather', ('CODEREF' => 'Weather::Weather',
        'Identifier' => 'weather', 'Help' => 'weather',
        'Cmdstats' => 'weather', 'Forker' => 1) );
+&addCmdHook("extra", 'metar', ('CODEREF' => 'Weather::Metar',
+       'Identifier' => 'weather', 'Help' => 'weather',
+       'Cmdstats' => 'weather', 'Forker' => 1) );
 &addCmdHook("extra", 'bzflist', ('CODEREF' => 'BZFlag::list',
        'Identifier' => 'bzflag', 'Cmdstats' => 'BZFlag',
        'Forker' => 1) );
index bf1c05e017f8a9ddd9868c9c86ee2c6177ac7b66..9fef90e73071b46b9535063ef7dd201428d02537 100644 (file)
@@ -21,12 +21,19 @@ BEGIN {
 
 sub Weather {
        my ($args) = @_;
-       &::performStrictReply(&queryText($args));
+       &::performStrictReply(&queryText($args, 'weather'));
+       return;
+}
+
+sub Metar {
+       my ($args) = @_;
+       &::performStrictReply(&queryText($args, 'metar'));
        return;
 }
 
 sub queryText {
     my ($station) = shift;
+    my ($wxmode) = shift;
     my $result;
 
     $station = uc($station);
@@ -96,6 +103,10 @@ sub queryText {
        $min_temp = $1;
 
        if ($time) {
+           if ($wxmode eq 'metar' && defined($feat{'ob'})) {
+               return ("METAR " . $place . ": " . $feat{'ob'});
+           }
+
            $result = "$place; $id; last updated: $time";
            foreach (sort keys %feat) {
                next if $_ eq 'ob';