//# 0 errors, 129 messages
//#
/*
    //#DNSCommand.java:1:1: class: com.dmdirc.addons.dns.DNSCommand$1
    //#DNSCommand.java:1:1: method: com.dmdirc.addons.dns.DNSCommand$1.com.dmdirc.addons.dns.DNSCommand$1__static_init
    //#DNSCommand.java:1:1: class: com.dmdirc.addons.dns.DNSCommand
    //#DNSCommand.java:1:1: method: com.dmdirc.addons.dns.DNSCommand.com.dmdirc.addons.dns.DNSCommand__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.dns;

import com.dmdirc.commandparser.CommandArguments;
import com.dmdirc.commandparser.CommandManager;
import com.dmdirc.commandparser.commands.GlobalCommand;
import com.dmdirc.ui.interfaces.InputWindow;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Performs DNS lookups for nicknames, hostnames or IPs.
 */
public final class DNSCommand extends GlobalCommand {
    //#DNSCommand.java:36: method: void com.dmdirc.addons.dns.DNSCommand.access$000(DNSCommand, InputWindow, bool, String, Object[])
    //#DNSCommand.java:36: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dns.DNSCommand:sendLine(InputWindow, bool, String, Object[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void access$000(DNSCommand, InputWindow, bool, String, Object[])
    //#    unanalyzed callee: void com.dmdirc.addons.dns.DNSCommand:sendLine(InputWindow, bool, String, Object[])
    //#input(void access$000(DNSCommand, InputWindow, bool, String, Object[])): x0
    //#input(void access$000(DNSCommand, InputWindow, bool, String, Object[])): x1
    //#input(void access$000(DNSCommand, InputWindow, bool, String, Object[])): x2
    //#input(void access$000(DNSCommand, InputWindow, bool, String, Object[])): x3
    //#input(void access$000(DNSCommand, InputWindow, bool, String, Object[])): x4
    //#pre[1] (void access$000(DNSCommand, InputWindow, bool, String, Object[])): x0 != null
    //#DNSCommand.java:36: end of method: void com.dmdirc.addons.dns.DNSCommand.access$000(DNSCommand, InputWindow, bool, String, Object[])
    //#DNSCommand.java:36: method: void com.dmdirc.addons.dns.DNSCommand.access$100(DNSCommand, InputWindow, bool, String, Object[])
    //#DNSCommand.java:36: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dns.DNSCommand:sendLine(InputWindow, bool, String, Object[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void access$100(DNSCommand, InputWindow, bool, String, Object[])
    //#    unanalyzed callee: void com.dmdirc.addons.dns.DNSCommand:sendLine(InputWindow, bool, String, Object[])
    //#input(void access$100(DNSCommand, InputWindow, bool, String, Object[])): x0
    //#input(void access$100(DNSCommand, InputWindow, bool, String, Object[])): x1
    //#input(void access$100(DNSCommand, InputWindow, bool, String, Object[])): x2
    //#input(void access$100(DNSCommand, InputWindow, bool, String, Object[])): x3
    //#input(void access$100(DNSCommand, InputWindow, bool, String, Object[])): x4
    //#pre[1] (void access$100(DNSCommand, InputWindow, bool, String, Object[])): x0 != null
    //#DNSCommand.java:36: end of method: void com.dmdirc.addons.dns.DNSCommand.access$100(DNSCommand, InputWindow, bool, String, Object[])
    
    /** Creates a new instance of DNSCommand. */
    public DNSCommand() {
        super();
    //#DNSCommand.java:40: method: void com.dmdirc.addons.dns.DNSCommand.com.dmdirc.addons.dns.DNSCommand()
    //#DNSCommand.java:40: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.commands.GlobalCommand()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void com.dmdirc.addons.dns.DNSCommand()
    //#    unanalyzed callee: void com.dmdirc.commandparser.commands.GlobalCommand()
    //#input(void com.dmdirc.addons.dns.DNSCommand()): this
        
        CommandManager.registerCommand(this);
    //#DNSCommand.java:42: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.commandparser.CommandManager:registerCommand(Command)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void com.dmdirc.addons.dns.DNSCommand()
    //#    unanalyzed callee: void com.dmdirc.commandparser.CommandManager:registerCommand(Command)
    }
    //#DNSCommand.java:43: end of method: void com.dmdirc.addons.dns.DNSCommand.com.dmdirc.addons.dns.DNSCommand()
    
