From b4fb3ba7e58e61035ce143fa0d0863ba66089d33 Mon Sep 17 00:00:00 2001 From: Andreas Scherbaum Date: Sun, 12 Aug 2012 14:47:57 +0200 Subject: [PATCH] - remove some old code --- docbot.pl | 140 ------------------------------------------------------ 1 file changed, 140 deletions(-) diff --git a/docbot.pl b/docbot.pl index 19e00dd..8ef3d17 100755 --- a/docbot.pl +++ b/docbot.pl @@ -845,40 +845,6 @@ sub print_msg { } -# authorized() -# -# check if a particular user is authorized to perform an action -# -# parameter: -# - action -# - nick -# return: -# - 0/1 (1 is authorized) -sub authorized { - -## FIXME -#die("FIXME: authorized()\n"); -# my $arg = shift; -# if (ref $arg ne 'HASH') { -# die "Subroutine 'authorized' must be passed a hashref\n"; -# } -# -# ## Check for required arguments -# for my $req (qw(action nick)) { -# exists $arg->{$req} and length $arg->{$req} -# or die qq{Subroutine "authorized" required argument "$req" not found\n}; -# } -# -# $SQL = "SELECT 1 FROM docbot_user WHERE LOWER(u_nick) = ?"; -# $sth = $dbh->prepare_cached($SQL); -# $count = $sth->execute(lc $arg->{nick}); -# $sth->finish(); -# -# return $count == 1 ? 1 : 0; - -} - - # init_terminal() # # initialise the terminal, logfiles and fork the bot into the background @@ -3750,112 +3716,6 @@ sub on_message { } - -# if ($msg =~ /^\s*(\?(?:learn|forget|config))\s+(.+)/i) { -# my ($command, $string) = ($1, $2); -# my $answer; -# -# if (!defined($heap->{whois_callback}->{$nick}->{authed})) { -# $heap->{whois_callback}->{$nick} = {event => (lc($channel) eq lc($irc->nick_name())) ? 'irc_msg' : 'irc_public'}; -# $heap->{whois_callback}->{$nick}->{authed} = 0; -# # register a callback -# @{$heap->{whois_callback}->{$nick}->{args}} = ($who, $where, $msg); -# -# # no auth information available -# # shoot a 'whois' to the irc server -# $irc->yield( whois => $nick ); -# return; -# } -# elsif ($heap->{whois_callback}->{$nick}->{authed} != 1) { -# $answer = "You are not authorized"; -# } -# else { -# # execute desired command -# #$answer = $admin_commands->{$command}($kernel, $nick, $channel, $string); -# $answer = "Execute command: $command"; -# print_msg("Execute command: $command", INFO); -# } -# # drop the callback for this nick -# undef ($heap->{whois_callback}->{$nick}); -# -# if (length($answer)) { -# # if command was called in channel print answer to channel, if it was PM print it as PM -# if (lc($channel) eq lc($irc->nick_name())) { -# $irc->yield( privmsg => $nick, $answer); -# } -# else { -# $irc->yield( privmsg => $channel, $answer); -# } -# return; -# } -# } -# elsif ($msg =~ /^\s*\?\?(\?*)(.+)/i) { -# $like = ($1 and $LIKESEARCH) ? 1 : 0; -# $msg = $2; -# $msg =~ s/^\s+//; -# -# if (substr($channel, 0, 1) eq '#') -# { -# if ($my_nick ne $irc_nick) { -# if (grep( /^$channel$/i, find_nick( $heap, $irc_nick ) )) { -# print_msg("Not processing query command, master bot is on channel", DEBUG); -# return; -# } -# } -# } -# -# if ($msg =~ /^(.+)\s+>\s+(\w+)/i) { -# return unless (grep( /^$channel$/i, find_nick( $heap, $2 ) )); -# $replyto = $2; -# $msg = $1; -# } elsif (lc($channel) eq lc($my_nick)) { -# $replyto = $nick; -# } else { -# $replyto = $channel; -# } -# } -# elsif ($msg =~ /^\s*$my_nick\W+tell\s+(\w+)\s+about\s+(.+)/i) { -# if ($1 eq "me") { -# $replyto = $nick; -# } elsif ($1 eq "us") { -# $replyto = $channel; -# } else { -# $replyto = $1; -# return unless (grep( /^$channel$/i, find_nick( $heap, $replyto ) )); -# } -# -# $msg = $2; -# } else { -# return; -# } -# -# # get data from db -# my $answers = get_answer($msg, $like); -# my $message_to_say = get_message($msg); -# my $numanswers = @$answers; -# -# # print each answer as one line, except when there are more than $MAXWRAP -# if ($numanswers) { -# $kernel->post(pg_docbot => privmsg => $replyto, "For information about '$msg' see:\n"); -# if ($numanswers <= $MAXWRAP) { -# for my $answer (@$answers) { -# $kernel->post(pg_docbot => privmsg => $replyto, $answer) -# } -# } -# else { -# for my $answer (word_wrap(' :: ', 250, @$answers)) { -# $kernel->post(pg_docbot => privmsg => $replyto, $answer); -# } -# } -# } -# else { # "nothing found," is always sends to the caller, not to the receiver -# # if command was called in channel print, answer to channel, if it was PM print it as PM -# if (lc($channel) eq lc($my_nick)) { -# $kernel->post(pg_docbot => privmsg => $nick, "Nothing found"); -# } else { -# $kernel->post(pg_docbot => privmsg => $channel, "Nothing found"); -# } -# } } -- 2.39.5