From: Michael Andreen Date: Tue, 12 May 2009 21:56:12 +0000 (+0200) Subject: Converted sendScan and called it anon for scanners too X-Git-Url: https://ruin.nu/git/%3CTMPL_VAR%20NAME=PAGE%3E?a=commitdiff_plain;h=df43148278c85c28726accbec2421688260661b7;p=NDIRC.git Converted sendScan and called it anon for scanners too --- diff --git a/Commands/Scans.pm b/Commands/Scans.pm index 1f5f347..2747acb 100644 --- a/Commands/Scans.pm +++ b/Commands/Scans.pm @@ -1,5 +1,5 @@ #************************************************************************** -# Copyright (C) 2008 by Michael Andreen * +# Copyright (C) 2009 by Michael Andreen * # * # This program is free software; you can redistribute it and/or modify * # it under the terms of the GNU General Public License as published by * @@ -186,4 +186,16 @@ SELECT ship,amount FROM fleet_ships WHERE fid = $1 ORDER BY num . "($scan->{scan_id} pt: $scan->{tick}): $text"); } +sub anon + : Help(syntax: .anon nick message) + : Type(scan) + : ACL(irc_anonscan) +{ + my ($self, $c, $msg) = @_; + my ($target,$mess) = $msg =~ /^(\S+) (.*)$/ or die 'ARGS'; + + $c->message("msg $target", "$mess (reply with /msg $ND::scanchan)"); + $c->message("msg $ND::scanchan", "$target << $mess"); +} + 1; diff --git a/Scans.pm b/Scans.pm index a22983d..2bd6795 100644 --- a/Scans.pm +++ b/Scans.pm @@ -25,7 +25,7 @@ require Exporter; our @ISA = qw/Exporter/; -our @EXPORT = qw/addScan addScanGroup sendScan/; +our @EXPORT = qw/addScan addScanGroup/; sub addScan { my ($id,$verbose) = @_; @@ -68,21 +68,6 @@ sub addScanGroup { } } -sub sendScan { - my ($msg, $command) = @_; - my ($target,$mess); - if (defined $msg && $msg =~ /^(\S+) (.*)$/){ - $target = $1; - $mess = $2; - }else{ - $ND::server->command("notice $ND::nick syntax: $command nick message"); - return; - } - if (scanner()){ - $ND::server->command("msg $target ".chr(2).$mess.chr(3)."4 (reply with /msg $ND::scanchan)"); - $ND::server->command("msg $ND::target ${ND::C}3$target << $mess"); - } -} diff --git a/database/roles.sql b/database/roles.sql index 999ae1f..87dd813 100644 --- a/database/roles.sql +++ b/database/roles.sql @@ -5,12 +5,14 @@ INSERT INTO roles VALUES('irc_masterinvite'); INSERT INTO roles VALUES('irc_gs'); INSERT INTO roles VALUES('irc_scanreqs'); INSERT INTO roles VALUES('irc_scan'); +INSERT INTO roles VALUES('irc_anonscan'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_nick'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_intel'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_masterop'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_masterinvite'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_scanreqs'); +INSERT INTO group_roles (gid,role) VALUES(1,'irc_anonscan'); INSERT INTO group_roles (gid,role) VALUES(2,'irc_gs'); INSERT INTO group_roles (gid,role) VALUES(2,'irc_scan'); @@ -19,6 +21,8 @@ INSERT INTO group_roles (gid,role) VALUES(3,'irc_p_nick'); INSERT INTO group_roles (gid,role) VALUES(3,'irc_masterop'); INSERT INTO group_roles (gid,role) VALUES(3,'irc_masterinvite'); INSERT INTO group_roles (gid,role) VALUES(3,'irc_scanreqs'); +INSERT INTO group_roles (gid,role) VALUES(3,'irc_anonscan'); + INSERT INTO group_roles (gid,role) VALUES(5,'irc_p_nick'); INSERT INTO group_roles (gid,role) VALUES(5,'irc_p_intel'); @@ -26,6 +30,7 @@ INSERT INTO group_roles (gid,role) VALUES(5,'irc_p_intel'); INSERT INTO group_roles (gid,role) VALUES(6,'irc_p_intel'); INSERT INTO group_roles (gid,role) VALUES(8,'irc_scanreqs'); +INSERT INTO group_roles (gid,role) VALUES(8,'irc_anonscan'); INSERT INTO group_roles (gid,role) VALUES(18,'irc_p_nick'); INSERT INTO group_roles (gid,role) VALUES(18,'irc_p_intel'); diff --git a/ndawn.pl b/ndawn.pl index 76fca28..d805d75 100644 --- a/ndawn.pl +++ b/ndawn.pl @@ -1,5 +1,5 @@ #************************************************************************** -# Copyright (C) 2008 by Michael Andreen * +# Copyright (C) 2009 by Michael Andreen * # * # This program is free software; you can redistribute it and/or modify * # it under the terms of the GNU General Public License as published by * @@ -66,6 +66,17 @@ sub event_pubmsg { my ($server, $msg, $nick, $address, $channel) = @_; eval { + if ($msg =~ /^(\S+): (.+)$/ && $disp->has_command('anon',$channel)){ + my $_ = $1; + my $text = $2; + my $channel = $server->channel_find($channel); + my $nick = $channel->nick_find($1); + unless ($nick || /(Constructing|Researching)/){ + print ".anon $_ $text"; + $msg = ".anon $_ $text"; + } + + } if (parseCommand($msg,$server,$nick,$address,$channel,$disp,DB())){ #Command parsed and run successfully }