]> ruin.nu Git - NDIRC.git/blobdiff - Misc.pm
Need to send a real value to execute when the role isn't available
[NDIRC.git] / Misc.pm
diff --git a/Misc.pm b/Misc.pm
index 37501f20d3944b5ef244e66ff24c1a0ca25dae15..aad40e3c36aa5f9fcfb1c5a448a87ce55d61145f 100644 (file)
--- a/Misc.pm
+++ b/Misc.pm
 package NDIRC::Misc;
 use strict;
 use warnings;
-require Exporter;
-
-our @ISA = qw/Exporter/;
+use feature ':5.10';
 
-our @EXPORT = qw/valuecolor addCommand parseCommand/;
+require Exporter;
 
-our %channels;
-our %commands;
+use NDIRC::Context;
 
-$channels{'#def-ndawn'} = ['all','member','def'];
-$channels{'#nd'} = ['all','member'];
-$channels{'#ndef'} = ['all','member','scan'];
-$channels{'#nd-day'} = ['all','member'];
-$channels{'#ndintel'} = ['all','member'];
-$channels{'#nd-officers'} = ['all','member'];
-$channels{'#ndawn'} = ['all'];
-$channels{'pm'} = ['pm'];
+our @ISA = qw/Exporter/;
 
-$ND::defchan = "#def-ndawn";
-$ND::memchan = "#nd";
-$ND::scanchan = "#ndef";
-$ND::bcchan = "#nd-day";
-$ND::intelchan = "#ndintel";
-$ND::officerchan = "#nd-officers";
-$ND::communitychan = "#ndawn";
-$ND::pubchan = "#newdawn";
+our @EXPORT = qw/valuecolor/;
 
 sub valuecolor {
        my $s = $_;
@@ -57,39 +40,5 @@ sub valuecolor {
        return $s;
 }
 
-sub addCommand {
-       my ($command, $list, $func) = @_;
-       $commands{$command} = {fun => $func, acc => $list};
-}
-
-sub parseCommand {
-       my ($msg,$channel) = @_;
-       if ($msg =~ /^(\w+)(?: (.+))?$/){
-               my $c = $1;
-               my $args = $2;
-               my @k = keys %commands;
-               if (exists $commands{$c}){
-                       my $a = $commands{$c}->{acc};
-                       my $b = (exists $channels{lc $channel} ? $channels{lc $channel} : ['all']);
-                       if (intersect($a,$b) > 0){
-                               $commands{$c}->{fun}->($args,$c);
-                               return 1;
-                       }
-               }
-       }
-       return 0;
-}
-
-sub intersect {
-       my ($a, $b) = @_;
-       my %union;
-       foreach my $e (@{$a}) { $union{$e} = 1 }
-
-       my %isect;
-       foreach my $e (@{$b}) {
-            $isect{$e} = 1 if ( exists $union{$e} )
-       }
-       return keys %isect;
-}
 
 1;