aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
authorDev Random2014-04-02 00:32:29 -0400
committerMichael Cerquoni2014-04-03 12:45:43 -0400
commit4aa483777b244962b0bc8d4048cd8b9f021c40e6 (patch)
tree56f854addfdf169928458a38f0419fcfa293f713 /OpenSim/Region/Application
parentReduced log levels for REST 404 errors to DEBUG (diff)
downloadopensim-SC_OLD-4aa483777b244962b0bc8d4048cd8b9f021c40e6.zip
opensim-SC_OLD-4aa483777b244962b0bc8d4048cd8b9f021c40e6.tar.gz
opensim-SC_OLD-4aa483777b244962b0bc8d4048cd8b9f021c40e6.tar.bz2
opensim-SC_OLD-4aa483777b244962b0bc8d4048cd8b9f021c40e6.tar.xz
Move new Estate commands to OpenSim.cs
Signed-off-by: Michael Cerquoni <nebadon2025@gmail.com>
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs137
1 files changed, 135 insertions, 2 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 5c3039d..544accf 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -45,6 +45,7 @@ using OpenSim.Framework.Servers;
45using OpenSim.Framework.Monitoring; 45using OpenSim.Framework.Monitoring;
46using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Services.Interfaces;
48 49
49namespace OpenSim 50namespace OpenSim
50{ 51{
@@ -399,6 +400,16 @@ namespace OpenSim
399 "delete-region <name>", 400 "delete-region <name>",
400 "Delete a region from disk", 401 "Delete a region from disk",
401 RunCommand); 402 RunCommand);
403
404 m_console.Commands.AddCommand("Estates", false, "estate set owner",
405 "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]",
406 "Sets the owner of the specified estate to the specified UUID or user. ",
407 SetEstateOwnerCommand);
408
409 m_console.Commands.AddCommand("Estates", false, "estate set name",
410 "estate set name <estate-id> <new name>",
411 "Sets the name of the specified estate to the specified value. New name must be unique.",
412 SetEstateNameCommand);
402 } 413 }
403 414
404 protected override void ShutdownSpecific() 415 protected override void ShutdownSpecific()
@@ -1165,6 +1176,130 @@ namespace OpenSim
1165 SceneManager.SaveCurrentSceneToArchive(cmdparams); 1176 SceneManager.SaveCurrentSceneToArchive(cmdparams);
1166 } 1177 }
1167 1178
1179 protected void SetEstateOwnerCommand(string module, string[] args)
1180 {
1181 string response = null;
1182
1183 Scene scene = SceneManager.CurrentOrFirstScene;
1184 IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
1185
1186 if (args.Length == 3)
1187 {
1188 response = "No estate specified.";
1189 }
1190 else
1191 {
1192 int estateId;
1193 if (!int.TryParse(args[3], out estateId))
1194 {
1195 response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]);
1196 }
1197 else
1198 {
1199 if (args.Length == 4)
1200 {
1201 response = "No user specified.";
1202 }
1203 else
1204 {
1205 UserAccount account = null;
1206
1207 // TODO: Is there a better choice here?
1208 UUID scopeID = UUID.Zero;
1209
1210 string s1 = args[4];
1211 if (args.Length == 5)
1212 {
1213 // attempt to get account by UUID
1214 UUID u;
1215 if (UUID.TryParse(s1, out u))
1216 {
1217 account = scene.UserAccountService.GetUserAccount(scopeID, u);
1218 if (account == null)
1219 response = String.Format("Could not find user {0}", s1);
1220 }
1221 else
1222 {
1223 response = String.Format("Invalid UUID {0}", s1);
1224 }
1225 }
1226 else
1227 {
1228 // attempt to get account by Firstname, Lastname
1229 string s2 = args[5];
1230 account = scene.UserAccountService.GetUserAccount(scopeID, s1, s2);
1231 if (account == null)
1232 response = String.Format("Could not find user {0} {1}", s1, s2);
1233 }
1234
1235 // If it's valid, send it off for processing.
1236 if (account != null)
1237 response = estateModule.SetEstateOwner(estateId, account);
1238
1239 if (response == String.Empty)
1240 {
1241 response = String.Format("Estate owner changed to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName);
1242 }
1243 }
1244 }
1245 }
1246
1247 // give the user some feedback
1248 if (response != null)
1249 MainConsole.Instance.Output(response);
1250 }
1251
1252 protected void SetEstateNameCommand(string module, string[] args)
1253 {
1254 string response = null;
1255
1256 Scene scene = SceneManager.CurrentOrFirstScene;
1257 IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
1258
1259 if (args.Length == 3)
1260 {
1261 response = "No estate specified.";
1262 }
1263 else
1264 {
1265 int estateId;
1266 if (!int.TryParse(args[3], out estateId))
1267 {
1268 response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]);
1269 }
1270 else
1271 {
1272 if (args.Length == 4)
1273 {
1274 response = "No name specified.";
1275 }
1276 else
1277 {
1278 // everything after the estate ID is "name"
1279 StringBuilder sb = new StringBuilder(args[4]);
1280 for (int i = 5; i < args.Length; i++)
1281 sb.Append (" " + args[i]);
1282
1283 string estateName = sb.ToString();
1284
1285 // send it off for processing.
1286 response = estateModule.SetEstateName(estateId, estateName);
1287
1288 if (response == String.Empty)
1289 {
1290 response = String.Format("Estate {0} renamed to \"{1}\"", estateId, estateName);
1291 }
1292 }
1293 }
1294 }
1295
1296 // give the user some feedback
1297 if (response != null)
1298 MainConsole.Instance.Output(response);
1299 }
1300
1301 #endregion
1302
1168 private static string CombineParams(string[] commandParams, int pos) 1303 private static string CombineParams(string[] commandParams, int pos)
1169 { 1304 {
1170 string result = String.Empty; 1305 string result = String.Empty;
@@ -1175,7 +1310,5 @@ namespace OpenSim
1175 result = result.TrimEnd(' '); 1310 result = result.TrimEnd(' ');
1176 return result; 1311 return result;
1177 } 1312 }
1178
1179 #endregion
1180 } 1313 }
1181} 1314}