//# 0 errors, 51 messages
//#
/*
    //#RedirectCommand.java:1:1: class: com.dmdirc.addons.redirect.RedirectCommand
    //#RedirectCommand.java:1:1: method: com.dmdirc.addons.redirect.RedirectCommand.com.dmdirc.addons.redirect.RedirectCommand__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.addons.redirect;

import com.dmdirc.MessageTarget;
import com.dmdirc.Server;
import com.dmdirc.commandparser.CommandArguments;
import com.dmdirc.commandparser.commands.ChatCommand;
import com.dmdirc.commandparser.commands.IntelligentCommand;
import com.dmdirc.ui.input.AdditionalTabTargets;
import com.dmdirc.ui.input.TabCompleter;
import com.dmdirc.ui.interfaces.InputWindow;
import java.util.List;

/**
 * The redirect command allows the user to redirect the output from another
 * command that would normally echo results locally to a query or channel
 * window instead.
 *
 * @author Chris
 */
public class RedirectCommand extends ChatCommand implements IntelligentCommand {
    
    public RedirectCommand() {
    //#RedirectCommand.java:44: method: void com.dmdirc.addons.redirect.RedirectCommand.com.dmdirc.addons.redirect.RedirectCommand()
    //#RedirectCommand.java:44: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.commands.ChatCommand()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.redirect.RedirectCommand
    //#    method: void com.dmdirc.addons.redirect.RedirectCommand()
    //#    unanalyzed callee: void com.dmdirc.commandparser.commands.ChatCommand()
    //#input(void com.dmdirc.addons.redirect.RedirectCommand()): this
    }
    //#RedirectCommand.java:45: end of method: void com.dmdirc.addons.redirect.RedirectCommand.com.dmdirc.addons.redirect.RedirectCommand()
    
    /** {@inheritDoc} */
    @Override
    public void execute(final InputWindow origin, final Server server,
            final MessageTarget target, final boolean isSilent, final CommandArguments args) {
        target.getFrame().getCommandParser().parseCommand(new FakeInputWindow(target),
    //#RedirectCommand.java:51: method: void com.dmdirc.addons.redirect.RedirectCommand.execute(InputWindow, Server, MessageTarget, bool, CommandArguments)
    //#RedirectCommand.java:51: Warning: method not available - call not analyzed
    //#    call on InputWindow com.dmdirc.MessageTarget:getFrame()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.redirect.RedirectCommand
    //#    method: void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)
    //#    unanalyzed callee: InputWindow com.dmdirc.MessageTarget:getFrame()
    //#RedirectCommand.java:51: Warning: method not available - call not analyzed
    //#    call on CommandParser com.dmdirc.ui.interfaces.InputWindow:getCommandParser()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.redirect.RedirectCommand
    //#    method: void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)
    //#    unanalyzed callee: CommandParser com.dmdirc.ui.interfaces.InputWindow:getCommandParser()
    //#RedirectCommand.java:51: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.commandparser.CommandArguments:getArgumentsAsString()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.redirect.RedirectCommand
    //#    method: void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)
    //#    unanalyzed callee: String com.dmdirc.commandparser.CommandArguments:getArgumentsAsString()
    //#RedirectCommand.java:51: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.parsers.CommandParser:parseCommand(InputWindow, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.redirect.RedirectCommand
    //#    method: void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)
    //#    unanalyzed callee: void com.dmdirc.commandparser.parsers.CommandParser:parseCommand(InputWindow, String)
    //#input(void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)): args
    //#input(void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)): target
    //#pre[1] (void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)): args != null
    //#pre[2] (void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)): target != null
    //#presumption(void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)): com.dmdirc.MessageTarget:getFrame(...)@51 != null
    //#presumption(void execute(InputWindow, Server, MessageTarget, bool, CommandArguments)): com.dmdirc.ui.interfaces.InputWindow:getCommandParser(...)@51 != null
                args.getArgumentsAsString());
    }
    //#RedirectCommand.java:53: end of method: void com.dmdirc.addons.redirect.RedirectCommand.execute(InputWindow, Server, MessageTarget, bool, CommandArguments)
    
