From 79133680ae1c61b5d56ff46c500a64f7fb35d1f0 Mon Sep 17 00:00:00 2001 From: timriker Date: Thu, 18 Nov 2004 07:56:30 +0000 Subject: [PATCH] babelfish cleanup git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1039 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/CommandStubs.pl | 4 ++-- src/Modules/{babel.pl => babelfish.pl} | 20 ++++++++++---------- src/modules.pl | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) rename src/Modules/{babel.pl => babelfish.pl} (84%) diff --git a/src/CommandStubs.pl b/src/CommandStubs.pl index 09cd884..edd2941 100644 --- a/src/CommandStubs.pl +++ b/src/CommandStubs.pl @@ -277,7 +277,7 @@ sub Modules { return; } - # babel bot: Jonathan Feinberg++ + # babelfish bot: Jonathan Feinberg++ if ($message =~ m{ ^\s* (?:babel(?:fish)?|x|xlate|translate) @@ -290,7 +290,7 @@ sub Modules { }xoi) { return unless (&hasParam("babelfish")); - &Forker("babelfish", sub { &babel::babelfish(lc $1, lc $2, $3); } ); + &Forker("babelfish", sub { &babelfish::babelfish(lc $1, lc $2, $3); } ); $cmdstats{'BabelFish'}++; return; diff --git a/src/Modules/babel.pl b/src/Modules/babelfish.pl similarity index 84% rename from src/Modules/babel.pl rename to src/Modules/babelfish.pl index 16beeb5..6d3b092 100644 --- a/src/Modules/babel.pl +++ b/src/Modules/babelfish.pl @@ -10,16 +10,16 @@ # hacked by Tim@Rikers.org to handle new URL and layout -package babel; +package babelfish; use strict; -my $no_babel; +my $no_babelfish; BEGIN { eval "use URI::Escape"; # utility functions for encoding the - if ($@) { $no_babel++}; # babelfish request + if ($@) { $no_babelfish++}; # babelfish request eval "use LWP::UserAgent"; - if ($@) { $no_babel++}; + if ($@) { $no_babelfish++}; } BEGIN { @@ -54,7 +54,7 @@ BEGIN { } sub babelfish { - return '' if $no_babel; + return '' if $no_babelfish; my ($from, $to, $phrase) = @_; &main::DEBUG("babelfish($from, $to, $phrase)"); @@ -82,7 +82,7 @@ sub babelfish { } sub translate { - return '' if $no_babel; + return '' if $no_babelfish; my ($phrase, $languagepair, $req, $ua) = @_; &main::DEBUG("translate($phrase, $languagepair, $req, $ua)"); @@ -115,16 +115,16 @@ sub translate { } else { $translated = ":("; # failure } - $translated = "babel.pl: result too long, probably an error" if (length($translated) > 700); + $translated = "babelfish.pl: result too long, probably an error" if (length($translated) > 700); &main::pSReply($translated); } if (0) { if (-t STDIN) { - #my $result = babel::babelfish('en','sp','hello world'); - #my $result = babel::babelfish('en','sp','The cheese is old and moldy, where is the bathroom?'); - my $result = babel::babelfish('en','gr','doesn\'t seem to translate things longer than 40 characters'); + #my $result = babelfish::babelfish('en','sp','hello world'); + #my $result = babelfish::babelfish('en','sp','The cheese is old and moldy, where is the bathroom?'); + my $result = babelfish::babelfish('en','gr','doesn\'t seem to translate things longer than 40 characters'); $result =~ s/; /\n/g; print "Babelfish says: \"$result\"\n"; } diff --git a/src/modules.pl b/src/modules.pl index be65dce..2070d67 100644 --- a/src/modules.pl +++ b/src/modules.pl @@ -22,7 +22,7 @@ if ($@) { ### MODULES. %myModules = ( - "babelfish" => "babel.pl", + "babelfish" => "babelfish.pl", "botmail" => "botmail.pl", "BZFlag" => "BZFlag.pl", "countdown" => "Countdown.pl", -- 2.39.5