diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-05-17 19:50:13 +0200 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-05-30 20:10:21 +0200 |
commit | 074983969cff73cfe428df59571a17ea0d482a42 (patch) | |
tree | 32c48ccaca306f13874972356dfa722e3c8dc7df /src/net/java/sip/communicator/impl | |
parent | 0e810a59a365943ac76628256351e90bd77b6319 (diff) | |
download | jitsi-074983969cff73cfe428df59571a17ea0d482a42.zip jitsi-074983969cff73cfe428df59571a17ea0d482a42.tar.gz jitsi-074983969cff73cfe428df59571a17ea0d482a42.tar.bz2 |
Handle CAP away-notify events.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java b/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java index a4e141f..128f3c8 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ChannelManager.java @@ -795,8 +795,6 @@ public class ChannelManager * chat room listener updates chat room data and fires events based on IRC * messages that report state changes for the specified channel. * - * FIXME handle AWAY messages (from away-notify) for fellow channel members - * * @author Danny van Heumen */ private final class ChatRoomListener @@ -1063,19 +1061,7 @@ public class ChannelManager { final IrcStatusEnum status = determineStatus(messageComponents[5]); - final IrcStatusEnum previous = - member.setPresenceStatus(status); - if (previous == status) { - // if there is no change in status, do not fire member - // property change event - return; - } - final ChatRoomMemberPropertyChangeEvent presenceEvent = - new ChatRoomMemberPropertyChangeEvent(member, - this.chatroom, - ChatRoomMemberPropertyChangeEvent.MEMBER_PRESENCE, - previous, status); - this.chatroom.fireMemberPropertyChangeEvent(presenceEvent); + updateMemberPresence(member, status); } break; @@ -1300,6 +1286,48 @@ public class ChannelManager } /** + * Event in case of user away message (CAP away-notify) + * + * @param aMsg away message + */ + @Override + public void onUserAway(AwayMessage msg) + { + final ChatRoomMemberIrcImpl member = + (ChatRoomMemberIrcImpl) this.chatroom.getChatRoomMember(msg + .getSource().getNick()); + if (member != null) + { + final IrcStatusEnum status = + msg.isAway() ? IrcStatusEnum.AWAY : IrcStatusEnum.ONLINE; + updateMemberPresence(member, status); + } + } + + /** + * Update member presence status. + * + * @param member the member + * @param newStatus the new presence status + */ + private void updateMemberPresence(ChatRoomMemberIrcImpl member, + IrcStatusEnum newStatus) + { + final IrcStatusEnum previous = member.setPresenceStatus(newStatus); + if (previous == newStatus) { + // if there is no change in status, do not fire member + // property change event + return; + } + final ChatRoomMemberPropertyChangeEvent presenceEvent = + new ChatRoomMemberPropertyChangeEvent(member, + this.chatroom, + ChatRoomMemberPropertyChangeEvent.MEMBER_PRESENCE, + previous, newStatus); + this.chatroom.fireMemberPropertyChangeEvent(presenceEvent); + } + + /** * Leave this chat room. */ private void leaveChatRoom() |