From 565ece6e27fa54253934518cc8c69ecfac9487e4 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sun, 17 May 2009 12:52:22 +0200 Subject: [PATCH] Converted .anon for def --- Commands/Def.pm | 43 +++++++++++++++++++++++++++++++++++++++++++ Def.pm | 18 +----------------- database/roles.sql | 4 ++++ ndawn.pl | 6 ++++-- 4 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 Commands/Def.pm diff --git a/Commands/Def.pm b/Commands/Def.pm new file mode 100644 index 0000000..7931033 --- /dev/null +++ b/Commands/Def.pm @@ -0,0 +1,43 @@ +#************************************************************************** +# 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 * +# the Free Software Foundation; either version 2 of the License, or * +# (at your option) any later version. * +# * +# This program is distributed in the hope that it will be useful, * +# but WITHOUT ANY WARRANTY; without even the implied warranty of * +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# GNU General Public License for more details. * +# * +# You should have received a copy of the GNU General Public License * +# along with this program; if not, write to the * +# Free Software Foundation, Inc., * +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +#**************************************************************************/ + +package NDIRC::Commands::Def; + +use strict; +use warnings; +use feature ':5.10'; + +use Moose; +use MooseX::MethodAttributes; + +sub anon + : Help(syntax: .anon nick message) + : Type(def) + : ACL(irc_anondef) +{ + my ($self,$c,$msg) = @_; + + my ($target,$mess) = $msg =~ /^(\S+) (.*)$/ or die 'ARGS'; + + $c->message("msg $target", "$mess"); + $c->message("msg ".$c->channel, "$target << $mess"); +} + +1; + diff --git a/Def.pm b/Def.pm index d3786a2..7dbec8b 100644 --- a/Def.pm +++ b/Def.pm @@ -29,7 +29,7 @@ require Exporter; our @ISA = qw/Exporter/; our @EXPORT = qw/showCall setType takeCall covCall ignoreCall - defcall anon setDefPrio setCalc getCalc/; + defcall setDefPrio setCalc getCalc/; sub showCall { my ($msg,$command) = @_; @@ -209,22 +209,6 @@ sub defcall { } } -sub anon { - my ($msg,$command) = @_; - my ($target,$mess); - if (defined $msg && $msg =~ /^(\S+) (.+)$/){ - $target = $1; - $mess = $2; - }else{ - $ND::server->command("notice $ND::nick Usage: $command nick message"); - return; - } - if (dc()){ - $ND::server->command("msg $target ".chr(2).$mess); - $ND::server->command("msg $ND::target ".chr(3)."3$1 << $2"); - } -} - sub setCalc { my ($msg,$command) = @_; my ($id, $calc); diff --git a/database/roles.sql b/database/roles.sql index fb3f64d..9024d30 100644 --- a/database/roles.sql +++ b/database/roles.sql @@ -28,6 +28,7 @@ INSERT INTO roles VALUES('irc_sethostile'); INSERT INTO roles VALUES('irc_setnick'); INSERT INTO roles VALUES('irc_setally'); INSERT INTO roles VALUES('irc_setchannel'); +INSERT INTO roles VALUES('irc_anondef'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_nick'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_intel'); @@ -57,6 +58,7 @@ INSERT INTO group_roles (gid,role) VALUES(1,'irc_sethostile'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_setnick'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_setally'); INSERT INTO group_roles (gid,role) VALUES(1,'irc_setchannel'); +INSERT INTO group_roles (gid,role) VALUES(1,'irc_anondef'); INSERT INTO group_roles (gid,role) VALUES(2,'irc_gs'); INSERT INTO group_roles (gid,role) VALUES(2,'irc_scan'); @@ -88,6 +90,7 @@ INSERT INTO group_roles (gid,role) VALUES(3,'irc_sethostile'); INSERT INTO group_roles (gid,role) VALUES(3,'irc_setnick'); INSERT INTO group_roles (gid,role) VALUES(3,'irc_setally'); INSERT INTO group_roles (gid,role) VALUES(3,'irc_setchannel'); +INSERT INTO group_roles (gid,role) VALUES(3,'irc_anondef'); INSERT INTO group_roles (gid,role) VALUES(4,'irc_points_others'); INSERT INTO group_roles (gid,role) VALUES(4,'irc_a'); @@ -106,6 +109,7 @@ INSERT INTO group_roles (gid,role) VALUES(6,'irc_getships'); INSERT INTO group_roles (gid,role) VALUES(6,'irc_getfleet'); INSERT INTO group_roles (gid,role) VALUES(6,'irc_d'); INSERT INTO group_roles (gid,role) VALUES(6,'irc_sethostile'); +INSERT INTO group_roles (gid,role) VALUES(6,'irc_anondef'); INSERT INTO group_roles (gid,role) VALUES(8,'irc_scanreqs'); INSERT INTO group_roles (gid,role) VALUES(8,'irc_anonscan'); diff --git a/ndawn.pl b/ndawn.pl index 49a7a07..cd935aa 100644 --- a/ndawn.pl +++ b/ndawn.pl @@ -55,10 +55,12 @@ my $TICK = $DBH->selectrow_array('SELECT tick()'); my $disp = new NDIRC::Dispatcher; -$disp->load('Basic','PA','Channel','Scans','Quotes','Members','Usermgm','Intel'); +$disp->load('Basic','PA','Channel','Quotes','Members','Usermgm','Intel','Def'); $ND::scanchan = '#testarmer'; -$disp->add_channel('#testarlite', ['pub','help','channel','def']); +$ND::defchan = '#testarlite'; +$ND::memchan = '#testarmer'; +$disp->add_channel($ND::defchan, ['pub','help','channel','def']); $disp->add_channel($ND::scanchan, ['pub','help','channel','scan','member']); $disp->add_channel('pm', ['pub','help','pm']); -- 2.39.2