1 # Xonotic rcon2irc plugin by Merlijn Hofstra licensed under GPL - showlogins.pl
2 # Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
5 show_success => 1, # only for logins to the irc bot
6 show_failed => 1, # only for logins to the irc bot
7 show_rcon_failure => 1,
9 ); $store{plugin_showlogins} = \%sl; }
14 if (defined %config) {
17 if ($store{plugin_showlogins}->{failed_attempts}) {
20 my @hostmasks = grep !$temp{$_}++, @{ $store{plugin_showlogins}->{failed_attempts} };
22 foreach my $mask (@hostmasks) {
24 foreach (@{ $store{plugin_showlogins}->{failed_attempts} }) {
25 $count++ if ($_ eq $mask);
28 out irc => 0, "PRIVMSG $config{irc_channel} :\00305* login failed\017 \00304$mask\017 tried to become an IRC admin \00304$count\017 times";
31 $store{plugin_showlogins}->{failed_attempts} = undef;
34 if ($store{plugin_showlogins}->{rcon_fail}) {
36 my @names = grep !$temp{$_}++, @{ $store{plugin_showlogins}->{rcon_fail} };
38 foreach my $name (@names) {
40 foreach (@{ $store{plugin_showlogins}->{rcon_fail} }) {
41 $count++ if ($_ eq $name);
44 out irc => 0, "PRIVMSG $config{irc_channel} :\00305* login failed\017 \00304$name\017 tried to use rcon commands \00304$count\017 times";
47 $store{plugin_showlogins}->{rcon_fail} = undef;
50 schedule $timer => $store{plugin_showlogins}->{failed_interval};;
54 [ irc => q{:(([^! ]*)![^ ]*) (?i:PRIVMSG) [^&#%]\S* :(.*)} => sub {
55 my ($hostmask, $nick, $command) = @_;
56 my $sl = $store{plugin_showlogins};
58 if ($command eq "login $config{irc_admin_password}") {
59 out irc => 0, "PRIVMSG $config{irc_channel} :\00310* login\017 $nick is now logged in as an IRC admin" if ($sl->{show_success});
63 if ($command =~ m/^login/i && $sl->{show_failed}) {
64 push @{ $store{plugin_showlogins}->{failed_attempts} }, $hostmask;
70 # failed rcon attempts
71 [ dp => q{server denied rcon access to (.*)} => sub {
72 my ($name) = map { color_dp2irc $_ } @_;
73 my $sl = $store{plugin_showlogins};
75 if ($sl->{show_rcon_failure}) {
76 push @{ $store{plugin_showlogins}->{rcon_fail} }, $name