|
|
|
|
@ -802,8 +802,16 @@ private ChatRoomIrcImpl initiatePrivateChatRoom(String user)
|
|
|
|
|
private class ChatRoomListener
|
|
|
|
|
extends VariousMessageListenerAdapter
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Chat room for which this listener is working.
|
|
|
|
|
*/
|
|
|
|
|
private ChatRoomIrcImpl chatroom;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor. Instantiate listener for the provided chat room.
|
|
|
|
|
*
|
|
|
|
|
* @param chatroom
|
|
|
|
|
*/
|
|
|
|
|
private ChatRoomListener(ChatRoomIrcImpl chatroom)
|
|
|
|
|
{
|
|
|
|
|
if (chatroom == null)
|
|
|
|
|
@ -812,6 +820,9 @@ private ChatRoomListener(ChatRoomIrcImpl chatroom)
|
|
|
|
|
this.chatroom = chatroom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of topic change.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onTopicChange(TopicMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -821,6 +832,9 @@ public void onTopicChange(TopicMessage msg)
|
|
|
|
|
this.chatroom.updateSubject(msg.getTopic().getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of channel mode changes.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onChannelMode(ChannelModeMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -830,6 +844,9 @@ public void onChannelMode(ChannelModeMessage msg)
|
|
|
|
|
processModeMessage(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of channel join message.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onChannelJoin(ChanJoinMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -851,6 +868,9 @@ public void onChannelJoin(ChanJoinMessage msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of channel part.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onChannelPart(ChanPartMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -886,6 +906,9 @@ public void onChannelPart(ChanPartMessage msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of channel kick.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onChannelKick(ChannelKick msg)
|
|
|
|
|
{
|
|
|
|
|
@ -919,6 +942,9 @@ public void onChannelKick(ChannelKick msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of user quit.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onUserQuit(QuitMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -932,6 +958,9 @@ public void onUserQuit(QuitMessage msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of nick change.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onNickChange(NickMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -957,6 +986,9 @@ public void onNickChange(NickMessage msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event in case of channel message arrival.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void onChannelMessage(ChannelPrivMsg msg)
|
|
|
|
|
{
|
|
|
|
|
@ -976,6 +1008,11 @@ public void onChannelMessage(ChannelPrivMsg msg)
|
|
|
|
|
ChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Process mode changes.
|
|
|
|
|
*
|
|
|
|
|
* @param msg raw mode message
|
|
|
|
|
*/
|
|
|
|
|
private void processModeMessage(ChannelModeMessage msg)
|
|
|
|
|
{
|
|
|
|
|
// TODO Handle or ignore ban channel mode (MODE STRING: +b
|
|
|
|
|
@ -1165,6 +1202,12 @@ sourceMember, new Date(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Extract chat room member identifier from message.
|
|
|
|
|
*
|
|
|
|
|
* @param msg raw mode message
|
|
|
|
|
* @return returns member instance
|
|
|
|
|
*/
|
|
|
|
|
private ChatRoomMemberIrcImpl extractChatRoomMember(
|
|
|
|
|
ChannelModeMessage msg)
|
|
|
|
|
{
|
|
|
|
|
@ -1195,17 +1238,35 @@ else if (source instanceof IRCUser)
|
|
|
|
|
return member;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test whether this listener corresponds to the chat room.
|
|
|
|
|
*
|
|
|
|
|
* @param chatRoomName chat room name
|
|
|
|
|
* @return returns true if this listener applies, false otherwise
|
|
|
|
|
*/
|
|
|
|
|
private boolean isThisChatRoom(String chatRoomName)
|
|
|
|
|
{
|
|
|
|
|
return this.chatroom.getIdentifier().equals(chatRoomName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test whether the source user is this user.
|
|
|
|
|
*
|
|
|
|
|
* @param user the source user
|
|
|
|
|
* @return returns true if this use, or false otherwise
|
|
|
|
|
*/
|
|
|
|
|
private boolean isMe(IRCUser user)
|
|
|
|
|
{
|
|
|
|
|
return IrcStack.this.connectionState.getNickname().equals(
|
|
|
|
|
user.getNick());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test whether the user nick is this user.
|
|
|
|
|
*
|
|
|
|
|
* @param name nick of the user
|
|
|
|
|
* @return returns true if so, false otherwise
|
|
|
|
|
*/
|
|
|
|
|
private boolean isMe(String name)
|
|
|
|
|
{
|
|
|
|
|
return IrcStack.this.connectionState.getNickname().equals(name);
|
|
|
|
|
|