Exemple #1
0
        public void SendMessage(string message, IChatUser sender)
        {
            if (!users.Contains(sender))
            {
                sender.Recieve("You are not registered in the chat!", null);
                return;
            }

            if (CommandFilter(message, sender))
            {
                return;
            }

            depth++;
            Debug.WriteLine(depth);

            foreach (IChatUser user in users)
            {
                if (user == sender)
                {
                    continue;
                }
                user.Recieve(message, sender);
            }

            ExecuteKickDepthCheck();
        }
Exemple #2
0
        private bool CommandFilter(string message, IChatUser sender)
        {
            string[] para = message.Split(' ');
            switch (para[0])
            {
            case "addBot":
                SendMessage("Adding Bot");
                AddBot();
                return(true);

            case "kick":
                if (!admins.Contains(sender))
                {
                    sender.Recieve("You don't have permissions to use command: " + para[0], null);
                    return(true);
                }
                MarkToKick(para[1]);
                return(true);

            default:
                break;
            }
            return(false);
        }