mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-25 18:32:15 -05:00
Implemented IRCConnection.onKick()
This commit is contained in:
parent
9d90a2d40e
commit
db5ac3a467
@ -141,18 +141,27 @@ public class IRCConnection extends PircBot
|
|||||||
* On Kick
|
* On Kick
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onKick(String channel, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason)
|
protected void onKick(String target, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason)
|
||||||
{
|
{
|
||||||
debug("Kick", channel + " " + recipientNick + "(" + kickerNick + ")");
|
debug("Kick", target + " " + recipientNick + "(" + kickerNick + ")");
|
||||||
|
|
||||||
|
if (recipientNick.equals(getNick())) {
|
||||||
|
// We are kicked
|
||||||
|
server.removeChannel(target);
|
||||||
|
service.sendBroadcast(new Intent(Broadcast.CHANNEL_REMOVE));
|
||||||
|
} else {
|
||||||
|
server.getChannel(target).addMessage(kickerNick + " kicked " + recipientNick);
|
||||||
|
service.sendBroadcast(new Intent(Broadcast.CHANNEL_MESSAGE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On Message
|
* On Message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onMessage(String channel, String sender, String login, String hostname, String message)
|
protected void onMessage(String target, String sender, String login, String hostname, String message)
|
||||||
{
|
{
|
||||||
debug("Message", channel + " " + sender + " " + message);
|
debug("Message", target + " " + sender + " " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,4 +26,5 @@ public class Broadcast
|
|||||||
|
|
||||||
public static final String CHANNEL_MESSAGE = "org.yaaic.channel.message";
|
public static final String CHANNEL_MESSAGE = "org.yaaic.channel.message";
|
||||||
public static final String CHANNEL_NEW = "org.yaaic.channel.new";
|
public static final String CHANNEL_NEW = "org.yaaic.channel.new";
|
||||||
|
public static final String CHANNEL_REMOVE = "org.yaaic.channel.remove";
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,16 @@ public class Server
|
|||||||
channels.put(channel.getName(), channel);
|
channels.put(channel.getName(), channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renive a (joined) channel
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public void removeChannel(String name)
|
||||||
|
{
|
||||||
|
channels.remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get icon for current server status
|
* Get icon for current server status
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user