예제 #1
0
 /// <summary>
 /// サーバからクライアントにニュメリックリプライを返します。
 /// </summary>
 /// <param name="numReply">リプライ番号</param>
 /// <param name="commandParams">リプライコマンドパラメータ</param>
 public void SendNumericReply(NumericReply numReply, params String[] commandParams)
 {
     if (IsClosing)
     {
         return;
     }
     lock (_connections)
         foreach (ConnectionBase connection in _connections)
         {
             connection.SendNumericReply(numReply, commandParams);
         }
 }
예제 #2
0
        /// <summary>
        /// サーバからクライアントにニュメリックリプライを返します。
        /// </summary>
        /// <param name="numReply">リプライ番号</param>
        /// <param name="commandParams">リプライコマンドパラメータ</param>
        public void SendNumericReply(NumericReply numReply, params String[] commandParams)
        {
            if (commandParams.Length > 14 || commandParams.Length < 0)
            {
                throw new ArgumentOutOfRangeException("commandParams");
            }

            NumericReplyMessage numMsg = new NumericReplyMessage(numReply);

            numMsg.CommandParams[0] = UserInfo.Nick;
            for (Int32 i = 0; i < commandParams.Length; i++)
            {
                numMsg.CommandParams[i + 1] = commandParams[i];
            }

            SendServerMessage(numMsg);
        }
예제 #3
0
        public async Task Execute(IContext <T> context, Func <Task> next)
        {
            if (!greeted)
            {
                if (NumericReply.TryParse <NamesReply>(context.Message, out var reply))
                {
                    var nick  = context.Session.Nick;
                    var names = reply.Names.Except(context.Session.Aliases).ToList();
                    var grt   = RandomGreeting();

                    if (names.Count > 1)
                    {
                        await context.Client.SayAsync($"{grt} guys!");
                    }
                    else if (names.Count > 0)
                    {
                        await context.Client.SayAsync($"{grt} {names[0]}!");
                    }
                }
            }

            await next();
        }
예제 #4
0
 public NumericReplyMessage(NumericReply i)
 {
     this.SetCommand(((Int32)i).ToString("000"));
     _replyNumber = ((Int32)i);
 }
예제 #5
0
 NumericReplyMessage(NumericReply i)
 {
     this.SetCommand(((Int32)i).ToString("000"));
     _replyNumber = ((Int32)i);
 }
예제 #6
0
 /// <summary>
 /// サーバからクライアントにニュメリックリプライを返します。
 /// </summary>
 /// <param name="numReply">リプライ番号</param>
 /// <param name="commandParams">リプライコマンドパラメータ</param>
 public void SendNumericReply(NumericReply numReply, params String[] commandParams)
 {
     if (IsClosing)
         return;
     lock (_connections)
         foreach (ConnectionBase connection in _connections)
             connection.SendNumericReply(numReply, commandParams);
 }