aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-02-12 20:42:11 -0500
committerBlueWall2011-02-12 20:42:11 -0500
commitc0e1742d479d4390701688da685892555f28bfbc (patch)
tree39d717dd9ce4c453898eca2237f9fc2d2879c1d4
parentMerge branch 'master' of /home/opensim/src/OpenSim/Core (diff)
parentFixed a couple of tests in the HttpServer. Not sure if this is enough. Mantis... (diff)
downloadopensim-SC_OLD-c0e1742d479d4390701688da685892555f28bfbc.zip
opensim-SC_OLD-c0e1742d479d4390701688da685892555f28bfbc.tar.gz
opensim-SC_OLD-c0e1742d479d4390701688da685892555f28bfbc.tar.bz2
opensim-SC_OLD-c0e1742d479d4390701688da685892555f28bfbc.tar.xz
Merge branch 'master' of /home/opensim/src/OpenSim/Core
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs2
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs6
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs6
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs30
-rw-r--r--OpenSim/Framework/Capabilities/CapsHandlers.cs2
-rw-r--r--OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs2
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs27
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs32
-rw-r--r--OpenSim/Framework/Util.cs10
-rw-r--r--OpenSim/Region/Application/OpenSim.cs77
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs12
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs169
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs26
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs362
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs224
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs616
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISceneViewer.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs56
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs19
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs66
-rw-r--r--OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs6
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs7
-rw-r--r--OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs335
-rw-r--r--OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs140
-rw-r--r--OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs582
-rw-r--r--OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs196
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs23
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs55
-rw-r--r--OpenSim/Services/GridService/GridService.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs12
-rw-r--r--bin/HttpServer_OpenSim.dllbin115712 -> 115712 bytes
-rw-r--r--bin/HttpServer_OpenSim.pdbbin409088 -> 409088 bytes
-rw-r--r--bin/OpenSim.ini.example3
-rw-r--r--bin/assets/TexturesAssetSet/TexturesAssetSet.xml9
-rw-r--r--bin/config-include/GridCommon.ini.example4
-rw-r--r--bin/config-include/HyperSimianGrid.ini11
-rw-r--r--bin/config-include/StandaloneCommon.ini.example4
-rwxr-xr-xbin/sqlite3.dllbin505771 -> 559244 bytes
59 files changed, 1164 insertions, 2164 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 7ef0f5f..f37c399 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -122,9 +122,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
122 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + 122 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
123 Thread.CurrentThread.ManagedThreadId.ToString() + 123 Thread.CurrentThread.ManagedThreadId.ToString() +
124 ")"); 124 ")");
125
125 m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); 126 m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
126 m_openSim.CreateRegion(regionsToLoad[i], true, out scene); 127 m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
127 regionsToLoad[i].EstateSettings.Save(); 128 regionsToLoad[i].EstateSettings.Save();
129
128 if (scene != null) 130 if (scene != null)
129 { 131 {
130 m_newRegionCreatedHandler = OnNewRegionCreated; 132 m_newRegionCreatedHandler = OnNewRegionCreated;
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index 019ca73..0188eb7 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -44,7 +44,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
44 44
45 // private static readonly int PARM_PATH = 1; 45 // private static readonly int PARM_PATH = 1;
46 46
47 private bool enabled = false; 47// private bool enabled = false;
48 private string qPrefix = "appearance"; 48 private string qPrefix = "appearance";
49 49
50 /// <summary> 50 /// <summary>
@@ -74,7 +74,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
74 74
75 // Activate if everything went OK 75 // Activate if everything went OK
76 76
77 enabled = true; 77// enabled = true;
78 78
79 Rest.Log.InfoFormat("{0} User appearance services initialization complete", MsgId); 79 Rest.Log.InfoFormat("{0} User appearance services initialization complete", MsgId);
80 } 80 }
@@ -95,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
95 95
96 public void Close() 96 public void Close()
97 { 97 {
98 enabled = false; 98// enabled = false;
99 Rest.Log.InfoFormat("{0} User appearance services closing down", MsgId); 99 Rest.Log.InfoFormat("{0} User appearance services closing down", MsgId);
100 } 100 }
101 101
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index c3cf08c..b415662 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -46,12 +46,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
46 public class RestInventoryServices : IRest 46 public class RestInventoryServices : IRest
47 { 47 {
48// private static readonly int PARM_USERID = 0; 48// private static readonly int PARM_USERID = 0;
49 private static readonly int PARM_PATH = 1; 49// private static readonly int PARM_PATH = 1;
50 50
51// private bool enabled = false; 51// private bool enabled = false;
52 private string qPrefix = "inventory"; 52 private string qPrefix = "inventory";
53 53
54 private static readonly string PRIVATE_ROOT_NAME = "My Inventory"; 54// private static readonly string PRIVATE_ROOT_NAME = "My Inventory";
55 55
56 /// <summary> 56 /// <summary>
57 /// The constructor makes sure that the service prefix is absolute 57 /// The constructor makes sure that the service prefix is absolute
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 8d93354..377c680 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -669,10 +669,6 @@ namespace OpenSim.Data.SQLite
669 } 669 }
670 } 670 }
671 671
672 /// <summary>
673 ///
674 /// </summary>
675 /// <param name="globalID"></param>
676 public void RemoveLandObject(UUID globalID) 672 public void RemoveLandObject(UUID globalID)
677 { 673 {
678 lock (ds) 674 lock (ds)
@@ -698,7 +694,6 @@ namespace OpenSim.Data.SQLite
698 if (landRow != null) 694 if (landRow != null)
699 { 695 {
700 landRow.Delete(); 696 landRow.Delete();
701 land.Rows.Remove(landRow);
702 } 697 }
703 List<DataRow> rowsToDelete = new List<DataRow>(); 698 List<DataRow> rowsToDelete = new List<DataRow>();
704 foreach (DataRow rowToCheck in landaccesslist.Rows) 699 foreach (DataRow rowToCheck in landaccesslist.Rows)
@@ -709,7 +704,6 @@ namespace OpenSim.Data.SQLite
709 for (int iter = 0; iter < rowsToDelete.Count; iter++) 704 for (int iter = 0; iter < rowsToDelete.Count; iter++)
710 { 705 {
711 rowsToDelete[iter].Delete(); 706 rowsToDelete[iter].Delete();
712 landaccesslist.Rows.Remove(rowsToDelete[iter]);
713 } 707 }
714 } 708 }
715 Commit(); 709 Commit();
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 1600bdc..3dbc215 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -220,6 +220,8 @@ namespace OpenSim.Framework
220 args["packed_appearance"] = appmap; 220 args["packed_appearance"] = appmap;
221 } 221 }
222 222
223 // Old, bad way. Keeping it fow now for backwards compatibility
224 // OBSOLETE -- soon to be deleted
223 if (ServiceURLs != null && ServiceURLs.Count > 0) 225 if (ServiceURLs != null && ServiceURLs.Count > 0)
224 { 226 {
225 OSDArray urls = new OSDArray(ServiceURLs.Count * 2); 227 OSDArray urls = new OSDArray(ServiceURLs.Count * 2);
@@ -232,6 +234,19 @@ namespace OpenSim.Framework
232 args["service_urls"] = urls; 234 args["service_urls"] = urls;
233 } 235 }
234 236
237 // again, this time the right way
238 if (ServiceURLs != null && ServiceURLs.Count > 0)
239 {
240 OSDMap urls = new OSDMap();
241 foreach (KeyValuePair<string, object> kvp in ServiceURLs)
242 {
243 //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value);
244 urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString());
245 }
246 args["serviceurls"] = urls;
247 }
248
249
235 return args; 250 return args;
236 } 251 }
237 252
@@ -327,7 +342,20 @@ namespace OpenSim.Framework
327 } 342 }
328 343
329 ServiceURLs = new Dictionary<string, object>(); 344 ServiceURLs = new Dictionary<string, object>();
330 if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) 345 // Try parse the new way, OSDMap
346 if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map)
347 {
348 OSDMap urls = (OSDMap)(args["serviceurls"]);
349 foreach (KeyValuePair<String, OSD> kvp in urls)
350 {
351 ServiceURLs[kvp.Key] = kvp.Value.AsString();
352 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]);
353
354 }
355 }
356 // else try the old way, OSDArray
357 // OBSOLETE -- soon to be deleted
358 else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
331 { 359 {
332 OSDArray urls = (OSDArray)(args["service_urls"]); 360 OSDArray urls = (OSDArray)(args["service_urls"]);
333 for (int i = 0; i < urls.Count / 2; i++) 361 for (int i = 0; i < urls.Count / 2; i++)
diff --git a/OpenSim/Framework/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Capabilities/CapsHandlers.cs
index 864e6dd..e1c800e 100644
--- a/OpenSim/Framework/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Framework/Capabilities/CapsHandlers.cs
@@ -88,8 +88,8 @@ namespace OpenSim.Framework.Capabilities
88 /// handler to be removed</param> 88 /// handler to be removed</param>
89 public void Remove(string capsName) 89 public void Remove(string capsName)
90 { 90 {
91 // This line must be here, or caps will break!
92 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); 91 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
92 m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
93 m_capsHandlers.Remove(capsName); 93 m_capsHandlers.Remove(capsName);
94 } 94 }
95 95
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index d5e84c7..f138437 100644
--- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
@@ -303,7 +303,7 @@ namespace OpenSim.Framework.Serialization.External
303 writer.WriteStartElement("GroupOwned"); 303 writer.WriteStartElement("GroupOwned");
304 writer.WriteString(inventoryItem.GroupOwned.ToString()); 304 writer.WriteString(inventoryItem.GroupOwned.ToString());
305 writer.WriteEndElement(); 305 writer.WriteEndElement();
306 if (inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) 306 if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty)
307 writer.WriteElementString("CreatorData", inventoryItem.CreatorData); 307 writer.WriteElementString("CreatorData", inventoryItem.CreatorData);
308 else if (options.ContainsKey("profile")) 308 else if (options.ContainsKey("profile"))
309 { 309 {
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index b28ad69..21e1e09 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -319,18 +319,21 @@ namespace OpenSim.Framework.Servers
319 return; 319 return;
320 } 320 }
321 321
322 string rawLevel = cmd[3]; 322 if (cmd.Length > 3)
323 323 {
324 ILoggerRepository repository = LogManager.GetRepository(); 324 string rawLevel = cmd[3];
325 Level consoleLevel = repository.LevelMap[rawLevel]; 325
326 326 ILoggerRepository repository = LogManager.GetRepository();
327 if (consoleLevel != null) 327 Level consoleLevel = repository.LevelMap[rawLevel];
328 m_consoleAppender.Threshold = consoleLevel; 328
329 else 329 if (consoleLevel != null)
330 Notice( 330 m_consoleAppender.Threshold = consoleLevel;
331 String.Format( 331 else
332 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", 332 Notice(
333 rawLevel)); 333 String.Format(
334 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
335 rawLevel));
336 }
334 337
335 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); 338 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
336 } 339 }
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index d4ee7ba..4c35132 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -143,6 +143,11 @@ namespace OpenSim.Framework.Servers.HttpServer
143 } 143 }
144 } 144 }
145 145
146 public List<string> GetStreamHandlerKeys()
147 {
148 return new List<string>(m_streamHandlers.Keys);
149 }
150
146 private static string GetHandlerKey(string httpMethod, string path) 151 private static string GetHandlerKey(string httpMethod, string path)
147 { 152 {
148 return httpMethod + ":" + path; 153 return httpMethod + ":" + path;
@@ -179,6 +184,11 @@ namespace OpenSim.Framework.Servers.HttpServer
179 } 184 }
180 } 185 }
181 186
187 public List<string> GetXmlRpcHandlerKeys()
188 {
189 return new List<string>(m_rpcHandlers.Keys);
190 }
191
182 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) 192 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
183 { 193 {
184 //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); 194 //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
@@ -196,6 +206,12 @@ namespace OpenSim.Framework.Servers.HttpServer
196 return false; 206 return false;
197 } 207 }
198 208
209 public List<string> GetHTTPHandlerKeys()
210 {
211 return new List<string>(m_HTTPHandlers.Keys);
212 }
213
214
199 public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) 215 public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
200 { 216 {
201 bool pollHandlerResult = false; 217 bool pollHandlerResult = false;
@@ -214,6 +230,12 @@ namespace OpenSim.Framework.Servers.HttpServer
214 return false; 230 return false;
215 } 231 }
216 232
233 public List<string> GetPollServiceHandlerKeys()
234 {
235 return new List<string>(m_pollHandlers.Keys);
236 }
237
238
217 // Note that the agent string is provided simply to differentiate 239 // Note that the agent string is provided simply to differentiate
218 // the handlers - it is NOT required to be an actual agent header 240 // the handlers - it is NOT required to be an actual agent header
219 // value. 241 // value.
@@ -232,6 +254,11 @@ namespace OpenSim.Framework.Servers.HttpServer
232 return false; 254 return false;
233 } 255 }
234 256
257 public List<string> GetAgentHandlerKeys()
258 {
259 return new List<string>(m_agentHandlers.Keys);
260 }
261
235 public bool AddLLSDHandler(string path, LLSDMethod handler) 262 public bool AddLLSDHandler(string path, LLSDMethod handler)
236 { 263 {
237 lock (m_llsdHandlers) 264 lock (m_llsdHandlers)
@@ -245,6 +272,11 @@ namespace OpenSim.Framework.Servers.HttpServer
245 return false; 272 return false;
246 } 273 }
247 274
275 public List<string> GetLLSDHandlerKeys()
276 {
277 return new List<string>(m_llsdHandlers.Keys);
278 }
279
248 public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) 280 public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler)
249 { 281 {
250 m_defaultLlsdHandler = handler; 282 m_defaultLlsdHandler = handler;
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index d1d8736..533e53a 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1334,6 +1334,11 @@ namespace OpenSim.Framework
1334 return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; 1334 return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
1335 } 1335 }
1336 1336
1337 public static byte[] StringToBytes256(string str, params object[] args)
1338 {
1339 return StringToBytes256(string.Format(str, args));
1340 }
1341
1337 public static byte[] StringToBytes256(string str) 1342 public static byte[] StringToBytes256(string str)
1338 { 1343 {
1339 if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } 1344 if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; }
@@ -1352,6 +1357,11 @@ namespace OpenSim.Framework
1352 return data; 1357 return data;
1353 } 1358 }
1354 1359
1360 public static byte[] StringToBytes1024(string str, params object[] args)
1361 {
1362 return StringToBytes1024(string.Format(str, args));
1363 }
1364
1355 public static byte[] StringToBytes1024(string str) 1365 public static byte[] StringToBytes1024(string str)
1356 { 1366 {
1357 if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } 1367 if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; }
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index ed4b620..4081888 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -294,6 +294,18 @@ namespace OpenSim
294 "show connections", 294 "show connections",
295 "Show connection data", HandleShow); 295 "Show connection data", HandleShow);
296 296
297 m_console.Commands.AddCommand("region", false, "show circuits",
298 "show circuits",
299 "Show agent circuit data", HandleShow);
300
301 m_console.Commands.AddCommand("region", false, "show http-handlers",
302 "show http-handlers",
303 "Show all registered http handlers", HandleShow);
304
305 m_console.Commands.AddCommand("region", false, "show pending-objects",
306 "show pending-objects",
307 "Show # of objects on the pending queues of all scene viewers", HandleShow);
308
297 m_console.Commands.AddCommand("region", false, "show modules", 309 m_console.Commands.AddCommand("region", false, "show modules",
298 "show modules", 310 "show modules",
299 "Show module data", HandleShow); 311 "Show module data", HandleShow);
@@ -943,6 +955,66 @@ namespace OpenSim
943 MainConsole.Instance.Output(connections.ToString()); 955 MainConsole.Instance.Output(connections.ToString());
944 break; 956 break;
945 957
958 case "circuits":
959 System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n");
960 m_sceneManager.ForEachScene(
961 delegate(Scene scene)
962 {
963 //this.HttpServer.
964 acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName);
965 foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values)
966 acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root"));
967 }
968 );
969
970 MainConsole.Instance.Output(acd.ToString());
971 break;
972
973 case "http-handlers":
974 System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n");
975
976 handlers.AppendFormat("* XMLRPC:\n");
977 foreach (String s in HttpServer.GetXmlRpcHandlerKeys())
978 handlers.AppendFormat("\t{0}\n", s);
979
980 handlers.AppendFormat("* HTTP:\n");
981 List<String> poll = HttpServer.GetPollServiceHandlerKeys();
982 foreach (String s in HttpServer.GetHTTPHandlerKeys())
983 handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
984
985 handlers.AppendFormat("* Agent:\n");
986 foreach (String s in HttpServer.GetAgentHandlerKeys())
987 handlers.AppendFormat("\t{0}\n", s);
988
989 handlers.AppendFormat("* LLSD:\n");
990 foreach (String s in HttpServer.GetLLSDHandlerKeys())
991 handlers.AppendFormat("\t{0}\n", s);
992
993 handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count);
994 foreach (String s in HttpServer.GetStreamHandlerKeys())
995 handlers.AppendFormat("\t{0}\n", s);
996
997 MainConsole.Instance.Output(handlers.ToString());
998 break;
999
1000 case "pending-objects":
1001 System.Text.StringBuilder pending = new System.Text.StringBuilder("Pending objects:\n");
1002 m_sceneManager.ForEachScene(
1003 delegate(Scene scene)
1004 {
1005 scene.ForEachScenePresence(
1006 delegate(ScenePresence sp)
1007 {
1008 pending.AppendFormat("{0}: {1} {2} pending\n",
1009 scene.RegionInfo.RegionName, sp.Name, sp.SceneViewer.GetPendingObjectsCount());
1010 }
1011 );
1012 }
1013 );
1014
1015 MainConsole.Instance.Output(pending.ToString());
1016 break;
1017
946 case "modules": 1018 case "modules":
947 MainConsole.Instance.Output("The currently loaded shared modules are:"); 1019 MainConsole.Instance.Output("The currently loaded shared modules are:");
948 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) 1020 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
@@ -958,11 +1030,12 @@ namespace OpenSim
958 delegate(Scene scene) 1030 delegate(Scene scene)
959 { 1031 {
960 MainConsole.Instance.Output(String.Format( 1032 MainConsole.Instance.Output(String.Format(
961 "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", 1033 "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}, Estate Name: {4}",
962 scene.RegionInfo.RegionName, 1034 scene.RegionInfo.RegionName,
963 scene.RegionInfo.RegionLocX, 1035 scene.RegionInfo.RegionLocX,
964 scene.RegionInfo.RegionLocY, 1036 scene.RegionInfo.RegionLocY,
965 scene.RegionInfo.InternalEndPoint.Port)); 1037 scene.RegionInfo.InternalEndPoint.Port,
1038 scene.RegionInfo.EstateSettings.EstateName));
966 }); 1039 });
967 break; 1040 break;
968 1041
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 1652b82..e950613 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -795,9 +795,7 @@ namespace OpenSim
795 /// <summary> 795 /// <summary>
796 /// Load the estate information for the provided RegionInfo object. 796 /// Load the estate information for the provided RegionInfo object.
797 /// </summary> 797 /// </summary>
798 /// <param name="regInfo"> 798 /// <param name="regInfo"></param>
799 /// A <see cref="RegionInfo"/>
800 /// </param>
801 public void PopulateRegionEstateInfo(RegionInfo regInfo) 799 public void PopulateRegionEstateInfo(RegionInfo regInfo)
802 { 800 {
803 IEstateDataService estateDataService = EstateDataService; 801 IEstateDataService estateDataService = EstateDataService;
@@ -819,7 +817,13 @@ namespace OpenSim
819 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); 817 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
820 818
821 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); 819 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
822 //regInfo.EstateSettings.Save(); 820
821 // FIXME: Later on, the scene constructor will reload the estate settings no matter what.
822 // Therefore, we need to do an initial save here otherwise the new estate name will be reset
823 // back to the default. The reloading of estate settings by scene could be eliminated if it
824 // knows that the passed in settings in RegionInfo are already valid. Also, it might be
825 // possible to eliminate some additional later saves made by callers of this method.
826 regInfo.EstateSettings.Save();
823 break; 827 break;
824 } 828 }
825 else 829 else
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index d4c3307..65a8fe3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -122,6 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
122 public int PacketsReceived; 122 public int PacketsReceived;
123 /// <summary>Number of packets sent to this client</summary> 123 /// <summary>Number of packets sent to this client</summary>
124 public int PacketsSent; 124 public int PacketsSent;
125 /// <summary>Number of packets resent to this client</summary>
126 public int PacketsResent;
125 /// <summary>Total byte count of unacked packets sent to this client</summary> 127 /// <summary>Total byte count of unacked packets sent to this client</summary>
126 public int UnackedBytes; 128 public int UnackedBytes;
127 129
@@ -256,9 +258,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
256 public string GetStats() 258 public string GetStats()
257 { 259 {
258 return string.Format( 260 return string.Format(
259 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", 261 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}",
262 PacketsReceived,
260 PacketsSent, 263 PacketsSent,
261 PacketsReceived, 264 PacketsResent,
262 UnackedBytes, 265 UnackedBytes,
263 m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count, 266 m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count,
264 m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count, 267 m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count,
@@ -441,13 +444,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
441 /// an outgoing packet from each, obeying the throttling bucket limits 444 /// an outgoing packet from each, obeying the throttling bucket limits
442 /// </summary> 445 /// </summary>
443 /// 446 ///
447 /// <remarks>
444 /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower 448 /// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower
445 /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have 449 /// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have
446 /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the 450 /// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the
447 /// wind queue). 451 /// wind queue).
448 /// 452 ///
449 /// <remarks>This function is only called from a synchronous loop in the 453 /// This function is only called from a synchronous loop in the
450 /// UDPServer so we don't need to bother making this thread safe</remarks> 454 /// UDPServer so we don't need to bother making this thread safe
455 /// </remarks>
456 ///
451 /// <returns>True if any packets were sent, otherwise false</returns> 457 /// <returns>True if any packets were sent, otherwise false</returns>
452 public bool DequeueOutgoing() 458 public bool DequeueOutgoing()
453 { 459 {
@@ -476,7 +482,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
476 m_udpServer.SendPacketFinal(nextPacket); 482 m_udpServer.SendPacketFinal(nextPacket);
477 m_nextPackets[i] = null; 483 m_nextPackets[i] = null;
478 packetSent = true; 484 packetSent = true;
479 this.PacketsSent++;
480 } 485 }
481 } 486 }
482 else 487 else
@@ -493,7 +498,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
493 // Send the packet 498 // Send the packet
494 m_udpServer.SendPacketFinal(packet); 499 m_udpServer.SendPacketFinal(packet);
495 packetSent = true; 500 packetSent = true;
496 this.PacketsSent++;
497 } 501 }
498 else 502 else
499 { 503 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index df8ddbb..584c577 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics;
30using System.IO; 31using System.IO;
31using System.Net; 32using System.Net;
32using System.Net.Sockets; 33using System.Net.Sockets;
@@ -506,7 +507,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
506 507
507 // Bump up the resend count on this packet 508 // Bump up the resend count on this packet
508 Interlocked.Increment(ref outgoingPacket.ResendCount); 509 Interlocked.Increment(ref outgoingPacket.ResendCount);
509 //Interlocked.Increment(ref Stats.ResentPackets);
510 510
511 // Requeue or resend the packet 511 // Requeue or resend the packet
512 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) 512 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false))
@@ -582,6 +582,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
582 udpClient.NeedAcks.Add(outgoingPacket); 582 udpClient.NeedAcks.Add(outgoingPacket);
583 } 583 }
584 } 584 }
585 else
586 {
587 Interlocked.Increment(ref udpClient.PacketsResent);
588 }
585 589
586 #endregion Sequence Number Assignment 590 #endregion Sequence Number Assignment
587 591
@@ -636,10 +640,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
636 { 640 {
637 object[] array = new object[] { buffer, packet }; 641 object[] array = new object[] { buffer, packet };
638 642
639 if (m_asyncPacketHandling) 643 Util.FireAndForget(HandleUseCircuitCode, array);
640 Util.FireAndForget(HandleUseCircuitCode, array);
641 else
642 HandleUseCircuitCode(array);
643 644
644 return; 645 return;
645 } 646 }
@@ -856,10 +857,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
856 // Begin the process of adding the client to the simulator 857 // Begin the process of adding the client to the simulator
857 AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); 858 AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint);
858 859
859 // Acknowledge the UseCircuitCode packet 860 // Send ack
860 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 861 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
861 862
862// m_log.DebugFormat( 863 // m_log.DebugFormat(
863// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 864// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
864// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 865// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
865 } 866 }
@@ -923,25 +924,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
923 924
924 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) 925 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
925 { 926 {
926 // Create the LLUDPClient 927 // In priciple there shouldn't be more than one thread here, ever.
927 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 928 // But in case that happens, we need to synchronize this piece of code
928 IClientAPI existingClient; 929 // because it's too important
929 930 lock (this)
930 if (!m_scene.TryGetClient(agentID, out existingClient))
931 { 931 {
932 // Create the LLClientView 932 IClientAPI existingClient;
933 LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
934 client.OnLogout += LogoutHandler;
935 933
936 client.DisableFacelights = m_disableFacelights; 934 if (!m_scene.TryGetClient(agentID, out existingClient))
935 {
936 // Create the LLUDPClient
937 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
938 // Create the LLClientView
939 LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
940 client.OnLogout += LogoutHandler;
937 941
938 // Start the IClientAPI 942 client.DisableFacelights = m_disableFacelights;
939 client.Start(); 943
940 } 944 // Start the IClientAPI
941 else 945 client.Start();
942 { 946
943 m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}", 947 }
944 udpClient.AgentID, remoteEndPoint, circuitCode); 948 else
949 {
950 m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}",
951 existingClient.AgentId, remoteEndPoint, circuitCode);
952 }
945 } 953 }
946 } 954 }
947 955
@@ -1050,6 +1058,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1050 1058
1051 #endregion Update Timers 1059 #endregion Update Timers
1052 1060
1061 // Use this for emergency monitoring -- bug hunting
1062 //if (m_scene.EmergencyMonitoring)
1063 // clientPacketHandler = MonitoredClientOutgoingPacketHandler;
1064 //else
1065 // clientPacketHandler = ClientOutgoingPacketHandler;
1066
1053 // Handle outgoing packets, resends, acknowledgements, and pings for each 1067 // Handle outgoing packets, resends, acknowledgements, and pings for each
1054 // client. m_packetSent will be set to true if a packet is sent 1068 // client. m_packetSent will be set to true if a packet is sent
1055 m_scene.ForEachClient(clientPacketHandler); 1069 m_scene.ForEachClient(clientPacketHandler);
@@ -1065,6 +1079,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1065 { 1079 {
1066 m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex); 1080 m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
1067 } 1081 }
1082
1068 } 1083 }
1069 1084
1070 Watchdog.RemoveThread(); 1085 Watchdog.RemoveThread();
@@ -1102,6 +1117,112 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1102 } 1117 }
1103 } 1118 }
1104 1119
1120 #region Emergency Monitoring
1121 // Alternative packet handler fuull of instrumentation
1122 // Handy for hunting bugs
1123 private Stopwatch watch1 = new Stopwatch();
1124 private Stopwatch watch2 = new Stopwatch();
1125
1126 private float avgProcessingTicks = 0;
1127 private float avgResendUnackedTicks = 0;
1128 private float avgSendAcksTicks = 0;
1129 private float avgSendPingTicks = 0;
1130 private float avgDequeueTicks = 0;
1131 private long nticks = 0;
1132 private long nticksUnack = 0;
1133 private long nticksAck = 0;
1134 private long nticksPing = 0;
1135 private int npacksSent = 0;
1136 private int npackNotSent = 0;
1137
1138 private void MonitoredClientOutgoingPacketHandler(IClientAPI client)
1139 {
1140 nticks++;
1141 watch1.Start();
1142 try
1143 {
1144 if (client is LLClientView)
1145 {
1146 LLUDPClient udpClient = ((LLClientView)client).UDPClient;
1147
1148 if (udpClient.IsConnected)
1149 {
1150 if (m_resendUnacked)
1151 {
1152 nticksUnack++;
1153 watch2.Start();
1154
1155 ResendUnacked(udpClient);
1156
1157 watch2.Stop();
1158 avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack);
1159 watch2.Reset();
1160 }
1161
1162 if (m_sendAcks)
1163 {
1164 nticksAck++;
1165 watch2.Start();
1166
1167 SendAcks(udpClient);
1168
1169 watch2.Stop();
1170 avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck);
1171 watch2.Reset();
1172 }
1173
1174 if (m_sendPing)
1175 {
1176 nticksPing++;
1177 watch2.Start();
1178
1179 SendPing(udpClient);
1180
1181 watch2.Stop();
1182 avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing);
1183 watch2.Reset();
1184 }
1185
1186 watch2.Start();
1187 // Dequeue any outgoing packets that are within the throttle limits
1188 if (udpClient.DequeueOutgoing())
1189 {
1190 m_packetSent = true;
1191 npacksSent++;
1192 }
1193 else
1194 npackNotSent++;
1195
1196 watch2.Stop();
1197 avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks);
1198 watch2.Reset();
1199
1200 }
1201 else
1202 m_log.WarnFormat("[LLUDPSERVER]: Client is not connected");
1203 }
1204 }
1205 catch (Exception ex)
1206 {
1207 m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name +
1208 " threw an exception: " + ex.Message, ex);
1209 }
1210 watch1.Stop();
1211 avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks);
1212 watch1.Reset();
1213
1214 // reuse this -- it's every ~100ms
1215 if (m_scene.EmergencyMonitoring && nticks % 100 == 0)
1216 {
1217 m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})",
1218 avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent);
1219 npackNotSent = npacksSent = 0;
1220 }
1221
1222 }
1223
1224 #endregion
1225
1105 private void ProcessInPacket(object state) 1226 private void ProcessInPacket(object state)
1106 { 1227 {
1107 IncomingPacket incomingPacket = (IncomingPacket)state; 1228 IncomingPacket incomingPacket = (IncomingPacket)state;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
index bdbd284..0a8331f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
@@ -210,6 +210,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
210 content = Math.Min(content + dripAmount, maxBurst); 210 content = Math.Min(content + dripAmount, maxBurst);
211 lastDrip = now; 211 lastDrip = now;
212 212
213 if (dripAmount < 0 || content < 0)
214 // sim has been idle for too long, integer has overflown
215 // previous calculation is meaningless, let's put it at correct max
216 content = maxBurst;
217
213 return true; 218 return true;
214 } 219 }
215 } 220 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 9d40688..d195110 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -143,7 +143,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
143 // Process all the pending adds 143 // Process all the pending adds
144 OutgoingPacket pendingAdd; 144 OutgoingPacket pendingAdd;
145 while (m_pendingAdds.TryDequeue(out pendingAdd)) 145 while (m_pendingAdds.TryDequeue(out pendingAdd))
146 m_packets[pendingAdd.SequenceNumber] = pendingAdd; 146 if (pendingAdd != null)
147 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
147 148
148 // Process all the pending removes, including updating statistics and round-trip times 149 // Process all the pending removes, including updating statistics and round-trip times
149 PendingAck pendingRemove; 150 PendingAck pendingRemove;
@@ -152,17 +153,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
152 { 153 {
153 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 154 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
154 { 155 {
155 m_packets.Remove(pendingRemove.SequenceNumber); 156 if (ackedPacket != null)
156
157 // Update stats
158 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
159
160 if (!pendingRemove.FromResend)
161 { 157 {
162 // Calculate the round-trip time for this packet and its ACK 158 m_packets.Remove(pendingRemove.SequenceNumber);
163 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; 159
164 if (rtt > 0) 160 // Update stats
165 ackedPacket.Client.UpdateRoundTrip(rtt); 161 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
162
163 if (!pendingRemove.FromResend)
164 {
165 // Calculate the round-trip time for this packet and its ACK
166 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
167 if (rtt > 0)
168 ackedPacket.Client.UpdateRoundTrip(rtt);
169 }
166 } 170 }
167 } 171 }
168 } 172 }
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
index c023a6f..1d8e70e 100644
--- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
@@ -26,12 +26,14 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console;
35using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
37using Caps=OpenSim.Framework.Capabilities.Caps; 39using Caps=OpenSim.Framework.Capabilities.Caps;
@@ -61,6 +63,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
61 { 63 {
62 m_scene = scene; 64 m_scene = scene;
63 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); 65 m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
66 MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps",
67 "show capabilities",
68 "Shows all registered capabilities", CapabilitiesCommand);
64 } 69 }
65 70
66 public void RegionLoaded(Scene scene) 71 public void RegionLoaded(Scene scene)
@@ -72,7 +77,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
72 m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this); 77 m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this);
73 } 78 }
74 79
75 public void PostInitialise() {} 80 public void PostInitialise()
81 {
82 }
76 83
77 public void Close() {} 84 public void Close() {}
78 85
@@ -226,5 +233,23 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
226 m_log.Info(" >> "+x+", "+y+": "+kvp.Value); 233 m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
227 } 234 }
228 } 235 }
236
237 private void CapabilitiesCommand(string module, string[] cmdparams)
238 {
239 System.Text.StringBuilder caps = new System.Text.StringBuilder();
240 caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
241
242 foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers)
243 {
244 caps.AppendFormat("** User {0}:\n", kvp.Key);
245 for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); )
246 {
247 Uri uri = new Uri(kvp2.Value.ToString());
248 caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery);
249 }
250 }
251
252 MainConsole.Instance.Output(caps.ToString());
253 }
229 } 254 }
230} 255}
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index 6fb8b46..df4d561 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -245,14 +245,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
245 WriteTextureData(httpRequest, httpResponse, texture, format); 245 WriteTextureData(httpRequest, httpResponse, texture, format);
246 return true; 246 return true;
247 } 247 }
248
249 } 248 }
250 249
251 // not found 250 // not found
252 m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); 251// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
253 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; 252 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
254 return true; 253 return true;
255
256 } 254 }
257 255
258 private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format) 256 private void WriteTextureData(OSHttpRequest request, OSHttpResponse response, AssetBase texture, string format)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 1a96098..26edba4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -128,6 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
128 + "<last> is the user's last name." + Environment.NewLine 128 + "<last> is the user's last name." + Environment.NewLine
129 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine 129 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
130 + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine 130 + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
131 + "-c|--creators preserves information about foreign creators." + Environment.NewLine
131 + "-v|--verbose extra debug messages." + Environment.NewLine 132 + "-v|--verbose extra debug messages." + Environment.NewLine
132 + "<IAR path> is the filesystem path at which to save the IAR." 133 + "<IAR path> is the filesystem path at which to save the IAR."
133 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), 134 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
@@ -396,6 +397,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
396 //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); 397 //ops.Add("v|version=", delegate(string v) { options["version"] = v; });
397 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); 398 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
398 ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); 399 ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; });
400 ops.Add("c|creators", delegate(string v) { options["creators"] = v; });
399 401
400 List<string> mainParams = ops.Parse(cmdparams); 402 List<string> mainParams = ops.Parse(cmdparams);
401 403
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 54b95f7..1337143 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
243 } 243 }
244 catch (Exception e) 244 catch (Exception e)
245 { 245 {
246 m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace); 246 m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace);
247 sp.ControllingClient.SendTeleportFailed("Internal error"); 247 sp.ControllingClient.SendTeleportFailed("Internal error");
248 } 248 }
249 } 249 }
@@ -983,7 +983,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
983 /// </summary> 983 /// </summary>
984 public void EnableChildAgent(ScenePresence sp, GridRegion region) 984 public void EnableChildAgent(ScenePresence sp, GridRegion region)
985 { 985 {
986 m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); 986 m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName);
987 987
988 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 988 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
989 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); 989 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 34b8114..4565d10 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
55 } 55 }
56 56
57 private string m_ProfileServerURI; 57 private string m_ProfileServerURI;
58 private bool m_OutboundPermission;
58 59
59// private bool m_Initialized = false; 60// private bool m_Initialized = false;
60 61
@@ -78,7 +79,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
78 79
79 IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; 80 IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
80 if (thisModuleConfig != null) 81 if (thisModuleConfig != null)
82 {
81 m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); 83 m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty);
84 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
85 }
82 else 86 else
83 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); 87 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
84 } 88 }
@@ -103,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
103 public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) 107 public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel)
104 { 108 {
105 string userAssetServer = string.Empty; 109 string userAssetServer = string.Empty;
106 if (IsForeignUser(avatarID, out userAssetServer)) 110 if (IsForeignUser(avatarID, out userAssetServer) && m_OutboundPermission)
107 { 111 {
108 Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); 112 Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
109 } 113 }
@@ -197,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
197 if (IsForeignUser(sender, out userAssetServer)) 201 if (IsForeignUser(sender, out userAssetServer))
198 m_assMapper.Get(item.AssetID, sender, userAssetServer); 202 m_assMapper.Get(item.AssetID, sender, userAssetServer);
199 203
200 if (IsForeignUser(receiver, out userAssetServer)) 204 if (IsForeignUser(receiver, out userAssetServer) && m_OutboundPermission)
201 m_assMapper.Post(item.AssetID, receiver, userAssetServer); 205 m_assMapper.Post(item.AssetID, receiver, userAssetServer);
202 } 206 }
203 207
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 43de2ab..a9d247a 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -47,7 +47,6 @@
47 <RegionModule id="RemoteAuthorizationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization.RemoteAuthorizationServicesConnector" /> 47 <RegionModule id="RemoteAuthorizationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization.RemoteAuthorizationServicesConnector" />
48 <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> 48 <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" />
49 <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> 49 <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" />
50 <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
51 <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> 50 <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
52 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> 51 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
53 <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> 52 <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index 01a2615..66994fa 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
139 139
140 if (scene != null) 140 if (scene != null)
141 { 141 {
142 UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, userID); 142 UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID));
143 isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName, 143 isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName,
144 account.Email, scene.RegionInfo.RegionName, regionID, out message); 144 account.Email, scene.RegionInfo.RegionName, regionID, out message);
145 } 145 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 023a44c..3c36799 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -247,13 +247,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
247 247
248 public void NeighboursCommand(string module, string[] cmdparams) 248 public void NeighboursCommand(string module, string[] cmdparams)
249 { 249 {
250 System.Text.StringBuilder caps = new System.Text.StringBuilder();
251
250 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache) 252 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
251 { 253 {
252 m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName); 254 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
253 List<GridRegion> regions = kvp.Value.GetNeighbours(); 255 List<GridRegion> regions = kvp.Value.GetNeighbours();
254 foreach (GridRegion r in regions) 256 foreach (GridRegion r in regions)
255 m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 257 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
256 } 258 }
259
260 MainConsole.Instance.Output(caps.ToString());
257 } 261 }
258 262
259 } 263 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 39410b5..3f63db3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -200,6 +200,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
200 return; 200 return;
201 } 201 }
202 } 202 }
203 else
204 {
205 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID);
206 return;
207 }
203 } 208 }
204 } 209 }
205 } 210 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
deleted file mode 100644
index 9213132..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ /dev/null
@@ -1,362 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using System;
30using System.Collections.Generic;
31using System.Reflection;
32using Nini.Config;
33using OpenSim.Framework;
34using OpenSim.Framework.Statistics;
35using OpenSim.Services.Connectors;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
39using OpenMetaverse;
40
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
42{
43 public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService
44 {
45 private static readonly ILog m_log =
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private bool m_Enabled = false;
49 private bool m_Initialized = false;
50 private Scene m_Scene;
51 private InventoryServicesConnector m_RemoteConnector;
52
53 private IUserManagement m_UserManager;
54 private IUserManagement UserManager
55 {
56 get
57 {
58 if (m_UserManager == null)
59 {
60 m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>();
61 }
62 return m_UserManager;
63 }
64 }
65
66
67 public Type ReplaceableInterface
68 {
69 get { return null; }
70 }
71
72 public string Name
73 {
74 get { return "RemoteInventoryServicesConnector"; }
75 }
76
77 public RemoteInventoryServicesConnector()
78 {
79 }
80
81 public RemoteInventoryServicesConnector(IConfigSource source)
82 {
83 Init(source);
84 }
85
86 protected override void Init(IConfigSource source)
87 {
88 m_RemoteConnector = new InventoryServicesConnector(source);
89 base.Init(source);
90 }
91
92 #region ISharedRegionModule
93
94 public void Initialise(IConfigSource source)
95 {
96 IConfig moduleConfig = source.Configs["Modules"];
97 if (moduleConfig != null)
98 {
99 string name = moduleConfig.GetString("InventoryServices", "");
100 if (name == Name)
101 {
102 Init(source);
103 m_Enabled = true;
104
105 m_log.Info("[INVENTORY CONNECTOR]: Remote inventory enabled");
106 }
107 }
108 }
109
110 public void PostInitialise()
111 {
112 }
113
114 public void Close()
115 {
116 }
117
118 public void AddRegion(Scene scene)
119 {
120// m_Scene = scene;
121 //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
122
123 if (!m_Enabled)
124 return;
125
126 if (!m_Initialized)
127 {
128 m_Initialized = true;
129 }
130
131 scene.RegisterModuleInterface<IInventoryService>(this);
132 m_cache.AddRegion(scene);
133
134 if (m_Scene == null)
135 m_Scene = scene;
136 }
137
138 public void RemoveRegion(Scene scene)
139 {
140 if (!m_Enabled)
141 return;
142
143 m_cache.RemoveRegion(scene);
144 }
145
146 public void RegionLoaded(Scene scene)
147 {
148 if (!m_Enabled)
149 return;
150
151 m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName);
152
153 }
154
155 #endregion ISharedRegionModule
156
157 #region IInventoryService
158
159 public override bool CreateUserInventory(UUID user)
160 {
161 return false;
162 }
163
164 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
165 {
166 return new List<InventoryFolderBase>();
167 }
168
169 public override InventoryCollection GetUserInventory(UUID userID)
170 {
171 return null;
172 }
173
174 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
175 {
176 UUID sessionID = GetSessionID(userID);
177 try
178 {
179 m_RemoteConnector.GetUserInventory(userID.ToString(), sessionID, callback);
180 }
181 catch (Exception e)
182 {
183 if (StatsManager.SimExtraStats != null)
184 StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure();
185
186 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}",
187 e.Source, e.Message);
188 }
189
190 }
191
192 // inherited. See base class
193 // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
194
195 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
196 {
197 UUID sessionID = GetSessionID(userID);
198 return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID);
199 }
200
201 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
202 {
203 UUID sessionID = GetSessionID(userID);
204 try
205 {
206 InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID);
207 foreach (InventoryItemBase item in invCol.Items)
208 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData);
209 return invCol;
210 }
211 catch (Exception e)
212 {
213 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}",
214 e.Source, e.Message);
215 }
216 InventoryCollection nullCollection = new InventoryCollection();
217 nullCollection.Folders = new List<InventoryFolderBase>();
218 nullCollection.Items = new List<InventoryItemBase>();
219 nullCollection.UserID = userID;
220 return nullCollection;
221 }
222
223 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
224 {
225 UUID sessionID = GetSessionID(userID);
226 return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID);
227 }
228
229 public override bool AddFolder(InventoryFolderBase folder)
230 {
231 if (folder == null)
232 return false;
233
234 UUID sessionID = GetSessionID(folder.Owner);
235 return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID);
236 }
237
238 public override bool UpdateFolder(InventoryFolderBase folder)
239 {
240 if (folder == null)
241 return false;
242
243 UUID sessionID = GetSessionID(folder.Owner);
244 return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID);
245 }
246
247 public override bool MoveFolder(InventoryFolderBase folder)
248 {
249 if (folder == null)
250 return false;
251
252 UUID sessionID = GetSessionID(folder.Owner);
253 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
254 }
255
256 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
257 {
258 if (folderIDs == null)
259 return false;
260 if (folderIDs.Count == 0)
261 return false;
262
263 UUID sessionID = GetSessionID(ownerID);
264 return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID);
265 }
266
267
268 public override bool PurgeFolder(InventoryFolderBase folder)
269 {
270 if (folder == null)
271 return false;
272
273 UUID sessionID = GetSessionID(folder.Owner);
274 return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID);
275 }
276
277 // public bool AddItem(InventoryItemBase item) inherited
278 // Uses AddItemPlain
279
280 protected override bool AddItemPlain(InventoryItemBase item)
281 {
282 if (item == null)
283 return false;
284
285 UUID sessionID = GetSessionID(item.Owner);
286 return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID);
287 }
288
289 public override bool UpdateItem(InventoryItemBase item)
290 {
291 if (item == null)
292 return false;
293
294 UUID sessionID = GetSessionID(item.Owner);
295 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
296 }
297
298 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
299 {
300 if (items == null)
301 return false;
302
303 UUID sessionID = GetSessionID(ownerID);
304 return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID);
305 }
306
307
308 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
309 {
310 if (itemIDs == null)
311 return false;
312 if (itemIDs.Count == 0)
313 return true;
314
315 UUID sessionID = GetSessionID(ownerID);
316 return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID);
317 }
318
319 public override InventoryItemBase GetItem(InventoryItemBase item)
320 {
321 if (item == null)
322 return null;
323
324 UUID sessionID = GetSessionID(item.Owner);
325 return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
326 }
327
328 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
329 {
330 if (folder == null)
331 return null;
332
333 UUID sessionID = GetSessionID(folder.Owner);
334 return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID);
335 }
336
337 public override bool HasInventoryForUser(UUID userID)
338 {
339 return false;
340 }
341
342 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
343 {
344 return new List<InventoryItemBase>();
345 }
346
347 public override int GetAssetPermissions(UUID userID, UUID assetID)
348 {
349 UUID sessionID = GetSessionID(userID);
350 return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID);
351 }
352
353
354 #endregion
355
356 private UUID GetSessionID(UUID userID)
357 {
358 return UUID.Zero;
359 }
360
361 }
362}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index c5972dd..56720b7 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -225,17 +225,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
225 if (destination == null) 225 if (destination == null)
226 return false; 226 return false;
227 227
228 // We limit the number of messages sent for a position change to just one per
229 // simulator so when we receive the update we need to hand it to each of the
230 // scenes; scenes each check to see if the is a scene presence for the avatar
231 // note that we really don't need the GridRegion for this call
228 foreach (Scene s in m_sceneList) 232 foreach (Scene s in m_sceneList)
229 { 233 {
230 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 234 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
231 { 235 s.IncomingChildAgentDataUpdate(cAgentData);
232 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
233 s.IncomingChildAgentDataUpdate(cAgentData);
234 return true;
235 }
236 } 236 }
237 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 237 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
238 return false; 238 return true;
239 } 239 }
240 240
241 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) 241 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
new file mode 100644
index 0000000..f6d1a82
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -0,0 +1,224 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Security;
33using System.Text;
34using log4net;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Console;
39using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes;
42
43namespace OpenSim.Region.CoreModules.World.Estate
44{
45 /// <summary>
46 /// Estate management console commands.
47 /// </summary>
48 public class EstateManagementCommands
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 protected EstateManagementModule m_module;
53
54 protected Commander m_commander = new Commander("estate");
55
56 public EstateManagementCommands(EstateManagementModule module)
57 {
58 m_module = module;
59 }
60
61 public void Initialise()
62 {
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",
66 "set terrain texture <number> <uuid> [<x>] [<y>]",
67 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
68 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
69 " that coordinate.",
70 consoleSetTerrainTexture);
71
72 m_module.Scene.AddCommand(m_module, "set terrain heights",
73 "set terrain heights <corner> <min> <max> [<x>] [<y>]",
74 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
75 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
76 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
77 consoleSetTerrainHeights);
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 }
117
118 protected void consoleSetTerrainTexture(string module, string[] args)
119 {
120 string num = args[3];
121 string uuid = args[4];
122 int x = (args.Length > 5 ? int.Parse(args[5]) : -1);
123 int y = (args.Length > 6 ? int.Parse(args[6]) : -1);
124
125 if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x)
126 {
127 if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y)
128 {
129 int corner = int.Parse(num);
130 UUID texture = UUID.Parse(uuid);
131
132 m_log.Debug("[ESTATEMODULE]: Setting terrain textures for " + m_module.Scene.RegionInfo.RegionName +
133 string.Format(" (C#{0} = {1})", corner, texture));
134
135 switch (corner)
136 {
137 case 0:
138 m_module.Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
139 break;
140 case 1:
141 m_module.Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture;
142 break;
143 case 2:
144 m_module.Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture;
145 break;
146 case 3:
147 m_module.Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
148 break;
149 }
150
151 m_module.Scene.RegionInfo.RegionSettings.Save();
152 m_module.TriggerRegionInfoChange();
153 m_module.sendRegionInfoPacketToAll();
154 }
155 }
156 }
157
158 protected void consoleSetTerrainHeights(string module, string[] args)
159 {
160 string num = args[3];
161 string min = args[4];
162 string max = args[5];
163 int x = (args.Length > 6 ? int.Parse(args[6]) : -1);
164 int y = (args.Length > 7 ? int.Parse(args[7]) : -1);
165
166 if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x)
167 {
168 if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y)
169 {
170 int corner = int.Parse(num);
171 float lowValue = float.Parse(min, Culture.NumberFormatInfo);
172 float highValue = float.Parse(max, Culture.NumberFormatInfo);
173
174 m_log.Debug("[ESTATEMODULE]: Setting terrain heights " + m_module.Scene.RegionInfo.RegionName +
175 string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue));
176
177 switch (corner)
178 {
179 case 0:
180 m_module.Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue;
181 m_module.Scene.RegionInfo.RegionSettings.Elevation2SW = highValue;
182 break;
183 case 1:
184 m_module.Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue;
185 m_module.Scene.RegionInfo.RegionSettings.Elevation2NW = highValue;
186 break;
187 case 2:
188 m_module.Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue;
189 m_module.Scene.RegionInfo.RegionSettings.Elevation2SE = highValue;
190 break;
191 case 3:
192 m_module.Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue;
193 m_module.Scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
194 break;
195 }
196
197 m_module.Scene.RegionInfo.RegionSettings.Save();
198 m_module.TriggerRegionInfoChange();
199 m_module.sendRegionHandshakeToAll();
200 }
201 }
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 }
223 }
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 01f04d9..57ab135 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -24,12 +24,14 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
27using System; 28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using System.Reflection; 31using System.Reflection;
31using System.Security; 32using System.Security;
32using log4net; 33using log4net;
34using Mono.Addins;
33using Nini.Config; 35using Nini.Config;
34using OpenMetaverse; 36using OpenMetaverse;
35using OpenSim.Framework; 37using OpenSim.Framework;
@@ -38,13 +40,17 @@ using OpenSim.Region.Framework.Scenes;
38 40
39namespace OpenSim.Region.CoreModules.World.Estate 41namespace OpenSim.Region.CoreModules.World.Estate
40{ 42{
41 public class EstateManagementModule : IEstateModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateManagementModule")]
44 public class EstateManagementModule : IEstateModule, INonSharedRegionModule
42 { 45 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 47
45 private delegate void LookupUUIDS(List<UUID> uuidLst); 48 private delegate void LookupUUIDS(List<UUID> uuidLst);
46 49
47 private Scene m_scene; 50 public Scene Scene { get; private set; }
51 public IUserManagement UserManager { get; private set; }
52
53 protected EstateManagementCommands m_commands;
48 54
49 private EstateTerrainXferHandler TerrainUploader; 55 private EstateTerrainXferHandler TerrainUploader;
50 56
@@ -58,89 +64,89 @@ namespace OpenSim.Region.CoreModules.World.Estate
58 { 64 {
59 uint sun = 0; 65 uint sun = 0;
60 66
61 if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime) 67 if (!Scene.RegionInfo.EstateSettings.UseGlobalTime)
62 sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800; 68 sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800;
63 UUID estateOwner; 69 UUID estateOwner;
64 estateOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; 70 estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
65 71
66 if (m_scene.Permissions.IsGod(remote_client.AgentId)) 72 if (Scene.Permissions.IsGod(remote_client.AgentId))
67 estateOwner = remote_client.AgentId; 73 estateOwner = remote_client.AgentId;
68 74
69 remote_client.SendDetailedEstateData(invoice, 75 remote_client.SendDetailedEstateData(invoice,
70 m_scene.RegionInfo.EstateSettings.EstateName, 76 Scene.RegionInfo.EstateSettings.EstateName,
71 m_scene.RegionInfo.EstateSettings.EstateID, 77 Scene.RegionInfo.EstateSettings.EstateID,
72 m_scene.RegionInfo.EstateSettings.ParentEstateID, 78 Scene.RegionInfo.EstateSettings.ParentEstateID,
73 GetEstateFlags(), 79 GetEstateFlags(),
74 sun, 80 sun,
75 m_scene.RegionInfo.RegionSettings.Covenant, 81 Scene.RegionInfo.RegionSettings.Covenant,
76 m_scene.RegionInfo.EstateSettings.AbuseEmail, 82 Scene.RegionInfo.EstateSettings.AbuseEmail,
77 estateOwner); 83 estateOwner);
78 84
79 remote_client.SendEstateList(invoice, 85 remote_client.SendEstateList(invoice,
80 (int)Constants.EstateAccessCodex.EstateManagers, 86 (int)Constants.EstateAccessCodex.EstateManagers,
81 m_scene.RegionInfo.EstateSettings.EstateManagers, 87 Scene.RegionInfo.EstateSettings.EstateManagers,
82 m_scene.RegionInfo.EstateSettings.EstateID); 88 Scene.RegionInfo.EstateSettings.EstateID);
83 89
84 remote_client.SendEstateList(invoice, 90 remote_client.SendEstateList(invoice,
85 (int)Constants.EstateAccessCodex.AccessOptions, 91 (int)Constants.EstateAccessCodex.AccessOptions,
86 m_scene.RegionInfo.EstateSettings.EstateAccess, 92 Scene.RegionInfo.EstateSettings.EstateAccess,
87 m_scene.RegionInfo.EstateSettings.EstateID); 93 Scene.RegionInfo.EstateSettings.EstateID);
88 94
89 remote_client.SendEstateList(invoice, 95 remote_client.SendEstateList(invoice,
90 (int)Constants.EstateAccessCodex.AllowedGroups, 96 (int)Constants.EstateAccessCodex.AllowedGroups,
91 m_scene.RegionInfo.EstateSettings.EstateGroups, 97 Scene.RegionInfo.EstateSettings.EstateGroups,
92 m_scene.RegionInfo.EstateSettings.EstateID); 98 Scene.RegionInfo.EstateSettings.EstateID);
93 99
94 remote_client.SendBannedUserList(invoice, 100 remote_client.SendBannedUserList(invoice,
95 m_scene.RegionInfo.EstateSettings.EstateBans, 101 Scene.RegionInfo.EstateSettings.EstateBans,
96 m_scene.RegionInfo.EstateSettings.EstateID); 102 Scene.RegionInfo.EstateSettings.EstateID);
97 } 103 }
98 104
99 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, 105 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor,
100 int matureLevel, bool restrictPushObject, bool allowParcelChanges) 106 int matureLevel, bool restrictPushObject, bool allowParcelChanges)
101 { 107 {
102 if (blockTerraform) 108 if (blockTerraform)
103 m_scene.RegionInfo.RegionSettings.BlockTerraform = true; 109 Scene.RegionInfo.RegionSettings.BlockTerraform = true;
104 else 110 else
105 m_scene.RegionInfo.RegionSettings.BlockTerraform = false; 111 Scene.RegionInfo.RegionSettings.BlockTerraform = false;
106 112
107 if (noFly) 113 if (noFly)
108 m_scene.RegionInfo.RegionSettings.BlockFly = true; 114 Scene.RegionInfo.RegionSettings.BlockFly = true;
109 else 115 else
110 m_scene.RegionInfo.RegionSettings.BlockFly = false; 116 Scene.RegionInfo.RegionSettings.BlockFly = false;
111 117
112 if (allowDamage) 118 if (allowDamage)
113 m_scene.RegionInfo.RegionSettings.AllowDamage = true; 119 Scene.RegionInfo.RegionSettings.AllowDamage = true;
114 else 120 else
115 m_scene.RegionInfo.RegionSettings.AllowDamage = false; 121 Scene.RegionInfo.RegionSettings.AllowDamage = false;
116 122
117 if (blockLandResell) 123 if (blockLandResell)
118 m_scene.RegionInfo.RegionSettings.AllowLandResell = false; 124 Scene.RegionInfo.RegionSettings.AllowLandResell = false;
119 else 125 else
120 m_scene.RegionInfo.RegionSettings.AllowLandResell = true; 126 Scene.RegionInfo.RegionSettings.AllowLandResell = true;
121 127
122 m_scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; 128 Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents;
123 129
124 m_scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; 130 Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor;
125 131
126 if (matureLevel <= 13) 132 if (matureLevel <= 13)
127 m_scene.RegionInfo.RegionSettings.Maturity = 0; 133 Scene.RegionInfo.RegionSettings.Maturity = 0;
128 else if (matureLevel <= 21) 134 else if (matureLevel <= 21)
129 m_scene.RegionInfo.RegionSettings.Maturity = 1; 135 Scene.RegionInfo.RegionSettings.Maturity = 1;
130 else 136 else
131 m_scene.RegionInfo.RegionSettings.Maturity = 2; 137 Scene.RegionInfo.RegionSettings.Maturity = 2;
132 138
133 if (restrictPushObject) 139 if (restrictPushObject)
134 m_scene.RegionInfo.RegionSettings.RestrictPushing = true; 140 Scene.RegionInfo.RegionSettings.RestrictPushing = true;
135 else 141 else
136 m_scene.RegionInfo.RegionSettings.RestrictPushing = false; 142 Scene.RegionInfo.RegionSettings.RestrictPushing = false;
137 143
138 if (allowParcelChanges) 144 if (allowParcelChanges)
139 m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; 145 Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true;
140 else 146 else
141 m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; 147 Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false;
142 148
143 m_scene.RegionInfo.RegionSettings.Save(); 149 Scene.RegionInfo.RegionSettings.Save();
144 TriggerRegionInfoChange(); 150 TriggerRegionInfoChange();
145 151
146 sendRegionInfoPacketToAll(); 152 sendRegionInfoPacketToAll();
@@ -154,19 +160,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
154 switch (corner) 160 switch (corner)
155 { 161 {
156 case 0: 162 case 0:
157 m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; 163 Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
158 break; 164 break;
159 case 1: 165 case 1:
160 m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture; 166 Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture;
161 break; 167 break;
162 case 2: 168 case 2:
163 m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture; 169 Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture;
164 break; 170 break;
165 case 3: 171 case 3:
166 m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; 172 Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
167 break; 173 break;
168 } 174 }
169 m_scene.RegionInfo.RegionSettings.Save(); 175 Scene.RegionInfo.RegionSettings.Save();
170 TriggerRegionInfoChange(); 176 TriggerRegionInfoChange();
171 sendRegionInfoPacketToAll(); 177 sendRegionInfoPacketToAll();
172 } 178 }
@@ -176,23 +182,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
176 switch (corner) 182 switch (corner)
177 { 183 {
178 case 0: 184 case 0:
179 m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue; 185 Scene.RegionInfo.RegionSettings.Elevation1SW = lowValue;
180 m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue; 186 Scene.RegionInfo.RegionSettings.Elevation2SW = highValue;
181 break; 187 break;
182 case 1: 188 case 1:
183 m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue; 189 Scene.RegionInfo.RegionSettings.Elevation1NW = lowValue;
184 m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue; 190 Scene.RegionInfo.RegionSettings.Elevation2NW = highValue;
185 break; 191 break;
186 case 2: 192 case 2:
187 m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue; 193 Scene.RegionInfo.RegionSettings.Elevation1SE = lowValue;
188 m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue; 194 Scene.RegionInfo.RegionSettings.Elevation2SE = highValue;
189 break; 195 break;
190 case 3: 196 case 3:
191 m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue; 197 Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue;
192 m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue; 198 Scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
193 break; 199 break;
194 } 200 }
195 m_scene.RegionInfo.RegionSettings.Save(); 201 Scene.RegionInfo.RegionSettings.Save();
196 TriggerRegionInfoChange(); 202 TriggerRegionInfoChange();
197 sendRegionInfoPacketToAll(); 203 sendRegionInfoPacketToAll();
198 } 204 }
@@ -208,30 +214,30 @@ namespace OpenSim.Region.CoreModules.World.Estate
208 bool UseGlobal, bool EstateFixedSun, float EstateSunHour) 214 bool UseGlobal, bool EstateFixedSun, float EstateSunHour)
209 { 215 {
210 // Water Height 216 // Water Height
211 m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; 217 Scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight;
212 218
213 // Terraforming limits 219 // Terraforming limits
214 m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; 220 Scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit;
215 m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; 221 Scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit;
216 222
217 // Time of day / fixed sun 223 // Time of day / fixed sun
218 m_scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun; 224 Scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun;
219 m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; 225 Scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun;
220 m_scene.RegionInfo.RegionSettings.SunPosition = SunHour; 226 Scene.RegionInfo.RegionSettings.SunPosition = SunHour;
221 227
222 m_scene.TriggerEstateSunUpdate(); 228 Scene.TriggerEstateSunUpdate();
223 229
224 //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); 230 //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString());
225 //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); 231 //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString());
226 232
227 sendRegionInfoPacketToAll(); 233 sendRegionInfoPacketToAll();
228 m_scene.RegionInfo.RegionSettings.Save(); 234 Scene.RegionInfo.RegionSettings.Save();
229 TriggerRegionInfoChange(); 235 TriggerRegionInfoChange();
230 } 236 }
231 237
232 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 238 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
233 { 239 {
234 IRestartModule restartModule = m_scene.RequestModuleInterface<IRestartModule>(); 240 IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>();
235 if (restartModule != null) 241 if (restartModule != null)
236 { 242 {
237 List<int> times = new List<int>(); 243 List<int> times = new List<int>();
@@ -252,8 +258,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
252 258
253 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) 259 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
254 { 260 {
255 m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; 261 Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
256 m_scene.RegionInfo.RegionSettings.Save(); 262 Scene.RegionInfo.RegionSettings.Save();
257 TriggerRegionInfoChange(); 263 TriggerRegionInfoChange();
258 } 264 }
259 265
@@ -261,17 +267,17 @@ namespace OpenSim.Region.CoreModules.World.Estate
261 { 267 {
262 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. 268 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
263 269
264 if (user == m_scene.RegionInfo.EstateSettings.EstateOwner) 270 if (user == Scene.RegionInfo.EstateSettings.EstateOwner)
265 return; // never process EO 271 return; // never process EO
266 272
267 if ((estateAccessType & 4) != 0) // User add 273 if ((estateAccessType & 4) != 0) // User add
268 { 274 {
269 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 275 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
270 { 276 {
271 m_scene.RegionInfo.EstateSettings.AddEstateUser(user); 277 Scene.RegionInfo.EstateSettings.AddEstateUser(user);
272 m_scene.RegionInfo.EstateSettings.Save(); 278 Scene.RegionInfo.EstateSettings.Save();
273 TriggerEstateInfoChange(); 279 TriggerEstateInfoChange();
274 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); 280 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
275 } 281 }
276 else 282 else
277 { 283 {
@@ -281,13 +287,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
281 } 287 }
282 if ((estateAccessType & 8) != 0) // User remove 288 if ((estateAccessType & 8) != 0) // User remove
283 { 289 {
284 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 290 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
285 { 291 {
286 m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user); 292 Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
287 m_scene.RegionInfo.EstateSettings.Save(); 293 Scene.RegionInfo.EstateSettings.Save();
288 TriggerEstateInfoChange(); 294 TriggerEstateInfoChange();
289 295
290 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID); 296 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
291 } 297 }
292 else 298 else
293 { 299 {
@@ -296,12 +302,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
296 } 302 }
297 if ((estateAccessType & 16) != 0) // Group add 303 if ((estateAccessType & 16) != 0) // Group add
298 { 304 {
299 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 305 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
300 { 306 {
301 m_scene.RegionInfo.EstateSettings.AddEstateGroup(user); 307 Scene.RegionInfo.EstateSettings.AddEstateGroup(user);
302 m_scene.RegionInfo.EstateSettings.Save(); 308 Scene.RegionInfo.EstateSettings.Save();
303 TriggerEstateInfoChange(); 309 TriggerEstateInfoChange();
304 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); 310 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
305 } 311 }
306 else 312 else
307 { 313 {
@@ -310,13 +316,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
310 } 316 }
311 if ((estateAccessType & 32) != 0) // Group remove 317 if ((estateAccessType & 32) != 0) // Group remove
312 { 318 {
313 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 319 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
314 { 320 {
315 m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); 321 Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
316 m_scene.RegionInfo.EstateSettings.Save(); 322 Scene.RegionInfo.EstateSettings.Save();
317 TriggerEstateInfoChange(); 323 TriggerEstateInfoChange();
318 324
319 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateGroups, m_scene.RegionInfo.EstateSettings.EstateID); 325 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
320 } 326 }
321 else 327 else
322 { 328 {
@@ -325,9 +331,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
325 } 331 }
326 if ((estateAccessType & 64) != 0) // Ban add 332 if ((estateAccessType & 64) != 0) // Ban add
327 { 333 {
328 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) 334 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions())
329 { 335 {
330 EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; 336 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
331 337
332 bool alreadyInList = false; 338 bool alreadyInList = false;
333 339
@@ -346,20 +352,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
346 EstateBan item = new EstateBan(); 352 EstateBan item = new EstateBan();
347 353
348 item.BannedUserID = user; 354 item.BannedUserID = user;
349 item.EstateID = m_scene.RegionInfo.EstateSettings.EstateID; 355 item.EstateID = Scene.RegionInfo.EstateSettings.EstateID;
350 item.BannedHostAddress = "0.0.0.0"; 356 item.BannedHostAddress = "0.0.0.0";
351 item.BannedHostIPMask = "0.0.0.0"; 357 item.BannedHostIPMask = "0.0.0.0";
352 358
353 m_scene.RegionInfo.EstateSettings.AddBan(item); 359 Scene.RegionInfo.EstateSettings.AddBan(item);
354 m_scene.RegionInfo.EstateSettings.Save(); 360 Scene.RegionInfo.EstateSettings.Save();
355 TriggerEstateInfoChange(); 361 TriggerEstateInfoChange();
356 362
357 ScenePresence s = m_scene.GetScenePresence(user); 363 ScenePresence s = Scene.GetScenePresence(user);
358 if (s != null) 364 if (s != null)
359 { 365 {
360 if (!s.IsChildAgent) 366 if (!s.IsChildAgent)
361 { 367 {
362 m_scene.TeleportClientHome(user, s.ControllingClient); 368 Scene.TeleportClientHome(user, s.ControllingClient);
363 } 369 }
364 } 370 }
365 371
@@ -369,7 +375,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
369 remote_client.SendAlertMessage("User is already on the region ban list"); 375 remote_client.SendAlertMessage("User is already on the region ban list");
370 } 376 }
371 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 377 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
372 remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); 378 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
373 } 379 }
374 else 380 else
375 { 381 {
@@ -378,9 +384,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
378 } 384 }
379 if ((estateAccessType & 128) != 0) // Ban remove 385 if ((estateAccessType & 128) != 0) // Ban remove
380 { 386 {
381 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) 387 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions())
382 { 388 {
383 EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; 389 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
384 390
385 bool alreadyInList = false; 391 bool alreadyInList = false;
386 EstateBan listitem = null; 392 EstateBan listitem = null;
@@ -393,20 +399,21 @@ namespace OpenSim.Region.CoreModules.World.Estate
393 listitem = banlistcheck[i]; 399 listitem = banlistcheck[i];
394 break; 400 break;
395 } 401 }
396
397 } 402 }
403
398 if (alreadyInList && listitem != null) 404 if (alreadyInList && listitem != null)
399 { 405 {
400 m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); 406 Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
401 m_scene.RegionInfo.EstateSettings.Save(); 407 Scene.RegionInfo.EstateSettings.Save();
402 TriggerEstateInfoChange(); 408 TriggerEstateInfoChange();
403 } 409 }
404 else 410 else
405 { 411 {
406 remote_client.SendAlertMessage("User is not on the region ban list"); 412 remote_client.SendAlertMessage("User is not on the region ban list");
407 } 413 }
414
408 //m_scene.RegionInfo.regionBanlist.Add(Manager(user); 415 //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
409 remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID); 416 remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID);
410 } 417 }
411 else 418 else
412 { 419 {
@@ -415,12 +422,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
415 } 422 }
416 if ((estateAccessType & 256) != 0) // Manager add 423 if ((estateAccessType & 256) != 0) // Manager add
417 { 424 {
418 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 425 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
419 { 426 {
420 m_scene.RegionInfo.EstateSettings.AddEstateManager(user); 427 Scene.RegionInfo.EstateSettings.AddEstateManager(user);
421 m_scene.RegionInfo.EstateSettings.Save(); 428 Scene.RegionInfo.EstateSettings.Save();
422 TriggerEstateInfoChange(); 429 TriggerEstateInfoChange();
423 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); 430 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
424 } 431 }
425 else 432 else
426 { 433 {
@@ -429,13 +436,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
429 } 436 }
430 if ((estateAccessType & 512) != 0) // Manager remove 437 if ((estateAccessType & 512) != 0) // Manager remove
431 { 438 {
432 if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) 439 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
433 { 440 {
434 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 441 Scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
435 m_scene.RegionInfo.EstateSettings.Save(); 442 Scene.RegionInfo.EstateSettings.Save();
436 TriggerEstateInfoChange(); 443 TriggerEstateInfoChange();
437 444
438 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); 445 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
439 } 446 }
440 else 447 else
441 { 448 {
@@ -447,7 +454,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
447 private void SendSimulatorBlueBoxMessage( 454 private void SendSimulatorBlueBoxMessage(
448 IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) 455 IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
449 { 456 {
450 IDialogModule dm = m_scene.RequestModuleInterface<IDialogModule>(); 457 IDialogModule dm = Scene.RequestModuleInterface<IDialogModule>();
451 458
452 if (dm != null) 459 if (dm != null)
453 dm.SendNotificationToUsersInRegion(senderID, senderName, message); 460 dm.SendNotificationToUsersInRegion(senderID, senderName, message);
@@ -462,61 +469,62 @@ namespace OpenSim.Region.CoreModules.World.Estate
462 private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics) 469 private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics)
463 { 470 {
464 if (physics) 471 if (physics)
465 m_scene.RegionInfo.RegionSettings.DisablePhysics = true; 472 Scene.RegionInfo.RegionSettings.DisablePhysics = true;
466 else 473 else
467 m_scene.RegionInfo.RegionSettings.DisablePhysics = false; 474 Scene.RegionInfo.RegionSettings.DisablePhysics = false;
468 475
469 if (scripted) 476 if (scripted)
470 m_scene.RegionInfo.RegionSettings.DisableScripts = true; 477 Scene.RegionInfo.RegionSettings.DisableScripts = true;
471 else 478 else
472 m_scene.RegionInfo.RegionSettings.DisableScripts = false; 479 Scene.RegionInfo.RegionSettings.DisableScripts = false;
473 480
474 if (collisionEvents) 481 if (collisionEvents)
475 m_scene.RegionInfo.RegionSettings.DisableCollisions = true; 482 Scene.RegionInfo.RegionSettings.DisableCollisions = true;
476 else 483 else
477 m_scene.RegionInfo.RegionSettings.DisableCollisions = false; 484 Scene.RegionInfo.RegionSettings.DisableCollisions = false;
478 485
479 486
480 m_scene.RegionInfo.RegionSettings.Save(); 487 Scene.RegionInfo.RegionSettings.Save();
481 TriggerRegionInfoChange(); 488 TriggerRegionInfoChange();
482 489
483 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); 490 Scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
484 } 491 }
485 492
486 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) 493 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
487 { 494 {
488 if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) 495 if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
489 return; 496 return;
490 497
491 if (prey != UUID.Zero) 498 if (prey != UUID.Zero)
492 { 499 {
493 ScenePresence s = m_scene.GetScenePresence(prey); 500 ScenePresence s = Scene.GetScenePresence(prey);
494 if (s != null) 501 if (s != null)
495 { 502 {
496 m_scene.TeleportClientHome(prey, s.ControllingClient); 503 Scene.TeleportClientHome(prey, s.ControllingClient);
497 } 504 }
498 } 505 }
499 } 506 }
500 507
501 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) 508 private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
502 { 509 {
503 if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) 510 if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
504 return; 511 return;
505 512
506 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 513 Scene.ForEachScenePresence(delegate(ScenePresence sp)
507 { 514 {
508 if (sp.UUID != senderID) 515 if (sp.UUID != senderID)
509 { 516 {
510 ScenePresence p = m_scene.GetScenePresence(sp.UUID); 517 ScenePresence p = Scene.GetScenePresence(sp.UUID);
511 // make sure they are still there, we could be working down a long list 518 // make sure they are still there, we could be working down a long list
512 // Also make sure they are actually in the region 519 // Also make sure they are actually in the region
513 if (p != null && !p.IsChildAgent) 520 if (p != null && !p.IsChildAgent)
514 { 521 {
515 m_scene.TeleportClientHome(p.UUID, p.ControllingClient); 522 Scene.TeleportClientHome(p.UUID, p.ControllingClient);
516 } 523 }
517 } 524 }
518 }); 525 });
519 } 526 }
527
520 private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) 528 private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID)
521 { 529 {
522 if (TerrainUploader != null) 530 if (TerrainUploader != null)
@@ -547,11 +555,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
547 TerrainUploader = null; 555 TerrainUploader = null;
548 } 556 }
549 remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); 557 remoteClient.SendAlertMessage("Terrain Upload Complete. Loading....");
550 ITerrainModule terr = m_scene.RequestModuleInterface<ITerrainModule>(); 558 ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>();
551 559
552 if (terr != null) 560 if (terr != null)
553 { 561 {
554 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); 562 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
555 563
556 try 564 try
557 { 565 {
@@ -597,7 +605,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
597 605
598 private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) 606 private void handleUploadTerrain(IClientAPI remote_client, string clientFileName)
599 { 607 {
600
601 if (TerrainUploader == null) 608 if (TerrainUploader == null)
602 { 609 {
603 610
@@ -615,16 +622,16 @@ namespace OpenSim.Region.CoreModules.World.Estate
615 { 622 {
616 remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); 623 remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!");
617 } 624 }
618
619 } 625 }
626
620 private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) 627 private void handleTerrainRequest(IClientAPI remote_client, string clientFileName)
621 { 628 {
622 // Save terrain here 629 // Save terrain here
623 ITerrainModule terr = m_scene.RequestModuleInterface<ITerrainModule>(); 630 ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>();
624 631
625 if (terr != null) 632 if (terr != null)
626 { 633 {
627 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); 634 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
628 if (File.Exists(Util.dataDir() + "/terrain.raw")) 635 if (File.Exists(Util.dataDir() + "/terrain.raw"))
629 { 636 {
630 File.Delete(Util.dataDir() + "/terrain.raw"); 637 File.Delete(Util.dataDir() + "/terrain.raw");
@@ -635,7 +642,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
635 byte[] bdata = new byte[input.Length]; 642 byte[] bdata = new byte[input.Length];
636 input.Read(bdata, 0, (int)input.Length); 643 input.Read(bdata, 0, (int)input.Length);
637 remote_client.SendAlertMessage("Terrain file written, starting download..."); 644 remote_client.SendAlertMessage("Terrain file written, starting download...");
638 m_scene.XferManager.AddNewFile("terrain.raw", bdata); 645 Scene.XferManager.AddNewFile("terrain.raw", bdata);
639 // Tell client about it 646 // Tell client about it
640 m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); 647 m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name);
641 remote_client.SendInitiateDownload("terrain.raw", clientFileName); 648 remote_client.SendInitiateDownload("terrain.raw", clientFileName);
@@ -645,35 +652,35 @@ namespace OpenSim.Region.CoreModules.World.Estate
645 private void HandleRegionInfoRequest(IClientAPI remote_client) 652 private void HandleRegionInfoRequest(IClientAPI remote_client)
646 { 653 {
647 RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); 654 RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs();
648 args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; 655 args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor;
649 args.estateID = m_scene.RegionInfo.EstateSettings.EstateID; 656 args.estateID = Scene.RegionInfo.EstateSettings.EstateID;
650 args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit; 657 args.maxAgents = (byte)Scene.RegionInfo.RegionSettings.AgentLimit;
651 args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus; 658 args.objectBonusFactor = (float)Scene.RegionInfo.RegionSettings.ObjectBonus;
652 args.parentEstateID = m_scene.RegionInfo.EstateSettings.ParentEstateID; 659 args.parentEstateID = Scene.RegionInfo.EstateSettings.ParentEstateID;
653 args.pricePerMeter = m_scene.RegionInfo.EstateSettings.PricePerMeter; 660 args.pricePerMeter = Scene.RegionInfo.EstateSettings.PricePerMeter;
654 args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX; 661 args.redirectGridX = Scene.RegionInfo.EstateSettings.RedirectGridX;
655 args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY; 662 args.redirectGridY = Scene.RegionInfo.EstateSettings.RedirectGridY;
656 args.regionFlags = GetRegionFlags(); 663 args.regionFlags = GetRegionFlags();
657 args.simAccess = m_scene.RegionInfo.AccessLevel; 664 args.simAccess = Scene.RegionInfo.AccessLevel;
658 args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition; 665 args.sunHour = (float)Scene.RegionInfo.RegionSettings.SunPosition;
659 args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; 666 args.terrainLowerLimit = (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit;
660 args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; 667 args.terrainRaiseLimit = (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit;
661 args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; 668 args.useEstateSun = Scene.RegionInfo.RegionSettings.UseEstateSun;
662 args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 669 args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight;
663 args.simName = m_scene.RegionInfo.RegionName; 670 args.simName = Scene.RegionInfo.RegionName;
664 args.regionType = m_scene.RegionInfo.RegionType; 671 args.regionType = Scene.RegionInfo.RegionType;
665 672
666 remote_client.SendRegionInfoToEstateMenu(args); 673 remote_client.SendRegionInfoToEstateMenu(args);
667 } 674 }
668 675
669 private void HandleEstateCovenantRequest(IClientAPI remote_client) 676 private void HandleEstateCovenantRequest(IClientAPI remote_client)
670 { 677 {
671 remote_client.SendEstateCovenantInformation(m_scene.RegionInfo.RegionSettings.Covenant); 678 remote_client.SendEstateCovenantInformation(Scene.RegionInfo.RegionSettings.Covenant);
672 } 679 }
673 680
674 private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) 681 private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
675 { 682 {
676 if (!m_scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) 683 if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
677 return; 684 return;
678 685
679 Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); 686 Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
@@ -681,11 +688,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
681 688
682 if (reportType == 1) 689 if (reportType == 1)
683 { 690 {
684 SceneData = m_scene.PhysicsScene.GetTopColliders(); 691 SceneData = Scene.PhysicsScene.GetTopColliders();
685 } 692 }
686 else if (reportType == 0) 693 else if (reportType == 0)
687 { 694 {
688 SceneData = m_scene.SceneGraph.GetTopScripts(); 695 SceneData = Scene.SceneGraph.GetTopScripts();
689 } 696 }
690 697
691 List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); 698 List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
@@ -693,7 +700,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
693 { 700 {
694 foreach (uint obj in SceneData.Keys) 701 foreach (uint obj in SceneData.Keys)
695 { 702 {
696 SceneObjectPart prt = m_scene.GetSceneObjectPart(obj); 703 SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
697 if (prt != null) 704 if (prt != null)
698 { 705 {
699 if (prt.ParentGroup != null) 706 if (prt.ParentGroup != null)
@@ -765,7 +772,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
765 { 772 {
766 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); 773 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
767 774
768 IUserManagement userManager = m_scene.RequestModuleInterface<IUserManagement>(); 775 IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>();
769 if (userManager != null) 776 if (userManager != null)
770 userManager.GetUserName(uuidarr[i]); 777 userManager.GetUserName(uuidarr[i]);
771 778
@@ -780,7 +787,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
780 787
781 public void sendRegionInfoPacketToAll() 788 public void sendRegionInfoPacketToAll()
782 { 789 {
783 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 790 Scene.ForEachScenePresence(delegate(ScenePresence sp)
784 { 791 {
785 if (!sp.IsChildAgent) 792 if (!sp.IsChildAgent)
786 HandleRegionInfoRequest(sp.ControllingClient); 793 HandleRegionInfoRequest(sp.ControllingClient);
@@ -791,99 +798,99 @@ namespace OpenSim.Region.CoreModules.World.Estate
791 { 798 {
792 RegionHandshakeArgs args = new RegionHandshakeArgs(); 799 RegionHandshakeArgs args = new RegionHandshakeArgs();
793 800
794 args.isEstateManager = m_scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId); 801 args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId);
795 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && m_scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId) 802 if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId)
796 args.isEstateManager = true; 803 args.isEstateManager = true;
797 804
798 args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; 805 args.billableFactor = Scene.RegionInfo.EstateSettings.BillableFactor;
799 args.terrainStartHeight0 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SW; 806 args.terrainStartHeight0 = (float)Scene.RegionInfo.RegionSettings.Elevation1SW;
800 args.terrainHeightRange0 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SW; 807 args.terrainHeightRange0 = (float)Scene.RegionInfo.RegionSettings.Elevation2SW;
801 args.terrainStartHeight1 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NW; 808 args.terrainStartHeight1 = (float)Scene.RegionInfo.RegionSettings.Elevation1NW;
802 args.terrainHeightRange1 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NW; 809 args.terrainHeightRange1 = (float)Scene.RegionInfo.RegionSettings.Elevation2NW;
803 args.terrainStartHeight2 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SE; 810 args.terrainStartHeight2 = (float)Scene.RegionInfo.RegionSettings.Elevation1SE;
804 args.terrainHeightRange2 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SE; 811 args.terrainHeightRange2 = (float)Scene.RegionInfo.RegionSettings.Elevation2SE;
805 args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE; 812 args.terrainStartHeight3 = (float)Scene.RegionInfo.RegionSettings.Elevation1NE;
806 args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE; 813 args.terrainHeightRange3 = (float)Scene.RegionInfo.RegionSettings.Elevation2NE;
807 args.simAccess = m_scene.RegionInfo.AccessLevel; 814 args.simAccess = Scene.RegionInfo.AccessLevel;
808 args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 815 args.waterHeight = (float)Scene.RegionInfo.RegionSettings.WaterHeight;
809 args.regionFlags = GetRegionFlags(); 816 args.regionFlags = GetRegionFlags();
810 args.regionName = m_scene.RegionInfo.RegionName; 817 args.regionName = Scene.RegionInfo.RegionName;
811 args.SimOwner = m_scene.RegionInfo.EstateSettings.EstateOwner; 818 args.SimOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
812 819
813 args.terrainBase0 = UUID.Zero; 820 args.terrainBase0 = UUID.Zero;
814 args.terrainBase1 = UUID.Zero; 821 args.terrainBase1 = UUID.Zero;
815 args.terrainBase2 = UUID.Zero; 822 args.terrainBase2 = UUID.Zero;
816 args.terrainBase3 = UUID.Zero; 823 args.terrainBase3 = UUID.Zero;
817 args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; 824 args.terrainDetail0 = Scene.RegionInfo.RegionSettings.TerrainTexture1;
818 args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; 825 args.terrainDetail1 = Scene.RegionInfo.RegionSettings.TerrainTexture2;
819 args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; 826 args.terrainDetail2 = Scene.RegionInfo.RegionSettings.TerrainTexture3;
820 args.terrainDetail3 = m_scene.RegionInfo.RegionSettings.TerrainTexture4; 827 args.terrainDetail3 = Scene.RegionInfo.RegionSettings.TerrainTexture4;
821 828
822 remoteClient.SendRegionHandshake(m_scene.RegionInfo,args); 829 remoteClient.SendRegionHandshake(Scene.RegionInfo,args);
823 } 830 }
824 831
825 public void sendRegionHandshakeToAll() 832 public void sendRegionHandshakeToAll()
826 { 833 {
827 m_scene.ForEachClient(sendRegionHandshake); 834 Scene.ForEachClient(sendRegionHandshake);
828 } 835 }
829 836
830 public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) 837 public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2)
831 { 838 {
832 if (parms2 == 0) 839 if (parms2 == 0)
833 { 840 {
834 m_scene.RegionInfo.EstateSettings.UseGlobalTime = true; 841 Scene.RegionInfo.EstateSettings.UseGlobalTime = true;
835 m_scene.RegionInfo.EstateSettings.SunPosition = 0.0; 842 Scene.RegionInfo.EstateSettings.SunPosition = 0.0;
836 } 843 }
837 else 844 else
838 { 845 {
839 m_scene.RegionInfo.EstateSettings.UseGlobalTime = false; 846 Scene.RegionInfo.EstateSettings.UseGlobalTime = false;
840 m_scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0; 847 Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0;
841 } 848 }
842 849
843 if ((parms1 & 0x00000010) != 0) 850 if ((parms1 & 0x00000010) != 0)
844 m_scene.RegionInfo.EstateSettings.FixedSun = true; 851 Scene.RegionInfo.EstateSettings.FixedSun = true;
845 else 852 else
846 m_scene.RegionInfo.EstateSettings.FixedSun = false; 853 Scene.RegionInfo.EstateSettings.FixedSun = false;
847 854
848 if ((parms1 & 0x00008000) != 0) 855 if ((parms1 & 0x00008000) != 0)
849 m_scene.RegionInfo.EstateSettings.PublicAccess = true; 856 Scene.RegionInfo.EstateSettings.PublicAccess = true;
850 else 857 else
851 m_scene.RegionInfo.EstateSettings.PublicAccess = false; 858 Scene.RegionInfo.EstateSettings.PublicAccess = false;
852 859
853 if ((parms1 & 0x10000000) != 0) 860 if ((parms1 & 0x10000000) != 0)
854 m_scene.RegionInfo.EstateSettings.AllowVoice = true; 861 Scene.RegionInfo.EstateSettings.AllowVoice = true;
855 else 862 else
856 m_scene.RegionInfo.EstateSettings.AllowVoice = false; 863 Scene.RegionInfo.EstateSettings.AllowVoice = false;
857 864
858 if ((parms1 & 0x00100000) != 0) 865 if ((parms1 & 0x00100000) != 0)
859 m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = true; 866 Scene.RegionInfo.EstateSettings.AllowDirectTeleport = true;
860 else 867 else
861 m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = false; 868 Scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
862 869
863 if ((parms1 & 0x00800000) != 0) 870 if ((parms1 & 0x00800000) != 0)
864 m_scene.RegionInfo.EstateSettings.DenyAnonymous = true; 871 Scene.RegionInfo.EstateSettings.DenyAnonymous = true;
865 else 872 else
866 m_scene.RegionInfo.EstateSettings.DenyAnonymous = false; 873 Scene.RegionInfo.EstateSettings.DenyAnonymous = false;
867 874
868 if ((parms1 & 0x01000000) != 0) 875 if ((parms1 & 0x01000000) != 0)
869 m_scene.RegionInfo.EstateSettings.DenyIdentified = true; 876 Scene.RegionInfo.EstateSettings.DenyIdentified = true;
870 else 877 else
871 m_scene.RegionInfo.EstateSettings.DenyIdentified = false; 878 Scene.RegionInfo.EstateSettings.DenyIdentified = false;
872 879
873 if ((parms1 & 0x02000000) != 0) 880 if ((parms1 & 0x02000000) != 0)
874 m_scene.RegionInfo.EstateSettings.DenyTransacted = true; 881 Scene.RegionInfo.EstateSettings.DenyTransacted = true;
875 else 882 else
876 m_scene.RegionInfo.EstateSettings.DenyTransacted = false; 883 Scene.RegionInfo.EstateSettings.DenyTransacted = false;
877 884
878 if ((parms1 & 0x40000000) != 0) 885 if ((parms1 & 0x40000000) != 0)
879 m_scene.RegionInfo.EstateSettings.DenyMinors = true; 886 Scene.RegionInfo.EstateSettings.DenyMinors = true;
880 else 887 else
881 m_scene.RegionInfo.EstateSettings.DenyMinors = false; 888 Scene.RegionInfo.EstateSettings.DenyMinors = false;
882 889
883 m_scene.RegionInfo.EstateSettings.Save(); 890 Scene.RegionInfo.EstateSettings.Save();
884 TriggerEstateInfoChange(); 891 TriggerEstateInfoChange();
885 892
886 m_scene.TriggerEstateSunUpdate(); 893 Scene.TriggerEstateSunUpdate();
887 894
888 sendDetailedEstateData(remoteClient, invoice); 895 sendDetailedEstateData(remoteClient, invoice);
889 } 896 }
@@ -891,137 +898,38 @@ namespace OpenSim.Region.CoreModules.World.Estate
891 #endregion 898 #endregion
892 899
893 #region IRegionModule Members 900 #region IRegionModule Members
901
902 public string Name { get { return "EstateManagementModule"; } }
903
904 public Type ReplaceableInterface { get { return null; } }
894 905
895 public void Initialise(Scene scene, IConfigSource source) 906 public void Initialise(IConfigSource source) {}
896 { 907
897 m_scene = scene; 908 public void AddRegion(Scene scene)
898 m_scene.RegisterModuleInterface<IEstateModule>(this);
899 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
900 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
901
902 m_scene.AddCommand(this, "set terrain texture",
903 "set terrain texture <number> <uuid> [<x>] [<y>]",
904 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
905 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
906 " that coordinate.",
907 consoleSetTerrainTexture);
908
909 m_scene.AddCommand(this, "set terrain heights",
910 "set terrain heights <corner> <min> <max> [<x>] [<y>]",
911 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
912 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
913 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
914 consoleSetTerrainHeights);
915 }
916
917 #region Console Commands
918
919 public void consoleSetTerrainTexture(string module, string[] args)
920 {
921 string num = args[3];
922 string uuid = args[4];
923 int x = (args.Length > 5 ? int.Parse(args[5]) : -1);
924 int y = (args.Length > 6 ? int.Parse(args[6]) : -1);
925
926 if (x == -1 || m_scene.RegionInfo.RegionLocX == x)
927 {
928 if (y == -1 || m_scene.RegionInfo.RegionLocY == y)
929 {
930 int corner = int.Parse(num);
931 UUID texture = UUID.Parse(uuid);
932
933 m_log.Debug("[ESTATEMODULE] Setting terrain textures for " + m_scene.RegionInfo.RegionName +
934 string.Format(" (C#{0} = {1})", corner, texture));
935
936 switch (corner)
937 {
938 case 0:
939 m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
940 break;
941 case 1:
942 m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture;
943 break;
944 case 2:
945 m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture;
946 break;
947 case 3:
948 m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
949 break;
950 }
951 m_scene.RegionInfo.RegionSettings.Save();
952 TriggerRegionInfoChange();
953 sendRegionInfoPacketToAll();
954
955 }
956 }
957 }
958
959 public void consoleSetTerrainHeights(string module, string[] args)
960 { 909 {
961 string num = args[3]; 910 Scene = scene;
962 string min = args[4]; 911 Scene.RegisterModuleInterface<IEstateModule>(this);
963 string max = args[5]; 912 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
964 int x = (args.Length > 6 ? int.Parse(args[6]) : -1); 913 Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
965 int y = (args.Length > 7 ? int.Parse(args[7]) : -1); 914
966 915 m_commands = new EstateManagementCommands(this);
967 if (x == -1 || m_scene.RegionInfo.RegionLocX == x) 916 m_commands.Initialise();
968 {
969 if (y == -1 || m_scene.RegionInfo.RegionLocY == y)
970 {
971 int corner = int.Parse(num);
972 float lowValue = float.Parse(min, Culture.NumberFormatInfo);
973 float highValue = float.Parse(max, Culture.NumberFormatInfo);
974
975 m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName +
976 string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue));
977
978 switch (corner)
979 {
980 case 0:
981 m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue;
982 m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue;
983 break;
984 case 1:
985 m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue;
986 m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue;
987 break;
988 case 2:
989 m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue;
990 m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue;
991 break;
992 case 3:
993 m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue;
994 m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
995 break;
996 }
997 m_scene.RegionInfo.RegionSettings.Save();
998 TriggerRegionInfoChange();
999 sendRegionHandshakeToAll();
1000 }
1001 }
1002 } 917 }
1003 918
1004 #endregion 919 public void RemoveRegion(Scene scene) {}
1005 920
1006 public void PostInitialise() 921 public void RegionLoaded(Scene scene)
1007 { 922 {
1008 // 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
1009 // DO NOT REMOVE or the sun will stop working 924 // DO NOT REMOVE or the sun will stop working
1010 m_scene.TriggerEstateSunUpdate(); 925 scene.TriggerEstateSunUpdate();
1011 } 926
1012 927 UserManager = scene.RequestModuleInterface<IUserManagement>();
1013 public void Close()
1014 {
1015 }
1016
1017 public string Name
1018 {
1019 get { return "EstateManagementModule"; }
1020 } 928 }
1021 929
1022 public bool IsSharedModule 930 public void Close()
1023 { 931 {
1024 get { return false; } 932 m_commands.Close();
1025 } 933 }
1026 934
1027 #endregion 935 #endregion
@@ -1031,14 +939,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
1031 public void changeWaterHeight(float height) 939 public void changeWaterHeight(float height)
1032 { 940 {
1033 setRegionTerrainSettings(height, 941 setRegionTerrainSettings(height,
1034 (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit, 942 (float)Scene.RegionInfo.RegionSettings.TerrainRaiseLimit,
1035 (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit, 943 (float)Scene.RegionInfo.RegionSettings.TerrainLowerLimit,
1036 m_scene.RegionInfo.RegionSettings.UseEstateSun, 944 Scene.RegionInfo.RegionSettings.UseEstateSun,
1037 m_scene.RegionInfo.RegionSettings.FixedSun, 945 Scene.RegionInfo.RegionSettings.FixedSun,
1038 (float)m_scene.RegionInfo.RegionSettings.SunPosition, 946 (float)Scene.RegionInfo.RegionSettings.SunPosition,
1039 m_scene.RegionInfo.EstateSettings.UseGlobalTime, 947 Scene.RegionInfo.EstateSettings.UseGlobalTime,
1040 m_scene.RegionInfo.EstateSettings.FixedSun, 948 Scene.RegionInfo.EstateSettings.FixedSun,
1041 (float)m_scene.RegionInfo.EstateSettings.SunPosition); 949 (float)Scene.RegionInfo.EstateSettings.SunPosition);
1042 950
1043 sendRegionInfoPacketToAll(); 951 sendRegionInfoPacketToAll();
1044 } 952 }
@@ -1078,32 +986,32 @@ namespace OpenSim.Region.CoreModules.World.Estate
1078 986
1079 // Fully implemented 987 // Fully implemented
1080 // 988 //
1081 if (m_scene.RegionInfo.RegionSettings.AllowDamage) 989 if (Scene.RegionInfo.RegionSettings.AllowDamage)
1082 flags |= RegionFlags.AllowDamage; 990 flags |= RegionFlags.AllowDamage;
1083 if (m_scene.RegionInfo.RegionSettings.BlockTerraform) 991 if (Scene.RegionInfo.RegionSettings.BlockTerraform)
1084 flags |= RegionFlags.BlockTerraform; 992 flags |= RegionFlags.BlockTerraform;
1085 if (!m_scene.RegionInfo.RegionSettings.AllowLandResell) 993 if (!Scene.RegionInfo.RegionSettings.AllowLandResell)
1086 flags |= RegionFlags.BlockLandResell; 994 flags |= RegionFlags.BlockLandResell;
1087 if (m_scene.RegionInfo.RegionSettings.DisableCollisions) 995 if (Scene.RegionInfo.RegionSettings.DisableCollisions)
1088 flags |= RegionFlags.SkipCollisions; 996 flags |= RegionFlags.SkipCollisions;
1089 if (m_scene.RegionInfo.RegionSettings.DisableScripts) 997 if (Scene.RegionInfo.RegionSettings.DisableScripts)
1090 flags |= RegionFlags.SkipScripts; 998 flags |= RegionFlags.SkipScripts;
1091 if (m_scene.RegionInfo.RegionSettings.DisablePhysics) 999 if (Scene.RegionInfo.RegionSettings.DisablePhysics)
1092 flags |= RegionFlags.SkipPhysics; 1000 flags |= RegionFlags.SkipPhysics;
1093 if (m_scene.RegionInfo.RegionSettings.BlockFly) 1001 if (Scene.RegionInfo.RegionSettings.BlockFly)
1094 flags |= RegionFlags.NoFly; 1002 flags |= RegionFlags.NoFly;
1095 if (m_scene.RegionInfo.RegionSettings.RestrictPushing) 1003 if (Scene.RegionInfo.RegionSettings.RestrictPushing)
1096 flags |= RegionFlags.RestrictPushObject; 1004 flags |= RegionFlags.RestrictPushObject;
1097 if (m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide) 1005 if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide)
1098 flags |= RegionFlags.AllowParcelChanges; 1006 flags |= RegionFlags.AllowParcelChanges;
1099 if (m_scene.RegionInfo.RegionSettings.BlockShowInSearch) 1007 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
1100 flags |= RegionFlags.BlockParcelSearch; 1008 flags |= RegionFlags.BlockParcelSearch;
1101 1009
1102 if (m_scene.RegionInfo.RegionSettings.FixedSun) 1010 if (Scene.RegionInfo.RegionSettings.FixedSun)
1103 flags |= RegionFlags.SunFixed; 1011 flags |= RegionFlags.SunFixed;
1104 if (m_scene.RegionInfo.RegionSettings.Sandbox) 1012 if (Scene.RegionInfo.RegionSettings.Sandbox)
1105 flags |= RegionFlags.Sandbox; 1013 flags |= RegionFlags.Sandbox;
1106 if (m_scene.RegionInfo.EstateSettings.AllowVoice) 1014 if (Scene.RegionInfo.EstateSettings.AllowVoice)
1107 flags |= RegionFlags.AllowVoice; 1015 flags |= RegionFlags.AllowVoice;
1108 1016
1109 // Fudge these to always on, so the menu options activate 1017 // Fudge these to always on, so the menu options activate
@@ -1125,32 +1033,32 @@ namespace OpenSim.Region.CoreModules.World.Estate
1125 { 1033 {
1126 RegionFlags flags = RegionFlags.None; 1034 RegionFlags flags = RegionFlags.None;
1127 1035
1128 if (m_scene.RegionInfo.EstateSettings.FixedSun) 1036 if (Scene.RegionInfo.EstateSettings.FixedSun)
1129 flags |= RegionFlags.SunFixed; 1037 flags |= RegionFlags.SunFixed;
1130 if (m_scene.RegionInfo.EstateSettings.PublicAccess) 1038 if (Scene.RegionInfo.EstateSettings.PublicAccess)
1131 flags |= (RegionFlags.PublicAllowed | 1039 flags |= (RegionFlags.PublicAllowed |
1132 RegionFlags.ExternallyVisible); 1040 RegionFlags.ExternallyVisible);
1133 if (m_scene.RegionInfo.EstateSettings.AllowVoice) 1041 if (Scene.RegionInfo.EstateSettings.AllowVoice)
1134 flags |= RegionFlags.AllowVoice; 1042 flags |= RegionFlags.AllowVoice;
1135 if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) 1043 if (Scene.RegionInfo.EstateSettings.AllowDirectTeleport)
1136 flags |= RegionFlags.AllowDirectTeleport; 1044 flags |= RegionFlags.AllowDirectTeleport;
1137 if (m_scene.RegionInfo.EstateSettings.DenyAnonymous) 1045 if (Scene.RegionInfo.EstateSettings.DenyAnonymous)
1138 flags |= RegionFlags.DenyAnonymous; 1046 flags |= RegionFlags.DenyAnonymous;
1139 if (m_scene.RegionInfo.EstateSettings.DenyIdentified) 1047 if (Scene.RegionInfo.EstateSettings.DenyIdentified)
1140 flags |= RegionFlags.DenyIdentified; 1048 flags |= RegionFlags.DenyIdentified;
1141 if (m_scene.RegionInfo.EstateSettings.DenyTransacted) 1049 if (Scene.RegionInfo.EstateSettings.DenyTransacted)
1142 flags |= RegionFlags.DenyTransacted; 1050 flags |= RegionFlags.DenyTransacted;
1143 if (m_scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner) 1051 if (Scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner)
1144 flags |= RegionFlags.AbuseEmailToEstateOwner; 1052 flags |= RegionFlags.AbuseEmailToEstateOwner;
1145 if (m_scene.RegionInfo.EstateSettings.BlockDwell) 1053 if (Scene.RegionInfo.EstateSettings.BlockDwell)
1146 flags |= RegionFlags.BlockDwell; 1054 flags |= RegionFlags.BlockDwell;
1147 if (m_scene.RegionInfo.EstateSettings.EstateSkipScripts) 1055 if (Scene.RegionInfo.EstateSettings.EstateSkipScripts)
1148 flags |= RegionFlags.EstateSkipScripts; 1056 flags |= RegionFlags.EstateSkipScripts;
1149 if (m_scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) 1057 if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport)
1150 flags |= RegionFlags.ResetHomeOnTeleport; 1058 flags |= RegionFlags.ResetHomeOnTeleport;
1151 if (m_scene.RegionInfo.EstateSettings.TaxFree) 1059 if (Scene.RegionInfo.EstateSettings.TaxFree)
1152 flags |= RegionFlags.TaxFree; 1060 flags |= RegionFlags.TaxFree;
1153 if (m_scene.RegionInfo.EstateSettings.DenyMinors) 1061 if (Scene.RegionInfo.EstateSettings.DenyMinors)
1154 flags |= (RegionFlags)(1 << 30); 1062 flags |= (RegionFlags)(1 << 30);
1155 1063
1156 return (uint)flags; 1064 return (uint)flags;
@@ -1158,38 +1066,38 @@ namespace OpenSim.Region.CoreModules.World.Estate
1158 1066
1159 public bool IsManager(UUID avatarID) 1067 public bool IsManager(UUID avatarID)
1160 { 1068 {
1161 if (avatarID == m_scene.RegionInfo.EstateSettings.EstateOwner) 1069 if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner)
1162 return true; 1070 return true;
1163 1071
1164 List<UUID> ems = new List<UUID>(m_scene.RegionInfo.EstateSettings.EstateManagers); 1072 List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers);
1165 if (ems.Contains(avatarID)) 1073 if (ems.Contains(avatarID))
1166 return true; 1074 return true;
1167 1075
1168 return false; 1076 return false;
1169 } 1077 }
1170 1078
1171 protected void TriggerRegionInfoChange() 1079 public void TriggerRegionInfoChange()
1172 { 1080 {
1173 ChangeDelegate change = OnRegionInfoChange; 1081 ChangeDelegate change = OnRegionInfoChange;
1174 1082
1175 if (change != null) 1083 if (change != null)
1176 change(m_scene.RegionInfo.RegionID); 1084 change(Scene.RegionInfo.RegionID);
1177 } 1085 }
1178 1086
1179 protected void TriggerEstateInfoChange() 1087 public void TriggerEstateInfoChange()
1180 { 1088 {
1181 ChangeDelegate change = OnEstateInfoChange; 1089 ChangeDelegate change = OnEstateInfoChange;
1182 1090
1183 if (change != null) 1091 if (change != null)
1184 change(m_scene.RegionInfo.RegionID); 1092 change(Scene.RegionInfo.RegionID);
1185 } 1093 }
1186 1094
1187 protected void TriggerEstateMessage(UUID fromID, string fromName, string message) 1095 public void TriggerEstateMessage(UUID fromID, string fromName, string message)
1188 { 1096 {
1189 MessageDelegate onmessage = OnEstateMessage; 1097 MessageDelegate onmessage = OnEstateMessage;
1190 1098
1191 if (onmessage != null) 1099 if (onmessage != null)
1192 onmessage(m_scene.RegionInfo.RegionID, fromID, fromName, message); 1100 onmessage(Scene.RegionInfo.RegionID, fromID, fromName, message);
1193 } 1101 }
1194 } 1102 }
1195} 1103}
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index e0f36a2..1094970 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -764,10 +764,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
764 764
765 if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle 765 if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle
766 { 766 {
767 if (!m_blacklistedregions.ContainsKey(regionhandle)) 767 m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting.");
768 lock (m_blacklistedregions)
768 { 769 {
769 m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting."); 770 if (!m_blacklistedregions.ContainsKey(regionhandle))
770 m_blacklistedregions.Add(regionhandle, Environment.TickCount); 771 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
771 } 772 }
772 } 773 }
773 774
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index c850f7f..721f0ee 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -32,7 +32,7 @@ namespace OpenSim.Region.Framework.Interfaces
32 public delegate void ChangeDelegate(UUID regionID); 32 public delegate void ChangeDelegate(UUID regionID);
33 public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); 33 public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message);
34 34
35 public interface IEstateModule : IRegionModule 35 public interface IEstateModule
36 { 36 {
37 event ChangeDelegate OnRegionInfoChange; 37 event ChangeDelegate OnRegionInfoChange;
38 event ChangeDelegate OnEstateInfoChange; 38 event ChangeDelegate OnEstateInfoChange;
diff --git a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs
index 7251d57..2397f22 100644
--- a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs
@@ -36,5 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces
36 void Close(); 36 void Close();
37 void QueuePartForUpdate(SceneObjectPart part); 37 void QueuePartForUpdate(SceneObjectPart part);
38 void SendPrimUpdates(); 38 void SendPrimUpdates();
39 int GetPendingObjectsCount();
39 } 40 }
40} 41}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4fca261..355671c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes
64 64
65 #region Fields 65 #region Fields
66 66
67 public bool EmergencyMonitoring = false;
68
67 public SynchronizeSceneHandler SynchronizeScene; 69 public SynchronizeSceneHandler SynchronizeScene;
68 public SimStatsReporter StatsReporter; 70 public SimStatsReporter StatsReporter;
69 public List<Border> NorthBorders = new List<Border>(); 71 public List<Border> NorthBorders = new List<Border>();
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index f8ff308..837e655 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -193,7 +193,8 @@ namespace OpenSim.Region.Framework.Scenes
193 } 193 }
194 } 194 }
195 195
196 public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); 196 public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest);
197
197 198
198 /// <summary> 199 /// <summary>
199 /// This informs all neighboring regions about the settings of it's child agent. 200 /// This informs all neighboring regions about the settings of it's child agent.
@@ -202,31 +203,17 @@ namespace OpenSim.Region.Framework.Scenes
202 /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. 203 /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
203 /// 204 ///
204 /// </summary> 205 /// </summary>
205 private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) 206 private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, GridRegion dest)
206 { 207 {
207 //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); 208 //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
208 try 209 try
209 { 210 {
210 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); 211 m_scene.SimulationService.UpdateAgent(dest, cAgentData);
211 uint x = 0, y = 0;
212 Utils.LongToUInts(regionHandle, out x, out y);
213 GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
214 m_scene.SimulationService.UpdateAgent(destination, cAgentData);
215 } 212 }
216 catch 213 catch
217 { 214 {
218 // Ignore; we did our best 215 // Ignore; we did our best
219 } 216 }
220
221 //if (regionAccepted)
222 //{
223 // //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent");
224 //}
225 //else
226 //{
227 // //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent");
228 //}
229
230 } 217 }
231 218
232 private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) 219 private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
@@ -240,14 +227,28 @@ namespace OpenSim.Region.Framework.Scenes
240 // This assumes that we know what our neighbors are. 227 // This assumes that we know what our neighbors are.
241 try 228 try
242 { 229 {
230 uint x = 0, y = 0;
231 List<string> simulatorList = new List<string>();
243 foreach (ulong regionHandle in presence.KnownChildRegionHandles) 232 foreach (ulong regionHandle in presence.KnownChildRegionHandles)
244 { 233 {
245 if (regionHandle != m_regionInfo.RegionHandle) 234 if (regionHandle != m_regionInfo.RegionHandle)
246 { 235 {
247 SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; 236 // we only want to send one update to each simulator; the simulator will
248 d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, 237 // hand it off to the regions where a child agent exists, this does assume
249 SendChildAgentDataUpdateCompleted, 238 // that the region position is cached or performance will degrade
250 d); 239 Utils.LongToUInts(regionHandle, out x, out y);
240 GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
241 if (! simulatorList.Contains(dest.ServerURI))
242 {
243 // we havent seen this simulator before, add it to the list
244 // and send it an update
245 simulatorList.Add(dest.ServerURI);
246
247 SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
248 d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest,
249 SendChildAgentDataUpdateCompleted,
250 d);
251 }
251 } 252 }
252 } 253 }
253 } 254 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4fcd8f5..6a92378 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2055,8 +2055,9 @@ namespace OpenSim.Region.Framework.Scenes
2055 2055
2056 public void GetProperties(IClientAPI client) 2056 public void GetProperties(IClientAPI client)
2057 { 2057 {
2058 //Viewer wants date in microseconds so multiply it by 1,000,000.
2058 client.SendObjectPropertiesReply( 2059 client.SendObjectPropertiesReply(
2059 m_fromUserInventoryItemID, (ulong)_creationDate, _creatorID, UUID.Zero, UUID.Zero, 2060 m_fromUserInventoryItemID, (ulong)_creationDate*(ulong)1e6, _creatorID, UUID.Zero, UUID.Zero,
2060 _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, 2061 _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID,
2061 ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, 2062 ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description,
2062 ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, 2063 ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask,
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index b44a010..7c067ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -205,6 +205,14 @@ namespace OpenSim.Region.Framework.Scenes
205 Reset(); 205 Reset();
206 } 206 }
207 207
208 public int GetPendingObjectsCount()
209 {
210 if (m_pendingObjects != null)
211 return m_pendingObjects.Count;
212
213 return 0;
214 }
215
208 public class ScenePartUpdate 216 public class ScenePartUpdate
209 { 217 {
210 public UUID FullID; 218 public UUID FullID;
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index 87d067c..dfeecb1 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -95,7 +95,15 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
95 "Show throttle settings for each client and for the server overall", 95 "Show throttle settings for each client and for the server overall",
96 "Without the 'full' option, only root agents are shown." 96 "Without the 'full' option, only root agents are shown."
97 + " With the 'full' option child agents are also shown.", 97 + " With the 'full' option child agents are also shown.",
98 ShowThrottlesReport); 98 ShowThrottlesReport);
99
100 scene.AddCommand(
101 this, "emergency-monitoring",
102 "Go on/off emergency monitoring mode",
103 "Go on/off emergency monitoring mode",
104 "Go on/off emergency monitoring mode",
105 EmergencyMonitoring);
106
99 } 107 }
100 108
101 public void RemoveRegion(Scene scene) 109 public void RemoveRegion(Scene scene)
@@ -120,7 +128,25 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
120 { 128 {
121 MainConsole.Instance.Output(GetThrottlesReport(cmd)); 129 MainConsole.Instance.Output(GetThrottlesReport(cmd));
122 } 130 }
123 131
132 protected void EmergencyMonitoring(string module, string[] cmd)
133 {
134 bool mode = true;
135 if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
136 {
137 mode = true;
138 MainConsole.Instance.Output("Emergency Monitoring ON");
139 }
140 else
141 {
142 mode = false;
143 MainConsole.Instance.Output("Emergency Monitoring OFF");
144 }
145
146 foreach (Scene s in m_scenes.Values)
147 s.EmergencyMonitoring = mode;
148 }
149
124 protected string GetColumnEntry(string entry, int maxLength, int columnPadding) 150 protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
125 { 151 {
126 return string.Format( 152 return string.Format(
@@ -154,24 +180,26 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
154 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); 180 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
155 181
156 report.AppendFormat( 182 report.AppendFormat(
157 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", 183 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}\n",
158 "Pkts", 184 "Pkts",
159 "Pkts", 185 "Pkts",
186 "Pkts",
160 "Bytes", 187 "Bytes",
161 "Pkts", 188 "Q Pkts",
162 "Pkts", 189 "Q Pkts",
163 "Pkts", 190 "Q Pkts",
164 "Pkts", 191 "Q Pkts",
165 "Pkts", 192 "Q Pkts",
166 "Pkts", 193 "Q Pkts",
167 "Pkts", 194 "Q Pkts",
168 "Pkts"); 195 "Q Pkts");
169 196
170 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); 197 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
171 report.AppendFormat( 198 report.AppendFormat(
172 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", 199 "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}\n",
173 "Out",
174 "In", 200 "In",
201 "Out",
202 "Resent",
175 "Unacked", 203 "Unacked",
176 "Resend", 204 "Resend",
177 "Land", 205 "Land",
@@ -333,7 +361,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
333 ThrottleRates throttleRates = udpServer.ThrottleRates; 361 ThrottleRates throttleRates = udpServer.ThrottleRates;
334 report.AppendFormat( 362 report.AppendFormat(
335 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", 363 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
336 "n/a", 364 (throttleRates.Total * 8) / 1000,
337 (throttleRates.ResendLimit * 8) / 1000, 365 (throttleRates.ResendLimit * 8) / 1000,
338 (throttleRates.LandLimit * 8) / 1000, 366 (throttleRates.LandLimit * 8) / 1000,
339 (throttleRates.WindLimit * 8) / 1000, 367 (throttleRates.WindLimit * 8) / 1000,
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index 5c779de..6d26075 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -63,7 +63,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
63 void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); 63 void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID);
64 void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); 64 void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile);
65 65
66 /// <summary>
67 /// Get information about a specific group to which the user belongs.
68 /// </summary>
69 /// <param name="RequestingAgentID">The agent requesting the information.</param>
70 /// <param name="AgentID">The agent requested.</param>
71 /// <param name="GroupID">The group requested.</param>
72 /// <returns>
73 /// If the user is a member of the group then the data structure is returned. If not, then null is returned.
74 /// </returns>
66 GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); 75 GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID);
76
77 /// <summary>
78 /// Get information about the groups to which a user belongs.
79 /// </summary>
80 /// <param name="RequestingAgentID">The agent requesting the information.</param>
81 /// <param name="AgentID">The agent requested.</param>
82 /// <returns>
83 /// Information about the groups to which the user belongs. If the user belongs to no groups then an empty
84 /// list is returned.
85 /// </returns>
67 List<GroupMembershipData> GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID); 86 List<GroupMembershipData> GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID);
68 87
69 void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); 88 void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 0d265f2..81725c5 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -704,7 +704,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
704 } 704 }
705 } 705 }
706 706
707
708 return findings; 707 return findings;
709 } 708 }
710 709
@@ -712,54 +711,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
712 { 711 {
713 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 712 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
714 713
715 GroupMembershipData data = new GroupMembershipData(); 714 GroupMembershipData data = null;
716 715 bool foundData = false;
717 ///////////////////////////////
718 // Agent Specific Information:
719 //
720 OSDMap UserActiveGroup;
721 if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
722 {
723 data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID);
724 }
725 716
726 OSDMap UserGroupMemberInfo; 717 OSDMap UserGroupMemberInfo;
727 if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) 718 if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))
728 { 719 {
720 data = new GroupMembershipData();
729 data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); 721 data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean();
730 data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); 722 data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger();
731 data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); 723 data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean();
732 data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); 724 data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID();
725
726 ///////////////////////////////
727 // Agent Specific Information:
728 //
729 OSDMap UserActiveGroup;
730 if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
731 {
732 data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID);
733 }
733 734
734 /////////////////////////////// 735 ///////////////////////////////
735 // Role Specific Information: 736 // Role Specific Information:
736 // 737 //
737
738 OSDMap GroupRoleInfo; 738 OSDMap GroupRoleInfo;
739 if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) 739 if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo))
740 { 740 {
741 data.GroupTitle = GroupRoleInfo["Title"].AsString(); 741 data.GroupTitle = GroupRoleInfo["Title"].AsString();
742 data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); 742 data.GroupPowers = GroupRoleInfo["Powers"].AsULong();
743 } 743 }
744 } 744
745 745 ///////////////////////////////
746 /////////////////////////////// 746 // Group Specific Information:
747 // Group Specific Information: 747 //
748 // 748 OSDMap GroupInfo;
749 OSDMap GroupInfo; 749 string GroupName;
750 string GroupName; 750 if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo))
751 if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) 751 {
752 { 752 data.GroupID = groupID;
753 data.GroupID = groupID; 753 data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean();
754 data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); 754 data.Charter = GroupInfo["Charter"].AsString();
755 data.Charter = GroupInfo["Charter"].AsString(); 755 data.FounderID = GroupInfo["FounderID"].AsUUID();
756 data.FounderID = GroupInfo["FounderID"].AsUUID(); 756 data.GroupName = GroupName;
757 data.GroupName = GroupName; 757 data.GroupPicture = GroupInfo["InsigniaID"].AsUUID();
758 data.GroupPicture = GroupInfo["InsigniaID"].AsUUID(); 758 data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean();
759 data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean(); 759 data.MembershipFee = GroupInfo["MembershipFee"].AsInteger();
760 data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); 760 data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean();
761 data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); 761 data.ShowInList = GroupInfo["ShowInList"].AsBoolean();
762 data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); 762 }
763 } 763 }
764 764
765 return data; 765 return data;
diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
index d4b7020..cee8851 100644
--- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
+++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
@@ -71,6 +71,9 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
71 71
72 public void RegionLoaded(Scene scene) 72 public void RegionLoaded(Scene scene)
73 { 73 {
74 if (!m_Enabled)
75 return;
76
74 m_Generator = scene.RequestModuleInterface<IMapImageGenerator>(); 77 m_Generator = scene.RequestModuleInterface<IMapImageGenerator>();
75 if (m_Generator == null) 78 if (m_Generator == null)
76 { 79 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 30fb252..72ee495 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1748,15 +1748,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1748 1748
1749 protected void SetTexture(SceneObjectPart part, string texture, int face) 1749 protected void SetTexture(SceneObjectPart part, string texture, int face)
1750 { 1750 {
1751 UUID textureID=new UUID(); 1751 UUID textureID = new UUID();
1752 1752
1753 if (!UUID.TryParse(texture, out textureID)) 1753 textureID = InventoryKey(texture, (int)AssetType.Texture);
1754 { 1754 if (textureID == UUID.Zero)
1755 textureID=InventoryKey(texture, (int)AssetType.Texture); 1755 {
1756 } 1756 if (!UUID.TryParse(texture, out textureID))
1757 1757 return;
1758 if (textureID == UUID.Zero) 1758 }
1759 return;
1760 1759
1761 Primitive.TextureEntry tex = part.Shape.Textures; 1760 Primitive.TextureEntry tex = part.Shape.Textures;
1762 1761
@@ -3062,14 +3061,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3062 msg.fromGroup = false;// fromGroup; 3061 msg.fromGroup = false;// fromGroup;
3063 msg.offline = (byte)0; //offline; 3062 msg.offline = (byte)0; //offline;
3064 msg.ParentEstateID = 0; //ParentEstateID; 3063 msg.ParentEstateID = 0; //ParentEstateID;
3065 msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition); 3064 msg.Position = new Vector3(m_host.AbsolutePosition);
3066 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; 3065 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
3067 msg.binaryBucket = new byte[0];// binaryBucket; 3066 msg.binaryBucket
3067 = Util.StringToBytes256(
3068 "{0}/{1}/{2}/{3}",
3069 World.RegionInfo.RegionName,
3070 (int)Math.Floor(m_host.AbsolutePosition.X),
3071 (int)Math.Floor(m_host.AbsolutePosition.Y),
3072 (int)Math.Floor(m_host.AbsolutePosition.Z));
3068 3073
3069 if (m_TransferModule != null) 3074 if (m_TransferModule != null)
3070 { 3075 {
3071 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 3076 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
3072 } 3077 }
3078
3073 ScriptSleep(2000); 3079 ScriptSleep(2000);
3074 } 3080 }
3075 3081
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c0c790d..688dfe4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -702,7 +702,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
702 // and convert the regionName to the target region 702 // and convert the regionName to the target region
703 if (regionName.Contains(".") && regionName.Contains(":")) 703 if (regionName.Contains(".") && regionName.Contains(":"))
704 { 704 {
705// List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); 705 // Even though we use none of the results, we need to perform this call because it appears
706 // to have some the side effect of setting up hypergrid teleport locations.
707 World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
708// List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
709
706 string[] parts = regionName.Split(new char[] { ':' }); 710 string[] parts = regionName.Split(new char[] { ':' });
707 if (parts.Length > 2) 711 if (parts.Length > 2)
708 regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; 712 regionName = parts[0] + ':' + parts[1] + "/ " + parts[2];
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 2601d2a..6a23dee 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Server.Handlers.Simulation
110 DoAgentDelete(request, responsedata, agentID, action, regionID); 110 DoAgentDelete(request, responsedata, agentID, action, regionID);
111 return responsedata; 111 return responsedata;
112 } 112 }
113 else if (method.Equals("QUERYACCESSS")) 113 else if (method.Equals("QUERYACCESS"))
114 { 114 {
115 DoQueryAccess(request, responsedata, agentID, regionID); 115 DoQueryAccess(request, responsedata, agentID, regionID);
116 return responsedata; 116 return responsedata;
@@ -200,6 +200,11 @@ namespace OpenSim.Server.Handlers.Simulation
200 200
201 // We're behind a proxy 201 // We're behind a proxy
202 Hashtable headers = (Hashtable)request["headers"]; 202 Hashtable headers = (Hashtable)request["headers"];
203
204 //// DEBUG
205 //foreach (object o in headers.Keys)
206 // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
207
203 string xff = "X-Forwarded-For"; 208 string xff = "X-Forwarded-For";
204 if (headers.ContainsKey(xff.ToLower())) 209 if (headers.ContainsKey(xff.ToLower()))
205 xff = xff.ToLower(); 210 xff = xff.ToLower();
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
deleted file mode 100644
index 9878855..0000000
--- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
+++ /dev/null
@@ -1,335 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using Nini.Config;
30using System;
31using System.Collections.Generic;
32using System.Reflection;
33using OpenSim.Framework;
34using OpenSim.Services.Interfaces;
35using OpenMetaverse;
36
37namespace OpenSim.Services.Connectors.Inventory
38{
39 public class HGInventoryServiceConnector : ISessionAuthInventoryService
40 {
41 private static readonly ILog m_log =
42 LogManager.GetLogger(
43 MethodBase.GetCurrentMethod().DeclaringType);
44
45 private Dictionary<string, InventoryServicesConnector> m_connectors = new Dictionary<string, InventoryServicesConnector>();
46
47 public HGInventoryServiceConnector(IConfigSource source)
48 {
49 IConfig moduleConfig = source.Configs["Modules"];
50 if (moduleConfig != null)
51 {
52
53 IConfig inventoryConfig = source.Configs["InventoryService"];
54 if (inventoryConfig == null)
55 {
56 m_log.Error("[HG INVENTORY SERVICE]: InventoryService missing from OpenSim.ini");
57 return;
58 }
59
60 m_log.Info("[HG INVENTORY SERVICE]: HG inventory service enabled");
61 }
62 }
63
64 private bool StringToUrlAndUserID(string id, out string url, out string userID)
65 {
66 url = String.Empty;
67 userID = String.Empty;
68
69 Uri assetUri;
70
71 if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) &&
72 assetUri.Scheme == Uri.UriSchemeHttp)
73 {
74 url = "http://" + assetUri.Authority;
75 userID = assetUri.LocalPath.Trim(new char[] { '/' });
76 return true;
77 }
78
79 return false;
80 }
81 private ISessionAuthInventoryService GetConnector(string url)
82 {
83 InventoryServicesConnector connector = null;
84 lock (m_connectors)
85 {
86 if (m_connectors.ContainsKey(url))
87 {
88 connector = m_connectors[url];
89 }
90 else
91 {
92 // We're instantiating this class explicitly, but this won't
93 // work in general, because the remote grid may be running
94 // an inventory server that has a different protocol.
95 // Eventually we will want a piece of protocol asking
96 // the remote server about its kind. Definitely cool thing to do!
97 connector = new InventoryServicesConnector(url);
98 m_connectors.Add(url, connector);
99 }
100 }
101 return connector;
102 }
103
104 public string Host
105 {
106 get { return string.Empty; }
107 }
108
109 public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback)
110 {
111 m_log.Debug("[HGInventory]: GetUserInventory " + id);
112 string url = string.Empty;
113 string userID = string.Empty;
114
115 if (StringToUrlAndUserID(id, out url, out userID))
116 {
117 ISessionAuthInventoryService connector = GetConnector(url);
118 connector.GetUserInventory(userID, sessionID, callback);
119 }
120
121 }
122
123 /// <summary>
124 /// Gets the user folder for the given folder-type
125 /// </summary>
126 /// <param name="userID"></param>
127 /// <param name="type"></param>
128 /// <returns></returns>
129 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string id, UUID sessionID)
130 {
131 m_log.Debug("[HGInventory]: GetSystemFolders " + id);
132 string url = string.Empty;
133 string userID = string.Empty;
134
135 if (StringToUrlAndUserID(id, out url, out userID))
136 {
137 ISessionAuthInventoryService connector = GetConnector(url);
138 return connector.GetSystemFolders(userID, sessionID);
139 }
140
141 return new Dictionary<AssetType, InventoryFolderBase>();
142 }
143
144 /// <summary>
145 /// Gets everything (folders and items) inside a folder
146 /// </summary>
147 /// <param name="userId"></param>
148 /// <param name="folderID"></param>
149 /// <returns></returns>
150 public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID)
151 {
152 m_log.Debug("[HGInventory]: GetFolderContent " + id);
153 string url = string.Empty;
154 string userID = string.Empty;
155
156 if (StringToUrlAndUserID(id, out url, out userID))
157 {
158 ISessionAuthInventoryService connector = GetConnector(url);
159 return connector.GetFolderContent(userID, folderID, sessionID);
160 }
161
162 return null;
163 }
164
165 public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID)
166 {
167 string url = string.Empty;
168 string userID = string.Empty;
169
170 if (StringToUrlAndUserID(id, out url, out userID))
171 {
172 ISessionAuthInventoryService connector = GetConnector(url);
173 return connector.AddFolder(userID, folder, sessionID);
174 }
175 return false;
176 }
177
178 public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID)
179 {
180 string url = string.Empty;
181 string userID = string.Empty;
182
183 if (StringToUrlAndUserID(id, out url, out userID))
184 {
185 ISessionAuthInventoryService connector = GetConnector(url);
186 return connector.UpdateFolder(userID, folder, sessionID);
187 }
188 return false;
189 }
190
191 public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID)
192 {
193 string url = string.Empty;
194 string userID = string.Empty;
195
196 if (StringToUrlAndUserID(id, out url, out userID))
197 {
198 ISessionAuthInventoryService connector = GetConnector(url);
199 return connector.MoveFolder(userID, folder, sessionID);
200 }
201 return false;
202 }
203
204 public bool DeleteFolders(string id, List<UUID> folders, UUID sessionID)
205 {
206 string url = string.Empty;
207 string userID = string.Empty;
208
209 if (StringToUrlAndUserID(id, out url, out userID))
210 {
211 ISessionAuthInventoryService connector = GetConnector(url);
212 return connector.DeleteFolders(userID, folders, sessionID);
213 }
214 return false;
215 }
216
217 public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID)
218 {
219 string url = string.Empty;
220 string userID = string.Empty;
221
222 if (StringToUrlAndUserID(id, out url, out userID))
223 {
224 ISessionAuthInventoryService connector = GetConnector(url);
225 return connector.PurgeFolder(userID, folder, sessionID);
226 }
227 return false;
228 }
229
230 public List<InventoryItemBase> GetFolderItems(string id, UUID folderID, UUID sessionID)
231 {
232 string url = string.Empty;
233 string userID = string.Empty;
234
235 if (StringToUrlAndUserID(id, out url, out userID))
236 {
237 ISessionAuthInventoryService connector = GetConnector(url);
238 return connector.GetFolderItems(userID, folderID, sessionID);
239 }
240 return new List<InventoryItemBase>();
241 }
242
243 public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
244 {
245 string url = string.Empty;
246 string userID = string.Empty;
247
248 if (StringToUrlAndUserID(id, out url, out userID))
249 {
250 ISessionAuthInventoryService connector = GetConnector(url);
251 return connector.AddItem(userID, item, sessionID);
252 }
253 return false;
254 }
255
256 public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID)
257 {
258 string url = string.Empty;
259 string userID = string.Empty;
260
261 if (StringToUrlAndUserID(id, out url, out userID))
262 {
263 ISessionAuthInventoryService connector = GetConnector(url);
264 return connector.UpdateItem(userID, item, sessionID);
265 }
266 return false;
267 }
268
269 public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID)
270 {
271 string url = string.Empty;
272 string userID = string.Empty;
273
274 if (StringToUrlAndUserID(id, out url, out userID))
275 {
276 ISessionAuthInventoryService connector = GetConnector(url);
277 return connector.MoveItems(userID, items, sessionID);
278 }
279 return false;
280 }
281
282 public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID)
283 {
284 string url = string.Empty;
285 string userID = string.Empty;
286
287 if (StringToUrlAndUserID(id, out url, out userID))
288 {
289 ISessionAuthInventoryService connector = GetConnector(url);
290 return connector.DeleteItems(userID, itemIDs, sessionID);
291 }
292 return false;
293 }
294
295 public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID)
296 {
297 string url = string.Empty;
298 string userID = string.Empty;
299
300 if (StringToUrlAndUserID(id, out url, out userID))
301 {
302 //m_log.DebugFormat("[HGInventory CONNECTOR]: calling {0}", url);
303 ISessionAuthInventoryService connector = GetConnector(url);
304 return connector.QueryItem(userID, item, sessionID);
305 }
306 return null;
307 }
308
309 public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID)
310 {
311 string url = string.Empty;
312 string userID = string.Empty;
313
314 if (StringToUrlAndUserID(id, out url, out userID))
315 {
316 ISessionAuthInventoryService connector = GetConnector(url);
317 return connector.QueryFolder(userID, folder, sessionID);
318 }
319 return null;
320 }
321
322 public int GetAssetPermissions(string id, UUID assetID, UUID sessionID)
323 {
324 string url = string.Empty;
325 string userID = string.Empty;
326
327 if (StringToUrlAndUserID(id, out url, out userID))
328 {
329 ISessionAuthInventoryService connector = GetConnector(url);
330 return connector.GetAssetPermissions(userID, assetID, sessionID);
331 }
332 return 0;
333 }
334 }
335}
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
deleted file mode 100644
index da8c7e2..0000000
--- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using OpenSim.Framework;
30using OpenSim.Services.Interfaces;
31using OpenMetaverse;
32
33namespace OpenSim.Services.Connectors
34{
35 /// <summary>
36 /// Defines all operations to access a remote inventory service
37 /// using session authentication as a form of security.
38 /// </summary>
39 public interface ISessionAuthInventoryService
40 {
41 string Host
42 {
43 get;
44 }
45
46 /// <summary>
47 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
48 /// inventory has been received
49 /// </summary>
50 /// <param name="userID"></param>
51 /// <param name="callback"></param>
52 void GetUserInventory(string userID, UUID session_id, InventoryReceiptCallback callback);
53
54 /// <summary>
55 /// Gets the user folder for the given folder-type
56 /// </summary>
57 /// <param name="userID"></param>
58 /// <param name="type"></param>
59 /// <returns></returns>
60 Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID session_id);
61
62 /// <summary>
63 /// Gets everything (folders and items) inside a folder
64 /// </summary>
65 /// <param name="userId"></param>
66 /// <param name="folderID"></param>
67 /// <returns></returns>
68 InventoryCollection GetFolderContent(string userID, UUID folderID, UUID session_id);
69
70 /// <summary>
71 /// Add a new folder to the user's inventory
72 /// </summary>
73 /// <param name="folder"></param>
74 /// <returns>true if the folder was successfully added</returns>
75 bool AddFolder(string userID, InventoryFolderBase folder, UUID session_id);
76
77 /// <summary>
78 /// Update a folder in the user's inventory
79 /// </summary>
80 /// <param name="folder"></param>
81 /// <returns>true if the folder was successfully updated</returns>
82 bool UpdateFolder(string userID, InventoryFolderBase folder, UUID session_id);
83
84 /// <summary>
85 /// Move an inventory folder to a new location
86 /// </summary>
87 /// <param name="folder">A folder containing the details of the new location</param>
88 /// <returns>true if the folder was successfully moved</returns>
89 bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id);
90
91 /// <summary>
92 /// Delete a list of inventory folders (from trash)
93 /// </summary>
94 bool DeleteFolders(string userID, List<UUID> folders, UUID session_id);
95
96 /// <summary>
97 /// Purge an inventory folder of all its items and subfolders.
98 /// </summary>
99 /// <param name="folder"></param>
100 /// <returns>true if the folder was successfully purged</returns>
101 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id);
102
103 /// <summary>
104 /// Get items from a folder.
105 /// </summary>
106 /// <param name="folder"></param>
107 /// <returns>true if the folder was successfully purged</returns>
108 List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID session_id);
109
110 /// <summary>
111 /// Add a new item to the user's inventory
112 /// </summary>
113 /// <param name="item"></param>
114 /// <returns>true if the item was successfully added</returns>
115 bool AddItem(string userID, InventoryItemBase item, UUID session_id);
116
117 /// <summary>
118 /// Update an item in the user's inventory
119 /// </summary>
120 /// <param name="item"></param>
121 /// <returns>true if the item was successfully updated</returns>
122 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id);
123
124 bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id);
125
126 /// <summary>
127 /// Delete an item from the user's inventory
128 /// </summary>
129 /// <param name="item"></param>
130 /// <returns>true if the item was successfully deleted</returns>
131 bool DeleteItems(string userID, List<UUID> itemIDs, UUID session_id);
132
133 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id);
134
135 InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID session_id);
136
137 int GetAssetPermissions(string userID, UUID assetID, UUID session_id);
138
139 }
140}
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
deleted file mode 100644
index f86b453..0000000
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ /dev/null
@@ -1,582 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Services.Interfaces;
37using OpenMetaverse;
38
39namespace OpenSim.Services.Connectors
40{
41 public class InventoryServicesConnector : ISessionAuthInventoryService
42 {
43 private static readonly ILog m_log =
44 LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType);
46
47 private string m_ServerURI = String.Empty;
48
49 private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>();
50 private Dictionary<UUID, DateTime> m_RequestTime = new Dictionary<UUID, DateTime>();
51
52 public InventoryServicesConnector()
53 {
54 }
55
56 public InventoryServicesConnector(string serverURI)
57 {
58 m_ServerURI = serverURI.TrimEnd('/');
59 }
60
61 public InventoryServicesConnector(IConfigSource source)
62 {
63 Initialise(source);
64 }
65
66 public virtual void Initialise(IConfigSource source)
67 {
68 IConfig inventoryConfig = source.Configs["InventoryService"];
69 if (inventoryConfig == null)
70 {
71 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
72 throw new Exception("InventoryService missing from OpenSim.ini");
73 }
74
75 string serviceURI = inventoryConfig.GetString("InventoryServerURI",
76 String.Empty);
77
78 if (serviceURI == String.Empty)
79 {
80 m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
81 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
82 }
83 m_ServerURI = serviceURI.TrimEnd('/');
84 }
85
86 #region ISessionAuthInventoryService
87
88 public string Host
89 {
90 get { return m_ServerURI; }
91 }
92
93 /// <summary>
94 /// Caller must catch eventual Exceptions.
95 /// </summary>
96 /// <param name="userID"></param>
97 /// <param name="sessionID"></param>
98 /// <param name="callback"></param>
99 public void GetUserInventory(string userIDStr, UUID sessionID, InventoryReceiptCallback callback)
100 {
101 UUID userID = UUID.Zero;
102 if (UUID.TryParse(userIDStr, out userID))
103 {
104 lock (m_RequestingInventory)
105 {
106 // *HACK ALERT*
107
108 // If an inventory request times out, it blocks any further requests from the
109 // same user, even after a relog. This is bad, and makes me sad.
110
111 // Really, we should detect a timeout and report a failure to the callback,
112 // BUT in my testing i found that it's hard to detect a timeout.. sometimes,
113 // a partial response is recieved, and sometimes a null response.
114
115 // So, for now, add a timer of ten seconds (which is the request timeout).
116
117 // This should basically have the same effect.
118
119 lock (m_RequestTime)
120 {
121 if (m_RequestTime.ContainsKey(userID))
122 {
123 TimeSpan interval = DateTime.Now - m_RequestTime[userID];
124 if (interval.TotalSeconds > 10)
125 {
126 m_RequestTime.Remove(userID);
127 if (m_RequestingInventory.ContainsKey(userID))
128 {
129 m_RequestingInventory.Remove(userID);
130 }
131 }
132 }
133 if (!m_RequestingInventory.ContainsKey(userID))
134 {
135 m_RequestTime.Add(userID, DateTime.Now);
136 m_RequestingInventory.Add(userID, callback);
137 }
138 else
139 {
140 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetUserInventory - ignoring repeated request for user {0}", userID);
141 return;
142 }
143 }
144 }
145
146 m_log.InfoFormat(
147 "[INVENTORY CONNECTOR]: Requesting inventory from {0}/GetInventory/ for user {1}",
148 m_ServerURI, userID);
149
150 RestSessionObjectPosterResponse<Guid, InventoryCollection> requester
151 = new RestSessionObjectPosterResponse<Guid, InventoryCollection>();
152 requester.ResponseCallback = InventoryResponse;
153
154 requester.BeginPostObject(m_ServerURI + "/GetInventory/", userID.Guid, sessionID.ToString(), userID.ToString());
155 }
156 }
157
158 /// <summary>
159 /// Gets the user folder for the given folder-type
160 /// </summary>
161 /// <param name="userID"></param>
162 /// <param name="type"></param>
163 /// <returns></returns>
164 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
165 {
166 List<InventoryFolderBase> folders = null;
167 Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
168 try
169 {
170 folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
171 "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
172
173 foreach (InventoryFolderBase f in folders)
174 dFolders[(AssetType)f.Type] = f;
175
176 return dFolders;
177 }
178 catch (Exception e)
179 {
180 // Maybe we're talking to an old inventory server. Try this other thing.
181 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.",
182 e.Source, e.Message);
183
184 try
185 {
186 InventoryCollection inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
187 "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString());
188 folders = inventory.Folders;
189 }
190 catch (Exception ex)
191 {
192 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.",
193 e.Source, ex.Message);
194 }
195
196 if ((folders != null) && (folders.Count > 0))
197 {
198 m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}",
199 folders.Count, userID);
200 foreach (InventoryFolderBase f in folders)
201 {
202 if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown))
203 dFolders[(AssetType)f.Type] = f;
204 }
205
206 UUID rootFolderID = dFolders[AssetType.Animation].ParentID;
207 InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID));
208 rootFolder = QueryFolder(userID, rootFolder, sessionID);
209 dFolders[AssetType.Folder] = rootFolder;
210 m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID);
211 return dFolders;
212 }
213 }
214
215 return new Dictionary<AssetType, InventoryFolderBase>();
216 }
217
218 /// <summary>
219 /// Gets everything (folders and items) inside a folder
220 /// </summary>
221 /// <param name="userId"></param>
222 /// <param name="folderID"></param>
223 /// <returns></returns>
224 public InventoryCollection GetFolderContent(string userID, UUID folderID, UUID sessionID)
225 {
226 try
227 {
228 // normal case
229 return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
230 "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString());
231 }
232 catch (TimeoutException e)
233 {
234 m_log.ErrorFormat(
235 "[INVENTORY CONNECTOR]: GetFolderContent operation to {0} for {1} timed out {2} {3}.",
236 m_ServerURI, folderID, e.Source, e.Message);
237 }
238 catch (Exception e)
239 {
240 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed for {0}, {1} {2} (old server?).",
241 folderID, e.Source, e.Message);
242 }
243
244 InventoryCollection nullCollection = new InventoryCollection();
245 nullCollection.Folders = new List<InventoryFolderBase>();
246 nullCollection.Items = new List<InventoryItemBase>();
247 nullCollection.UserID = new UUID(userID);
248 return nullCollection;
249 }
250
251 public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID)
252 {
253 try
254 {
255 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
256 "POST", m_ServerURI + "/NewFolder/", folder, sessionID.ToString(), folder.Owner.ToString());
257 }
258 catch (Exception e)
259 {
260 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory folder operation failed for {0} {1}, {2} {3}",
261 folder.Name, folder.ID, e.Source, e.Message);
262 }
263
264 return false;
265 }
266
267 public bool UpdateFolder(string userID, InventoryFolderBase folder, UUID sessionID)
268 {
269 try
270 {
271 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
272 "POST", m_ServerURI + "/UpdateFolder/", folder, sessionID.ToString(), folder.Owner.ToString());
273 }
274 catch (Exception e)
275 {
276 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update inventory folder operation failed for {0} {1}, {2} {3}",
277 folder.Name, folder.ID, e.Source, e.Message);
278 }
279
280 return false;
281 }
282
283 public bool DeleteFolders(string userID, List<UUID> folderIDs, UUID sessionID)
284 {
285 try
286 {
287 List<Guid> guids = new List<Guid>();
288 foreach (UUID u in folderIDs)
289 guids.Add(u.Guid);
290 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
291 "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID);
292 }
293 catch (Exception e)
294 {
295 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}",
296 e.Source, e.Message);
297 }
298
299 return false;
300 }
301
302 public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID)
303 {
304 try
305 {
306 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
307 "POST", m_ServerURI + "/MoveFolder/", folder, sessionID.ToString(), folder.Owner.ToString());
308 }
309 catch (Exception e)
310 {
311 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory folder operation failed for {0} {1}, {2} {3}",
312 folder.Name, folder.ID, e.Source, e.Message);
313 }
314
315 return false;
316 }
317
318 public bool PurgeFolder(string userID, InventoryFolderBase folder, UUID sessionID)
319 {
320 try
321 {
322 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
323 "POST", m_ServerURI + "/PurgeFolder/", folder, sessionID.ToString(), folder.Owner.ToString());
324 }
325 catch (Exception e)
326 {
327 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Purge inventory folder operation failed for {0} {1}, {2} {3}",
328 folder.Name, folder.ID, e.Source, e.Message);
329 }
330
331 return false;
332 }
333
334 public List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID sessionID)
335 {
336 try
337 {
338 InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID));
339 return SynchronousRestSessionObjectPoster<InventoryFolderBase, List<InventoryItemBase>>.BeginPostObject(
340 "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID);
341 }
342 catch (Exception e)
343 {
344 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed for folder {0}, {1} {2}",
345 folderID, e.Source, e.Message);
346 }
347
348 return null;
349 }
350
351 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID)
352 {
353 try
354 {
355 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
356 "POST", m_ServerURI + "/NewItem/", item, sessionID.ToString(), item.Owner.ToString());
357 }
358 catch (Exception e)
359 {
360 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Add new inventory item operation failed for {0} {1}, {2} {3}",
361 item.Name, item.ID, e.Source, e.Message);
362 }
363
364 return false;
365 }
366
367 public bool UpdateItem(string userID, InventoryItemBase item, UUID sessionID)
368 {
369 try
370 {
371 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
372 "POST", m_ServerURI + "/NewItem/", item, sessionID.ToString(), item.Owner.ToString());
373 }
374 catch (Exception e)
375 {
376 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Update new inventory item operation failed for {0} {1}, {2} {3}",
377 item.Name, item.ID, e.Source, e.Message);
378 }
379
380 return false;
381 }
382
383 /**
384 * MoveItems Async group
385 */
386
387 delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID);
388
389 private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID)
390 {
391 if (items == null)
392 {
393 m_log.WarnFormat("[INVENTORY CONNECTOR]: request to move items got a null list.");
394 return;
395 }
396
397 try
398 {
399 //SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject(
400 // "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString());
401
402 //// Success
403 //return;
404 string uri = m_ServerURI + "/inventory/" + userID;
405 if (SynchronousRestObjectRequester.
406 MakeRequest<List<InventoryItemBase>, bool>("PUT", uri, items))
407 m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster succeeded {1}", items.Count, uri);
408 else
409 m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster failed {1}", items.Count, uri); ;
410
411 return;
412
413 }
414 catch (Exception e)
415 {
416 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.",
417 e.Source, e.Message);
418 }
419
420 }
421
422 private void MoveItemsCompleted(IAsyncResult iar)
423 {
424 MoveItemsDelegate d = (MoveItemsDelegate)iar.AsyncState;
425 d.EndInvoke(iar);
426 }
427
428 public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID)
429 {
430 MoveItemsDelegate d = MoveItemsAsync;
431 d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d);
432 return true;
433 }
434
435 public bool DeleteItems(string userID, List<UUID> items, UUID sessionID)
436 {
437 try
438 {
439 List<Guid> guids = new List<Guid>();
440 foreach (UUID u in items)
441 guids.Add(u.Guid);
442 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
443 "POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID);
444 }
445 catch (Exception e)
446 {
447 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory items operation failed, {0} {1}",
448 e.Source, e.Message);
449 }
450
451 return false;
452 }
453
454 public InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID sessionID)
455 {
456 try
457 {
458 return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.BeginPostObject(
459 "POST", m_ServerURI + "/QueryItem/", item, sessionID.ToString(), item.Owner.ToString());
460 }
461 catch (Exception e)
462 {
463 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory item operation failed, {0} {1}",
464 e.Source, e.Message);
465 }
466
467 return null;
468 }
469
470 public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID)
471 {
472 try
473 {
474 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
475 "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID);
476 }
477 catch (Exception e)
478 {
479 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Query inventory folder operation failed, {0} {1}",
480 e.Source, e.Message);
481 }
482
483 return null;
484 }
485
486 public int GetAssetPermissions(string userID, UUID assetID, UUID sessionID)
487 {
488 try
489 {
490 InventoryItemBase item = new InventoryItemBase();
491 item.Owner = new UUID(userID);
492 item.AssetID = assetID;
493 return SynchronousRestSessionObjectPoster<InventoryItemBase, int>.BeginPostObject(
494 "POST", m_ServerURI + "/AssetPermissions/", item, sessionID.ToString(), userID);
495 }
496 catch (Exception e)
497 {
498 m_log.ErrorFormat("[INVENTORY CONNECTOR]: AssetPermissions operation failed, {0} {1}",
499 e.Source, e.Message);
500 }
501
502 return 0;
503 }
504
505 #endregion
506
507 /// <summary>
508 /// Callback used by the inventory server GetInventory request
509 /// </summary>
510 /// <param name="userID"></param>
511 private void InventoryResponse(InventoryCollection response)
512 {
513 UUID userID = response.UserID;
514 InventoryReceiptCallback callback = null;
515 lock (m_RequestingInventory)
516 {
517 if (m_RequestingInventory.ContainsKey(userID))
518 {
519 callback = m_RequestingInventory[userID];
520 m_RequestingInventory.Remove(userID);
521 lock (m_RequestTime)
522 {
523 if (m_RequestTime.ContainsKey(userID))
524 {
525 m_RequestTime.Remove(userID);
526 }
527 }
528 }
529 else
530 {
531 m_log.WarnFormat(
532 "[INVENTORY CONNECTOR]: " +
533 "Received inventory response for {0} for which we do not have a record of requesting!",
534 userID);
535 return;
536 }
537 }
538
539 m_log.InfoFormat("[INVENTORY CONNECTOR]: " +
540 "Received inventory response for user {0} containing {1} folders and {2} items",
541 userID, response.Folders.Count, response.Items.Count);
542
543 InventoryFolderImpl rootFolder = null;
544
545 ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
546 ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
547
548 foreach (InventoryFolderBase folder in response.Folders)
549 {
550 if (folder.ParentID == UUID.Zero)
551 {
552 rootFolder = new InventoryFolderImpl(folder);
553 folders.Add(rootFolder);
554
555 break;
556 }
557 }
558
559 if (rootFolder != null)
560 {
561 foreach (InventoryFolderBase folder in response.Folders)
562 {
563 if (folder.ID != rootFolder.ID)
564 {
565 folders.Add(new InventoryFolderImpl(folder));
566 }
567 }
568
569 foreach (InventoryItemBase item in response.Items)
570 {
571 items.Add(item);
572 }
573 }
574 else
575 {
576 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Did not get back an inventory containing a root folder for user {0}", userID);
577 }
578
579 callback(folders, items);
580 }
581 }
582}
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
deleted file mode 100644
index a7aa138..0000000
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ /dev/null
@@ -1,196 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Services.Interfaces;
37using OpenMetaverse;
38
39namespace OpenSim.Services.Connectors
40{
41 /// <summary>
42 /// This connector is temporary. It's used by the user server, before that server is refactored.
43 /// </summary>
44 public class QuickAndDirtyInventoryServiceConnector : IInventoryService
45 {
46// private static readonly ILog m_log =
47// LogManager.GetLogger(
48// MethodBase.GetCurrentMethod().DeclaringType);
49
50 private string m_ServerURI = String.Empty;
51
52 //private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>();
53
54 public QuickAndDirtyInventoryServiceConnector()
55 {
56 }
57
58 public QuickAndDirtyInventoryServiceConnector(string serverURI)
59 {
60 m_ServerURI = serverURI.TrimEnd('/');
61 }
62
63 /// <summary>
64 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
65 /// </summary>
66 /// <param name="userId"></param>
67 /// <returns></returns>
68 public bool CreateUserInventory(UUID userId)
69 {
70 return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
71 "POST", m_ServerURI + "CreateInventory/", userId.Guid);
72 }
73
74 /// <summary>
75 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
76 /// </summary>
77 /// <param name="userId"></param>
78 /// <returns></returns>
79 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
80 {
81 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
82 "POST", m_ServerURI + "RootFolders/", userId.Guid);
83 }
84
85 /// <summary>
86 /// Returns a list of all the active gestures in a user's inventory.
87 /// </summary>
88 /// <param name="userId">
89 /// The <see cref="UUID"/> of the user
90 /// </param>
91 /// <returns>
92 /// A flat list of the gesture items.
93 /// </returns>
94 public List<InventoryItemBase> GetActiveGestures(UUID userId)
95 {
96 return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>(
97 "POST", m_ServerURI + "ActiveGestures/", userId.Guid);
98 }
99
100 public InventoryCollection GetUserInventory(UUID userID)
101 {
102 return null;
103 }
104
105 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
106 {
107 }
108
109 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
110 {
111 return null;
112 }
113
114 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
115 {
116 return null;
117 }
118
119 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
120 {
121 return null;
122 }
123
124 public bool AddFolder(InventoryFolderBase folder)
125 {
126 return false;
127 }
128
129 public bool UpdateFolder(InventoryFolderBase folder)
130 {
131 return false;
132 }
133
134 public bool MoveFolder(InventoryFolderBase folder)
135 {
136 return false;
137 }
138
139 public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
140 {
141 return false;
142 }
143
144
145 public bool PurgeFolder(InventoryFolderBase folder)
146 {
147 return false;
148 }
149
150 public bool AddItem(InventoryItemBase item)
151 {
152 return false;
153 }
154
155 public bool UpdateItem(InventoryItemBase item)
156 {
157 return false;
158 }
159
160 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
161 {
162 return false;
163 }
164
165 public bool DeleteItems(UUID owner, List<UUID> itemIDs)
166 {
167 return false;
168 }
169
170 public InventoryItemBase GetItem(InventoryItemBase item)
171 {
172 return null;
173 }
174
175 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
176 {
177 return null;
178 }
179
180 public bool HasInventoryForUser(UUID userID)
181 {
182 return false;
183 }
184
185 public InventoryFolderBase GetRootFolder(UUID userID)
186 {
187 return null;
188 }
189
190 public int GetAssetPermissions(UUID userID, UUID assetID)
191 {
192 return 0;
193 }
194
195 }
196}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
index dd8fe2b..93fdae3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
@@ -87,16 +87,17 @@ namespace OpenSim.Region.OptionalModules.Simian
87 if (String.IsNullOrEmpty(m_serverUrl)) 87 if (String.IsNullOrEmpty(m_serverUrl))
88 return; 88 return;
89 89
90 m_refreshtime = Convert.ToInt32(config.GetString("RefreshTime")); 90 int refreshseconds = Convert.ToInt32(config.GetString("RefreshTime"));
91 if (m_refreshtime <= 0) 91 if (refreshseconds <= 0)
92 return; 92 return;
93 93
94 m_refreshtime = refreshseconds * 1000; // convert from seconds to ms
94 m_log.InfoFormat("[SIMIAN MAPTILE] enabled with refresh timeout {0} and URL {1}", 95 m_log.InfoFormat("[SIMIAN MAPTILE] enabled with refresh timeout {0} and URL {1}",
95 m_refreshtime,m_serverUrl); 96 m_refreshtime,m_serverUrl);
96 97
97 m_enabled = true; 98 m_enabled = true;
98 } 99 }
99 100
100 ///<summary> 101 ///<summary>
101 /// 102 ///
102 ///</summary> 103 ///</summary>
@@ -106,7 +107,7 @@ namespace OpenSim.Region.OptionalModules.Simian
106 { 107 {
107 m_refreshTimer.Enabled = true; 108 m_refreshTimer.Enabled = true;
108 m_refreshTimer.AutoReset = true; 109 m_refreshTimer.AutoReset = true;
109 m_refreshTimer.Interval = 5 * 60 * 1000; // every 5 minutes 110 m_refreshTimer.Interval = 5 * 60 * 1000; // every 5 minutes
110 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh); 111 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
111 } 112 }
112 } 113 }
@@ -120,12 +121,12 @@ namespace OpenSim.Region.OptionalModules.Simian
120 if (! m_enabled) 121 if (! m_enabled)
121 return; 122 return;
122 123
123 // Every shared region module has to maintain an indepedent list of 124 // Every shared region module has to maintain an indepedent list of
124 // currently running regions 125 // currently running regions
125 lock (m_scenes) 126 lock (m_scenes)
126 m_scenes[scene.RegionInfo.RegionID] = scene; 127 m_scenes[scene.RegionInfo.RegionID] = scene;
127 } 128 }
128 129
129 ///<summary> 130 ///<summary>
130 /// 131 ///
131 ///</summary> 132 ///</summary>
@@ -150,7 +151,7 @@ namespace OpenSim.Region.OptionalModules.Simian
150 // loaded and initialized 151 // loaded and initialized
151 if (m_lastrefresh > 0 && Util.EnvironmentTickCountSubtract(m_lastrefresh) < m_refreshtime) 152 if (m_lastrefresh > 0 && Util.EnvironmentTickCountSubtract(m_lastrefresh) < m_refreshtime)
152 return; 153 return;
153 154
154 m_log.DebugFormat("[SIMIAN MAPTILE] map refresh fired"); 155 m_log.DebugFormat("[SIMIAN MAPTILE] map refresh fired");
155 lock (m_scenes) 156 lock (m_scenes)
156 { 157 {
@@ -169,7 +170,7 @@ namespace OpenSim.Region.OptionalModules.Simian
169 170
170 m_lastrefresh = Util.EnvironmentTickCount(); 171 m_lastrefresh = Util.EnvironmentTickCount();
171 } 172 }
172 173
173 ///<summary> 174 ///<summary>
174 /// 175 ///
175 ///</summary> 176 ///</summary>
@@ -211,7 +212,7 @@ namespace OpenSim.Region.OptionalModules.Simian
211 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); 212 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
212 request.Timeout = 20000; 213 request.Timeout = 20000;
213 request.ReadWriteTimeout = 5000; 214 request.ReadWriteTimeout = 5000;
214 215
215 using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) 216 using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
216 { 217 {
217 using (Stream responseStream = response.GetResponseStream()) 218 using (Stream responseStream = response.GetResponseStream())
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index c5313fc..cc6bffb 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -48,6 +48,9 @@ namespace OpenSim.Services.Connectors.Simulation
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 // we use this dictionary to track the pending updateagent requests, maps URI --> position update
52 private Dictionary<string,AgentPosition> m_updateAgentQueue = new Dictionary<string,AgentPosition>();
53
51 //private GridRegion m_Region; 54 //private GridRegion m_Region;
52 55
53 public SimulationServiceConnector() 56 public SimulationServiceConnector()
@@ -133,10 +136,56 @@ namespace OpenSim.Services.Connectors.Simulation
133 /// </summary> 136 /// </summary>
134 public bool UpdateAgent(GridRegion destination, AgentPosition data) 137 public bool UpdateAgent(GridRegion destination, AgentPosition data)
135 { 138 {
136 // we need a better throttle for these 139 // The basic idea of this code is that the first thread that needs to
137 // return false; 140 // send an update for a specific avatar becomes the worker for any subsequent
141 // requests until there are no more outstanding requests. Further, only send the most
142 // recent update; this *should* never be needed but some requests get
143 // slowed down and once that happens the problem with service end point
144 // limits kicks in and nothing proceeds
145 string uri = destination.ServerURI + AgentPath() + data.AgentID + "/";
146 lock (m_updateAgentQueue)
147 {
148 if (m_updateAgentQueue.ContainsKey(uri))
149 {
150 // Another thread is already handling
151 // updates for this simulator, just update
152 // the position and return, overwrites are
153 // not a problem since we only care about the
154 // last update anyway
155 m_updateAgentQueue[uri] = data;
156 return true;
157 }
158
159 // Otherwise update the reference and start processing
160 m_updateAgentQueue[uri] = data;
161 }
138 162
139 return UpdateAgent(destination, (IAgentData)data); 163 AgentPosition pos = null;
164 while (true)
165 {
166 lock (m_updateAgentQueue)
167 {
168 // save the position
169 AgentPosition lastpos = pos;
170
171 pos = m_updateAgentQueue[uri];
172
173 // this is true if no one put a new
174 // update in the map since the last
175 // one we processed, if thats the
176 // case then we are done
177 if (pos == lastpos)
178 {
179 m_updateAgentQueue.Remove(uri);
180 return true;
181 }
182 }
183
184 UpdateAgent(destination,(IAgentData)pos);
185 }
186
187 // unreachable
188 return true;
140 } 189 }
141 190
142 /// <summary> 191 /// <summary>
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 125c2be..aeff9b5 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Services.GridService
286 } 286 }
287 287
288 } 288 }
289 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); 289 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count);
290 return rinfos; 290 return rinfos;
291 } 291 }
292 292
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 588c1dd..9d98c8f 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -220,9 +220,15 @@ namespace OpenSim.Services.GridService
220 string[] parts = mapName.Split(new char[] {' '}); 220 string[] parts = mapName.Split(new char[] {' '});
221 string regionName = String.Empty; 221 string regionName = String.Empty;
222 if (parts.Length > 1) 222 if (parts.Length > 1)
223 regionName = parts[1]; 223 {
224 regionName = mapName.Substring(parts[0].Length + 1);
225 regionName = regionName.Trim(new char[] {'"'});
226 }
224 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) 227 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
228 {
229 regInfo.RegionName = mapName;
225 return regInfo; 230 return regInfo;
231 }
226 } 232 }
227 233
228 return null; 234 return null;
@@ -317,9 +323,9 @@ namespace OpenSim.Services.GridService
317 323
318 regInfo.RegionID = regionID; 324 regInfo.RegionID = regionID;
319 325
320 if ( externalName == string.Empty ) 326 if (externalName == string.Empty)
321 regInfo.RegionName = regInfo.ServerURI; 327 regInfo.RegionName = regInfo.ServerURI;
322 else 328 else
323 regInfo.RegionName = externalName; 329 regInfo.RegionName = externalName;
324 330
325 m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); 331 m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
diff --git a/bin/HttpServer_OpenSim.dll b/bin/HttpServer_OpenSim.dll
index d7503a0..a7a1303 100644
--- a/bin/HttpServer_OpenSim.dll
+++ b/bin/HttpServer_OpenSim.dll
Binary files differ
diff --git a/bin/HttpServer_OpenSim.pdb b/bin/HttpServer_OpenSim.pdb
index 4151588..c6f3b23 100644
--- a/bin/HttpServer_OpenSim.pdb
+++ b/bin/HttpServer_OpenSim.pdb
Binary files differ
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 7245bee..5bac56e 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -306,6 +306,9 @@
306[ODEPhysicsSettings] 306[ODEPhysicsSettings]
307 ;# {mesh_sculpted_prim} {[Startup]physics:OpenDynamicsEngine} {Mesh sculpties so they collide as they look?} {true false} true 307 ;# {mesh_sculpted_prim} {[Startup]physics:OpenDynamicsEngine} {Mesh sculpties so they collide as they look?} {true false} true
308 ;; Do we want to mesh sculpted prim to collide like they look? 308 ;; Do we want to mesh sculpted prim to collide like they look?
309 ;; If you are seeing sculpt texture decode problems
310 ;; (messages such as "Decoded image with unhandled number of components: 0 shortly followed by a physcs exception")
311 ;; then you might want to try setting this to false.
309 ; mesh_sculpted_prim = true 312 ; mesh_sculpted_prim = true
310 313
311 ;# {use_NINJA_physics_joints} {[Startup]physics:OpenDynamicsEngine} {Use jointed (NINJA) physics?} {true false} false 314 ;# {use_NINJA_physics_joints} {[Startup]physics:OpenDynamicsEngine} {Use jointed (NINJA) physics?} {true false} false
diff --git a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml
index 5484ee2..3af9c99 100644
--- a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml
+++ b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml
@@ -413,6 +413,15 @@
413 <Key Name="assetType" Value="0" /> 413 <Key Name="assetType" Value="0" />
414 <Key Name="fileName" Value="default_clear.jp2" /> 414 <Key Name="fileName" Value="default_clear.jp2" />
415 </Section> 415 </Section>
416
417 <!-- 3a367d1c-bef1-6d43-7595-e88c1e3aadb3 is a UUID that viewers assume exists in the asset server -->
418 <!-- See http://opensimulator.org/mantis/bug_view_advanced_page.php?bug_id=4751 for more details -->
419 <Section Name="Default Alpha Layer Texture">
420 <Key Name="assetID" Value="3a367d1c-bef1-6d43-7595-e88c1e3aadb3"/>
421 <Key Name="name" Value="Default Alpha Layer Texture"/>
422 <Key Name="assetType" Value="0" />
423 <Key Name="fileName" Value="default_clear.jp2" />
424 </Section>
416 425
417 <Section Name="Default Avatar"> 426 <Section Name="Default Avatar">
418 <Key Name="assetID" Value="c228d1cf-4b5d-4ba8-84f4-899a0796aa97"/> 427 <Key Name="assetID" Value="c228d1cf-4b5d-4ba8-84f4-899a0796aa97"/>
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example
index 761e5eb..e1bcf00 100644
--- a/bin/config-include/GridCommon.ini.example
+++ b/bin/config-include/GridCommon.ini.example
@@ -88,6 +88,10 @@
88 ; accessible from other grids 88 ; accessible from other grids
89 ; 89 ;
90 ProfileServerURI = "http://mygridserver.com:8002/user" 90 ProfileServerURI = "http://mygridserver.com:8002/user"
91 ;; If you want to protect your assets from being copied by foreign visitors
92 ;; uncomment the next line. You may want to do this on sims that have licensed content.
93 ; OutboundPermission = False
94
91 95
92[Modules] 96[Modules]
93 ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. 97 ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini
index 0b01116..89d6be7 100644
--- a/bin/config-include/HyperSimianGrid.ini
+++ b/bin/config-include/HyperSimianGrid.ini
@@ -82,3 +82,14 @@
82 82
83[Profiles] 83[Profiles]
84 Module = "SimianProfiles" 84 Module = "SimianProfiles"
85
86[HGInventoryAccessModule]
87 ;
88 ; === HG ONLY ===
89 ; Change this to your profile server
90 ; accessible from other grids
91 ;
92 ProfileServerURI = "http://mygridserver.com:8002/user"
93 ;; If you want to protect your assets from being copied by foreign visitors
94 ;; uncomment the next line. You may want to do this on sims that have licensed content.
95 ; OutboundPermission = False
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example
index 4956bc3..213219c 100644
--- a/bin/config-include/StandaloneCommon.ini.example
+++ b/bin/config-include/StandaloneCommon.ini.example
@@ -33,6 +33,10 @@
33 33
34[HGInventoryAccessModule] 34[HGInventoryAccessModule]
35 ProfileServerURI = "http://127.0.0.1:9000/profiles" 35 ProfileServerURI = "http://127.0.0.1:9000/profiles"
36 ;; If you want to protect your assets from being copied by foreign visitors
37 ;; uncomment the next line. You may want to do this on sims that have licensed content.
38 ; OutboundPermission = False
39
36 40
37[Modules] 41[Modules]
38 ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. 42 ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
diff --git a/bin/sqlite3.dll b/bin/sqlite3.dll
index 558a015..f29dc62 100755
--- a/bin/sqlite3.dll
+++ b/bin/sqlite3.dll
Binary files differ