r4386 - trunk/Docs/server/rcon2irc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 6 15:45:25 EDT 2008


Author: div0
Date: 2008-09-06 15:45:25 -0400 (Sat, 06 Sep 2008)
New Revision: 4386

Modified:
   trunk/Docs/server/rcon2irc/rbiserver.pl
   trunk/Docs/server/rcon2irc/rcon2irc.pl
Log:
make rcon2irc support the new join command in eventlog


Modified: trunk/Docs/server/rcon2irc/rbiserver.pl
===================================================================
--- trunk/Docs/server/rcon2irc/rbiserver.pl	2008-09-06 19:33:14 UTC (rev 4385)
+++ trunk/Docs/server/rcon2irc/rbiserver.pl	2008-09-06 19:45:25 UTC (rev 4386)
@@ -9,19 +9,6 @@
 	close $fh;
 }
 
-# call the log analyzer at the end of a match
-[ dp => q{:end} => sub {
-	system(q{
-		for X in ~/Nexuiz/home/.nexuiz/extramaps/data/*.log; do
-			if [ x"`tail -n 1 "$X"`" = x":gameover" ]; then
-				ssh hector 'l=$HOME/.nexuiz/server-remote-$RANDOM.log; cat >"$l"; ~/.nexuiz/logspam/addlogs-processonly.sh "$l"' < "$X"
-				rm -f "$X"
-			fi
-		done
-	});
-	return 0;
-} ],
-
 # the AOL calendar
 [ dp => q{\001(.*?)\^7: d} => sub {
 	my $aoltime = time() - 746748000;
@@ -87,3 +74,41 @@
 	$store{rbi_totalvotes} = $totalvotes;
 	return 0;
 } ],
+[ dp => q{pure: -(\S+) (.*)} => sub {
+	my ($status, $nick) = @_;
+	$nick = color_dp2irc $nick;
+	out irc => 0, "PRIVMSG $config{irc_channel} :\001ACTION thinks $nick is $status\001";
+	return 0;
+} ],
+[ dp => q{:recordset:(\d+):.*} => sub {
+	my ($id) = @_;
+	my $ip = $store{"playerip_$id"};
+	my $slot = $store{"playerslot_$id"};
+	my $name = $config{irc_nick};
+	$name =~ s/Nex//; # haggerNexCTF -> haggerCTF
+	$ip =~ s/\./-/g;
+	my $pattern = "/nexuiz/data/home/.nexuiz/extramaps-$name/sv_autodemos/????-??-??_??-??_$store{map}_${slot}_$ip-*.dem";
+	if(my @result = glob $pattern)
+	{
+		print "Cleaning up demos: protecting $result[0]\n";
+		chmod 0444, @result;
+	}
+	else
+	{
+		print "Record set but could not find the demo.\n";
+	}
+	return 0;
+} ],
+# delete demos at the end of the match
+[ dp => q{:end} => sub {
+	my $name = $config{irc_nick};
+	$name =~ s/Nex//; # haggerNexCTF -> haggerCTF
+	my $pattern = "/nexuiz/data/home/.nexuiz/extramaps-$name/sv_autodemos/*.dem";
+	for(glob $pattern)
+	{
+		next if not -w $_;   # protected demo (by record, or other markers)
+		next if -M $_ > 0.1; # not old enough yet
+		print "Cleaning up demos: deleting $_\n";
+		unlink $_;
+	}
+} ],

Modified: trunk/Docs/server/rcon2irc/rcon2irc.pl
===================================================================
--- trunk/Docs/server/rcon2irc/rcon2irc.pl	2008-09-06 19:33:14 UTC (rev 4385)
+++ trunk/Docs/server/rcon2irc/rcon2irc.pl	2008-09-06 19:45:25 UTC (rev 4386)
@@ -991,10 +991,12 @@
 	} ],
 
 	# chat: Nexuiz server -> IRC channel, nick set
-	[ dp => q{:join:(\d+):(?:player|bot):(.*)} => sub {
-		my ($id, $nick) = @_;
+	[ dp => q{:join:(\d+):(\d+):([^:]*):(.*)} => sub {
+		my ($id, $slot, $ip, $nick) = @_;
 		$nick = color_dp2irc $nick;
 		$store{"playernick_$id"} = $nick;
+		$store{"playerslot_$id"} = $slot;
+		$store{"playerip_$id"} = $ip;
 		return 0;
 	} ],
 




More information about the nexuiz-commits mailing list