internal void ChangeName(String oldNickname, String newNickname) { if (ContainsUser(newNickname)) { _logger.Error("Changing nickname " + oldNickname + " into " + newNickname + ", but a channel user with that nickname already exists. Some observable subscriptions may be lost."); _users.Remove(oldNickname); _knownUsers.Remove(oldNickname); return; } IChannelUser channelUser = _users[oldNickname]; _users.ChangeItemKey(channelUser, newNickname); _knownUsers.ChangeItemKey(channelUser, newNickname); }
private void ChangeNickname(User user, String nickname) { if (_users.Contains(nickname)) { _logger.Error("Changing nickname of " + user.Name + " into " + nickname + ", but a user with that nickname already exists. Some observable subscriptions may be lost."); if (user.Equals(_me)) { _me = _users[nickname] as User; } user.Channels.Cast <Channel>().Do(c => c.ChangeName(user.Name, nickname)); _users.Remove(user); return; } _users.ChangeItemKey(user, nickname); user.Channels.Cast <Channel>().Do(c => c.ChangeName(user.Name, nickname)); user.Name.Value = nickname; user.Identity.Name.Value = nickname; }