X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ndawn.pl;h=d61640d4c6c068e82c9ae1653b0d824ea6d2da8a;hb=fb91afb326b44a3e46fb92b060696aabc343e1cc;hp=ffb7e5851a9ec17c1c396af7722d7887b6290a49;hpb=c6964887c87acd5769ec90ce8734407f74433fc7;p=NDIRC.git diff --git a/ndawn.pl b/ndawn.pl index ffb7e58..d61640d 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 * @@ -55,25 +55,44 @@ my $TICK = $DBH->selectrow_array('SELECT tick()'); my $disp = new NDIRC::Dispatcher; -$disp->load('Basic','PA'); +$disp->load('Basic','PA','Channel','Scans','Quotes'); -$disp->add_channel('#testarlite', ['pub','help']); -$disp->add_channel('#testarmer', ['pub','help']); +$ND::scanchan = '#testarmer'; +$disp->add_channel('#testarlite', ['pub','help','channel']); +$disp->add_channel($ND::scanchan, ['pub','help','channel','scan']); +$disp->add_channel('pm', ['pub','help','pm']); sub event_pubmsg { my ($server, $msg, $nick, $address, $channel) = @_; - if (parseCommand($msg,$server,$nick,$address,$channel,$disp,DB())){ - #Command parsed and run successfully - } + 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 + } + }; + print $@ if $@; } sub event_privmsg { my ($server, $msg, $nick, $address) = @_; - if (parseCommand($msg,$server,$nick,$address,'pm',$disp,DB())){ - #Command parsed and run successfully - } + eval { + if (parseCommand($msg,$server,$nick,$address,'pm',$disp,DB())){ + #Command parsed and run successfully + } + }; + print $@ if $@; } sub refresh {