From f2b044dd477305d15d95a36826b6bbc487cf190f Mon Sep 17 00:00:00 2001 From: timriker Date: Fri, 18 Feb 2005 03:09:12 +0000 Subject: [PATCH] no more pSReply git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1139 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/CLI/Support.pl | 4 - src/CommandStubs.pl | 26 ++--- src/DynaConfig.pl | 30 +++--- src/IRC/Irc.pl | 4 - src/IRC/IrcHooks.pl | 2 +- src/Misc.pl | 6 +- src/Modules/Debian.pl | 20 ++-- src/Modules/Factoids.pl | 2 +- src/Modules/HTTPDtype.pl | 2 +- src/Modules/UserDCC.pl | 206 +++++++++++++++++++-------------------- src/Modules/insult.pl | 2 +- src/Modules/md5.pl | 4 +- src/Modules/scramble.pl | 2 +- src/Process.pl | 24 ++--- src/UserExtra.pl | 34 +++---- 15 files changed, 179 insertions(+), 189 deletions(-) diff --git a/src/CLI/Support.pl b/src/CLI/Support.pl index 7b3a371..26a7416 100644 --- a/src/CLI/Support.pl +++ b/src/CLI/Support.pl @@ -86,8 +86,4 @@ sub performAddressedReply { &msg($who, @_); } -sub pSReply { - &msg($who, @_); -} - 1; diff --git a/src/CommandStubs.pl b/src/CommandStubs.pl index 26d3077..054d02f 100644 --- a/src/CommandStubs.pl +++ b/src/CommandStubs.pl @@ -397,7 +397,7 @@ sub Modules { push(@list, "$str ($_%)"); } - &pSReply( &formListReply(0, "Nickometer list for $term ", @list) ); + &performStrictReply( &formListReply(0, "Nickometer list for $term ", @list) ); &DEBUG("test."); return; @@ -482,7 +482,7 @@ sub Modules { $reply .= ". Started the scan ".&Time2String(time() - $wingaterun)." ago"; } - &pSReply("$reply."); + &performStrictReply("$reply."); return; } @@ -571,7 +571,7 @@ sub seen { "saying\002:\002 '$seen[4]'."; } - &pSReply($reply); + &performStrictReply($reply); return; } @@ -728,7 +728,7 @@ sub DebianNew { } close IDX1; - &::pSReply( &::formListReply(0, "New debian packages:", @new) ); + &::performStrictReply( &::formListReply(0, "New debian packages:", @new) ); } sub do_verstats { @@ -805,7 +805,7 @@ sub do_verstats { # hack. this is one major downside to scheduling. $chan = $c; - &pSReply( &formListReply(0, "IRC Client versions for $c ", @list) ); + &performStrictReply( &formListReply(0, "IRC Client versions for $c ", @list) ); # clean up not-needed data structures. undef %ver; @@ -891,9 +891,9 @@ sub do_text_counters { } if (defined $sum) { - &pSReply("total count of \037$type\037 on \002$c\002: $sum$topstr"); + &performStrictReply("total count of \037$type\037 on \002$c\002: $sum$topstr"); } else { - &pSReply("zero counter for \037$type\037."); + &performStrictReply("zero counter for \037$type\037."); } } else { # TODO: convert $where to hash and use a sqlSelect @@ -901,7 +901,7 @@ sub do_text_counters { " WHERE $where AND nick=".&sqlQuote($arg) ))[0]; if (!defined $x) { # !defined. - &pSReply("$arg has not said $type yet."); + &performStrictReply("$arg has not said $type yet."); return 1; } @@ -927,7 +927,7 @@ sub do_text_counters { } my $pct1 = sprintf("%.01f", 100*$x/$sum); - &pSReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra"); + &performStrictReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra"); } return 1; @@ -972,9 +972,9 @@ sub textstats_main { } if (defined $sum) { - &pSReply("total count of \037$type\037 on \002$c\002: $sum$topstr"); + &performStrictReply("total count of \037$type\037 on \002$c\002: $sum$topstr"); } else { - &pSReply("zero counter for \037$type\037."); + &performStrictReply("zero counter for \037$type\037."); } return; @@ -1013,7 +1013,7 @@ sub textstats_main { # return; if (!defined $x) { # !defined. - &pSReply("$arg has not said $type yet."); + &performStrictReply("$arg has not said $type yet."); return; } @@ -1024,7 +1024,7 @@ sub textstats_main { } my $pct1 = sprintf("%.01f", 100*$x/$sum); - &pSReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra"); + &performStrictReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra"); } sub nullski { diff --git a/src/DynaConfig.pl b/src/DynaConfig.pl index c5d9aa7..59badae 100644 --- a/src/DynaConfig.pl +++ b/src/DynaConfig.pl @@ -226,7 +226,7 @@ sub writeUserFile { $wtime_userfile = time(); &status("--- Saved USERFILE ($cusers users; $cbans bans; $cignore ignore) at $time"); if (defined $msgType and $msgType =~ /^chat$/) { - &pSReply("--- Writing user file..."); + &performStrictReply("--- Writing user file..."); } } @@ -399,7 +399,7 @@ sub writeChanFile { " chans) at $time"); if (defined $msgType and $msgType =~ /^chat$/) { - &pSReply("--- Writing chan file..."); + &performStrictReply("--- Writing chan file..."); } } @@ -503,7 +503,7 @@ sub hasFlag { return 1; } else { &status("DCC CHAT: <$who> $message -- not enough flags."); - &pSReply("error: you do not have enough flags for that. ($flag required)"); + &performStrictReply("error: you do not have enough flags for that. ($flag required)"); return 0; } } @@ -699,20 +699,20 @@ sub chanSet { if ($cmd eq "+chan") { if (exists $chanconf{$chan}) { - &pSReply("chan $chan already exists."); + &performStrictReply("chan $chan already exists."); return; } $chanconf{$chan}{_time_added} = time(); $chanconf{$chan}{autojoin} = $conn->nick(); - &pSReply("Joining $chan..."); + &performStrictReply("Joining $chan..."); &joinchan($chan); return; } if (!exists $chanconf{$chan}) { - &pSReply("no such channel $chan"); + &performStrictReply("no such channel $chan"); return; } @@ -727,7 +727,7 @@ sub chanSet { if ($state) { # add/set. if (defined $was and $was eq "1") { - &pSReply("setting $what for $chan already 1."); + &performStrictReply("setting $what for $chan already 1."); return; } @@ -735,12 +735,12 @@ sub chanSet { } else { # delete/unset. if (!defined $was) { - &pSReply("setting $what for $chan is not set."); + &performStrictReply("setting $what for $chan is not set."); return; } if ($was eq "0") { - &pSReply("setting $what for $chan already 0."); + &performStrictReply("setting $what for $chan already 0."); return; } @@ -751,10 +751,10 @@ sub chanSet { $was = ($was) ? "; was '$was'" : ""; if ($val eq "0") { - &pSReply("Unsetting $what for $chan$was."); + &performStrictReply("Unsetting $what for $chan$was."); delete $chanconf{$chan}{$what}; } else { - &pSReply("Setting $what for $chan to '$val'$was."); + &performStrictReply("Setting $what for $chan to '$val'$was."); $chanconf{$chan}{$what} = $val; } @@ -765,11 +765,11 @@ sub chanSet { my $was = $chanconf{$chan}{$what}; if (defined $was and $was eq $val) { - &pSReply("setting $what for $chan already '$val'."); + &performStrictReply("setting $what for $chan already '$val'."); return; } $was = ($was) ? "; was '$was'" : ""; - &pSReply("Setting $what for $chan to '$val'$was."); + &performStrictReply("Setting $what for $chan to '$val'$was."); $chanconf{$chan}{$what} = $val; @@ -785,9 +785,9 @@ sub chanSet { } if (exists $chanconf{$chan}{$what}) { - &pSReply("$what for $chan is '$chanconf{$chan}{$what}'"); + &performStrictReply("$what for $chan is '$chanconf{$chan}{$what}'"); } else { - &pSReply("$what for $chan is not set."); + &performStrictReply("$what for $chan is not set."); } } diff --git a/src/IRC/Irc.pl b/src/IRC/Irc.pl index 5d3705c..6a41967 100644 --- a/src/IRC/Irc.pl +++ b/src/IRC/Irc.pl @@ -399,10 +399,6 @@ sub performAddressedReply { &performReply(@_); } -sub pSReply { - &performStrictReply(@_); -} - # Usage: &performStrictReply($reply); sub performStrictReply { my ($reply) = @_; diff --git a/src/IRC/IrcHooks.pl b/src/IRC/IrcHooks.pl index fed0a18..551198d 100644 --- a/src/IRC/IrcHooks.pl +++ b/src/IRC/IrcHooks.pl @@ -346,7 +346,7 @@ sub on_dcc_open_chat { &verifyUser($nick, $nuh{lc $nick}); if (!exists $users{$userHandle}{HOSTS}) { - &pSReply("you have no hosts defined in my user file; rejecting."); + &performStrictReply("you have no hosts defined in my user file; rejecting."); $sock->close(); return; } diff --git a/src/Misc.pl b/src/Misc.pl index 6cb2e7b..30222f4 100644 --- a/src/Misc.pl +++ b/src/Misc.pl @@ -16,7 +16,7 @@ sub help { my $file = $bot_data_dir."/blootbot.help"; my %help = (); - # crude hack for pSReply() to work as expected. + # crude hack for performStrictReply() to work as expected. $msgType = "private" if ($msgType eq "public"); if (!open(FILE, $file)) { @@ -70,10 +70,10 @@ sub help { if (exists $help{$topic}) { foreach (split /\n/, $help{$topic}) { - &pSReply($_); + &performStrictReply($_); } } else { - &pSReply("no help on $topic. Use 'help' without arguments."); + &performStrictReply("no help on $topic. Use 'help' without arguments."); } return ''; diff --git a/src/Modules/Debian.pl b/src/Modules/Debian.pl index 1da1c12..bd60b66 100644 --- a/src/Modules/Debian.pl +++ b/src/Modules/Debian.pl @@ -314,7 +314,7 @@ sub searchContents { my $prefix = "Debian Search of '$query' "; if (scalar @list) { # @list. - &::pSReply( &::formListReply(0, $prefix, @list) ); + &::performStrictReply( &::formListReply(0, $prefix, @list) ); return; } @@ -324,7 +324,7 @@ sub searchContents { if (!scalar @list) { my $prefix = "Debian Package/File/Desc Search of '$query' "; - &::pSReply( &::formListReply(0, $prefix, ) ); + &::performStrictReply( &::formListReply(0, $prefix, ) ); } elsif (scalar @list == 1) { # list = 1. &::DEBUG("deb: list == 1; showing package info of '$list[0]'."); @@ -332,7 +332,7 @@ sub searchContents { } else { # list > 1. my $prefix = "Debian Desc Search of '$query' "; - &::pSReply( &::formListReply(0, $prefix, @list) ); + &::performStrictReply( &::formListReply(0, $prefix, @list) ); } } @@ -422,7 +422,7 @@ sub searchAuthor { my @list = keys %hash; if (scalar @list != 1) { my $prefix = "Debian Author Search of '$query' "; - &::pSReply( &::formListReply(0, $prefix, @list) ); + &::performStrictReply( &::formListReply(0, $prefix, @list) ); return 1; } @@ -436,7 +436,7 @@ sub searchAuthor { my $email = join(', ', keys %{ $maint{$list[0]} }); my $prefix = "Debian Packages by $list[0] \002<\002$email\002>\002 "; - &::pSReply( &::formListReply(0, $prefix, @pkg) ); + &::performStrictReply( &::formListReply(0, $prefix, @pkg) ); } #### @@ -763,7 +763,7 @@ sub infoPackages { } } - &::pSReply("$package: $pkg{$query}"); + &::performStrictReply("$package: $pkg{$query}"); } # Usage: &infoStats($dist); @@ -827,7 +827,7 @@ sub infoStats { ### TODO: don't count ppl with multiple email addresses. - &::pSReply( + &::performStrictReply( "Debian Distro Stats on $dist... ". "\002$total{'count'}\002 packages, ". "\002".scalar(keys %{ $total{'maint'} })."\002 maintainers, ". @@ -1084,7 +1084,7 @@ sub DebianFind { &::Forker("debian", sub { &infoPackages("info", "$results[0] $dist"); } ); } else { my $prefix = "Debian Package Listing of '$query' "; - &::pSReply( &::formListReply(0, $prefix, @results) ); + &::performStrictReply( &::formListReply(0, $prefix, @results) ); } } @@ -1144,13 +1144,13 @@ sub searchDescFE { if (!scalar @list) { my $prefix = "Debian Desc Search of '$query' "; - &::pSReply( &::formListReply(0, $prefix, ) ); + &::performStrictReply( &::formListReply(0, $prefix, ) ); } elsif (scalar @list == 1) { # list = 1. &::DEBUG("deb: list == 1; showing package info of '$list[0]'."); &infoPackages("info", $list[0]); } else { # list > 1. my $prefix = "Debian Desc Search of '$query' "; - &::pSReply( &::formListReply(0, $prefix, @list) ); + &::performStrictReply( &::formListReply(0, $prefix, @list) ); } } diff --git a/src/Modules/Factoids.pl b/src/Modules/Factoids.pl index 56639af..351ea2a 100644 --- a/src/Modules/Factoids.pl +++ b/src/Modules/Factoids.pl @@ -129,7 +129,7 @@ sub CmdFactInfo { return; } - &pSReply("$factinfo{'factoid_key'} -- ". join("; ", @array) ."."); + &performStrictReply("$factinfo{'factoid_key'} -- ". join("; ", @array) ."."); return; } diff --git a/src/Modules/HTTPDtype.pl b/src/Modules/HTTPDtype.pl index c69f360..c91ecd0 100644 --- a/src/Modules/HTTPDtype.pl +++ b/src/Modules/HTTPDtype.pl @@ -27,7 +27,7 @@ sub HTTPDtype { $line = (length($h{Server}) > 0) ? $h{Server} : "Couldn't fetch headers from $HOST"; - &::pSReply($line||"Unknown Error Condition"); + &::performStrictReply($line||"Unknown Error Condition"); } 1; diff --git a/src/Modules/UserDCC.pl b/src/Modules/UserDCC.pl index cb17b80..cec6291 100644 --- a/src/Modules/UserDCC.pl +++ b/src/Modules/UserDCC.pl @@ -34,11 +34,11 @@ sub userDCC { my $count = scalar(keys %{ $dcc{'CHAT'} }); my $dccCHAT = $message; - &pSReply("Start of who ($count users)."); + &performStrictReply("Start of who ($count users)."); foreach (keys %{ $dcc{'CHAT'} }) { - &pSReply("=> $_"); + &performStrictReply("=> $_"); } - &pSReply("End of who."); + &performStrictReply("End of who."); return; } @@ -53,7 +53,7 @@ sub userDCC { } my $result = &doQuestion($args); - &pSReply($result); + &performStrictReply($result); return; } @@ -284,17 +284,17 @@ sub userDCC { next unless (&IsNickInChan($opee,$_)); $found++; if ($channels{$_}{'o'}{$opee}) { - &pSReply("op: $opee already has ops on $_"); + &performStrictReply("op: $opee already has ops on $_"); next; } $op++; - &pSReply("opping $opee on $_"); + &performStrictReply("opping $opee on $_"); &op($_, $opee); } if ($found != $op) { - &pSReply("op: opped on all possible channels."); + &performStrictReply("op: opped on all possible channels."); } else { &DEBUG("op: found => '$found'."); &DEBUG("op: op => '$op'."); @@ -489,9 +489,9 @@ sub userDCC { return unless (&hasFlag("n")); &status("USER reload $who"); - &pSReply("reloading..."); + &performStrictReply("reloading..."); &reloadAllModules(); - &pSReply("reloaded."); + &performStrictReply("reloaded."); return; } @@ -548,15 +548,15 @@ sub userDCC { } if (!exists $chanconf{$args[0]}) { - &pSReply("no such channel $args[0]"); + &performStrictReply("no such channel $args[0]"); return; } - &pSReply("showing channel conf."); + &performStrictReply("showing channel conf."); foreach (sort keys %{ $chanconf{$args[0]} }) { - &pSReply("$chan: $_ => $chanconf{$args[0]}{$_}"); + &performStrictReply("$chan: $_ => $chanconf{$args[0]}{$_}"); } - &pSReply("End of chaninfo."); + &performStrictReply("End of chaninfo."); return; } @@ -589,7 +589,7 @@ sub userDCC { # READ ONLY. if (defined $what and $what !~ /^[-+]/ and !defined $val and $no_chan) { - &pSReply("Showing $what values on all channels..."); + &performStrictReply("Showing $what values on all channels..."); my %vals; foreach (keys %chanconf) { @@ -603,10 +603,10 @@ sub userDCC { } foreach (keys %vals) { - &pSReply(" $what = $_(" . scalar(keys %{$vals{$_}}) . "): ".join(' ', sort keys %{ $vals{$_} } ) ); + &performStrictReply(" $what = $_(" . scalar(keys %{$vals{$_}}) . "): ".join(' ', sort keys %{ $vals{$_} } ) ); } - &pSReply("End of list."); + &performStrictReply("End of list."); return; } @@ -617,9 +617,9 @@ sub userDCC { foreach $chan (@chans) { if ($chan eq '_default') { - &pSReply("Default channel settings"); + &performStrictReply("Default channel settings"); } else { - &pSReply("chan: $chan (see _default also)"); + &performStrictReply("chan: $chan (see _default also)"); } my @items; my $str = ""; @@ -627,13 +627,13 @@ sub userDCC { my $newstr = join(', ', @items); ### TODO: make length use channel line limit? if (length $newstr > 370) { - &pSReply(" $str"); + &performStrictReply(" $str"); @items = (); } $str = $newstr; push(@items, "$_ => $chanconf{$chan}{$_}"); } - &pSReply(" $str") if (@items); + &performStrictReply(" $str") if (@items); } return; } @@ -670,21 +670,21 @@ sub userDCC { } if (!exists $chanconf{$chan}) { - &pSReply("no such channel $chan"); + &performStrictReply("no such channel $chan"); return; } if ($args ne "") { if (!&getChanConf($args,$chan)) { - &pSReply("$args does not exist for $chan"); + &performStrictReply("$args does not exist for $chan"); return; } my @chans = &ChanConfList($args); &DEBUG("scalar chans => ".scalar(@chans) ); if (scalar @chans == 1 and $chans[0] eq "_default" and !$no_chan) { - &psReply("ok, $args was set only for _default; unsetting for _defaul but setting for other chans."); + &performStrictReply("ok, $args was set only for _default; unsetting for _defaul but setting for other chans."); my $val = $chanconf{$_}{_default}; foreach (keys %chanconf) { @@ -698,7 +698,7 @@ sub userDCC { } if ($no_chan and !exists($chanconf{_default}{$args})) { - &pSReply("ok, $args for _default does not exist, removing from all chans."); + &performStrictReply("ok, $args for _default does not exist, removing from all chans."); foreach (keys %chanconf) { next unless (exists $chanconf{$_}{$args}); @@ -711,23 +711,23 @@ sub userDCC { return; } - &pSReply("Unsetting channel ($chan) option $args. (was $chanconf{$chan}{$args})"); + &performStrictReply("Unsetting channel ($chan) option $args. (was $chanconf{$chan}{$args})"); delete $chanconf{$chan}{$args}; return; } if ($delete) { - &pSReply("Deleting channel $chan for sure!"); + &performStrictReply("Deleting channel $chan for sure!"); $utime_chanfile = time(); $ucount_chanfile++; &part($chan); - &pSReply("Leaving $chan..."); + &performStrictReply("Leaving $chan..."); delete $chanconf{$chan}; } else { - &pSReply("Prefix channel with '-' to delete for sure."); + &performStrictReply("Prefix channel with '-' to delete for sure."); } return; @@ -744,7 +744,7 @@ sub userDCC { my $u = &getUser($who); my $crypt = &mkcrypt($args[0]); - &pSReply("Set your passwd to '$crypt'"); + &performStrictReply("Set your passwd to '$crypt'"); $users{$u}{PASS} = $crypt; $utime_userfile = time(); @@ -762,29 +762,29 @@ sub userDCC { } if (!&IsUser($args[0])) { - &pSReply("user $args[0] is not valid."); + &performStrictReply("user $args[0] is not valid."); return; } my $u = &getUser($args[0]); if (!defined $u) { - &pSReply("Internal error, u = NULL."); + &performStrictReply("Internal error, u = NULL."); return; } if (scalar @args == 1) { # del pass. if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { - &pSReply("cannot remove passwd of others."); + &performStrictReply("cannot remove passwd of others."); return; } if (!exists $users{$u}{PASS}) { - &pSReply("$u does not have pass set anyway."); + &performStrictReply("$u does not have pass set anyway."); return; } - &pSReply("Deleted pass from $u."); + &performStrictReply("Deleted pass from $u."); $utime_userfile = time(); $ucount_userfile++; @@ -795,7 +795,7 @@ sub userDCC { } my $crypt = &mkcrypt($args[1]); - &pSReply("Set $u's passwd to '$crypt'"); + &performStrictReply("Set $u's passwd to '$crypt'"); $users{$u}{PASS} = $crypt; $utime_userfile = time(); @@ -827,20 +827,20 @@ sub userDCC { } if (!defined $user) { - &pSReply("user does not exist."); + &performStrictReply("user does not exist."); return; } my $flags = $users{$user}{FLAGS}; if (!defined $chflag) { - &pSReply("Flags for $user: $flags"); + &performStrictReply("Flags for $user: $flags"); return; } &DEBUG("who => $who"); &DEBUG("verifyUser => $verifyUser"); if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { - &pSReply("cannto change attributes of others."); + &performStrictReply("cannto change attributes of others."); return "REPLY"; } @@ -851,7 +851,7 @@ sub userDCC { if ($_ eq "-") { $state = 0; next; } if (!defined $state) { - &pSReply("no initial + or - was found in attr."); + &performStrictReply("no initial + or - was found in attr."); return; } @@ -863,7 +863,7 @@ sub userDCC { and $param{owner} =~ /^\Q$user\E$/i and $flags =~ /[nmo]/ ) { - &pSReply("not removing flag $_ for $user."); + &performStrictReply("not removing flag $_ for $user."); next; } next unless ($flags =~ s/\Q$_\E//); @@ -875,10 +875,10 @@ sub userDCC { if ($change) { $utime_userfile = time(); $ucount_userfile++; - &pSReply("Current flags: $flags"); + &performStrictReply("Current flags: $flags"); $users{$user}{FLAGS} = $flags; } else { - &pSReply("No flags changed: $flags"); + &performStrictReply("No flags changed: $flags"); } return; @@ -908,22 +908,22 @@ sub userDCC { } if (!defined $user) { - &pSReply("user $who or $args[0] does not exist."); + &performStrictReply("user $who or $args[0] does not exist."); return; } if ($user =~ /^\Q$chnick\E$/i) { - &pSReply("user == chnick. why should I do that?"); + &performStrictReply("user == chnick. why should I do that?"); return; } if (&getUser($chnick)) { - &pSReply("user $chnick is already used!"); + &performStrictReply("user $chnick is already used!"); return; } if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { - &pSReply("cannto change nick of others."); + &performStrictReply("cannto change nick of others."); return "REPLY" if ($who eq "_default"); return; } @@ -937,7 +937,7 @@ sub userDCC { $utime_userfile = time(); $ucount_userfile++; - &pSReply("Changed '$user' to '$chnick' successfully."); + &performStrictReply("Changed '$user' to '$chnick' successfully."); return; } @@ -969,17 +969,17 @@ sub userDCC { } if (!defined $user) { - &pSReply("user $user does not exist."); + &performStrictReply("user $user does not exist."); return; } if (!defined $mask) { - &pSReply("Hostmasks for $user: " . join(" ", keys %{$users{$user}{HOSTS}})); + &performStrictReply("Hostmasks for $user: " . join(" ", keys %{$users{$user}{HOSTS}})); return; } if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { - &pSReply("cannto change masks of others."); + &performStrictReply("cannto change masks of others."); return; } @@ -987,24 +987,24 @@ sub userDCC { if ($state) { # add. if ($mask !~ /^$mask{nuh}$/) { - &pSReply("error: mask ($mask) is not a real hostmask."); + &performStrictReply("error: mask ($mask) is not a real hostmask."); return; } if (exists $users{$user}{HOSTS}{$mask}) { - &pSReply("mask $mask already exists."); + &performStrictReply("mask $mask already exists."); return; } ### TODO: override support. $users{$user}{HOSTS}{$mask} = 1; - &pSReply("Added $mask to list of masks."); + &performStrictReply("Added $mask to list of masks."); } else { # delete. if (!exists $users{$user}{HOSTS}{$mask}) { - &pSReply("mask $mask does not exist."); + &performStrictReply("mask $mask does not exist."); return; } @@ -1012,9 +1012,9 @@ sub userDCC { delete $users{$user}{HOSTS}{$mask}; if (scalar keys %{ $users{$user}{HOSTS} } != $count) { - &pSReply("Removed $mask from list of masks."); + &performStrictReply("Removed $mask from list of masks."); } else { - &pSReply("error: could not find $mask in list of masks."); + &performStrictReply("error: could not find $mask in list of masks."); return; } } @@ -1058,9 +1058,9 @@ sub userDCC { } if (@c) { - &pSReply("Removed $mask from chans: @c"); + &performStrictReply("Removed $mask from chans: @c"); } else { - &pSReply("$mask was not found in ban list."); + &performStrictReply("$mask was not found in ban list."); } return; @@ -1075,7 +1075,7 @@ sub userDCC { $time = $1; &DEBUG("time = $time."); if ($time < 0) { - &pSReply("error: time cannot be negatime?"); + &performStrictReply("error: time cannot be negatime?"); return; } } else { @@ -1087,19 +1087,19 @@ sub userDCC { } if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { - &pSReply("cannto change masks of others."); + &performStrictReply("cannto change masks of others."); return; } if ($mask !~ /^$mask{nuh}$/) { - &pSReply("error: mask ($mask) is not a real hostmask."); + &performStrictReply("error: mask ($mask) is not a real hostmask."); return; } if ( &banAdd($mask,$chan,$time,$reason) == 2) { - &pSReply("ban already exists; overwriting."); + &performStrictReply("ban already exists; overwriting."); } - &pSReply("Added $mask for $chan (time => $time, reason => $reason)"); + &performStrictReply("Added $mask for $chan (time => $time, reason => $reason)"); return; } @@ -1114,12 +1114,12 @@ sub userDCC { my $user = &getUser($arg); if (!defined $user) { - &pSReply("whois: user $user does not exist."); + &performStrictReply("whois: user $user does not exist."); return; } ### TODO: better (eggdrop-like) output. - &pSReply("user: $user"); + &performStrictReply("user: $user"); foreach (keys %{ $users{$user} }) { my $ref = ref $users{$user}{$_}; @@ -1127,14 +1127,14 @@ sub userDCC { my $type = $_; ### DOES NOT WORK??? foreach (keys %{ $users{$user}{$type} }) { - &pSReply(" $type => $_"); + &performStrictReply(" $type => $_"); } next; } - &pSReply(" $_ => $users{$user}{$_}"); + &performStrictReply(" $_ => $users{$user}{$_}"); } - &pSReply("End of USER whois."); + &performStrictReply("End of USER whois."); return; } @@ -1144,34 +1144,34 @@ sub userDCC { if (defined $arg) { if ($arg ne "_default" and !&validChan($arg) ) { - &pSReply("error: chan $chan is invalid."); + &performStrictReply("error: chan $chan is invalid."); return; } } if (!scalar keys %bans) { - &pSReply("Ban list is empty."); + &performStrictReply("Ban list is empty."); return; } my $c; - &pSReply(" mask: expire, time-added, count, who-by, reason"); + &performStrictReply(" mask: expire, time-added, count, who-by, reason"); foreach $c (keys %bans) { next unless (!defined $arg or $arg =~ /^\Q$c\E$/i); - &pSReply(" $c:"); + &performStrictReply(" $c:"); foreach (keys %{ $bans{$c} }) { my $val = $bans{$c}{$_}; if (ref $val eq "ARRAY") { my @array = @{ $val }; - &pSReply(" $_: @array"); + &performStrictReply(" $_: @array"); } else { &DEBUG("unknown ban: $val"); } } } - &pSReply("END of bans."); + &performStrictReply("END of bans."); return; } @@ -1180,7 +1180,7 @@ sub userDCC { my $arg = $2; if (defined $arg and $arg !~ /^$mask{chan}$/) { - &pSReply("error: chan $chan is invalid."); + &performStrictReply("error: chan $chan is invalid."); return; } @@ -1190,7 +1190,7 @@ sub userDCC { } &DEBUG("End of bans."); - &pSReply("END of bans."); + &performStrictReply("END of bans."); return; } @@ -1200,7 +1200,7 @@ sub userDCC { &writeUserFile(); &writeChanFile(); - &pSReply("saved user and chan files"); + &performStrictReply("saved user and chan files"); return; } @@ -1233,9 +1233,9 @@ sub userDCC { if (!$state) { # delignore. if ( &ignoreDel($mask) ) { - &pSReply("ok, deleted ignores for $mask."); + &performStrictReply("ok, deleted ignores for $mask."); } else { - &pSReply("could not find $mask in ignore list."); + &performStrictReply("could not find $mask in ignore list."); } return; } @@ -1266,9 +1266,9 @@ sub userDCC { } if ( &ignoreAdd($mask, $chan, $time, $comment) > 1) { - &pSReply("FIXME: $mask already in ignore list; written over anyway."); + &performStrictReply("FIXME: $mask already in ignore list; written over anyway."); } else { - &pSReply("added $mask to ignore list."); + &performStrictReply("added $mask to ignore list."); } return; @@ -1279,41 +1279,41 @@ sub userDCC { if (defined $arg) { if ($arg !~ /^$mask{chan}$/) { - &pSReply("error: chan $chan is invalid."); + &performStrictReply("error: chan $chan is invalid."); return; } if (!&validChan($arg)) { - &pSReply("error: chan $arg is invalid."); + &performStrictReply("error: chan $arg is invalid."); return; } - &pSReply("Showing bans for $arg only."); + &performStrictReply("Showing bans for $arg only."); } if (!scalar keys %ignore) { - &pSReply("Ignore list is empty."); + &performStrictReply("Ignore list is empty."); return; } ### TODO: proper (eggdrop-like) formatting. my $c; - &pSReply(" mask: expire, time-added, who, comment"); + &performStrictReply(" mask: expire, time-added, who, comment"); foreach $c (keys %ignore) { next unless (!defined $arg or $arg =~ /^\Q$c\E$/i); - &pSReply(" $c:"); + &performStrictReply(" $c:"); foreach (keys %{ $ignore{$c} }) { my $ref = ref $ignore{$c}{$_}; if ($ref eq "ARRAY") { my @array = @{ $ignore{$c}{$_} }; - &pSReply(" $_: @array"); + &performStrictReply(" $_: @array"); } else { &DEBUG("unknown ignore line?"); } } } - &pSReply("END of ignore."); + &performStrictReply("END of ignore."); return; } @@ -1333,11 +1333,11 @@ sub userDCC { if ($str eq 'add') { if (scalar @args != 2) { - &pSReply('adduser requires hostmask argument.'); + &performStrictReply('adduser requires hostmask argument.'); return; } } elsif (scalar @args != 1) { - &pSReply('too many arguments.'); + &performStrictReply('too many arguments.'); return; } @@ -1345,14 +1345,14 @@ sub userDCC { # adduser. if (scalar @args == 1) { $args[1] = &getHostMask($args[0]); - &pSReply("Attemping to guess $args[0]'s hostmask..."); + &performStrictReply("Attemping to guess $args[0]'s hostmask..."); # crude hack... crappy Net::IRC $conn->schedule(5, sub { # hopefully this is right. my $nick = (keys %{ $cache{nuhInfo} })[0]; if (!defined $nick) { - &pSReply("couldn't get nuhinfo... adding user without a hostmask."); + &performStrictReply("couldn't get nuhinfo... adding user without a hostmask."); &userAdd($nick); return; } @@ -1360,9 +1360,9 @@ sub userDCC { if ( &userAdd($nick, $mask) ) { # success. - &pSReply("Added $nick with flags $users{$nick}{FLAGS}"); + &performStrictReply("Added $nick with flags $users{$nick}{FLAGS}"); my @hosts = keys %{ $users{$nick}{HOSTS} }; - &pSReply("hosts: @hosts"); + &performStrictReply("hosts: @hosts"); } }); return; @@ -1370,21 +1370,21 @@ sub userDCC { &DEBUG("args => @args"); if ( &userAdd(@args) ) { # success. - &pSReply("Added $args[0] with flags $users{$args[0]}{FLAGS}"); + &performStrictReply("Added $args[0] with flags $users{$args[0]}{FLAGS}"); my @hosts = keys %{ $users{$args[0]}{HOSTS} }; - &pSReply("hosts: @hosts"); + &performStrictReply("hosts: @hosts"); } else { # failure. - &pSReply("User $args[0] already exists"); + &performStrictReply("User $args[0] already exists"); } } else { # deluser. if ( &userDel($args[0]) ) { # success. - &pSReply("Deleted $args[0] successfully."); + &performStrictReply("Deleted $args[0] successfully."); } else { # failure. - &pSReply("User $args[0] does not exist."); + &performStrictReply("User $args[0] does not exist."); } } @@ -1412,9 +1412,9 @@ sub userDCC { push(@time, "$str (".&Time2String($_).")"); } - &pSReply( &formListReply(0, "Schedulers: ", @time ) ); - &pSReply( &formListReply(0, "Scheds to run: ", sort @list ) ); - &pSReply( &formListReply(0, "Scheds running(should not happen?) ", sort @run ) ); + &performStrictReply( &formListReply(0, "Schedulers: ", @time ) ); + &performStrictReply( &formListReply(0, "Scheds to run: ", sort @list ) ); + &performStrictReply( &formListReply(0, "Scheds running(should not happen?) ", sort @run ) ); return; } diff --git a/src/Modules/insult.pl b/src/Modules/insult.pl index 4ff90ee..e39fbcc 100644 --- a/src/Modules/insult.pl +++ b/src/Modules/insult.pl @@ -34,7 +34,7 @@ sub Insult { my $whois = "$insultwho is"; $whois = "You are" if ($insultwho eq $::who or $insultwho eq "me"); - &::pSReply("$whois nothing but a$n $adj $amt of $adj2 $noun"); + &::performStrictReply("$whois nothing but a$n $adj $amt of $adj2 $noun"); } 1; diff --git a/src/Modules/md5.pl b/src/Modules/md5.pl index 8b59b7c..440e603 100644 --- a/src/Modules/md5.pl +++ b/src/Modules/md5.pl @@ -11,9 +11,7 @@ sub md5 { my($message) = @_; return unless &::loadPerlModule("Digest::MD5"); -#perl -e'use Digest::MD5 qw(md5_hex); print md5_hex("foo\n") . "\n";' - - &::pSReply(&Digest::MD5::md5_hex($message)); + &::performStrictReply(&Digest::MD5::md5_hex($message)); } 1; diff --git a/src/Modules/scramble.pl b/src/Modules/scramble.pl index 9700406..de652bb 100644 --- a/src/Modules/scramble.pl +++ b/src/Modules/scramble.pl @@ -57,7 +57,7 @@ sub scramble # been included in the original string $scrambled =~ s/\s+$//; - &::pSReply($scrambled||"Unknown Error Condition"); + &::performStrictReply($scrambled||"Unknown Error Condition"); } 1; diff --git a/src/Process.pl b/src/Process.pl index 76d220d..84387ec 100644 --- a/src/Process.pl +++ b/src/Process.pl @@ -104,7 +104,7 @@ sub process { my @array = split / /, $message; if ($who =~ /^_default$/i) { - &pSReply("you are too eleet."); + &performStrictReply("you are too eleet."); return; } @@ -116,25 +116,25 @@ sub process { my $do_nick = $array[1] || $who; if (!exists $users{$do_nick}) { - &pSReply("nick $do_nick is not in user list."); + &performStrictReply("nick $do_nick is not in user list."); return; } my $crypt = $users{$do_nick}{PASS}; if (!defined $crypt) { - &pSReply("user $do_nick has no passwd set."); + &performStrictReply("user $do_nick has no passwd set."); return; } if (!&ckpasswd($array[0], $crypt)) { - &pSReply("invalid passwd for $do_nick."); + &performStrictReply("invalid passwd for $do_nick."); return; } my $mask = "$who!$user@".&makeHostMask($host); ### TODO: prevent adding multiple dupe masks? ### TODO: make &addHostMask() CMD? - &pSReply("Added $mask for $do_nick..."); + &performStrictReply("Added $mask for $do_nick..."); $users{$do_nick}{HOSTS}{$mask} = 1; return; @@ -146,7 +146,7 @@ sub process { my @array = split ' ', $message; if ($who =~ /^_default$/i) { - &pSReply("you are too eleet."); + &performStrictReply("you are too eleet."); return; } @@ -165,18 +165,18 @@ sub process { } if (!exists $users{$who} and !$first) { - &pSReply("nick $who is not in user list."); + &performStrictReply("nick $who is not in user list."); return; } if ($first) { - &pSReply("First time user... adding you as Master."); + &performStrictReply("First time user... adding you as Master."); $users{$who}{FLAGS} = "aemnorst"; } my $crypt = $users{$who}{PASS}; if (defined $crypt) { - &pSReply("user $who already has pass set."); + &performStrictReply("user $who already has pass set."); return; } @@ -187,13 +187,13 @@ sub process { if (!scalar keys %{ $users{$who}{HOSTS} }) { my $mask = "*!$user@".&makeHostMask($host); - &pSReply("Added hostmask '\002$mask\002' to $who"); + &performStrictReply("Added hostmask '\002$mask\002' to $who"); $users{$who}{HOSTS}{$mask} = 1; } $crypt = &mkcrypt($array[0]); $users{$who}{PASS} = $crypt; - &pSReply("new pass for $who, crypt $crypt."); + &performStrictReply("new pass for $who, crypt $crypt."); return; } @@ -263,7 +263,7 @@ sub process { # customized random message. my $tmp = (rand() < 0.5) ? ", $who" : ""; - &pSReply( &getRandom(keys %{ $lang{'hello'} }) . $tmp ); + &performStrictReply( &getRandom(keys %{ $lang{'hello'} }) . $tmp ); return; } diff --git a/src/UserExtra.pl b/src/UserExtra.pl index 9d27eb9..8253b89 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -64,7 +64,7 @@ sub chaninfo { my $str = sprintf("%s (%d)", $_, scalar(keys %{ $channels{$_}{''} })); push(@array, $str); } - &pSReply($reply.": ".join(', ', @array)); + &performStrictReply($reply.": ".join(', ', @array)); &ircCheck(); ### total user count. @@ -87,7 +87,7 @@ sub chaninfo { } my $chans = scalar(keys %channels); - &pSReply( + &performStrictReply( "i've cached \002$tucount\002 ". &fixPlural("user",$tucount). ", \002$uucount\002 unique ". &fixPlural("user",$uucount). ", distributed over \002$chans\002 ". @@ -166,7 +166,7 @@ sub chaninfo { if ($count) { $reply .= ". \002$count\002 has said the most with a total of \002$new{$count}\002 messages"; } - &pSReply("$reply."); + &performStrictReply("$reply."); } # Command statistics. @@ -191,7 +191,7 @@ sub cmdstats { push(@array, "\002$int\002 of $_"); } } - &pSReply("command usage include ". &IJoin(@array)."."); + &performStrictReply("command usage include ". &IJoin(@array)."."); } # Factoid extension info. xk++ @@ -215,7 +215,7 @@ sub factstats { my $type = shift(@_); &Forker("factoids", sub { - &pSReply( &CmdFactStats($type) ); + &performStrictReply( &CmdFactStats($type) ); } ); } @@ -225,9 +225,9 @@ sub karma { { nick => $target, type => "karma" }) || 0; if ($karma != 0) { - &pSReply("$target has karma of $karma"); + &performStrictReply("$target has karma of $karma"); } else { - &pSReply("$target has neutral karma"); + &performStrictReply("$target has neutral karma"); } } @@ -396,7 +396,7 @@ sub do_countrystats { # TODO: move this into a scheduler like nickometer $msgType = "private"; - &pSReply( &formListReply(0, "Country Stats ", @list) ); + &performStrictReply( &formListReply(0, "Country Stats ", @list) ); delete $cache{countryStats}; delete $cache{on_who_Hack}; @@ -467,7 +467,7 @@ sub userCommands { $retval .= sprintf(" %X", ord($_)); } - &pSReply("$arg is$retval"); + &performStrictReply("$arg is$retval"); return; } @@ -488,9 +488,9 @@ sub userCommands { # return; # } - &pSReply( crypt($args[1], $args[0]) ); + &performStrictReply( crypt($args[1], $args[0]) ); } else { - &pSReply( &mkcrypt($args[0]) ); + &performStrictReply( &mkcrypt($args[0]) ); } return; @@ -530,9 +530,9 @@ sub userCommands { return unless (&hasFlag("n")); &status("USER reload $who"); - &pSReply("reloading..."); + &performStrictReply("reloading..."); my $modules = &reloadAllModules(); - &pSReply("reloaded:$modules"); + &performStrictReply("reloaded:$modules"); return; } @@ -598,7 +598,7 @@ sub userCommands { } $reply =~ y/A-Za-z/N-ZA-Mn-za-m/; - &pSReply($reply); + &performStrictReply($reply); return; } @@ -644,7 +644,7 @@ sub userCommands { } $ratio = sprintf("%.01f", 100*$perc/($perc+$perc2) ); - &pSReply("Total CPU usage: \002$cpu_usage\002 s ... ". + &performStrictReply("Total CPU usage: \002$cpu_usage\002 s ... ". "Total used: \002$total\002 % ". "(parent/child ratio: $ratio %)" ); @@ -695,7 +695,7 @@ sub userCommands { $reply .= ". I was last disconnected for '$reason'."; } - &pSReply($reply); + &performStrictReply($reply); return; } @@ -716,7 +716,7 @@ sub userCommands { $count{'Commands'} += $cmdstats{$_}; } - &pSReply( + &performStrictReply( "Since $startString, there have been". " \002$count{'Update'}\002 ". &fixPlural("modification", $count{'Update'}). -- 2.39.2