From 6cf8963cfc8dc562f7ec8f3c5d538f05a0e7a0be Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Thu, 16 Aug 2012 06:58:14 +0000 Subject: Disabled message-sending-throttling Added a command to view uptime/cpu/ram usage statistics The hilight/dehilight commands can accept a comma-separated list of nicks The exempt command is now deprecated A restriction-system has been added to replace the old exemption system, and also includes additional restrictions that can be added, such as "don't let this account use !ops" Added a plugin command, so other bots can have ASM generate alerts Updated users and flags Updated channel hilights Replaced code that shows up in several places to split a long privmsg into two parts with a utility function Added a detection class for fuzzy-matching against a nick blacklist Fixed some major memory leaks, the bot stays stable around 30MB rather than shooting up to 65MB after a couple of days The bot now uses nickserv REGAIN instead of ghost/release/nick Added channel modes, ban lists, and quiet lists to state tracking Ignore chanserv in netsplit detections Track time/setter when a topic is changed in a channel Monitor if a channel is set +r and is still +r 45 minutes later, if so generate an alert Print status and how long it took to sync once the bot has started and synced, and warn about failed syncings. --- modules/util.pl | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'modules/util.pl') diff --git a/modules/util.pl b/modules/util.pl index 109882b..7a111b5 100644 --- a/modules/util.pl +++ b/modules/util.pl @@ -137,6 +137,18 @@ sub flood_process { } } +# If $tgts="#antispammeta" that's fine, and if $tgts = ["#antispammeta", "##linux-ops"] that's cool too +sub sendLongMsg { + my ($module, $conn, $tgts, $txtz) = @_; + if (length($txtz) <= 380) { + $conn->privmsg($tgts, $txtz); + } else { + my $splitpart = rindex($txtz, " ", 380); + $conn->privmsg($tgts, substr($txtz, 0, $splitpart)); + $conn->privmsg($tgts, substr($txtz, $splitpart)); + } +} + sub getAlert { my ($module, $c, $risk, $t) = @_; my @disable = (); @@ -183,4 +195,33 @@ sub dprint { print $text if $::debug; } +sub notRestricted { + my ($module, $nick, $restriction) = @_; + $nick = lc $nick; + my $host = $::sn{$nick}{host}; + my $account = lc $::sn{$nick}{account}; + my $ret = 1; + if (defined($::restrictions->{nicks}->{nick}->{$nick})) { + if (defined($::restrictions->{nicks}->{nick}->{$nick}->{$restriction})) { + $ret= 0; + } + } + if ((defined($host)) && (defined($account))) { + if (defined($::restrictions->{accounts}->{account}->{$account})) { + if (defined($::restrictions->{accounts}->{account}->{$account}->{$restriction})) { + $ret= 0; + } + } + if (defined($::restrictions->{hosts}->{host}->{$host})) { + if (defined($::restrictions->{hosts}->{host}->{$host}->{$restriction})) { + $ret= 0; + } + } + } + if (($ret == 0) && ($::debugx{restrictions})) { + print "Restriction $restriction found for $nick\n"; + } + return $ret; +} + return 1; -- cgit v1.2.3