From 204fd7531aba4f893ac45c94d04c24ffb0643445 Mon Sep 17 00:00:00 2001 From: djmcgrath Date: Mon, 21 Apr 2008 15:19:42 +0000 Subject: [PATCH] * Merged r1772:1784 from /branches/misc-cleanup git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1803 c11ca15a-4712-0410-83d8-924469b57eb5 --- ChangeLog | 21 +++++ files/infobot.help | 197 ++++++++++++++++++++------------------- src/CommandStubs.pl | 9 -- src/DynaConfig.pl | 5 +- src/Modules/UserDCC.pl | 38 ++++---- src/Modules/countdown.pl | 2 +- 6 files changed, 144 insertions(+), 128 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1033aad..4864c93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,22 @@ * Removed unmaintained patches directory +* Changed +chan to chanadd + +* Changed -chan to chandel + +* Changed +ban to banadd + +* Changed -ban to bandel + +* Changed +host to hostadd + +* Changed -host to hostdel + +* Changed adduser to useradd + +* Changed deluser to userdel + 1.5.1 ===== @@ -15,4 +31,9 @@ created_by properly * New +M flag to allow modifying factoids created by same nick +1.5.0 +===== + +* Rebranding from blootbot + # vim:ts=4:sw=4:expandtab:tw=80 diff --git a/files/infobot.help b/files/infobot.help index 53e2b16..8f2d684 100644 --- a/files/infobot.help +++ b/files/infobot.help @@ -2,76 +2,32 @@ # Author: Tim Riker ### +# Special entry main: I learn mainly by observing declarative statements such as "x is at http://www.xxx.com", and then reply when people ask things like "where can i find x?" action: This is used to override the usual response. "x is does the hokey-pokey". When asked about x, the bot does this "* infobot does the hokey-pokey" +addressing: It is a good idea if I stay in REQUIRE mode so that I won't yell out random crap if I listen in too hard. Currently there is no way to turn this off on-the-fly. (REQUIRE mode requires me to be addressed by name if I am to respond) + alternation: The || symbol in an entry causes an infobot to choose one of the replies at random. "X is Y||Z" will produce "X is Y" or "X is Z" randomly. author: oznoid (mailto:lenzo@ri.cmu.edu) is my original author. -dollar variables: D: To be used in factoids -dollar variables: $Fdunno - ... -dollar variables: $Fquestion - ... -dollar variables: $Fupdate - ... -dollar variables: $channel - channel from which the factoid was requested -dollar variables: $date - current date (GMT) -dollar variables: $day - day of week (full name, locale) -dollar variables: $factoids - factoid count -dollar variables: $host - hostname of factoid requester -dollar variables: $ident - bot nick -dollar variables: $lastspeaker - ... -dollar variables: $memusage - ... -dollar variables: $rand - random number, also $rand100.2 -dollar variables: $randnick - random nick -dollar variables: $startTime - start time -dollar variables: $time - current time (GMT) -dollar variables: $uptime - ... -dollar variables: $user - username of factoid requester -dollar variables: $who - nick of factoid requester - -corrections: If I come back with "...but x is at http://xx.xx.xx" or something like that, and you want to change the entry, use "no, x is at http://sdfsdfsdf". The "No," tells me to supercede the existing value. -corrections: you can append stuff to a factoid with "also". "x is also at ..." - -math: D: math expresions can be evaluated. This uses Perl syntax. -math: E: 1+1 -math: + - add -math: - - subtract -math: * - multiply -math: / - division -math: ** - to the power -math: pi - pi -math: & - and -math: | = or -math: ^ - xor - -redirection: If a factoid x contains simply " see y", then when asked for x, I will deliver factoidor command result y instead. - -reply: There is a special tag, , that is used to override the usual response. Usually, a response is "X is Y", but it can be made "Y" by making the entry "X is Y". - -# now the commands... - -adduser: D: Administrative command to add new user to the .users file -adduser: U: ## -adduser: E: ## bloot bloot!bloot@example.com - -addressing: It is a good idea if I stay in REQUIRE mode so that I won't yell out random crap if I listen in too hard. Currently there is no way to turn this off on-the-fly. (REQUIRE mode requires me to be addressed by name if I am to respond) - babelfish: D: Frontend to babelfish translating service provided by http://babelfish.altavista.com/ Note that utf8 is used for non-ascii characters. babelfish: U: x babelfish: U: translate babelfish: E: x en de your cars rock --ban: D: FIXME: --ban: U: ## --ban: E: ## *!*@owns.org --ban: E: ## MoronMan +bandel: D: FIXME: +bandel: U: ## +bandel: E: ## *!*@owns.org +bandel: E: ## MoronMan -+ban: D: FIXME: -+ban: U: ## [chan] [time] [reason] -+ban: E: ## *!*@owns.org #bots 60 stop flooding. -+ban: E: ## *!*@*microsoft.com STOOPID -+ban: E: ## MoronMan +banadd: D: FIXME: +banadd: U: ## [chan] [time] [reason] +banadd: E: ## *!*@owns.org #bots 60 stop flooding. +banadd: E: ## *!*@*microsoft.com STOOPID +banadd: E: ## MoronMan botmail: D: Send someone botmail botmail: U: ## {for [:] }|stats|check|read @@ -80,13 +36,13 @@ botmail: E: ## stats botmail: E: ## check botmail: E: ## read --chan: D: Leave a channel permanently --chan: U: ## -#channel --chan: E: ## -#botpark +chanadd: D: Join a channel permanently +chanadd: U: ## #channel +chanadd: E: ## #botpark -+chan: D: Join a channel permanently -+chan: U: ## #channel -+chan: E: ## #botpark +chandel: D: Leave a channel permanently +chandel: U: ## -#channel +chandel: E: ## -#botpark chaninfo: D: Display channel statistics on Op, Ban, Deop, Unban, Part, Join, SignOff, PublicMsg, Kick and Topic chaninfo: U: ## [#channel] @@ -129,6 +85,9 @@ contents: E: ## x11amp potato cookie: I can feed your appetite with random factoids. +corrections: If I come back with "...but x is at http://xx.xx.xx" or something like that, and you want to change the entry, use "no, x is at http://sdfsdfsdf". The "No," tells me to supercede the existing value. +corrections: you can append stuff to a factoid with "also". "x is also at ..." + cpustats: cpustats dumps the bot's cpu usage this session crypt: It's good that you thought about encryption. I can do it for you. @@ -149,10 +108,6 @@ dauthor: E: ## Wichert potato dbugs: D: Show the current count of release critical bugs (latest versions) dbugs: U: ## -deluser: D: Administrative command to remove a user from the .users file -deluser: U: ## -deluser: E: ## bloot - ddesc: D: Search the Description: lines in Debian packages ddesc: U: ## [dist] ddesc: E: ## mule @@ -176,6 +131,26 @@ dns: E: ## 3.1.33.7 do: D: operator command to do things in a channel do: U: ## +dollar variables: D: To be used in factoids +dollar variables: $Fdunno - ... +dollar variables: $Fquestion - ... +dollar variables: $Fupdate - ... +dollar variables: $channel - channel from which the factoid was requested +dollar variables: $date - current date (GMT) +dollar variables: $day - day of week (full name, locale) +dollar variables: $factoids - factoid count +dollar variables: $host - hostname of factoid requester +dollar variables: $ident - bot nick +dollar variables: $lastspeaker - ... +dollar variables: $memusage - ... +dollar variables: $rand - random number, also $rand100.2 +dollar variables: $randnick - random nick +dollar variables: $startTime - start time +dollar variables: $time - current time (GMT) +dollar variables: $uptime - ... +dollar variables: $user - username of factoid requester +dollar variables: $who - nick of factoid requester + dstats: D: Show basic stats on the current size of the Debian distros dstats: U: ## [dist] dstats: E: ## @@ -208,6 +183,22 @@ factstats: == unrequest -- unrequested factoids. factstats: == vandalism -- ?? factstats: E: ## new +flags: D: Flags for chattr command +flags: D: "A" - bot administration over /msg (default is only via DCC CHAT) +flags: D: "O" - dynamic ops (as on channel). (automatic +o) +flags: D: "T" - add topics. +flags: D: "a" - ask/request factoid. +flags: D: "m" - modify all factoids. (includes renaming) +flags: D: "M" - modify own factoids. (includes renaming) +flags: D: "n" - bot owner, can "reload" +flags: D: "o" - master of bot (automatic +amrt) +flags: D: - can search on factoid strings shorter than 2 chars +flags: D: - can tell bot to join new channels +flags: D: - can [un]lock factoids +flags: D: "r" - remove factoid. +flags: D: "t" - teach/add factoid. +flags: D: "s" - Bypass +silent on channels + forget: If I have an old/redundant factoid x, "forget x" will cause me to erase it. freshmeat: D: Frontend to www.freshmeat.net @@ -218,6 +209,21 @@ hex: D: Convert ascii to hex hex: U: ## hex: E: ## carrot +hex2ip: D: Convert Hex idents for some gateways to an IP address +hex2ip: U: ## <8 char hex value> +hex2ip: E: ## AabBcC12 + +hostadd: D: admin command to list or add hostmasks to a user account +hostadd: U: ## [user] [] +hostadd: E: ## owner +hostadd: E: ## *!*@owns.org +hostadd: E: ## owner leet!leet@*.heh.org + +hostdel: D: admin command to remove hostmask from a user account +hostdel: U: ## [user] +hostdel: E: ## *!*@owns.org +hostdel: E: ## owner leet!leet@*.heh.org + httpdtype: D: Get httpd server software version / configuration httpdtype: U: ## httpdtype: E: ## example.com @@ -275,6 +281,18 @@ lock: E: ## abuse lock: N: By default, only registered "ops" on the bots or factoids matching the user's nick are able to lock factoids. lock: N: Requires factoid extension (extra) support enabled. +math: D: math expresions can be evaluated. This uses Perl syntax. +math: E: 1+1 +math: + - add +math: - - subtract +math: * - multiply +math: / - division +math: ** - to the power +math: pi - pi +math: & - and +math: | = or +math: ^ - xor + md5: D: calculates the md5sum of a given string md5: U: ## md5: E: ## When will infobot achieve world domination? @@ -349,10 +367,14 @@ quote: D: Frontend to yahoo's online stock market share listing quote: U: ## quote: E: ## RHAT,MSFT +redirection: If a factoid x contains simply " see y", then when asked for x, I will deliver factoidor command result y instead. + rename: D: Factoid renaming rename: U: ## 'from' 'to' rename: E: ## 'infobot' 'infobot' +reply: There is a special tag, , that is used to override the usual response. Usually, a response is "X is Y", but it can be made "Y" by making the entry "X is Y". + reverse: D: reverses a given string reverse: U: ## reverse: E: ## When will infobot achieve world domination? @@ -447,8 +469,20 @@ unlock: E: ## abuse uptime: D: Show the current uptime, and the top 3 uptimes recorded uptime: U: ## +useradd: D: Administrative command to add new user to the .users file +useradd: U: ## +useradd: E: ## SomeAccount SomeAccount!someguy@example.com + +userdel: D: Administrative command to remove a user from the .users file +userdel: U: ## +userdel: E: ## SomeAccount + wantnick: If someone's taken my nick (I hope not) and I'm using some temporary nick, I can change back to my original nick if it's not taken (again). +whois: D: List available information for an account on the bot +whois: U: ## +whois: E: ## SomeAccount + wikipedia: D: Frontend to the Wikipedia at http://www.wikipedia.org/wiki/ Note that utf8 is used for non-ascii characters. wikipedia: U: ## wikipedia: U: wiki @@ -458,41 +492,10 @@ wtf: D: Interface to the BSD wtf command wtf: U: ## wtf: E: ## iirc --host: D: admin command to remove hostmask from a user account --host: U: ## [user] --host: E: ## *!*@owns.org --host: E: ## owner leet!leet@*.heh.org - -+host: D: admin command to list or add hostmasks to a user account -+host: U: ## [user] [] -+host: E: ## owner -+host: E: ## *!*@owns.org -+host: E: ## owner leet!leet@*.heh.org - -flags: D: Flags for chattr command -flags: D: "A" - bot administration over /msg (default is only via DCC CHAT) -flags: D: "O" - dynamic ops (as on channel). (automatic +o) -flags: D: "T" - add topics. -flags: D: "a" - ask/request factoid. -flags: D: "m" - modify all factoids. (includes renaming) -flags: D: "M" - modify own factoids. (includes renaming) -flags: D: "n" - bot owner, can "reload" -flags: D: "o" - master of bot (automatic +amrt) -flags: D: - can search on factoid strings shorter than 2 chars -flags: D: - can tell bot to join new channels -flags: D: - can [un]lock factoids -flags: D: "r" - remove factoid. -flags: D: "t" - teach/add factoid. -flags: D: "s" - Bypass +silent on channels - rssfeeds: D: rssfeeds is used to control the RSS Feed tracking module rssfeeds: U: rssfeeds [command] rssfeeds: E: rssfeeds flush rssfeeds: D: flush - Will erase the cache file. (Must be chattr +o) rssfeeds: D: update - Force a manual update of the feeds. (Must be chattr +o) -hex2ip: D: Convert Hex idents for some gateways to an IP address -hex2ip: U: ## <8 char hex value> -hex2ip: E: ## AabBcC12 - # vim:ts=4:sw=4:expandtab:tw=80 diff --git a/src/CommandStubs.pl b/src/CommandStubs.pl index 7363a1f..ae5c24f 100644 --- a/src/CommandStubs.pl +++ b/src/CommandStubs.pl @@ -776,14 +776,6 @@ sub do_text_counters { return 1; } -sub nullski { - my ($arg) = @_; - return unless ( defined $arg ); - - # big security hole - #foreach (`$arg`) { &msg($who,$_); } -} - %cmdhooks=(); ### ### START ADDING HOOKS. @@ -827,7 +819,6 @@ sub nullski { &addCmdHook('metar', ('CODEREF' => 'Weather::Metar', 'Identifier' => 'Weather', 'Help' => 'weather', 'Cmdstats' => 'Weather', 'Forker' => 1) ); &addCmdHook('News', ('CODEREF' => 'News::Parse', Module => 'News', 'Cmdstats' => 'News', 'Identifier' => 'News' ) ); &addCmdHook('(?:nick|lame)ometer(?: for)?', ('CODEREF' => 'nickometer::query', 'Identifier' => 'nickometer', 'Cmdstats' => 'nickometer', 'Forker' => 1) ); -&addCmdHook('nullski', ('CODEREF' => 'nullski', ) ); &addCmdHook('OnJoin', ('CODEREF' => 'Cmdonjoin', 'Identifier' => 'OnJoin', 'Module' => 'OnJoin') ); &addCmdHook('page', ('CODEREF' => 'pager::page', 'Identifier' => 'pager', 'Cmdstats' => 'pager', 'Forker' => 1, 'Help' => 'page') ); &addCmdHook('piglatin', ('CODEREF' => 'piglatin::piglatin', 'Identifier' => 'piglatin', 'Cmdstats' => 'piglatin', 'Forker' => 1) ); diff --git a/src/DynaConfig.pl b/src/DynaConfig.pl index e52a2ea..1c3cad3 100644 --- a/src/DynaConfig.pl +++ b/src/DynaConfig.pl @@ -23,7 +23,8 @@ my @regFlagsUser = ( 'O', # dynamic ops (as on channel). (automatic +o) 'T', # add topics. 'a', # ask/request factoid. - 'm', # modify factoid. (includes renaming) + 'm', # modify all factoids. (includes renaming) + 'M', # modify own factoids. (includes renaming) 'n', # bot owner, can 'reload' 'o', # master of bot (automatic +amrt) # can search on factoid strings shorter than 2 chars @@ -757,7 +758,7 @@ sub getUser { sub chanSet { my ( $cmd, $chan, $what, $val ) = @_; - if ( $cmd eq '+chan' ) { + if ( $cmd eq 'chanadd' ) { if ( exists $chanconf{$chan} ) { &performStrictReply("chan $chan already exists."); return; diff --git a/src/Modules/UserDCC.pl b/src/Modules/UserDCC.pl index 08913ca..157b139 100644 --- a/src/Modules/UserDCC.pl +++ b/src/Modules/UserDCC.pl @@ -573,8 +573,8 @@ sub userDCC { return; } - # +chan. - if ( $message =~ /^(chanset|\+chan)(\s+(.*?))?$/ ) { + # chanadd. + if ( $message =~ /^(chanset|chanadd)(\s+(.*?))?$/ ) { my $cmd = $1; my $args = $3; my $no_chan = 0; @@ -668,13 +668,14 @@ sub userDCC { return; } - if ( $message =~ /^(chanunset|\-chan)(\s+(.*))?$/ ) { + if ( $message =~ /^(chanunset|chandel)(\s+(.*))?$/ ) { return unless ( &hasFlag('n') ); + my $cmd = $1; my $args = $3; my $no_chan = 0; if ( !defined $args ) { - &help('chanunset'); + &help($cmd); return; } @@ -981,10 +982,10 @@ sub userDCC { return; } - if ( $message =~ /^([-+])host(\s+(.*))?$/ ) { - my $cmd = $1 . 'host'; + if ( $message =~ /^(hostadd|hostdel)(\s+(.*))?$/ ) { + my $cmd = $1; my (@args) = split /[\s\t]+/, $3 || ''; - my $state = ( $1 eq "+" ) ? 1 : 0; + my $state = ( $1 eq "hostadd" ) ? 1 : 0; if ( !scalar @args ) { &help($cmd); @@ -1070,11 +1071,11 @@ sub userDCC { return; } - if ( $message =~ /^([-+])ban(\s+(.*))?$/ ) { - my $cmd = $1 . 'ban'; + if ( $message =~ /^(banadd|bandel)(\s+(.*))?$/ ) { + my $cmd = $1; my $flatarg = $3; my (@args) = split /[\s\t]+/, $3 || ''; - my $state = ( $1 eq "+" ) ? 1 : 0; + my $state = ( $1 eq "banadd" ) ? 1 : 0; if ( !scalar @args ) { &help($cmd); @@ -1164,7 +1165,7 @@ sub userDCC { my $user = &getUser($arg); if ( !defined $user ) { - &performStrictReply("whois: user $user does not exist."); + &performStrictReply("whois: user '$arg' does not exist."); return; } @@ -1378,22 +1379,21 @@ sub userDCC { return; } - # adduser/deluser. - if ( $message =~ /^(add|del)user(\s+(.*))?$/i ) { - my $str = $1; - my $strstr = $1 . 'user'; + # useradd/userdel. + if ( $message =~ /^(useradd|userdel)(\s+(.*))?$/i ) { + my $cmd = $1; my @args = split /\s+/, $3 || ''; my $args = $3; - my $state = ( $str =~ /^(add)$/ ) ? 1 : 0; + my $state = ( $cmd eq "useradd" ) ? 1 : 0; if ( !scalar @args ) { - &help($strstr); + &help($cmd); return; } - if ( $str eq 'add' ) { + if ( $cmd eq 'useradd' ) { if ( scalar @args != 2 ) { - &performStrictReply('adduser requires hostmask argument.'); + &performStrictReply('useradd requires hostmask argument.'); return; } } diff --git a/src/Modules/countdown.pl b/src/Modules/countdown.pl index b77d3e0..90fcd74 100644 --- a/src/Modules/countdown.pl +++ b/src/Modules/countdown.pl @@ -11,7 +11,7 @@ use strict; sub countdown { my ($query) = @_; - my $file = "$bot_base_dir/$param{'ircUser'}.countdown"; + my $file = "$bot_data_dir/$param{'ircUser'}.countdown"; my ( %date, %desc ); my $reply; -- 2.39.2