diff options
Diffstat (limited to 'lib/ASM')
| -rw-r--r-- | lib/ASM/Commander.pm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/ASM/Commander.pm b/lib/ASM/Commander.pm index a0a5179..b9c8e28 100644 --- a/lib/ASM/Commander.pm +++ b/lib/ASM/Commander.pm @@ -143,6 +143,9 @@ my $cmdtbl = { '^;falsematch\b' => { 'flag' => 's', 'cmd' => \&cmd_falsematch }, + '^;nicks (?<nick>\S+)\s*$' => { + 'flag' => 's', + 'cmd' => \&cmd_nicks }, }; sub new { @@ -1037,4 +1040,30 @@ sub cmd_falsematch { $conn->privmsg($event->replyto, 'To whitelist false matches for the impersonation check, have someone with the "a" flag run ";restrict nick LegitimateNickGoesHere +nonickbl_impersonate". Contact ilbelkyr if this issue reoccurs.'); } + +sub cmd_nicks { + my ($conn, $event) = @_; + my $nick = $+{nick}; + if (!defined $::db) { + $conn->privmsg($event->replyto, "I am set to run without a database, fool."); + return; + } + my $DB = $::db->{DBH_LOG}; + my $doit = sprintf ("select distinct nick from joins as v1 + inner join ( + select distinct host from joins where nick=%s + and host not like %s + and host <> %s + ) as v2 + on v1.host = v2.host + where v1.nick not like %s + ", + $DB->quote($nick), + $DB->quote('gateway/%/session'), + $DB->quote('127.0.0.1'), + $DB->quote('guest%') + ); + my $result = $DB->selectcol_arrayref( $doit ); + $conn->privmsg($event->replyto, "Results for $nick: " . ASM::Util->commaAndify(sort @$result)); +} # vim: ts=8:sts=8:sw=8:noexpandtab |
