X-Git-Url: https://ruin.nu/git/?p=NDIRC.git;a=blobdiff_plain;f=Misc.pm;h=aad40e3c36aa5f9fcfb1c5a448a87ce55d61145f;hp=bada45151b3df42dc46c3c60f289a7937021727d;hb=921132036eac2233472b1b315e4ee39f5ab17fbd;hpb=05629ec258dcfc359decc3cbc44c3345dd0eb62e diff --git a/Misc.pm b/Misc.pm index bada451..aad40e3 100644 --- a/Misc.pm +++ b/Misc.pm @@ -27,7 +27,7 @@ use NDIRC::Context; our @ISA = qw/Exporter/; -our @EXPORT = qw/valuecolor parseCommand/; +our @EXPORT = qw/valuecolor/; sub valuecolor { my $s = $_; @@ -40,49 +40,5 @@ sub valuecolor { return $s; } -sub parseCommand { - my ($msg, $server, $nick, $address, $channel, $disp,$model) = @_; - - return if $channel !~ /^#/ && $msg =~ /^~/; - $msg = ".$msg" if $channel !~ /^#/ && $msg =~ /^[^.!]/; - - my ($p,$command,$args) = ($msg =~ /^([.!~])(\S+)(?: (.+))?/); - - if ($msg =~ m{http://[\w.]+/.+?scan(_id|_grp)?=(\w+)}){ - if (!$command || $command =~ m{^http://}){ - ($p,$command,$args) = ('.','addscan',$msg); - }elsif($command ne 'addscan'){ - parseCommand (".addscan $msg", $server, $nick, $address, $channel, $disp,$model) - } - } - - return 0 unless $disp->has_command($command,$channel); - - my $reply_string; - given ($p){ - when ('!'){ - $reply_string = "privmsg $nick"; - } - when ('~'){ - $reply_string = "privmsg $channel"; - } - default { - $reply_string = "notice $nick"; - } - } - - $address =~ s/.*@(.*)/$1/; - my $c = NDIRC::Context->new({ - host => $address, - nick => $nick, - channel => $channel, - disp => $disp, - model => $model, - server => $server, - reply_string => $reply_string, - }); - - return $disp->run_command($c,$command,$args); -} 1;