From 96ea6300618b3a7392b7c39a9e2121b3208f06ab Mon Sep 17 00:00:00 2001 From: fruitiex Date: Tue, 20 Oct 2009 17:58:55 +0000 Subject: [PATCH] echo-rcon.pl now allows multiple instances of rcon2irc on the same server, bans.pl can echo connection attempts from banned clients (patch by merlijn) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8162 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- server/rcon2irc/bans.pl | 32 ++++++++++++++++++++++++++++++++ server/rcon2irc/echo-rcon.pl | 9 ++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 server/rcon2irc/bans.pl diff --git a/server/rcon2irc/bans.pl b/server/rcon2irc/bans.pl new file mode 100644 index 000000000..1e30bc781 --- /dev/null +++ b/server/rcon2irc/bans.pl @@ -0,0 +1,32 @@ +# Nexuiz rcon2irc plugin by Merlijn Hofstra licensed under GPL - bans.pl +# Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins. + +$store{plugin_bans}->{interval} = 300; #interval to displays bans + +sub out ($$@); +sub schedule($$); + +schedule sub { + my ($timer) = @_; + if ($store{plugin_bans}->{attempts}) { + foreach (sort keys %{ $store{plugin_bans}->{attempts} }) { + out irc => 0, "PRIVMSG $config{irc_channel} :\00305* banned client\017 \00304$_\017 was refused to connect \00304" . + $store{plugin_bans}->{attempts}->{$_} . "\017 times"; + } + $store{plugin_bans}->{attempts} = undef; + } + schedule $timer => $store{plugin_bans}->{interval};; +} => 1; + +[ dp => q{(?:\^\d)?NOTE:(?:\^\d)? banned client (\d+\.\d+\.\d+\.\d+) just tried to enter} => sub { + my ($ip) = @_; + $store{plugin_bans}->{attempts}->{$ip} += 1; + return 0; +} ], + +[ dp => q{(?:\^\d)?NOTE:(?:\^\d)? banned client (.*) has to go} => sub { + my ($name) = @_; + $name = color_dp2irc $name; + out irc => 0, "PRIVMSG $config{irc_channel} :\00305* banned client\017 $name\017 was removed from the server"; + return 0; +} ], diff --git a/server/rcon2irc/echo-rcon.pl b/server/rcon2irc/echo-rcon.pl index 4e05ecdc2..94df84f13 100644 --- a/server/rcon2irc/echo-rcon.pl +++ b/server/rcon2irc/echo-rcon.pl @@ -5,8 +5,15 @@ sub out($$@); [ dp => q{server received rcon command from (.*): (.*)} => sub { my ($origin, $cmd) = @_; - return 0 if ($origin eq $config{dp_listen}); #do not relay rcon2irc commands + my @dests = split ' ', $store{plugin_echo-rcon}->{dest}; + return 0 if grep { $_ eq $origin } @dests; #do not relay rcon2irc commands my $origin = color_dp2irc $origin; out irc => 0, "PRIVMSG $config{irc_channel} :\00302* admin\017 command recieved from $origin: \00304$cmd\017"; return 0; } ], + +[ dp => q{"log_dest_udp" is "([^"]*)" \["[^"]*"\]} => sub { + my ($dest) = @_; + $store{plugin_echo-rcon}->{dest} = $dest; + return 0; +} ], -- 2.39.2