From f7cae48a17d6decd0a9bd997188271daa0a885b1 Mon Sep 17 00:00:00 2001 From: timriker Date: Tue, 11 Nov 2003 21:33:00 +0000 Subject: [PATCH] ws git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@880 c11ca15a-4712-0410-83d8-924469b57eb5 --- ChangeLog | 2 +- ChangeLog.old | 10 +++--- INSTALL | 22 ++++++------- INSTALL.mysql | 6 ++-- INSTALL.sqlite | 2 +- README | 6 ++-- blootbot | 4 +-- doc/cmd.list | 16 +++++----- doc/old/BUGS | 6 ++-- doc/old/USAGE | 20 ++++++------ old/Freshmeat_II.pl | 4 +-- old/News.pl | 6 ++-- old/dbm.pl | 4 +-- patches/Google.pm | 64 +++++++++++++++++++------------------- scripts/dbm2mysql.pl | 2 +- scripts/irclog2html.pl | 2 +- scripts/makepasswd | 2 +- scripts/oreilly_prettyp.pl | 64 +++++++++++++++++++------------------- scripts/showvars.pl | 64 +++++++++++++++++++------------------- src/CommandStubs.pl | 4 +-- src/Factoids/Norm.pl | 2 +- src/Factoids/Reply.pl | 2 +- src/IRC/Irc.pl | 2 +- src/IRC/IrcHooks.pl | 2 +- src/IRC/Schedulers.pl | 2 +- src/Misc.pl | 2 +- src/Modules/Countdown.pl | 2 +- src/Modules/Exchange.pl | 18 ++++++----- src/Modules/Factoids.pl | 20 ++++++------ src/Modules/HTTPDtype.pl | 14 ++++----- src/Modules/News.pl | 6 ++-- src/Modules/Quote.pl | 4 +-- src/Modules/Units.pl | 50 ++++++++++++++--------------- src/Modules/Weather.pl | 2 +- src/Modules/babel.pl | 47 ++++++++++++++-------------- src/Modules/insult.pl | 2 +- src/Modules/zfi.pl | 2 +- src/Modules/zsi.pl | 2 +- src/Shm.pl | 3 +- src/UserExtra.pl | 6 ++-- src/core.pl | 6 ++-- src/dbi.pl | 2 +- src/modules.pl | 10 +++--- 43 files changed, 262 insertions(+), 256 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9039653..8491f04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -199,7 +199,7 @@ and opt-out (news unnotify) irchooks: splitted into IrcHelpers.pl so we can reload it on the fly. factoids: added debugging for short factoids that may be botched up - references + references 2001-04-12 21:12 dms diff --git a/ChangeLog.old b/ChangeLog.old index 0986ea0..5d10ab1 100644 --- a/ChangeLog.old +++ b/ChangeLog.old @@ -3,11 +3,11 @@ v1.0.0 (20000725): bug fixes mainly. - Fixed warning in Modules/Uptime.pl for clean install. - More fixes for scripts/*mysql*.pl from GmLB. - Added command 'hex'. - - GmLB fixed mysql2txt.pl and txt2mysql.pl. You can now import and + - GmLB fixed mysql2txt.pl and txt2mysql.pl. You can now import and export to inforbot 'factpacks'.- v1.0.0RC3 (20000720): bug fixes mainly. - - Debian.pl's infoPackages() now checks for incoming + - Debian.pl's infoPackages() now checks for incoming automatically and shows the new file. - irq/dan found the bot wouldn't run if a stale (invalid) pid file exists. Fixed. @@ -215,7 +215,7 @@ v1.0.0pre3 (20000319): - Fixed Freshmeat.pl not to show duplicate packages found by 'name' and 'oneliner' search. Made showPackage() function. - Debian modules now does multi distro. (woody's non-us appears to - be different structure so does not work :(, very crude hack... + be different structure so does not work :(, very crude hack... may not even work). - Added subfactoid randomising. eg: '(one|two|three)'. - 'dauthor' now works! @@ -317,7 +317,7 @@ v0.99pre12 (20000125): v0.99pre11 (20000123): - Fixes here and there... - - Debian find now searches Package names. Fallback automatically + - Debian find now searches Package names. Fallback automatically to contents file search. - Fixed typo related to log cycling. - Added netsplit detection code. @@ -601,7 +601,7 @@ v0.17.0 (19991126): - Ability to turn off minVolunteerLength. - More changes to prevent chatter in unaddressed manner. - We remove any ansi or control chars when piping to the log file. - RevHippie++. + RevHippie++. - Added 'thanks' language. - Typo in Freshmeat.pl; Fixed. - Added $rootwarnmode = passive || aggressive to satisfy lilo@OPN. diff --git a/INSTALL b/INSTALL index ef5ee58..08d8a63 100644 --- a/INSTALL +++ b/INSTALL @@ -8,19 +8,19 @@ Method of installation. - Edit files/blootbot.chan to set which channels to join. - Install the following Perl modules: - - Net::IRC perl module - - Debian: (apt-get install libnet-irc-perl) - - WWW::Search - - Debian: (apt-get install libwww-search-perl) - - LWP - - Debian: (apt-get install libwww-perl) - - HTML::Parser - - Debian: (apt-get install libhtml-parser-perl) + - Net::IRC perl module + - Debian: (apt-get install libnet-irc-perl) + - WWW::Search + - Debian: (apt-get install libwww-search-perl) + - LWP + - Debian: (apt-get install libwww-perl) + - HTML::Parser + - Debian: (apt-get install libhtml-parser-perl) - Choose your database: - - MySQL, read INSTALL.mysql (supported) - - SQLite, read INSTALL.sqlite (supported) - - PgSQL, read INSTALL.pgsql (unsupported, may work) + - MySQL, read INSTALL.mysql (supported) + - SQLite, read INSTALL.sqlite (supported) + - PgSQL, read INSTALL.pgsql (unsupported, may work) - There are "bugs" in the perl modules. Read INSTALL.patches on how to fix. diff --git a/INSTALL.mysql b/INSTALL.mysql index 40063e5..5de7a16 100644 --- a/INSTALL.mysql +++ b/INSTALL.mysql @@ -11,10 +11,10 @@ INSTALL.mysql = Possible problems - if connection to localhost is (short) refused, run - '/etc/init.d/mysql stop' - '/etc/init.d/mysql start' + '/etc/init.d/mysql stop' + '/etc/init.d/mysql start' - if connection for user is refused, reload grant tables with - 'mysqladmin -u root -p reload' + 'mysqladmin -u root -p reload' * [OPTIONAL] - run 'scripts/dbm2mysql.pl old-db' to convert dbm database file diff --git a/INSTALL.sqlite b/INSTALL.sqlite index ec3b9c5..c156712 100644 --- a/INSTALL.sqlite +++ b/INSTALL.sqlite @@ -17,7 +17,7 @@ other distros might need to build from sources. SQLite sources: -http://www.hwaci.com/sw/sqlite/ +http://www.hwaci.com/sw/sqlite/ DBD::SQLite sources: diff --git a/README b/README index 092e416..7d080ff 100644 --- a/README +++ b/README @@ -50,7 +50,7 @@ cases. preliminary pgsql support has been added but someone with pgperl knowledge needs to fix it up or at least unify the module with mysql. INSTALLATION - - Read the included INSTALL file + - Read the included INSTALL file NOTICE Be warned that this bot consumes quite a lot of memory upon start @@ -66,7 +66,7 @@ However, these people do not realize the potential of open wingates. test all modifications properly (and extensively). Suggestions are welcomed. - gp@OPN is currently working on a C version of infobot or + gp@OPN is currently working on a C version of infobot or blootbot, not based on the above source base. Core factoid code and mysql support works - but that is it. @@ -80,7 +80,7 @@ features listed in 'TODO'. you to find the cookies than for me to hand-feed them to you ;) See 'EXAMPLES' for various usage of factoids and "hidden" -variables. If you're hardcore, check out 'CommandStubs.pl' and +variables. If you're hardcore, check out 'CommandStubs.pl' and 'UserExtras.pl' for cool features. topic [help] - Topic help. diff --git a/blootbot b/blootbot index 5be7642..323c122 100755 --- a/blootbot +++ b/blootbot @@ -5,7 +5,7 @@ use strict; use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir - $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir + $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir $bot_pid $memusage %param ); @@ -47,7 +47,7 @@ BEGIN { # prevent duplicate processes of the same bot &duperuncheck(); -# initialize everything +# initialize everything &startup(); # first time initialization. &setup(); diff --git a/doc/cmd.list b/doc/cmd.list index 8cf384a..17600a6 100644 --- a/doc/cmd.list +++ b/doc/cmd.list @@ -61,15 +61,15 @@ if ($message =~ /^wantNick$/i) { &addCmdHook("main", 'chan(stats|info)', ('CODEREF' => 'chaninfo', ) ); &addCmdHook("main", 'cmd(stats|info)', ('CODEREF' => 'cmdstats', ) ); -&addCmdHook("main", 'factinfo', ('CODEREF' => 'factinfo', -&addCmdHook("main", 'factstats?', ('CODEREF' => 'factstats', -&addCmdHook("main", 'help', ('CODEREF' => 'help', +&addCmdHook("main", 'factinfo', ('CODEREF' => 'factinfo', +&addCmdHook("main", 'factstats?', ('CODEREF' => 'factstats', +&addCmdHook("main", 'help', ('CODEREF' => 'help', &addCmdHook("main", 'karma', ('CODEREF' => 'karma', ) ); -&addCmdHook("main", 'i?spell', ('CODEREF' => 'ispell', -&addCmdHook("main", 'd?nslookup', ('CODEREF' => 'DNS', -&addCmdHook("main", 'tell|explain', ('CODEREF' => 'tell', -&addCmdHook("main", 'news', ('CODEREF' => 'News::Parse', -&addCmdHook("main", 'countrystats', ('CODEREF' => 'countryStats', +&addCmdHook("main", 'i?spell', ('CODEREF' => 'ispell', +&addCmdHook("main", 'd?nslookup', ('CODEREF' => 'DNS', +&addCmdHook("main", 'tell|explain', ('CODEREF' => 'tell', +&addCmdHook("main", 'news', ('CODEREF' => 'News::Parse', +&addCmdHook("main", 'countrystats', ('CODEREF' => 'countryStats', # Modules/UserDCC.pl if ($message =~ /^(exit|quit)$/i) { if ($message =~ /^who$/) { diff --git a/doc/old/BUGS b/doc/old/BUGS index 9c45512..72f3449 100644 --- a/doc/old/BUGS +++ b/doc/old/BUGS @@ -15,7 +15,7 @@ Problem #2: [UPDATED 20000224] has not received notification of the new topic before changing to the second modification of the topic, it would use the absolute first (0) topic as a reference, - therefore missing out on the first alteration of the + therefore missing out on the first alteration of the topic. A very cheap solution exists. Edit IrcHooks.pl, search for @@ -53,7 +53,7 @@ Problem #4: 199912xx just 1 (total of 2), depending on the return of SELECT. If this still persists and memory leaks are happening, first make sure you are not using broken mysql tables, secondly bitch at the - mysql-perl author that there is a memory leak when a broken table + mysql-perl author that there is a memory leak when a broken table is in use. Problem #5: @@ -71,7 +71,7 @@ Problem #5: since __WARN__ hooks are not called from inside one. ### From 'perlvar'... - Note that __DIE__/__WARN__ handlers are very special in one + Note that __DIE__/__WARN__ handlers are very special in one respect: they may be called to report (probable) errors found by the parser. In such a case the parser may be in inconsistent state, so any attempt to evaluate Perl code from such a handler diff --git a/doc/old/USAGE b/doc/old/USAGE index 8f085ab..d922ed7 100644 --- a/doc/old/USAGE +++ b/doc/old/USAGE @@ -6,9 +6,9 @@ = === === ==== ====== ===== ==== ====== ==== ========================================================================== - ====================================== - USER COMMANDS - ====================================== + ====================================== + USER COMMANDS + ====================================== Command: 4op ============= @@ -215,7 +215,7 @@ Usage: Example: > blootbot: chanstats i am on 2 channels: #blootbot #debian - i've cached 5 users distributed over 2 channels. + i've cached 5 users distributed over 2 channels. > blootbot: chanstats #blootbot On #blootbot, there have been 1 Join, 1 Op and 20 @@ -366,9 +366,9 @@ Example: - ====================================== - MODULE COMMANDS - ====================================== + ====================================== + MODULE COMMANDS + ====================================== Command: babelfish ============= @@ -623,9 +623,9 @@ Example: DOES NOT WORK - ====================================== - MISCELLANEOUS/FACTOID COMMANDS - ====================================== + ====================================== + MISCELLANEOUS/FACTOID COMMANDS + ====================================== Command: forget ============= diff --git a/old/Freshmeat_II.pl b/old/Freshmeat_II.pl index f543c54..470b201 100644 --- a/old/Freshmeat_II.pl +++ b/old/Freshmeat_II.pl @@ -172,7 +172,7 @@ sub downloadIndex { ### lets get on with business. # set the last refresh time. fixes multiple spawn bug. - &::dbSet("freshmeat", + &::dbSet("freshmeat", { "projectname_short" => "_" }, { "latest_version" => time(), "desc_short" => "dummy project to track date" } @@ -341,7 +341,7 @@ sub xml_end { if ($i % 200 == 0 and $i != 0) { &::showProc(); - &::status("FM: unlocking and locking ($i): ". + &::status("FM: unlocking and locking ($i): ". &::Time2String( time() - $locktime ) ); $locktime = time(); diff --git a/old/News.pl b/old/News.pl index 1c1629d..e03f9a3 100644 --- a/old/News.pl +++ b/old/News.pl @@ -542,7 +542,7 @@ sub mod { if ($flags eq "") { $done++ if (!$done and $mod_news =~ s/\Q$op\E/$np/); $done++ if (!$done and $mod_nnews =~ s/\Q$op\E/$np/); - } elsif ($flags eq "g") { + } elsif ($flags eq "g") { $done++ if ($mod_news =~ s/\Q$op\E/$np/g); $done++ if ($mod_nnews =~ s/\Q$op\E/$np/g); } @@ -799,7 +799,7 @@ sub latest { if (!$flag) { return unless ($unread); - # just a temporary measure not to flood ourself off the + # just a temporary measure not to flood ourself off the # network with news until we get global notice() and msg() # throttling. if (time() - ($::cache{newsTime} || 0) < 5) { @@ -831,7 +831,7 @@ sub latest { $i = &newsS2N($_); $sorted[$i] = $_; } - + for ($i=0; $i<=scalar(@sorted); $i++) { my $news = $sorted[$i]; next unless (defined $news); diff --git a/old/dbm.pl b/old/dbm.pl index 0048143..8dc5d4b 100644 --- a/old/dbm.pl +++ b/old/dbm.pl @@ -346,7 +346,7 @@ sub searchTable { if (!scalar &dbGetColInfo($table)) { return; - } + } my @results; foreach (keys %{$table}) { @@ -391,7 +391,7 @@ sub getFactInfo { } &ERROR("gFI: should never happen."); -} +} ##### # Usage: &getFactoid($faqtoid); diff --git a/patches/Google.pm b/patches/Google.pm index 869eed3..04f586e 100644 --- a/patches/Google.pm +++ b/patches/Google.pm @@ -11,7 +11,7 @@ package WWW::Search::Google; =head1 NAME -WWW::Search::Google - class for searching Google +WWW::Search::Google - class for searching Google =head1 SYNOPSIS @@ -58,7 +58,7 @@ page in C<{_next_url}>. C is called (from C) whenever more hits are needed. It calls C to fetch the page specified by C<{_next_url}>. -It then parses this page, appending any search hits it finds to +It then parses this page, appending any search hits it finds to C<{cache}>. If it finds a ``next'' button in the text, it sets C<{_next_url}> to point to the page for the next set of results, otherwise it sets it to undef to indicate we''re done. @@ -66,7 +66,7 @@ set of results, otherwise it sets it to undef to indicate we''re done. =head1 TESTING -This module adheres to the C test suite mechanism. +This module adheres to the C test suite mechanism. =head1 AUTHOR @@ -75,7 +75,7 @@ This backend is written and maintained/supported by Jim Smyser. =head1 BUGS -Google is not an easy search engine to parse in that it is capable +Google is not an easy search engine to parse in that it is capable of altering it's output ever so slightly on different search terms. There may be new slight results output the author has not yet seen that will pop at any given time for certain searches. So, if you think you see @@ -94,11 +94,11 @@ Minor code correction for empty returned titles Forgot to add new next url regex in 2.19! 2.19 -Regex work on some search results url's that has changed. Number found +Regex work on some search results url's that has changed. Number found return should be right now. 2.17 -Insert url as a title when no title is found. +Insert url as a title when no title is found. 2.13 New regexp to parse newly found results format with certain search terms. @@ -118,7 +118,7 @@ Added Kingpin's new hash_to_cgi_string() 10/12/99 Fixed missing links / regexp crap. 2.05 -Matching overhaul to get the code parsing right due to multiple +Matching overhaul to get the code parsing right due to multiple tags being used by google on the hit lines. 9/25/99 2.02 @@ -139,10 +139,10 @@ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. =cut #' - - + + ##################################################################### - + require Exporter; @EXPORT = qw(); @EXPORT_OK = qw(); @@ -156,12 +156,12 @@ $TEST_CASES = <<"ENDTESTCASES"; &test('Google', '$MAINTAINER', 'one_page', '+LS'.'AM +rep'.'lication', \$TEST_RANGE, 2,99); &test('Google', '$MAINTAINER', 'multi', 'dir'.'ty ha'.'rr'.'y bimbo', \$TEST_GREATER_THAN, 101); ENDTESTCASES - + use Carp (); use WWW::Search(qw(generic_option strip_tags)); require WWW::SearchResult; - - + + sub undef_to_emptystring { return defined($_[0]) ? $_[0] : ""; } @@ -172,12 +172,12 @@ sub native_setup_search $self->user_agent('user'); $self->{_next_to_retrieve} = 0; $self->{'_num_hits'} = 100; - if (!defined($self->{_options})) { - $self->{_options} = { - 'search_url' => 'http://www.google.com/search', - 'num' => $self->{'_num_hits'}, - }; - }; + if (!defined($self->{_options})) { + $self->{_options} = { + 'search_url' => 'http://www.google.com/search', + 'num' => $self->{'_num_hits'}, + }; + }; my($options_ref) = $self->{_options}; if (defined($native_options_ref)) { # Copy in new options. @@ -195,7 +195,7 @@ sub native_setup_search $self->{_debug} = $options_ref->{'search_debug'}; $self->{_debug} = 2 if ($options_ref->{'search_parse_debug'}); $self->{_debug} = 0 if (!defined($self->{_debug})); - + # Finally figure out the url. $self->{_base_url} = $self->{_next_url} = @@ -203,7 +203,7 @@ sub native_setup_search "?" . $options . "q=" . $native_query; } - + # private sub begin_new_hit { my($self) = shift; @@ -236,13 +236,13 @@ sub native_retrieve_some { foreach ($self->split_lines($response->content())) { next if m@^$@; # short circuit for blank lines - if ($state == $HEADER && m/about ([\d,]+)<\/b>/) + if ($state == $HEADER && m/about ([\d,]+)<\/b>/) { my($n) = $1; $self->approximate_result_count($n); print STDERR "Found Total: $n\n" ; $state = $HITS; - } + } if ($state == $HITS && m|

]*)\>(.*?)|i) { my ($url, $title) = ($1,$2); @@ -255,7 +255,7 @@ sub native_retrieve_some { $title = "No Title" if ($title =~ /^\s+/); $hit->title(strip_tags($title)); $state = $HITS; - } + } elsif ($state == $HITS && m|(.*?)
<.*?>|i) { my ($url, $title) = ($1,$2); @@ -268,7 +268,7 @@ sub native_retrieve_some { $title = "No Title" if ($title =~ /^\s+/); $hit->title(strip_tags($title)); $state = $HITS; - } + } elsif ($state == $HITS && m@^

(.*)
(.*)@i || m@^

(.*).*?
(.*)@i) @@ -289,8 +289,8 @@ sub native_retrieve_some { $mDesc = $mDesc . '
' if not $mDesc =~ m@
@; $hit->description($mDesc) if (defined($hit)); $state = $HITS; - } - elsif ($state == $HITS && m@^(\.\.(.+))@i) + } + elsif ($state == $HITS && m@^(\.\.(.+))@i) { print STDERR "**Parsing Description Line**\n" if ($self->{_debug}); $raw .= $_; @@ -301,16 +301,16 @@ sub native_retrieve_some { $hit->description($sDesc) if $sDesc =~ m@^\.@; $sDesc = ''; $state = $HITS; - } - elsif ($state == $HITS && m@