summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2016-02-17 11:44:00 -0700
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2016-02-17 11:44:00 -0700
commitff74b7a412dc79c6bcc137b7809b2207bc9ad5f9 (patch)
tree33500f92e65ec30655a1d6b59c6d22f3b72d7b4b
parente9383d0aaf0e4faedd131fbfc831e928fe189774 (diff)
Add a ;nicks command to track down known nicks, searching by host. Incomplete / much more work to be done.
-rw-r--r--lib/ASM/Commander.pm29
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