/// <summary> /// Kicks users off the region /// </summary> /// <param name="cmdparams">name of avatar to kick</param> private void KickUserCommand(string[] cmdparams) { string alert = null; IList agents = new List <IScenePresence>(CurrentOrFirstScene.GetScenePresences()); if (cmdparams.Length < 4) { if (cmdparams.Length < 3) { return; } UUID avID = UUID.Zero; if (cmdparams[2] == "all") { foreach (IScenePresence presence in agents) { RegionInfo regionInfo = presence.Scene.RegionInfo; MainConsole.Instance.Info(String.Format("Kicking user: {0,-16}{1,-37} in region: {2,-16}", presence.Name, presence.UUID, regionInfo.RegionName)); // kick client... if (alert != null) { presence.ControllingClient.Kick(alert); } else { presence.ControllingClient.Kick("\nThe Aurora manager kicked you out.\n"); } // ...and close on our side IEntityTransferModule transferModule = presence.Scene.RequestModuleInterface <IEntityTransferModule> (); if (transferModule != null) { transferModule.IncomingCloseAgent(presence.Scene, presence.UUID); } } } else if (UUID.TryParse(cmdparams[2], out avID)) { foreach (IScenePresence presence in agents) { if (presence.UUID == avID) { RegionInfo regionInfo = presence.Scene.RegionInfo; MainConsole.Instance.Info(String.Format("Kicking user: {0,-16}{1,-37} in region: {2,-16}", presence.Name, presence.UUID, regionInfo.RegionName)); // kick client... if (alert != null) { presence.ControllingClient.Kick(alert); } else { presence.ControllingClient.Kick("\nThe Aurora manager kicked you out.\n"); } // ...and close on our side IEntityTransferModule transferModule = presence.Scene.RequestModuleInterface <IEntityTransferModule> (); if (transferModule != null) { transferModule.IncomingCloseAgent(presence.Scene, presence.UUID); } } } } } if (cmdparams.Length > 4) { alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4)); } foreach (IScenePresence presence in agents) { RegionInfo regionInfo = presence.Scene.RegionInfo; string param = Util.CombineParams(cmdparams, 2); if (presence.Name.ToLower().Contains(param.ToLower()) || (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))) { MainConsole.Instance.Info(String.Format("Kicking user: {0,-16}{1,-37} in region: {2,-16}", presence.Name, presence.UUID, regionInfo.RegionName)); // kick client... if (alert != null) { presence.ControllingClient.Kick(alert); } else { presence.ControllingClient.Kick("\nThe Aurora manager kicked you out.\n"); } // ...and close on our side IEntityTransferModule transferModule = presence.Scene.RequestModuleInterface <IEntityTransferModule> (); if (transferModule != null) { transferModule.IncomingCloseAgent(presence.Scene, presence.UUID); } } } MainConsole.Instance.Info(""); }
private void HandleShowUsers(string[] cmd) { List <string> args = new List <string> (cmd); args.RemoveAt(0); string[] showParams = args.ToArray(); List <IScenePresence> agents = new List <IScenePresence>(); if (showParams.Length > 1 && showParams[1] == "full") { if (MainConsole.Instance.ConsoleScene == null) { foreach (IScene scene in m_localScenes) { agents.AddRange(scene.GetScenePresences()); } } else { agents = CurrentOrFirstScene.GetScenePresences(); } } else { if (MainConsole.Instance.ConsoleScene == null) { foreach (IScene scene in m_localScenes) { agents.AddRange(scene.GetScenePresences()); } } else { agents = CurrentOrFirstScene.GetScenePresences(); } agents.RemoveAll(delegate(IScenePresence sp) { return(sp.IsChildAgent); }); } MainConsole.Instance.Info(String.Format("\nAgents connected: {0}\n", agents.Count)); MainConsole.Instance.Info(String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", "Firstname", "Lastname", "Agent ID", "Root/Child", "Region", "Position")); foreach (IScenePresence presence in agents) { RegionInfo regionInfo = presence.Scene.RegionInfo; string regionName; if (regionInfo == null) { regionName = "Unresolvable"; } else { regionName = regionInfo.RegionName; } MainConsole.Instance.Info(String.Format("{0,-16}{1,-37}{2,-11}{3,-16}{4,-30}", presence.Name, presence.UUID, presence.IsChildAgent ? "Child" : "Root", regionName, presence.AbsolutePosition.ToString())); } MainConsole.Instance.Info(String.Empty); MainConsole.Instance.Info(String.Empty); }