1 # Nexuiz rcon2irc plugin by Merlijn Hofstra licensed under GPL - qnetauth.pl
2 # Place this file inside the same directory as rcon2irc.pl and add the full filename to the plugins.
4 # This plugin will automatically authenticate users who have a login for Quakenet (on the Q bot).
5 # If you login to the Q bot, this plugin will pick this up and users in the list below can automatically
6 # execute commands on the rcon2irc bot.
7 { my @users = qw{merlijn};
9 $store{plugin_qnetauth}->{users} = \@users; }
14 if (defined %config) {
17 out irc => 0, "PRIVMSG Q :users " . $config{irc_channel};
18 schedule $timer => 300;;
22 # Catch joins of people in a channel the bot is in and catch our own joins of a channel
23 [ irc => q{:(([^! ]*)![^ ]*) JOIN (#.+)} => sub {
24 my ($hostmask, $nick, $chan) = @_;
25 my $qa = $store{plugin_qnetauth};
27 if ($nick eq $config{irc_nick}) {
28 out irc => 0, "PRIVMSG Q :users $chan"; # get auths for all users
30 $qa->{hosts}->{$nick} = $hostmask;
31 out irc => 0, "PRIVMSG Q :whois $nick"; # get auth for single user
37 # Catch response of users request
38 [ irc => q{:Q!TheQBot@CServe.quakenet.org NOTICE [^:]+ :[@\+\s]?(\S+)\s+(\S+)\s*(\S*)\s*\((.*)\)} => sub {
39 my ($nick, $username, $flags, $host) = @_;
40 my $qa = $store{plugin_qnetauth};
42 foreach my $user (@{ $qa->{users} }) {
43 $store{logins}{"$nick!$host"} = time() + 600 if ($user eq $username);
49 # Catch response of whois request
50 [ irc => q{:Q!TheQBot@CServe.quakenet.org NOTICE [^:]+ :-Information for user (.*) \(using account (.*)\):} => sub {
51 my ($nick, $username) = @_;
52 my $qa = $store{plugin_qnetauth};
54 foreach my $user (@{ $qa->{users} }) {
55 if ($user eq $username) {
56 my $hostmask = $qa->{hosts}->{$nick};
57 $store{logins}{$hostmask} = time() + 600;