--- Extras.pl.orig 2001-12-18 14:49:01.000000000 +0000 +++ Extras.pl 2005-01-21 10:19:10.000000000 +0000 @@ -3,6 +3,8 @@ # Kevin A. Lenzo +use URI::Find::Simple qw( list_uris ); + sub Extras { # called after it decides if it's been addressed. # you have access tothe global variables here, @@ -33,6 +35,26 @@ # -- this section moved from Process.pl -- kl + # added by muttley 2005-01-10 + my @uris = list_uris($message); + if (getparam('uri_title') && @uris) { + if ($pid = fork) { + # this takes some time, so fork. + #return 'NOREPLY'; + } else { + my $response = uri_title(@uris); + if ($msgType =~ /private/) { + &msg($who, $response); + } else { + &say($response); + } + eval {require POSIX}; + POSIX::_exit(0) || kill 9, $$; + } + #return $response if defined $response; + } + + if ($addressed and $message =~ m|^\s*(.*?)\s+=~\s+s\/(.+?)\/(.*?)\/([a-z]*);?\s*$|) { # substitution: X =~ s/A/B/ @@ -228,10 +250,12 @@ } } + + # currency exchanger, bobby@bofh.dk if( defined(getparam('exchange')) and getparam('exchange') - and ( $message =~ /^\s*(?:ex)?change\s+/i or $message =~ /^\s*currenc(?:ies|y) for\s/i )){ + and ( $message =~ /^\s*(?:ex)?(?:change|convert)\s+/i or $message =~ /^\s*currenc(?:ies|y) for\s/i )){ &status("message($message)"); my $response=''; @@ -241,11 +265,18 @@ return 'NOREPLY'; } - if ($message =~ /^\s*(?:ex)?change\s+([\d\.\,]+)\s+(\S+)\s+(?:into|to|for)\s+(\S+)/i) { + if ($message =~ /^\s*(?:ex)?(?:change|convert)\s+([\d\.\,]+)\s+(\S+)\s+(?:into|to|for)\s+(\S+)/i) { my($Amount,$From,$To) = ($1,$2,$3); - $From = uc $From; $To = uc $To; - &status("calling exchange($From, $To, $Amount) ..."); - $response = &exchange($From, $To, $Amount); + + # $response = "bork bork bork"; # &exchange($From, $To, $Amount); + if ($message =~ /convert/) { + &status("calling convert($From, $To, $Amount) ..."); + $response = &convert($From, $To, $Amount); + } else { + $From = uc $From; $To = uc $To; + &status("calling exchange($From, $To, $Amount) ..."); + $response = &exchange($From, $To, $Amount); + } # Change Finland, purl! No no. How about 'currency for'. # } elsif( $message =~ /^\s*(?:ex)?change ([\w\s]+)/) { } elsif( $message =~ /^\s*currenc(?:ies|y) for\s(?:the\s)?([\w\s]+)/i ) {