Fixed a case where the chat room members are cleaned out because the

account is already disabled, but a handler is still acting on its final
messages.
fix-message-formatting
Danny van Heumen 11 years ago
parent f6c4a76dbf
commit 1e3325adaa

@ -1514,19 +1514,22 @@ public void onChannelPart(final ChanPartMessage msg)
String userNick = msg.getSource().getNick();
ChatRoomMember member = this.chatroom.getChatRoomMember(userNick);
try
{
// Possibility that 'member' is null (should be fixed now
// that race condition in irc-api is fixed)
this.chatroom.fireMemberPresenceEvent(member, null,
ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT,
msg.getPartMsg());
}
catch (NullPointerException e)
if (member != null)
{
LOGGER.warn(
"This should not have happened. Please report this "
+ "as it is a bug.", e);
// When the account has been disabled, the chat room may return
// null. If that is NOT the case, continue handling.
try
{
this.chatroom.fireMemberPresenceEvent(member, null,
ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT,
msg.getPartMsg());
}
catch (NullPointerException e)
{
LOGGER.warn(
"This should not have happened. Please report this "
+ "as it is a bug.", e);
}
}
}
@ -1738,12 +1741,11 @@ public void onChannelNotice(final ChannelNotice msg)
*/
private void leaveChatRoom()
{
if (!IrcStack.this.isConnected())
final IRCApi irc = IrcStack.this.session.get();
if (irc != null)
{
return;
irc.deleteListener(this);
}
final IRCApi irc = IrcStack.this.session.get();
irc.deleteListener(this);
IrcStack.this.joined.remove(this.chatroom.getIdentifier());
IrcStack.this.provider.getMUC().fireLocalUserPresenceEvent(
this.chatroom,
@ -1954,10 +1956,7 @@ private boolean isThisChatRoom(final String chatRoomName)
*/
private boolean isMe(final IRCUser user)
{
// FIXME in case of disconnected, connectionState == null, so
// results in NPE.
return IrcStack.this.connectionState.getNickname().equals(
user.getNick());
return isMe(user.getNick());
}
/**
@ -1968,9 +1967,12 @@ private boolean isMe(final IRCUser user)
*/
private boolean isMe(final String name)
{
// FIXME in case of disconnected, connectionState == null, so
// results in NPE.
return IrcStack.this.connectionState.getNickname().equals(name);
String userNick = IrcStack.this.getActiveNick();
if (userNick == null)
{
return false;
}
return userNick.equals(name);
}
}

Loading…
Cancel
Save