    /** {@inheritDoc} */
    @Override
    public void execute(final InputWindow origin, final boolean isSilent,
            final CommandArguments args) {
        if (args.getArguments().length == 0) {
    //#DNSCommand.java:49: method: void com.dmdirc.addons.dns.DNSCommand.execute(InputWindow, bool, CommandArguments)
    //#DNSCommand.java:49: Warning: method not available - call not analyzed
    //#    call on String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    unanalyzed callee: String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#input(void execute(InputWindow, bool, CommandArguments)): "Resolving: "._tainted
    //#input(void execute(InputWindow, bool, CommandArguments)): args
    //#input(void execute(InputWindow, bool, CommandArguments)): isSilent
    //#input(void execute(InputWindow, bool, CommandArguments)): origin
    //#input(void execute(InputWindow, bool, CommandArguments)): this
    //#pre[1] (void execute(InputWindow, bool, CommandArguments)): args != null
    //#presumption(void execute(InputWindow, bool, CommandArguments)): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@54 >= 1
    //#presumption(void execute(InputWindow, bool, CommandArguments)): com.dmdirc.commandparser.CommandArguments:getArguments(...)@49 != null
    //#presumption(void execute(InputWindow, bool, CommandArguments)): com.dmdirc.commandparser.CommandArguments:getArguments(...)@54 != null
    //#unanalyzed(void execute(InputWindow, bool, CommandArguments)): Effects-of-calling:java.util.TimerTask
    //#test_vector(void execute(InputWindow, bool, CommandArguments)): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@49: {1..+Inf}, {0}
            showUsage(origin, isSilent, "dns", "<IP|hostname>");
    //#DNSCommand.java:50: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dns.DNSCommand:showUsage(InputWindow, bool, String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    unanalyzed callee: void com.dmdirc.addons.dns.DNSCommand:showUsage(InputWindow, bool, String, String)
            return;
        }
        
        sendLine(origin, isSilent, FORMAT_OUTPUT, "Resolving: " + args.getArguments()[0]);
    //#DNSCommand.java:54: Warning: method not available - call not analyzed
    //#    call on String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    unanalyzed callee: String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#DNSCommand.java:54: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dns.DNSCommand:sendLine(InputWindow, bool, String, Object[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    unanalyzed callee: void com.dmdirc.addons.dns.DNSCommand:sendLine(InputWindow, bool, String, Object[])
        new Timer("DNS Command Timer").schedule(new TimerTask() {
    //#DNSCommand.java:55: method: void com.dmdirc.addons.dns.DNSCommand$1.com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)
    //#input(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): Param_1
    //#input(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): Param_2
    //#input(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): Param_3
    //#input(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): Param_4
    //#input(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this
    //#output(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.this$0
    //#output(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.val$args
    //#output(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.val$isSilent
    //#output(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.val$origin
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.this$0 == Param_1
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): init'ed(this.this$0)
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.val$args == Param_2
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): init'ed(this.val$args)
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.val$isSilent == Param_4
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): init'ed(this.val$isSilent)
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): this.val$origin == Param_3
    //#post(void com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)): init'ed(this.val$origin)
    //#DNSCommand.java:55: end of method: void com.dmdirc.addons.dns.DNSCommand$1.com.dmdirc.addons.dns.DNSCommand$1(DNSCommand, CommandArguments, InputWindow, bool)
            /** {@inheritDoc} */
            @Override
            public void run() {
                if (args.getArguments()[0].matches("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b")) {
    //#DNSCommand.java:59: method: void com.dmdirc.addons.dns.DNSCommand$1.run()
    //#DNSCommand.java:59: Warning: method not available - call not analyzed
    //#    call on String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand$1
    //#    method: void run()
    //#    unanalyzed callee: String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#input(void run()): ""._tainted
    //#input(void run()): ": "._tainted
    //#input(void run()): "Resolved: "._tainted
    //#input(void run()): this
    //#input(void run()): this.this$0
    //#input(void run()): this.val$args
    //#input(void run()): this.val$isSilent
    //#input(void run()): this.val$origin
    //#pre[2] (void run()): this.this$0 != null
    //#pre[3] (void run()): this.val$args != null
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@59 >= 1
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@60 >= 1
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@60 >= 1
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@64 >= 1
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...).length@64 >= 1
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...)@59 != null
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...)@60 != null
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...)@60 != null
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...)@64 != null
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...)@64 != null
    //#presumption(void run()): com.dmdirc.commandparser.CommandArguments:getArguments(...)[0]@59 != null
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void run()): Effects-of-calling:java.net.InetAddress:getByName
    //#unanalyzed(void run()): Effects-of-calling:java.net.InetAddress:getHostName
    //#unanalyzed(void run()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void run()): Effects-of-calling:java.net.InetAddress:getAllByName
    //#unanalyzed(void run()): Effects-of-calling:java.net.InetAddress:getHostAddress
    //#unanalyzed(void run()): Effects-of-calling:java.util.List:add
    //#unanalyzed(void run()): Effects-of-calling:java.lang.Object:toString
    //#unanalyzed(void run()): Effects-of-calling:com.dmdirc.addons.dns.DNSCommand:sendLine
    //#test_vector(void run()): java.lang.String:matches(...)@59: {0}, {1}
                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Resolved: "
    //#DNSCommand.java:60: Warning: method not available - call not analyzed
    //#    call on String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand$1
    //#    method: void run()
    //#    unanalyzed callee: String[] com.dmdirc.commandparser.CommandArguments:getArguments()
                            + args.getArguments()[0] + ": "
                            + DNSPlugin.getHostname(args.getArguments()[0]));
                } else {
                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Resolved: "
    //#DNSCommand.java:64: Warning: method not available - call not analyzed
    //#    call on String[] com.dmdirc.commandparser.CommandArguments:getArguments()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dns.DNSCommand$1
    //#    method: void run()
    //#    unanalyzed callee: String[] com.dmdirc.commandparser.CommandArguments:getArguments()
                            + args.getArguments()[0] + ": "
                            + DNSPlugin.getIPs(args.getArguments()[0]));
                }
            }
    //#DNSCommand.java:68: end of method: void com.dmdirc.addons.dns.DNSCommand$1.run()
        }, 0);
    }
    //#DNSCommand.java:70: end of method: void com.dmdirc.addons.dns.DNSCommand.execute(InputWindow, bool, CommandArguments)
    
    /** {@inheritDoc} */
    @Override
    public String getName() {
        return "dns";
    //#DNSCommand.java:75: method: String com.dmdirc.addons.dns.DNSCommand.getName()
    //#output(String getName()): return_value
    //#post(String getName()): return_value == &"dns"
    //#DNSCommand.java:75: end of method: String com.dmdirc.addons.dns.DNSCommand.getName()
    }
    
    /** {@inheritDoc} */
    @Override
    public boolean showInHelp() {
        return true;
    //#DNSCommand.java:81: method: bool com.dmdirc.addons.dns.DNSCommand.showInHelp()
    //#output(bool showInHelp()): return_value
    //#post(bool showInHelp()): return_value == 1
    //#DNSCommand.java:81: end of method: bool com.dmdirc.addons.dns.DNSCommand.showInHelp()
    }
    
    /** {@inheritDoc} */
    @Override
    public String getHelp() {
        return "dns <IP|hostname> - Performs DNS lookup of the specified ip/hostname/nickname";
    //#DNSCommand.java:87: method: String com.dmdirc.addons.dns.DNSCommand.getHelp()
    //#output(String getHelp()): return_value
    //#post(String getHelp()): return_value == &"dns <IP|hostname> - Performs DNS lookup of the specified ip.hostname.nickname"
    //#DNSCommand.java:87: end of method: String com.dmdirc.addons.dns.DNSCommand.getHelp()
    }
    
}
    //#output(com.dmdirc.addons.dns.DNSCommand$1__static_init): __Descendant_Table[com/dmdirc/addons/dns/DNSCommand$1]
    //#output(com.dmdirc.addons.dns.DNSCommand$1__static_init): __Dispatch_Table.run()V
    //#post(com.dmdirc.addons.dns.DNSCommand$1__static_init): __Descendant_Table[com/dmdirc/addons/dns/DNSCommand$1] == &__Dispatch_Table
    //#post(com.dmdirc.addons.dns.DNSCommand$1__static_init): __Dispatch_Table.run()V == &run
    //#DNSCommand.java:: end of method: com.dmdirc.addons.dns.DNSCommand$1.com.dmdirc.addons.dns.DNSCommand$1__static_init
    //#DNSCommand.java:: end of class: com.dmdirc.addons.dns.DNSCommand$1
    //#output(com.dmdirc.addons.dns.DNSCommand__static_init): __Descendant_Table[com/dmdirc/addons/dns/DNSCommand]
    //#output(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;ZLcom/dmdirc/commandparser/CommandArguments;)V
    //#output(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String;
    //#output(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.showInHelp()Z
    //#post(com.dmdirc.addons.dns.DNSCommand__static_init): __Descendant_Table[com/dmdirc/addons/dns/DNSCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;ZLcom/dmdirc/commandparser/CommandArguments;)V == &execute
    //#post(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String; == &getHelp
    //#post(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(com.dmdirc.addons.dns.DNSCommand__static_init): __Dispatch_Table.showInHelp()Z == &showInHelp
    //#DNSCommand.java:: end of method: com.dmdirc.addons.dns.DNSCommand.com.dmdirc.addons.dns.DNSCommand__static_init
    //#DNSCommand.java:: end of class: com.dmdirc.addons.dns.DNSCommand