    /** {@inheritDoc} */
    @Override
    public String getName() {
        return "redirect";
    //#RedirectCommand.java:58: method: String com.dmdirc.addons.redirect.RedirectCommand.getName()
    //#output(String getName()): return_value
    //#post(String getName()): return_value == &"redirect"
    //#RedirectCommand.java:58: end of method: String com.dmdirc.addons.redirect.RedirectCommand.getName()
    }
    
    /** {@inheritDoc} */
    @Override
    public boolean showInHelp() {
        return true;
    //#RedirectCommand.java:64: method: bool com.dmdirc.addons.redirect.RedirectCommand.showInHelp()
    //#output(bool showInHelp()): return_value
    //#post(bool showInHelp()): return_value == 1
    //#RedirectCommand.java:64: end of method: bool com.dmdirc.addons.redirect.RedirectCommand.showInHelp()
    }
    
    /** {@inheritDoc} */
    @Override
    public String getHelp() {
        return "redirect <command> - sends the output of the command to a channel or query window";
    //#RedirectCommand.java:70: method: String com.dmdirc.addons.redirect.RedirectCommand.getHelp()
    //#output(String getHelp()): return_value
    //#post(String getHelp()): return_value == &"redirect <command> - sends the output of the command to a channel or query window"
    //#RedirectCommand.java:70: end of method: String com.dmdirc.addons.redirect.RedirectCommand.getHelp()
    }

    /** {@inheritDoc} */
    @Override
    public AdditionalTabTargets getSuggestions(final int arg, final List<String> previousArgs) {
        return TabCompleter.getIntelligentResults(arg, previousArgs, 0);
    //#RedirectCommand.java:76: method: AdditionalTabTargets com.dmdirc.addons.redirect.RedirectCommand.getSuggestions(int, List)
    //#RedirectCommand.java:76: Warning: method not available - call not analyzed
    //#    call on AdditionalTabTargets com.dmdirc.ui.input.TabCompleter:getIntelligentResults(int, List, int)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.redirect.RedirectCommand
    //#    method: AdditionalTabTargets getSuggestions(int, List)
    //#    unanalyzed callee: AdditionalTabTargets com.dmdirc.ui.input.TabCompleter:getIntelligentResults(int, List, int)
    //#input(AdditionalTabTargets getSuggestions(int, List)): arg
    //#input(AdditionalTabTargets getSuggestions(int, List)): previousArgs
    //#output(AdditionalTabTargets getSuggestions(int, List)): return_value
    //#post(AdditionalTabTargets getSuggestions(int, List)): init'ed(return_value)
    //#RedirectCommand.java:76: end of method: AdditionalTabTargets com.dmdirc.addons.redirect.RedirectCommand.getSuggestions(int, List)
    }
    
}
    //#output(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Descendant_Table[com/dmdirc/addons/redirect/RedirectCommand]
    //#output(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;Lcom/dmdirc/Server;Lcom/dmdirc/MessageTarget;ZLcom/dmdirc/commandparser/CommandArguments;)V
    //#output(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String;
    //#output(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.getSuggestions(ILjava/util/List;)Lcom/dmdirc/ui/input/AdditionalTabTargets;
    //#output(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.showInHelp()Z
    //#post(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Descendant_Table[com/dmdirc/addons/redirect/RedirectCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;Lcom/dmdirc/Server;Lcom/dmdirc/MessageTarget;ZLcom/dmdirc/commandparser/CommandArguments;)V == &execute
    //#post(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String; == &getHelp
    //#post(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.getSuggestions(ILjava/util/List;)Lcom/dmdirc/ui/input/AdditionalTabTargets; == &getSuggestions
    //#post(com.dmdirc.addons.redirect.RedirectCommand__static_init): __Dispatch_Table.showInHelp()Z == &showInHelp
    //#RedirectCommand.java:: end of method: com.dmdirc.addons.redirect.RedirectCommand.com.dmdirc.addons.redirect.RedirectCommand__static_init
    //#RedirectCommand.java:: end of class: com.dmdirc.addons.redirect.RedirectCommand
