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:
parent
39293ad3fc
commit
5fe3e01f30
@ -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");
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user