1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 08:52:18 -05:00

Add channel name to CHANNEL_NEW and CHANNEL_REMOVE broadcasts

This commit is contained in:
Sebastian Kaspari 2010-03-05 14:25:33 +01:00
parent 39293ad3fc
commit 5fe3e01f30
4 changed files with 23 additions and 9 deletions

View File

@ -151,7 +151,10 @@ public class IRCConnection extends PircBot
if (sender.equals(getNick())) {
// We joined a new channel
server.addChannel(new Channel(target));
service.sendBroadcast(new Intent(Broadcast.CHANNEL_NEW));
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
service.sendBroadcast(intent);
} else {
server.getChannel(target).addMessage(sender + " joined");
@ -172,7 +175,10 @@ public class IRCConnection extends PircBot
if (recipientNick.equals(getNick())) {
// We are kicked
server.removeChannel(target);
service.sendBroadcast(new Intent(Broadcast.CHANNEL_REMOVE));
Intent intent = new Intent(Broadcast.CHANNEL_REMOVE);
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
service.sendBroadcast(intent);
} else {
server.getChannel(target).addMessage(kickerNick + " kicked " + recipientNick);
@ -256,7 +262,10 @@ public class IRCConnection extends PircBot
if (sender.equals(getNick())) {
// We pareted a channel
server.removeChannel(target);
service.sendBroadcast(new Intent(Broadcast.CHANNEL_REMOVE));
Intent intent = new Intent(Broadcast.CHANNEL_REMOVE);
intent.putExtra(Broadcast.EXTRA_CHANNEL, target);
service.sendBroadcast(intent);
} else {
server.getChannel(target).addMessage(sender + " parted");

View File

@ -23,6 +23,6 @@ package org.yaaic.listener;
public interface ChannelListener
{
public void onChannelMessage(String target);
public void onNewChannel();
public void onRemoveChannel();
public void onNewChannel(String target);
public void onRemoveChannel(String target);
}

View File

@ -43,6 +43,11 @@ public class ChannelReceiver extends BroadcastReceiver
if (action.equals(Broadcast.CHANNEL_MESSAGE)) {
listener.onChannelMessage(intent.getExtras().getString(Broadcast.EXTRA_CHANNEL));
} else if (action.equals(Broadcast.CHANNEL_NEW)) {
listener.onNewChannel(intent.getExtras().getString(Broadcast.EXTRA_CHANNEL));
} else if (action.equals(Broadcast.CHANNEL_REMOVE)) {
intent.getExtras().getString(Broadcast.EXTRA_CHANNEL);
}
}
}

View File

@ -27,10 +27,8 @@ import org.yaaic.irc.IRCService;
import org.yaaic.listener.ChannelListener;
import org.yaaic.listener.FlingListener;
import org.yaaic.model.Broadcast;
import org.yaaic.model.Channel;
import org.yaaic.model.Server;
import org.yaaic.receiver.ChannelReceiver;
import org.yaaic.receiver.ServerReceiver;
import android.app.Activity;
import android.app.Dialog;
@ -196,14 +194,16 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann
/**
* On new channel
*/
public void onNewChannel()
public void onNewChannel(String target)
{
}
/**
* On channel remove
*/
public void onRemoveChannel()
public void onRemoveChannel(String target)
{
}
}