-#**************************************************************************
-# Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu> *
-# *
-# 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 *
-# the Free Software Foundation; either version 2 of the License, or *
-# (at your option) any later version. *
-# *
-# This program is distributed in the hope that it will be useful, *
-# but WITHOUT ANY WARRANTY; without even the implied warranty of *
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-# GNU General Public License for more details. *
-# *
-# You should have received a copy of the GNU General Public License *
-# along with this program; if not, write to the *
-# Free Software Foundation, Inc., *
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
-#**************************************************************************/
-package NDIRC::Intel;
-use strict;
-use warnings;
-use ND::DB;
-use NDIRC::Access;
-use NDIRC::Misc;
-use ND::Include;
-require Exporter;
-
-our @ISA = qw/Exporter/;
-
-our @EXPORT = qw/setChannel/;
-
-sub setChannel {
- my ($msg, $command) = @_;
- my ($x,$y,$z,$channel);
- if(defined $msg && $msg =~ /^(\d+)\D(\d+)\D(\d+) (\S+)$/){
- $x = $1;
- $y = $2;
- $z = $3;
- $channel = $4;
- }else{
- $ND::server->command("notice $ND::nick Usage: .$command X:Y:Z channel");
- return;
- }
- if (my $user = intel){
- my $findid = $ND::DBH->prepare_cached(q{SELECT id,channel FROM current_planet_stats
- WHERE x = ? AND y = ? and z = ?});
- my ($id,$c) = $ND::DBH->selectrow_array($findid,undef,$x,$y,$z);
- if ($ND::DBH->do('UPDATE planets SET channel = $1 WHERE id = $2'
- ,undef,$channel,$id)){
-
- if (defined $c){
- $ND::server->command("msg $ND::target Changed $x:$y:$z from $ND::B$c$ND::B to $ND::B$channel");
- }else{
- $ND::server->command("msg $ND::target Setting $x:$y:$z as $ND::B$channel");
- }
- intel_log $user->{uid},$id,"Set channel to: $channel";
- }else{
- $ND::server->command("msg $ND::target Couldn't find a planet at $x:$y:$z");
- }
- }
-}
-
-1;