예제 #1
0
        public override void CheckRequest()
        {
            base.CheckRequest();

            if (_errorCode != ChatError.NoError)
            {
                return;
            }

            if (_session.UserInfo.JoinedChannels.Count == 0)
            {
                _errorCode     = ChatError.IRCError;
                _sendingBuffer = ChatIRCError.BuildNoSuchChannelError(_cmd.ChannelName);
                return;
            }

            if (!_session.UserInfo.GetJoinedChannelByName(_cmd.ChannelName, out _channel))
            {
                _errorCode     = ChatError.IRCError;
                _sendingBuffer = ChatIRCError.BuildNoSuchChannelError(_cmd.ChannelName);
                return;
            }

            if (!_channel.GetChannelUserBySession(_session, out _user))
            {
                _errorCode     = ChatError.Parse;
                _sendingBuffer = ChatIRCError.BuildNoSuchNickError();
                return;
            }
        }
예제 #2
0
        protected override void BuildErrorResponse()
        {
            base.BuildErrorResponse();
            switch (_errorCode)
            {
            case ChatError.NoSuchChannel:
                _sendingBuffer =
                    ChatIRCError.BuildNoSuchChannelError(_request.ChannelName);
                break;

            case ChatError.NoSuchNick:
                _sendingBuffer = ChatIRCError.BuildNoSuchNickError();
                break;
            }
        }
예제 #3
0
 public override void CheckRequest()
 {
     base.CheckRequest();
     //can not find any user
     if (!_channel.GetChannelUserBySession(_session, out _user))
     {
         _errorCode     = ChatError.IRCError;
         _sendingBuffer = ChatIRCError.BuildNoSuchNickError();
         return;
     }
     if (!ChatChannelManager.GetChannel(_cmd.ChannelName, out _channel))
     {
         _errorCode     = ChatError.IRCError;
         _sendingBuffer = ChatIRCError.BuildNoSuchChannelError(_cmd.ChannelName);
     }
 }
예제 #4
0
        private void GetChannelAndUser()
        {
            if (_session.UserInfo.JoinedChannels.Count == 0)
            {
                _errorCode     = ChatError.IRCError;
                _sendingBuffer = ChatIRCError.BuildNoSuchChannelError(_cmd.ChannelName);
                return;
            }

            if (!_session.UserInfo.GetJoinedChannelByName(_cmd.ChannelName, out _channel))
            {
                _errorCode     = ChatError.IRCError;
                _sendingBuffer = ChatIRCError.BuildNoSuchChannelError(_cmd.ChannelName);
                return;
            }

            if (!_channel.GetChannelUserBySession(_session, out _user))
            {
                _errorCode     = ChatError.Parse;
                _sendingBuffer = ChatIRCError.BuildNoSuchNickError();
                return;
            }
        }