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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Sep 15 10:16:17 EDT 2009


Author: fruitiex
Date: 2009-09-15 10:16:17 -0400 (Tue, 15 Sep 2009)
New Revision: 7813

Added:
   trunk/server/rcon2irc/echo-rcon.pl
   trunk/server/rcon2irc/joinmessage.pl
   trunk/server/rcon2irc/raw.pl
Modified:
   trunk/server/rcon2irc/suggestmap.pl
Log:
rcon2irc plugins by merlijn


Added: trunk/server/rcon2irc/echo-rcon.pl
===================================================================
--- trunk/server/rcon2irc/echo-rcon.pl	                        (rev 0)
+++ trunk/server/rcon2irc/echo-rcon.pl	2009-09-15 14:16:17 UTC (rev 7813)
@@ -0,0 +1,12 @@
+# Nexuiz rcon2irc plugin by Merlijn Hofstra licensed under GPL - echo-rcon.pl
+# Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
+
+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 $origin = color_dp2irc $origin;
+	out irc => 0, "PRIVMSG $config{irc_channel} :\00302* admin\017 command recieved from $origin: \00304$cmd\017";
+	return 0;
+} ],

Added: trunk/server/rcon2irc/joinmessage.pl
===================================================================
--- trunk/server/rcon2irc/joinmessage.pl	                        (rev 0)
+++ trunk/server/rcon2irc/joinmessage.pl	2009-09-15 14:16:17 UTC (rev 7813)
@@ -0,0 +1,33 @@
+# Nexuiz rcon2irc plugin by Merlijn Hofstra licensed under GPL - joinmessage.pl
+# Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
+
+# Do not use more than 5 lines here, as they will be cut off by the client.
+my @jmtext = (
+	"Welcome to this Nexuiz server",
+	"Have fun but please behave.",
+);
+
+$store{plugin_joinmessage} = \@jmtext;
+
+sub out($$@);
+
+[ dp => q{:join:(\d+):(\d+):([^:]*):(.*)} => sub {
+	my ($id, $slot, $ip, $nick) = @_;
+	my $text = $store{plugin_joinmessage};
+
+	return 0 if ( $ip =~ m/^bot$/i );
+	return 0 if defined $store{"playerid_byslot_$slot"};
+
+	foreach ( @{ $text } ) {
+		out dp => 0, "tell #$slot " . $_;
+	}
+	return 0;
+} ],
+
+[ dp => q{:part:(\d+)} => sub {
+	my ($id) = @_;
+	my $slot = $store{"playerslot_byid_$id"};
+
+	$store{"playerid_byslot_$slot"} = undef;
+	return 0;
+} ],

Added: trunk/server/rcon2irc/raw.pl
===================================================================
--- trunk/server/rcon2irc/raw.pl	                        (rev 0)
+++ trunk/server/rcon2irc/raw.pl	2009-09-15 14:16:17 UTC (rev 7813)
@@ -0,0 +1,26 @@
+# Nexuiz rcon2irc plugin by Merlijn Hofstra licensed under GPL - raw.pl
+# Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
+
+# Use this plugin with extreme caution, it allows irc-admins to modify ANYTHING on your server.
+
+# Usage: In query with the bot the raw command directs commands to the server or irc connection.
+# Example: raw dp exec server.cfg
+# Example: raw irc PRIVMSG #nexuiz: YaY!
+
+sub out($$@);
+
+[ irc => q{:(([^! ]*)![^ ]*) (?i:PRIVMSG) [^&#%]\S* :(.*)} => sub {
+	my ($hostmask, $nick, $command) = @_;
+	
+	return 0 if (($store{logins}{$hostmask} || 0) < time());
+	
+	if ($command =~ m/^raw (dp|irc) (.+)/i) {
+		out irc => 0, $2 if ($1 eq 'irc');
+		out dp => 0, $2 if ($1 eq 'dp');
+		
+		out irc => 0, "PRIVMSG $nick :command executed";
+		return -1;
+	}
+	
+	return 0;
+} ],

Modified: trunk/server/rcon2irc/suggestmap.pl
===================================================================
--- trunk/server/rcon2irc/suggestmap.pl	2009-09-15 12:44:13 UTC (rev 7812)
+++ trunk/server/rcon2irc/suggestmap.pl	2009-09-15 14:16:17 UTC (rev 7813)
@@ -6,8 +6,7 @@
 #read the suggest vote
 [ dp => q{:vote:suggested:(.+):(\d+)} => sub {
 	my ($map, $id) = @_;
-	my $nick = color_dp2irc $store{"playernick_byid_$id"};
-	$nick ||= '(console)';
+	my $nick = $store{"playernick_byid_$id"} || 'console';
 	out irc => 0, "PRIVMSG $config{irc_channel} :* map suggested: \00304$map\017 by $nick\017";
 	return 0;
 } ],



More information about the nexuiz-commits mailing list