1 #**************************************************************************
2 # Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu> *
4 # This program is free software; you can redistribute it and/or modify *
5 # it under the terms of the GNU General Public License as published by *
6 # the Free Software Foundation; either version 2 of the License, or *
7 # (at your option) any later version. *
9 # This program is distributed in the hope that it will be useful, *
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 # GNU General Public License for more details. *
14 # You should have received a copy of the GNU General Public License *
15 # along with this program; if not, write to the *
16 # Free Software Foundation, Inc., *
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 #**************************************************************************/
19 package NDIRC::Delling;
30 my $TICK = $DBH->selectrow_array('SELECT tick()');
33 my ($sender, $heap, $who, $where, $msg) = @_[SENDER, HEAP, ARG0 .. ARG2];
34 my ($nick,$username,$address) = ( split /[!@]/, $who );
35 my $channel = $where->[0];
37 my $irc = $sender->get_heap();
39 #$irc->yield(privmsg => $channel, "Authed? " . $irc->is_nick_authed($nick));
41 if ($msg =~ /^(\S+): (.+)$/ && $heap->{disp}->has_command('anon',$channel)){
44 unless ($irc->is_channel_member($channel,$1) || /(Constructing|Researching)/){
45 $msg = ".anon $_ $text";
49 if (parseCommand($msg,$irc,$nick,$address,$channel,$heap->{disp},DB())){
50 #Command parsed and run successfully
56 my ($sender, $heap, $who, $where, $msg) = @_[SENDER, HEAP, ARG0 .. ARG2];
57 my ($nick,$username,$address) = ( split /[!@]/, $who );
58 my $irc = $sender->get_heap();
60 if (parseCommand($msg,$irc,$nick,$address,'pm',$heap->{disp},DB())){
61 #Command parsed and run successfully
66 my ($sender, $heap, $who, $channel) = @_[SENDER, HEAP, ARG0 .. ARG1];
67 my ($nick,$username,$address) = ( split /[!@]/, $who );
68 my $irc = $sender->get_heap();
70 if($heap->{disp}->has_command('voice',$channel)){
72 my $flags = $dbh->prepare_cached(q{
75 JOIN groupmembers g USING (uid)
76 JOIN channel_group_flags gf USING (gid)
77 WHERE u.hostmask = $1 AND channel = $2 AND flag IN ('o','v');
79 $flags->execute($address, $channel);
82 while (my ($flag) = $flags->fetchrow()){
87 $irc->yield(mode => $channel, $mode, @who) if $mode;
92 my ($kernel,$heap) = @_[KERNEL,HEAP];
93 print 'Time: ' . time() . ' Lag: ' . $heap->{connector}->lag() . "\n";
94 $kernel->delay( refresh => 60 );