示例#1
0
        public void RecievePublicMessage(User from, string to, string message)
        {
            string[] msg = message.Split(' ');

            // Parse as a command
            if (msg[0].StartsWith("-"))
            {
                // -ExternalCommand Params
                IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Magenta);

                string   command   = msg[0].Substring(1);
                object[] arguments = msg.Length > 1 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { };

                parent.IssueCommand(this, from, command, arguments);
            }
            else if (msg[0].StartsWith("+"))
            {
                IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Yellow);
                string   command   = msg[0].Substring(1);
                object[] arguments = msg.Length > 0 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { };
                CoreCommands.Execute(command, this.parent, this, from.Nick, arguments);
            }
            else // Just display the message in a specified colour
            {
                IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Green);
            }
        }