X-Git-Url: https://ruin.nu/git/?p=NDIRC.git;a=blobdiff_plain;f=Commands%2FChannel.pm;h=9207b0c4cadf71645339da18cab0eaec2756c1bc;hp=d309ce00ae1ac4e533f08f66f90101db2fe28159;hb=e8c94cdebefdc428ea92fde6db63f18d3e8399b2;hpb=1ccb344994c1b517c662da9f236cf1c640780177 diff --git a/Commands/Channel.pm b/Commands/Channel.pm index d309ce0..9207b0c 100644 --- a/Commands/Channel.pm +++ b/Commands/Channel.pm @@ -33,8 +33,9 @@ sub op { my ($self,$c,$msg) = @_; - $self->name =~ /(op|voice)/; - my @access = ($1); + $self->name =~ /(de)?(op|voice)/; + my @access = ($2); + my $mod = $1 ? '-' : ''; if ($msg =~ /^\s*$/){ $msg = $c->nick; @@ -42,19 +43,19 @@ sub op } my $mode = q{ -SELECT DISTINCT channel FROM users u +SELECT DISTINCT LOWER(flag) FROM users u JOIN groupmembers g USING (uid) JOIN channel_group_flags gf USING (gid) JOIN channel_flags f USING (flag) WHERE u.hostmask ILIKE $1 AND channel = $2 AND f.name = ANY($3); }; if ($c->check_user_roles(qw/irc_masterop/)){ - $mode = 1; + $mode = substr $access[0], 0,1; }else{ ($mode) = $c->model->selectrow_array($mode,undef,$c->host,$c->channel,\@access); } if ($mode){ - $c->server->command($self->name . " " . $c->channel . " $msg"); + $c->command(mode => $c->channel, "$mod$mode", $msg); }else{ $c->reply("No access to " . $self->name . " in this channel"); } @@ -88,7 +89,7 @@ WHERE u.hostmask ILIKE $1 AND COALESCE(channel = $2,TRUE) } } for (@channels){ - $c->server->command("invite ". $c->nick ." $_"); + $c->command(invite => $c->nick, $_); } }