Skip to content

Commit

Permalink
Actually fix previously mentioned nick change issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mbax committed Jul 2, 2019
1 parent c1c8352 commit 97c82fa
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,22 @@ public void nick(ClientReceiveCommandEvent event) {
return;
}
boolean isSelf = ((User) event.getActor()).getNick().equals(this.getClient().getNick());
String newNick = event.getParameters().get(0);
Optional<User> user = this.getTracker().getTrackedUser(((User) event.getActor()).getNick());
if (!user.isPresent()) {
if (isSelf) {
this.getClient().setCurrentNick(event.getParameters().get(0));
this.getClient().setCurrentNick(newNick);
return; // Don't fail if NICK changes while not in a channel!
}
this.trackException(event, "NICK message sent for user not in tracked channels");
return;
}
User oldUser = user.get();
this.getTracker().trackUserNickChange(user.get().getNick(), event.getParameters().get(0));
User newUser = this.getTracker().getTrackedUser(((User) event.getActor()).getNick()).get();
this.getTracker().trackUserNickChange(user.get().getNick(), newNick);
User newUser = this.getTracker().getTrackedUser(newNick).get();
this.fire(new UserNickChangeEvent(this.getClient(), event.getSource(), oldUser, newUser));
if (isSelf) {
this.getClient().setCurrentNick(event.getParameters().get(0));
this.getClient().setCurrentNick(newNick);
}
}
}

0 comments on commit 97c82fa

Please sign in to comment.