]> ruin.nu Git - NDIRC.git/commitdiff
Remove the use of global defchan in report_incs, also allow the command in def channel
authorMichael Andreen <harv@ruin.nu>
Wed, 19 Aug 2009 21:21:48 +0000 (23:21 +0200)
committerMichael Andreen <harv@ruin.nu>
Wed, 19 Aug 2009 21:21:48 +0000 (23:21 +0200)
Commands/Def.pm
Eos.pm

index 321697871bc4113e2cb2fd5ea0b45bac829c4295..b115dd44be93aefc3cdcdc315e34fa02a88302fb 100644 (file)
@@ -226,7 +226,8 @@ SELECT calc FROM calls WHERE id = $1}
 }
 
 sub report_incs
-       : Type(pm)
+       : Help(Used to report incs, same as pasting in pm. Use ~ prefix to send output to channel)
+       : Type(def)
 {
        my ($self,$c,$msg) = @_;
 
@@ -288,33 +289,33 @@ INSERT INTO incomings (call,pid,eta,amount,fleet) VALUES(?,?,?,?,?) RETURNING in
                                                },undef,$call[0],$attacker[2],$9,$amount,$7);
                                                @attacker = map (valuecolor(0),@attacker);
                                                if (! $threefleeter || $call[2]){
-                                                       $c->message(privmsg => $ND::defchan, "<b>New incoming: CallId: $call[0], IncId: $incid $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]) https://nd.ruin.nu/calls/edit/$call[0]</b>");
+                                                       $c->reply("<b>New incoming: CallId: $call[0], IncId: $incid $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]) https://nd.ruin.nu/calls/edit/$call[0]</b>");
                                                }else{
-                                                       $c->message(privmsg => $ND::defchan, "<b>Do not cover</b>, NoDef member is under attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4])  https://nd.ruin.nu/calls/edit/$call[0]");
+                                                       $c->reply("<b>Do not cover</b>, NoDef member is under attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4])  https://nd.ruin.nu/calls/edit/$call[0]");
                                                }
                                                $dbh->do(q{UPDATE planets SET hit_us = hit_us + 1 WHERE pid = ?},undef,$attacker[2]);
                                                if ($call[1] eq 'Covered'){
                                                        $dbh->do(q{UPDATE calls SET status = 'Open' WHERE call = ?},undef,$call[0]);
-                                                       $c->message(privmsg => $ND::defchan, "<b>Call is likely not covered anymore, please recalc! calc: $call[3]</b>");
+                                                       $c->reply("<b>Call is likely not covered anymore, please recalc! calc: $call[3]</b>");
                                                }
                                        }else{
                                                @attacker = map (valuecolor(0),@attacker);
-                                               $c->message(privmsg => $ND::defchan, "Duplicate call: Callid: $call[0], Covered: $call[1], Open: $call[2] $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]), landing tick: $landing_tick");
+                                               $c->reply("Duplicate call: Callid: $call[0], Covered: $call[1], Open: $call[2] $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]), landing tick: $landing_tick");
                                        }
 
                                        my ($fleetcatch) = $dbh->selectrow_array(q{
 SELECT count(*) FROM launch_confirmations WHERE uid = ? AND back = ?
                                        },undef,$user->{uid},$landing_tick);
                                        if ($fleetcatch > 0){
-                                               $c->message(privmsg => $ND::defchan, "<c04>THIS IS A POSSIBLE FLEETCATCH!</c>");
+                                               $c->reply("<c04>THIS IS A POSSIBLE FLEETCATCH!</c>");
                                        }
                                }
                                $dbh->commit;
                        }else{
-                               $c->message(privmsg => $ND::defchan, "<c04>Didn't find any planet with coordinates $4:$5:$6 at this tick</c>");
+                               $c->reply("<c04>Didn't find any planet with coordinates $4:$5:$6 at this tick</c>");
                        }
                }else{
-                       $c->message(privmsg => $ND::defchan, "<c04>No member registered with coordinates $1:$2:$3</c>");
+                       $c->reply("<c04>No member registered with coordinates $1:$2:$3</c>");
                }
        }
 
diff --git a/Eos.pm b/Eos.pm
index 6a6c96ebd0622bebfd9218a150eb056e1d138c42..325f69591eee73b1428af2be9d23d6cc010a0c8b 100644 (file)
--- a/Eos.pm
+++ b/Eos.pm
@@ -59,7 +59,7 @@ sub irc_msg {
                #Command parsed and run successfully
        }else{
                $irc->yield(privmsg => $ND::defchan, chr(3)."04 $nick >> $msg");
-               parseCommand(".report_incs $msg",$irc,$nick,' BATCH ','pm',$heap->{disp},DB());
+               parseCommand("~report_incs $msg",$irc,$nick,' BATCH ',$ND::defchan,$heap->{disp},DB());
        }
 }
 
@@ -128,7 +128,7 @@ sub refresh {
        while (my $req = $ircreqs->fetchrow_hashref){
                if ($req->{channel} eq 'def'){
                        $irc->yield(privmsg => $ND::defchan, chr(3)."04 ## $req->{username} via webbie ## >> $req->{message}");
-                       parseCommand(".report_incs $req->{message}",$irc,$req->{username},' BATCH ','pm',$heap->{disp},$dbh);
+                       parseCommand("~report_incs $req->{message}",$irc,$req->{username},' BATCH ',$ND::defchan,$heap->{disp},$dbh);
                }elsif($req->{channel} eq 'scan'){
                        $irc->yield(privmsg => $ND::scanchan, "<$req->{username} via webbie> $req->{message}");
                }elsif($req->{channel} eq 'members'){