private static void AdminAction(string adminNick, string action, string[] args)
        {
            List <string> splitArray = new List <string>(action.Split(new char[] { ' ' }));
            string        command    = splitArray[0].ToUpper();

            splitArray.RemoveAt(0);
            if (command == "KILL")
            {
                string nick = splitArray[0];
                splitArray.RemoveAt(0);
                string reason = String.Join(" ", splitArray.ToArray());
                AdminTools.disconnectUser(nick, "User " + nick + " has been Disconnected by " + adminNick + " (" + reason + ").");
            }
            else if (command == "MUTE")
            {
                string nick = splitArray[0];
                splitArray.RemoveAt(0);
                string reason = String.Join(" ", splitArray.ToArray());
                AdminTools.muteUser(nick, adminNick);
            }
            else if (command == "UNMUTE")
            {
                string nick = splitArray[0];
                splitArray.RemoveAt(0);
                string reason = String.Join(" ", splitArray.ToArray());
                AdminTools.unMuteUser(nick, adminNick);
            }
        }
 public static void OnCommand(Lists.MessageType messageType, string nick, string message, string[] args)
 {
     if (messageType == Lists.MessageType.Message)
     {
         if (Lists.OnlineAdmins.ContainsKey(nick))
         {
             SendMessage(nick, "<" + nick + " (Admin)> " + message);
         }
         else
         {
             SendMessage(nick, "<" + nick + "> " + message);
         }
     }
     else if (messageType == Lists.MessageType.Action)
     {
         SendMessage(nick, "* " + nick + " " + message);
     }
     else if (messageType == Lists.MessageType.AdminAction)
     {
         if (Lists.Admins.ContainsKey(args[0]))
         {
             if (Lists.Admins[args[0]] == args[1])
             {
                 if (Lists.OnlineAdmins.ContainsKey(nick))
                 {
                 }
                 else
                 {
                     Lists.getConnectionByNick[nick].sendMessageToUser("---You have successfully logged in as " + args[0]);
                     SendAdminMessage("Room Admin " + args[0] + " now online (" + nick + ")");
                     Lists.OnlineAdmins.Add(nick, Lists.getConnectionByNick[nick]);
                     Lists.getConnectionByNick[nick].currUserAdmin = args[0];
                 }
                 AdminAction(nick, message, args);
                 return;
             }
         }
         Lists.getConnectionByNick[nick].sendMessageToUser("---Login Incorrect");
         AdminTools.msgAllOnlineAdmins("Failed Administrative Login by " + nick + " using user '" + args[0] + "'.");
     }
     else if (messageType == Lists.MessageType.Notice)
     {
         SendMessage(nick, "* " + nick + ": " + message + " *");
     }
 }
 private static void SendMessage(string From, string Message)
 {
     if (isMuted(From))
     {
         if (Lists.getConnectionByNick.ContainsKey(From))
         {
             Lists.getConnectionByNick[From].sendMessageToUser("You are muted, so you cannot talk.");
             e = new StatusChangedEventArgs("Muted user> " + Message);
             OnStatusChanged(e);
             AdminTools.msgAllOnlineAdmins("Muted user> " + Message);
         }
     }
     else
     {
         StreamWriter swSenderSender;
         e = new StatusChangedEventArgs(Message);
         OnStatusChanged(e);
         TcpClient[] tcpClients = new TcpClient[ChatServer.htUsers.Count];
         ChatServer.htUsers.Values.CopyTo(tcpClients, 0);
         for (int i = 0; i < tcpClients.Length; i++)
         {
             try
             {
                 if (Message.Trim() == "" || tcpClients[i] == null)
                 {
                     continue;
                 }
                 swSenderSender = new StreamWriter(tcpClients[i].GetStream());
                 swSenderSender.WriteLine(Message);
                 swSenderSender.Flush();
                 swSenderSender = null;
             }
             catch
             {
                 RemoveUser(tcpClients[i]);
             }
         }
     }
 }
 private void button5_Click_1(object sender, EventArgs e)
 {
     AdminTools.disconnectUser(textBox5.Text, null);
     textBox5.Clear(); textBox5.Text = "";
 }
 private void button4_Click_1(object sender, EventArgs e)
 {
     AdminTools.unMuteUser(textBox4.Text, "Server");
     textBox4.Clear(); textBox4.Text = "";
 }