internal bool RemoveUser(String nickname) { if (!ContainsUser(nickname)) { _logger.Error("Trying to remove user " + nickname + " from channel " + Name + ", but user does not exist in this channel."); return(false); } _users.Remove(nickname); _knownUsers.Remove(nickname); return(true); }
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; }
internal bool RemoveChannel(String channelName) { if (!ContainsChannel(channelName)) { _logger.Error("Trying to remove channel " + channelName + " from user " + Name + ", but user is not in this channel."); return(false); } _channels.Remove(channelName); _knownChannels.Remove(channelName); return(true); }