diff --git a/pom.xml b/pom.xml index 085e83f..8841f72 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ com.cnaude.pircbotx pircbotx - 2.1.5 + 2.1.6 diff --git a/src/main/java/com/cnaude/purpleirc/IRCListeners/AwayListener.java b/src/main/java/com/cnaude/purpleirc/IRCListeners/AwayListener.java new file mode 100644 index 0000000..f133826 --- /dev/null +++ b/src/main/java/com/cnaude/purpleirc/IRCListeners/AwayListener.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2014 cnaude + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.cnaude.purpleirc.IRCListeners; + +import com.cnaude.purpleirc.PurpleBot; +import com.cnaude.purpleirc.PurpleIRC; +import org.pircbotx.User; +import org.pircbotx.hooks.ListenerAdapter; +import org.pircbotx.hooks.events.AwayEvent; + +/** + * + * @author cnaude + */ +public class AwayListener extends ListenerAdapter { + + PurpleIRC plugin; + PurpleBot ircBot; + + /** + * + * @param plugin + * @param ircBot + */ + public AwayListener(PurpleIRC plugin, PurpleBot ircBot) { + this.plugin = plugin; + this.ircBot = ircBot; + } + + /** + * + * @param event + */ + @Override + public void onAway(AwayEvent event) { + String awayMessage = event.getAwayMessage(); + User user = event.getUser(); + + plugin.logDebug("[USER:" + user.getNick() + "] [Away:" + awayMessage + "]"); + } +} diff --git a/src/main/java/com/cnaude/purpleirc/PurpleBot.java b/src/main/java/com/cnaude/purpleirc/PurpleBot.java index 3dab99c..ebea1e9 100644 --- a/src/main/java/com/cnaude/purpleirc/PurpleBot.java +++ b/src/main/java/com/cnaude/purpleirc/PurpleBot.java @@ -17,6 +17,7 @@ package com.cnaude.purpleirc; import com.cnaude.purpleirc.IRCListeners.ActionListener; +import com.cnaude.purpleirc.IRCListeners.AwayListener; import com.cnaude.purpleirc.IRCListeners.ConnectListener; import com.cnaude.purpleirc.IRCListeners.DisconnectListener; import com.cnaude.purpleirc.IRCListeners.JoinListener; @@ -354,6 +355,7 @@ public final class PurpleBot { private void addListeners() { ircListeners.add(new ActionListener(plugin, this)); + ircListeners.add(new AwayListener(plugin, this)); ircListeners.add(new ConnectListener(plugin, this)); ircListeners.add(new DisconnectListener(plugin, this)); ircListeners.add(new JoinListener(plugin, this));