]> git.xonotic.org Git - xonotic/xonotic.git/blob - server/rcon2irc/raw.pl
Merge branch 'master' into divVerent/crypto2
[xonotic/xonotic.git] / server / rcon2irc / raw.pl
1 # Xonotic rcon2irc plugin by Merlijn Hofstra licensed under GPL - raw.pl
2 # Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
3
4 # Use this plugin with extreme caution, it allows irc-admins to modify ANYTHING on your server.
5
6 # Usage: In query with the bot the raw command directs commands to the server or irc connection.
7 # Example: raw dp exec server.cfg
8 # Example: raw irc PRIVMSG #xonotic: YaY!
9
10 sub out($$@);
11
12 [ irc => q{:(([^! ]*)![^ ]*) (?i:PRIVMSG) [^&#%]\S* :(.*)} => sub {
13         my ($hostmask, $nick, $command) = @_;
14         
15         return 0 if (($store{logins}{$hostmask} || 0) < time());
16         
17         if ($command =~ m/^raw (dp|irc) (.+)/i) {
18                 out irc => 0, $2 if ($1 eq 'irc');
19                 out dp => 0, $2 if ($1 eq 'dp');
20                 
21                 out irc => 0, "PRIVMSG $nick :command executed";
22                 return -1;
23         }
24         
25         return 0;
26 } ],