From 9d90a2d40ea7756814629f9e3bd962928728e074 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Tue, 2 Mar 2010 19:43:27 +0100 Subject: [PATCH] Implemented IRCConnection.onJoin() --- src/org/yaaic/irc/IRCConnection.java | 10 +++++++--- src/org/yaaic/model/Broadcast.java | 29 +--------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/org/yaaic/irc/IRCConnection.java b/src/org/yaaic/irc/IRCConnection.java index cb7267f..3cff545 100644 --- a/src/org/yaaic/irc/IRCConnection.java +++ b/src/org/yaaic/irc/IRCConnection.java @@ -123,13 +123,17 @@ public class IRCConnection extends PircBot * On Join */ @Override - protected void onJoin(String channel, String sender, String login, String hostname) + protected void onJoin(String target, String sender, String login, String hostname) { - debug("Join", channel + " " + sender); + debug("Join", target + " " + sender); if (sender.equals(getNick())) { // We joined a new channel - server.addChannel(new Channel(channel)); + server.addChannel(new Channel(target)); + service.sendBroadcast(new Intent(Broadcast.CHANNEL_NEW)); + } else { + server.getChannel(target).addMessage(sender + " joined"); + service.sendBroadcast(new Intent(Broadcast.CHANNEL_MESSAGE)); } } diff --git a/src/org/yaaic/model/Broadcast.java b/src/org/yaaic/model/Broadcast.java index 6c284c5..afd0308 100644 --- a/src/org/yaaic/model/Broadcast.java +++ b/src/org/yaaic/model/Broadcast.java @@ -25,32 +25,5 @@ public class Broadcast public static final String SERVER_UPDATE = "org.yaaic.server.status"; public static final String CHANNEL_MESSAGE = "org.yaaic.channel.message"; - /* - public static final String CHANNEL_ACTION = "org.yaaic.channel.action"; - public static final String CHANNEL_INFO = "org.yaaic.channel.info"; - public static final String CHANNEL_DEOP = "org.yaaic.channel.deop"; - public static final String CHANNEL_DEVOICE = "org.yaaic.channel.devoice"; - public static final String CHANNEL_INVITE = "org.yaaic.channel.invite"; - public static final String CHANNEL_JOIN = "org.yaaic.channel.join"; - public static final String CHANNEL_KICK = "org.yaaic.channel.kick"; - public static final String CHANNEL_MESSAGE = "org.yaaic.channel.message"; - public static final String CHANNEL_MODE = "org.yaaic.channel.mode"; - public static final String CHANNEL_OP = "org.yaaic.channel.op"; - public static final String CHANNEL_PART = "org.yaaic.channel.part"; - public static final String CHANNEL_TOPIC = "org.yaaic.channel.topic"; - public static final String CHANNEL_USER = "org.yaaic.channel.user"; - public static final String CHANNEL_VOICE = "org.yaaic.channel.voice"; - - public static final String USER_NICK = "org.yaaic.user.nick"; - public static final String USER_NOTICE = "org.yaaic.user.notice"; - public static final String USER_MESSAGE = "org.yaaic.user.message"; - public static final String USER_QUIT = "org.yaaic.user.quit"; - - public static final String EXTRA_SENDER = "sender"; - public static final String EXTRA_CHANNEL = "channel"; - public static final String EXTRA_MESSAGE = "message"; - public static final String EXTRA_TOPIC = "topic"; - public static final String EXTRA_USERCOUNT = "usercount"; - public static final String EXTRA_RECEIVER = "receiver"; - */ + public static final String CHANNEL_NEW = "org.yaaic.channel.new"; }