From ace19fe095a1b9e5809898616b66510170ab09d3 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Mon, 12 Apr 2010 21:38:35 +0200 Subject: [PATCH] IRCConnection: Implemented setAutojoinChannels() --- src/org/yaaic/irc/IRCConnection.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/org/yaaic/irc/IRCConnection.java b/src/org/yaaic/irc/IRCConnection.java index 521e9d8..9d36ba3 100644 --- a/src/org/yaaic/irc/IRCConnection.java +++ b/src/org/yaaic/irc/IRCConnection.java @@ -49,6 +49,7 @@ public class IRCConnection extends PircBot { private IRCService service; private Server server; + private String[] autojoinChannels; /** * Create a new connection @@ -88,6 +89,16 @@ public class IRCConnection extends PircBot // The real "version" value is provided by onVersion() this.setVersion(realname); } + + /** + * Set channels to autojoin after connect + * + * @param channels + */ + public void setAutojoinChannels(String[] channels) + { + autojoinChannels = channels; + } /** * On version (CTCP version) @@ -139,6 +150,13 @@ public class IRCConnection extends PircBot ); service.sendBroadcast(intent); + + if (autojoinChannels != null) { + for (String channel : autojoinChannels) { + // Add support for channel keys + joinChannel(channel); + } + } } /**