diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 544accf..59b4614 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -272,6 +272,7 @@ namespace OpenSim | |||
272 | + " [--no-objects]" | 272 | + " [--no-objects]" |
273 | + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" | 273 | + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" |
274 | + " [--displacement \"<x,y,z>\"]" | 274 | + " [--displacement \"<x,y,z>\"]" |
275 | + " [--default-user \"User Name\"]" | ||
275 | + " [<OAR path>]", | 276 | + " [<OAR path>]", |
276 | "Load a region's data from an OAR archive.", | 277 | "Load a region's data from an OAR archive.", |
277 | "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine | 278 | "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine |
@@ -401,6 +402,12 @@ namespace OpenSim | |||
401 | "Delete a region from disk", | 402 | "Delete a region from disk", |
402 | RunCommand); | 403 | RunCommand); |
403 | 404 | ||
405 | m_console.Commands.AddCommand("Estates", false, "estate create", | ||
406 | "estate create <owner UUID> <estate name>", | ||
407 | "Creates a new estate with the specified name, owned by the specified user." | ||
408 | + " Estate name must be unique.", | ||
409 | CreateEstateCommand); | ||
410 | |||
404 | m_console.Commands.AddCommand("Estates", false, "estate set owner", | 411 | m_console.Commands.AddCommand("Estates", false, "estate set owner", |
405 | "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", | 412 | "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", |
406 | "Sets the owner of the specified estate to the specified UUID or user. ", | 413 | "Sets the owner of the specified estate to the specified UUID or user. ", |
@@ -410,6 +417,11 @@ namespace OpenSim | |||
410 | "estate set name <estate-id> <new name>", | 417 | "estate set name <estate-id> <new name>", |
411 | "Sets the name of the specified estate to the specified value. New name must be unique.", | 418 | "Sets the name of the specified estate to the specified value. New name must be unique.", |
412 | SetEstateNameCommand); | 419 | SetEstateNameCommand); |
420 | |||
421 | m_console.Commands.AddCommand("Estates", false, "estate link region", | ||
422 | "estate link region <estate ID> <region ID>", | ||
423 | "Attaches the specified region to the specified estate.", | ||
424 | EstateLinkRegionCommand); | ||
413 | } | 425 | } |
414 | 426 | ||
415 | protected override void ShutdownSpecific() | 427 | protected override void ShutdownSpecific() |
@@ -1176,6 +1188,58 @@ namespace OpenSim | |||
1176 | SceneManager.SaveCurrentSceneToArchive(cmdparams); | 1188 | SceneManager.SaveCurrentSceneToArchive(cmdparams); |
1177 | } | 1189 | } |
1178 | 1190 | ||
1191 | protected void CreateEstateCommand(string module, string[] args) | ||
1192 | { | ||
1193 | string response = null; | ||
1194 | UUID userID; | ||
1195 | |||
1196 | if (args.Length == 2) | ||
1197 | { | ||
1198 | response = "No user specified."; | ||
1199 | } | ||
1200 | else if (!UUID.TryParse(args[2], out userID)) | ||
1201 | { | ||
1202 | response = String.Format("{0} is not a valid UUID", args[2]); | ||
1203 | } | ||
1204 | else if (args.Length == 3) | ||
1205 | { | ||
1206 | response = "No estate name specified."; | ||
1207 | } | ||
1208 | else | ||
1209 | { | ||
1210 | Scene scene = SceneManager.CurrentOrFirstScene; | ||
1211 | |||
1212 | // TODO: Is there a better choice here? | ||
1213 | UUID scopeID = UUID.Zero; | ||
1214 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, userID); | ||
1215 | if (account == null) | ||
1216 | { | ||
1217 | response = String.Format("Could not find user {0}", userID); | ||
1218 | } | ||
1219 | else | ||
1220 | { | ||
1221 | // concatenate it all to "name" | ||
1222 | StringBuilder sb = new StringBuilder(args[3]); | ||
1223 | for (int i = 4; i < args.Length; i++) | ||
1224 | sb.Append (" " + args[i]); | ||
1225 | string estateName = sb.ToString().Trim(); | ||
1226 | |||
1227 | // send it off for processing. | ||
1228 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1229 | response = estateModule.CreateEstate(estateName, userID); | ||
1230 | if (response == String.Empty) | ||
1231 | { | ||
1232 | List<int> estates = scene.EstateDataService.GetEstates(estateName); | ||
1233 | response = String.Format("Estate {0} created as \"{1}\"", estates.ElementAt(0), estateName); | ||
1234 | } | ||
1235 | } | ||
1236 | } | ||
1237 | |||
1238 | // give the user some feedback | ||
1239 | if (response != null) | ||
1240 | MainConsole.Instance.Output(response); | ||
1241 | } | ||
1242 | |||
1179 | protected void SetEstateOwnerCommand(string module, string[] args) | 1243 | protected void SetEstateOwnerCommand(string module, string[] args) |
1180 | { | 1244 | { |
1181 | string response = null; | 1245 | string response = null; |
@@ -1298,6 +1362,56 @@ namespace OpenSim | |||
1298 | MainConsole.Instance.Output(response); | 1362 | MainConsole.Instance.Output(response); |
1299 | } | 1363 | } |
1300 | 1364 | ||
1365 | private void EstateLinkRegionCommand(string module, string[] args) | ||
1366 | { | ||
1367 | int estateId =-1; | ||
1368 | UUID regionId = UUID.Zero; | ||
1369 | Scene scene = null; | ||
1370 | string response = null; | ||
1371 | |||
1372 | if (args.Length == 3) | ||
1373 | { | ||
1374 | response = "No estate specified."; | ||
1375 | } | ||
1376 | else if (!int.TryParse(args [3], out estateId)) | ||
1377 | { | ||
1378 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args [3]); | ||
1379 | } | ||
1380 | else if (args.Length == 4) | ||
1381 | { | ||
1382 | response = "No region specified."; | ||
1383 | } | ||
1384 | else if (!UUID.TryParse(args[4], out regionId)) | ||
1385 | { | ||
1386 | response = String.Format("\"{0}\" is not a valid UUID for a Region", args [4]); | ||
1387 | } | ||
1388 | else if (!SceneManager.TryGetScene(regionId, out scene)) | ||
1389 | { | ||
1390 | // region may exist, but on a different sim. | ||
1391 | response = String.Format("No access to Region \"{0}\"", args [4]); | ||
1392 | } | ||
1393 | |||
1394 | if (response != null) | ||
1395 | { | ||
1396 | MainConsole.Instance.Output(response); | ||
1397 | return; | ||
1398 | } | ||
1399 | |||
1400 | // send it off for processing. | ||
1401 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1402 | response = estateModule.SetRegionEstate(scene.RegionInfo, estateId); | ||
1403 | if (response == String.Empty) | ||
1404 | { | ||
1405 | estateModule.TriggerRegionInfoChange(); | ||
1406 | estateModule.sendRegionHandshakeToAll(); | ||
1407 | response = String.Format ("Region {0} is now attached to estate {1}", regionId, estateId); | ||
1408 | } | ||
1409 | |||
1410 | // give the user some feedback | ||
1411 | if (response != null) | ||
1412 | MainConsole.Instance.Output (response); | ||
1413 | } | ||
1414 | |||
1301 | #endregion | 1415 | #endregion |
1302 | 1416 | ||
1303 | private static string CombineParams(string[] commandParams, int pos) | 1417 | private static string CombineParams(string[] commandParams, int pos) |