aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Estate
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-02-12 00:46:01 +0000
committerJustin Clark-Casey (justincc)2011-02-12 00:46:01 +0000
commit7e21c1eadf28e86b29fdd24b33e29950e195c6db (patch)
tree96a3a7a545ee7957030a06ed6b6be3f8a711fe83 /OpenSim/Region/CoreModules/World/Estate
parentrefactor: split out estate management commands into separate class (diff)
downloadopensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.zip
opensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.tar.gz
opensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.tar.bz2
opensim-SC_OLD-7e21c1eadf28e86b29fdd24b33e29950e195c6db.tar.xz
Hack in a crude temporary "estate show" command
This will show the estate for each region, along with that estate's id and the estate owner. This is temporary because the command output might change. This commit also converts the estate module from the old to the new region module format
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs74
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs40
2 files changed, 93 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 14f5b1e..f6d1a82 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -30,21 +30,29 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Security; 32using System.Security;
33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Console;
39using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
37using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
39 42
40namespace OpenSim.Region.CoreModules.World.Estate 43namespace OpenSim.Region.CoreModules.World.Estate
41{ 44{
45 /// <summary>
46 /// Estate management console commands.
47 /// </summary>
42 public class EstateManagementCommands 48 public class EstateManagementCommands
43 { 49 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 51
46 protected EstateManagementModule m_module; 52 protected EstateManagementModule m_module;
47 53
54 protected Commander m_commander = new Commander("estate");
55
48 public EstateManagementCommands(EstateManagementModule module) 56 public EstateManagementCommands(EstateManagementModule module)
49 { 57 {
50 m_module = module; 58 m_module = module;
@@ -52,20 +60,60 @@ namespace OpenSim.Region.CoreModules.World.Estate
52 60
53 public void Initialise() 61 public void Initialise()
54 { 62 {
55 m_module.Scene.AddCommand(this, "set terrain texture", 63 m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
64
65 m_module.Scene.AddCommand(m_module, "set terrain texture",
56 "set terrain texture <number> <uuid> [<x>] [<y>]", 66 "set terrain texture <number> <uuid> [<x>] [<y>]",
57 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + 67 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
58 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + 68 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
59 " that coordinate.", 69 " that coordinate.",
60 consoleSetTerrainTexture); 70 consoleSetTerrainTexture);
61 71
62 m_module.Scene.AddCommand(this, "set terrain heights", 72 m_module.Scene.AddCommand(m_module, "set terrain heights",
63 "set terrain heights <corner> <min> <max> [<x>] [<y>]", 73 "set terrain heights <corner> <min> <max> [<x>] [<y>]",
64 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + 74 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
65 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + 75 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
66 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", 76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
67 consoleSetTerrainHeights); 77 consoleSetTerrainHeights);
68 } 78
79 Command showCommand
80 = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator.");
81
82 m_commander.RegisterCommand("show", showCommand);
83
84 m_module.Scene.RegisterModuleCommander(m_commander);
85
86 m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
87 }
88
89 public void Close()
90 {
91 m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
92 m_module.Scene.UnregisterModuleCommander(m_commander.Name);
93 }
94
95 /// <summary>
96 /// Processes commandline input. Do not call directly.
97 /// </summary>
98 /// <param name="args">Commandline arguments</param>
99 protected void EventManagerOnPluginConsole(string[] args)
100 {
101 if (args[0] == "estate")
102 {
103 if (args.Length == 1)
104 {
105 m_commander.ProcessConsoleCommand("help", new string[0]);
106 return;
107 }
108
109 string[] tmpArgs = new string[args.Length - 2];
110 int i;
111 for (i = 2; i < args.Length; i++)
112 tmpArgs[i - 2] = args[i];
113
114 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
115 }
116 }
69 117
70 protected void consoleSetTerrainTexture(string module, string[] args) 118 protected void consoleSetTerrainTexture(string module, string[] args)
71 { 119 {
@@ -152,5 +200,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
152 } 200 }
153 } 201 }
154 } 202 }
203
204 protected void ShowEstatesCommand(Object[] args)
205 {
206 StringBuilder report = new StringBuilder();
207 RegionInfo ri = m_module.Scene.RegionInfo;
208 EstateSettings es = ri.EstateSettings;
209
210 report.AppendFormat("Estate information for region {0}\n", ri.RegionName);
211 report.AppendFormat(
212 "{0,-20} {1,-7} {2,-20}\n",
213 "Estate Name",
214 "ID",
215 "Owner");
216
217 report.AppendFormat(
218 "{0,-20} {1,-7} {2,-20}\n",
219 es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner));
220
221 MainConsole.Instance.Output(report.ToString());
222 }
155 } 223 }
156} \ No newline at end of file 224} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 54d3c61..57ab135 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Security; 32using System.Security;
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
@@ -39,15 +40,17 @@ using OpenSim.Region.Framework.Scenes;
39 40
40namespace OpenSim.Region.CoreModules.World.Estate 41namespace OpenSim.Region.CoreModules.World.Estate
41{ 42{
42 public class EstateManagementModule : IEstateModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateManagementModule")]
44 public class EstateManagementModule : IEstateModule, INonSharedRegionModule
43 { 45 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 47
46 private delegate void LookupUUIDS(List<UUID> uuidLst); 48 private delegate void LookupUUIDS(List<UUID> uuidLst);
47 49
48 public Scene Scene { get; private set; } 50 public Scene Scene { get; private set; }
51 public IUserManagement UserManager { get; private set; }
49 52
50 protected EstateManagementCommands m_commands; 53 protected EstateManagementCommands m_commands;
51 54
52 private EstateTerrainXferHandler TerrainUploader; 55 private EstateTerrainXferHandler TerrainUploader;
53 56
@@ -895,9 +898,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
895 #endregion 898 #endregion
896 899
897 #region IRegionModule Members 900 #region IRegionModule Members
901
902 public string Name { get { return "EstateManagementModule"; } }
903
904 public Type ReplaceableInterface { get { return null; } }
898 905
899 public void Initialise(Scene scene, IConfigSource source) 906 public void Initialise(IConfigSource source) {}
900 { 907
908 public void AddRegion(Scene scene)
909 {
901 Scene = scene; 910 Scene = scene;
902 Scene.RegisterModuleInterface<IEstateModule>(this); 911 Scene.RegisterModuleInterface<IEstateModule>(this);
903 Scene.EventManager.OnNewClient += EventManager_OnNewClient; 912 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
@@ -906,26 +915,21 @@ namespace OpenSim.Region.CoreModules.World.Estate
906 m_commands = new EstateManagementCommands(this); 915 m_commands = new EstateManagementCommands(this);
907 m_commands.Initialise(); 916 m_commands.Initialise();
908 } 917 }
909 918
910 public void PostInitialise() 919 public void RemoveRegion(Scene scene) {}
920
921 public void RegionLoaded(Scene scene)
911 { 922 {
912 // Sets up the sun module based no the saved Estate and Region Settings 923 // Sets up the sun module based no the saved Estate and Region Settings
913 // DO NOT REMOVE or the sun will stop working 924 // DO NOT REMOVE or the sun will stop working
914 Scene.TriggerEstateSunUpdate(); 925 scene.TriggerEstateSunUpdate();
915 } 926
916 927 UserManager = scene.RequestModuleInterface<IUserManagement>();
917 public void Close()
918 {
919 }
920
921 public string Name
922 {
923 get { return "EstateManagementModule"; }
924 } 928 }
925 929
926 public bool IsSharedModule 930 public void Close()
927 { 931 {
928 get { return false; } 932 m_commands.Close();
929 } 933 }
930 934
931 #endregion 935 #endregion