File: raw.pl

package info (click to toggle)
nexuiz-data 2.5.2-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,294,288 kB
  • sloc: ansic: 10,523; perl: 6,845; sh: 2,188; java: 1,417; xml: 969; lisp: 519; ruby: 136; makefile: 125
file content (26 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
} ],