Ejemplo n.º 1
0
        /// <returns><c>true</c> if the nickname is now free, <c>false</c> otherwise.</returns>
        private bool AttemptNicknameRecovery(IUserInfo info, string nickname)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            if (nickname == null)
            {
                throw new ArgumentNullException("nickname");
            }

            nickname = nickname.ToLower().Trim();

            IUserInfo current = Manager.Where(u => u.Nickname != null).Single(u => u.Nickname.ToLower().Trim() == nickname);

            if (info.IsRegistered && info.UserId == current.UserId)
            {
                Manager.Disconnect(current);
                return(true);
            }

            return(false);
        }