X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fcore%2FCore.java;h=96555e39576c62adbfba5fac4d537ae4a10cb7cb;hb=2fb2343aea0a4c6d81fa1acb76e8ad85844f82b2;hp=38958f71a24fa223ac815ff3120dc26e6f0dbdfd;hpb=d30170400a6af5d4fbfa3f2e18bcf366b02160aa;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 38958f7..96555e3 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -33,6 +33,7 @@ import java.util.logging.Logger; import net.pterodactylus.irc.Connection; import net.pterodactylus.irc.ConnectionBuilder; import net.pterodactylus.irc.DccReceiver; +import net.pterodactylus.irc.event.ChannelJoined; import net.pterodactylus.irc.event.ChannelMessageReceived; import net.pterodactylus.irc.event.ConnectionEstablished; import net.pterodactylus.irc.event.DccSendReceived; @@ -235,6 +236,30 @@ public class Core extends AbstractIdleService { } /** + * Shows a message when a channel was joined by us. + * + * @param channelJoined + * The channel joined event + */ + @Subscribe + public void channelJoined(ChannelJoined channelJoined) { + if (channelJoined.connection().isSource(channelJoined.client())) { + Optional network = getNetwork(channelJoined.connection()); + if (!network.isPresent()) { + return; + } + + Optional channel = getChannel(network.get(), channelJoined.channel()); + if (!channel.isPresent()) { + return; + } + + joinedChannels.add(channel.get()); + logger.info(String.format("Joined Channel %s on %s.", channelJoined.channel(), network.get().name())); + } + } + + /** * If a message on a channel is received, it is parsed for pack information * with is then added to a bot. *