1 #**************************************************************************
2 # Copyright (C) 2008 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 #**************************************************************************/
20 package NDIRC::Commands::Channel;
27 use MooseX::MethodAttributes;
30 : Alias(qw/deop voice devoice/)
31 : Help(syntax: .op [nicks] | Gives op to the specified nicks, or yourself if no command is given)
34 my ($self,$c,$msg) = @_;
36 my ($access) = $self->name =~ /(op|voice)/;
41 $where = "OR f.name = 'auto_$access'";
45 SELECT DISTINCT c.name FROM users u
46 JOIN groupmembers g ON g.uid = u.uid
47 JOIN channel_group_flags gf ON g.gid = gf.group
48 JOIN channels c ON gf.channel = c.id
49 JOIN channel_flags f ON f.id = gf.flag
50 WHERE u.hostmask ILIKE ? AND c.name = ? AND (f.name = '$access' $where);
52 if ($c->check_user_roles(qw/irc_masterop/)){
55 ($mode) = $c->model->selectrow_array($mode,undef,$c->host,$c->channel);
58 $c->server->command($self->name . " " . $c->channel . " $msg");
60 $c->reply("No access to " . $self->name . " in this channel");