Connection connection = entry.getValue();
return new ConnectedNetwork(network, connection.hostname(),
connection.port(),
- connection.getUptime().get(),
+ connection.getUptime().orElse(Duration.ofSeconds(0)),
connection.nickname(),
channels.stream()
.filter((channel) -> channel.network()
return;
}
- /* get connection. */
- Connection connection = networkConnections.get(bot.network());
- if (connection == null) {
- /* request for unknown network? */
- return;
- }
-
/* stop the DCC receiver. */
if (download.get().dccReceiver() != null) {
download.get().dccReceiver().stop();
downloads.remove(pack.name(), download.get());
}
+ /* get connection. */
+ Connection connection = networkConnections.get(bot.network());
+ if (connection == null) {
+ /* request for unknown network? */
+ return;
+ }
+
/* remove the request from the bot, too. */
try {
connection.sendMessage(bot.name(), String.format("XDCC %s", (download.get().dccReceiver() != null) ? "CANCEL" : "REMOVE"));
* The connection to remove
*/
private void removeConnection(Connection connection) {
+ logger.debug(String.format("Removing Connection %s...", connection));
Optional<Network> network = getNetwork(connection);
if (!network.isPresent()) {
+ logger.debug(String.format("Connection %s did not belong to any network.", connection));
return;
}
+ logger.debug(String.format("Connection %s belongs to network %s.", connection, network.get()));
networkConnections.remove(network.get());
/* find all channels that need to be removed. */
if (!joinedChannel.network().equals(network.get())) {
continue;
}
-
+ logger.debug(String.format("Channel %s will be removed.", joinedChannel));
channelIterator.remove();
}
}