|
@@ -29,6 +29,8 @@ import com.dmdirc.commandparser.CommandArguments;
|
29
|
29
|
import com.dmdirc.commandparser.commands.context.CommandContext;
|
30
|
30
|
import com.dmdirc.interfaces.Connection;
|
31
|
31
|
|
|
32
|
+import java.util.Optional;
|
|
33
|
+
|
32
|
34
|
import javax.inject.Inject;
|
33
|
35
|
import javax.inject.Provider;
|
34
|
36
|
|
|
@@ -60,11 +62,9 @@ public class ServerInfo extends DebugCommand {
|
60
|
62
|
@Override
|
61
|
63
|
public void execute(final FrameContainer origin,
|
62
|
64
|
final CommandArguments args, final CommandContext context) {
|
63
|
|
- if (origin.getConnection() == null) {
|
64
|
|
- sendLine(origin, args.isSilent(), FORMAT_ERROR,
|
65
|
|
- "This window isn't connected to a server");
|
66
|
|
- } else {
|
67
|
|
- final Connection connection = origin.getConnection();
|
|
65
|
+ final Optional<Connection> optionalConnection = origin.getOptionalConnection();
|
|
66
|
+ if (optionalConnection.isPresent()) {
|
|
67
|
+ final Connection connection = optionalConnection.get();
|
68
|
68
|
sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Server name: "
|
69
|
69
|
+ connection.getAddress());
|
70
|
70
|
sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Actual name: "
|
|
@@ -75,10 +75,13 @@ public class ServerInfo extends DebugCommand {
|
75
|
75
|
+ connection.getParser().getServerSoftware() + " - "
|
76
|
76
|
+ connection.getParser().getServerSoftwareType());
|
77
|
77
|
sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Modes: "
|
78
|
|
- + connection.getParser().getBooleanChannelModes() + " "
|
79
|
|
- + connection.getParser().getListChannelModes() + " "
|
80
|
|
- + connection.getParser().getParameterChannelModes() + " "
|
|
78
|
+ + connection.getParser().getBooleanChannelModes() + ' '
|
|
79
|
+ + connection.getParser().getListChannelModes() + ' '
|
|
80
|
+ + connection.getParser().getParameterChannelModes() + ' '
|
81
|
81
|
+ connection.getParser().getDoubleParameterChannelModes());
|
|
82
|
+ } else {
|
|
83
|
+ sendLine(origin, args.isSilent(), FORMAT_ERROR,
|
|
84
|
+ "This window isn't connected to a server");
|
82
|
85
|
}
|
83
|
86
|
}
|
84
|
87
|
|