//      public void SelectiveBroadcast(string message, string tag, List<Chat> exclude = null)
//      {
//         if (string.IsNullOrEmpty(message))
//            return;
//
//         if (exclude == null)
//            exclude = new List<Chat>();
//
//         List<Chat> receivers = new List<Chat>();
//         lock (managerLock)
//         {
//            Log("Enter selective broadcast lock", MyExtensions.Logging.LogLevel.Locks);
//            receivers = activeChatters.Except(exclude).ToList();
//            receivers = receivers.Where(x => AllAcceptedTagsForUser(x.UID).Contains(tag)).ToList();
//            Log("Exit selective broadcast lock", MyExtensions.Logging.LogLevel.Locks);
//         }
//
//         Log("Just before broadast", MyExtensions.Logging.LogLevel.SuperDebug);
//         foreach (Chat chatter in receivers)
//            chatter.MySend(message);
//         Log("Just after broadcast", MyExtensions.Logging.LogLevel.SuperDebug);
//      }

      public void Broadcast(LanguageTagParameters parameters, JSONObject container, List<Chat> exclude = null)
      {
         if (exclude == null)
            exclude = new List<Chat>();

//         List<Chat> receivers = new List<Chat>();
//         lock (managerLock)
//         {
//            Log("Enter broadcast tag lock", MyExtensions.Logging.LogLevel.Locks);
//            receivers = activeChatters.Except(exclude).ToList();
//            Log("Exit broadcast tag lock", MyExtensions.Logging.LogLevel.Locks);
//         }

         Log("Just before tag broadast", MyExtensions.Logging.LogLevel.SuperDebug);
         foreach (Chat chatter in ConnectedUsers().Select(x => (Chat)x).Except(exclude))
         {
            parameters.UpdateUser(chatter.ThisUser);  //Update the message to reflect user preferences
            chatter.MySend(parameters, container);    //Send a tag message by filling the container with the tag parameters
         }
         Log("Just after tag broadcast", MyExtensions.Logging.LogLevel.SuperDebug);
      }
      public void Broadcast(LanguageTagParameters parameters, JSONObject container, List<Chat> exclude = null)
      {
         if (exclude == null)
            exclude = new List<Chat>();

         Log("Just before tag broadast", MyExtensions.Logging.LogLevel.SuperDebug);
         foreach (Chat chatter in ConnectedUsers().Select(x => (Chat)x).Except(exclude))
         {
            parameters.UpdateUser(chatter.ThisUser);  //Update the message to reflect user preferences

            //Send a tag message by filling the container with the tag parameters
            if(!parameters.RawSendingUser.ShadowBanned || parameters.RawSendingUser.UID == chatter.ThisUser.UID)
               chatter.MySend(parameters, container);    
         }
         Log("Just after tag broadcast", MyExtensions.Logging.LogLevel.SuperDebug);
      }