[nexuiz-commits] r8162 - trunk/server/rcon2irc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Oct 20 13:58:55 EDT 2009


Author: fruitiex
Date: 2009-10-20 13:58:55 -0400 (Tue, 20 Oct 2009)
New Revision: 8162

Added:
   trunk/server/rcon2irc/bans.pl
Modified:
   trunk/server/rcon2irc/echo-rcon.pl
Log:
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)


Added: trunk/server/rcon2irc/bans.pl
===================================================================
--- trunk/server/rcon2irc/bans.pl	                        (rev 0)
+++ trunk/server/rcon2irc/bans.pl	2009-10-20 17:58:55 UTC (rev 8162)
@@ -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;
+} ],

Modified: trunk/server/rcon2irc/echo-rcon.pl
===================================================================
--- trunk/server/rcon2irc/echo-rcon.pl	2009-10-20 15:34:32 UTC (rev 8161)
+++ trunk/server/rcon2irc/echo-rcon.pl	2009-10-20 17:58:55 UTC (rev 8162)
@@ -5,8 +5,15 @@
 
 [ 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;
+} ],



More information about the nexuiz-commits mailing list