]> ruin.nu Git - NDIRC.git/commitdiff
Converted .anon for def
authorMichael Andreen <harv@ruin.nu>
Sun, 17 May 2009 10:52:22 +0000 (12:52 +0200)
committerMichael Andreen <harv@ruin.nu>
Sun, 17 May 2009 10:52:22 +0000 (12:52 +0200)
Commands/Def.pm [new file with mode: 0644]
Def.pm
database/roles.sql
ndawn.pl

diff --git a/Commands/Def.pm b/Commands/Def.pm
new file mode 100644 (file)
index 0000000..7931033
--- /dev/null
@@ -0,0 +1,43 @@
+#**************************************************************************
+#   Copyright (C) 2009 by Michael Andreen <harvATruinDOTnu>               *
+#                                                                         *
+#   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", "<b>$mess</b>");
+       $c->message("msg ".$c->channel, "<c03>$target << $mess</c>");
+}
+
+1;
+
diff --git a/Def.pm b/Def.pm
index d3786a25bcc4badefb679c935087242ce7e112c2..7dbec8b1f761906ddc9b83ab80622d596b76524e 100644 (file)
--- 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);
index fb3f64d59afc487ffe694edc434bf0ff7cd64744..9024d30d895a16c01e617455b0c5b6b7029138df 100644 (file)
@@ -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');
index 49a7a079c92cf8ffce28050bdd3dae5ca5dde417..cd935aae7bc2728ff0825c07a9fc08cab64baa76 100644 (file)
--- 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']);