aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDan Lake2012-01-03 16:52:53 -0800
committerDan Lake2012-01-03 16:52:53 -0800
commitecf9824b63d181bd4e64bd5cb0ff37b952669bb9 (patch)
tree269207a773c6bd1fd8383885e0c5649d70b34a62 /OpenSim
parentAccess to these static methods to serialize objects are useful outside of ser... (diff)
parentUpdate C5.dll to version 1.1.1 from 1.1.0 (diff)
downloadopensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.zip
opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.tar.gz
opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.tar.bz2
opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs148
-rw-r--r--OpenSim/Framework/IProfileModule.cs37
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs23
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs17
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs81
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs87
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs102
-rw-r--r--OpenSim/Region/CoreModules/LightShare/LightShareModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs31
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs18
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs223
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs237
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs325
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs1
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs33
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs2
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs21
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs27
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs57
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs81
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs4
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs55
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs33
-rw-r--r--OpenSim/Services/Interfaces/IHypergridServices.cs1
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs4
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs8
43 files changed, 900 insertions, 911 deletions
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index e91a4b8..3ce4e66 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -240,78 +240,84 @@ namespace OpenSim.Capabilities.Handlers
240 240
241 if (containingFolder != null) 241 if (containingFolder != null)
242 { 242 {
243 version = containingFolder.Version; 243// m_log.DebugFormat(
244// "[WEB FETCH INV DESC HANDLER]: Retrieved folder {0} {1} for agent id {2}",
245// containingFolder.Name, containingFolder.ID, agentID);
244 246
245 if (fetchItems) 247 version = containingFolder.Version;
246 { 248//
247 /* 249// if (fetchItems)
248 List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>(); 250// {
249 251// List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>();
250 foreach (InventoryItemBase item in contents.Items) 252//
251 { 253// foreach (InventoryItemBase item in contents.Items)
252 if (item.AssetType == (int)AssetType.Link) 254// {
253 { 255// if (item.AssetType == (int)AssetType.Link)
254 InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); 256// {
255 257// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
256 // Take care of genuinely broken links where the target doesn't exist 258//
257 // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, 259// // Take care of genuinely broken links where the target doesn't exist
258 // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles 260// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
259 // rather than having to keep track of every folder requested in the recursion. 261// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
260 if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link && linkedItem.AssetType == (int)AssetType.Object) 262// // rather than having to keep track of every folder requested in the recursion.
261 linkedItemsToAdd.Add(linkedItem); 263// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
262 } 264// linkedItemsToAdd.Insert(0, linkedItem);
263 } 265// }
264 266// }
265 foreach (InventoryItemBase linkedItem in linkedItemsToAdd) 267//
266 { 268// foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
267 m_log.DebugFormat( 269// {
268 "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}", 270// m_log.DebugFormat(
269 linkedItem.Name, folderID, agentID); 271// "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}",
270 272// linkedItem.Name, folderID, agentID);
271 contents.Items.Insert(0, linkedItem); 273//
272 } 274// contents.Items.Add(linkedItem);
273 */ 275// }
274 276//
275 /* 277// // If the folder requested contains links, then we need to send those folders first, otherwise the links
276 // If the folder requested contains links, then we need to send those folders first, otherwise the links 278// // will be broken in the viewer.
277 // will be broken in the viewer. 279// HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>();
278 HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>(); 280// foreach (InventoryItemBase item in contents.Items)
279 foreach (InventoryItemBase item in contents.Items) 281// {
280 { 282// if (item.AssetType == (int)AssetType.Link)
281 if (item.AssetType == (int)AssetType.Link) 283// {
282 { 284// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
283 InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); 285//
284 286// // Take care of genuinely broken links where the target doesn't exist
285 // Take care of genuinely broken links where the target doesn't exist 287// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
286 // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, 288// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
287 // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles 289// // rather than having to keep track of every folder requested in the recursion.
288 // rather than having to keep track of every folder requested in the recursion. 290// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
289 if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) 291// {
290 { 292// // We don't need to send the folder if source and destination of the link are in the same
291 // We don't need to send the folder if source and destination of the link are in the same 293// // folder.
292 // folder. 294// if (linkedItem.Folder != containingFolder.ID)
293 if (linkedItem.Folder != containingFolder.ID) 295// linkedItemFolderIdsToSend.Add(linkedItem.Folder);
294 linkedItemFolderIdsToSend.Add(linkedItem.Folder); 296// }
295 } 297// }
296 } 298// }
297 } 299//
298 300// foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
299 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) 301// {
300 { 302// m_log.DebugFormat(
301 m_log.DebugFormat( 303// "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}",
302 "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}", 304// linkedItemFolderId, folderID, agentID);
303 linkedItemFolderId, folderID, agentID); 305//
304 306// int dummyVersion;
305 int dummyVersion; 307// InventoryCollection linkedCollection
306 InventoryCollection linkedCollection 308// = Fetch(
307 = Fetch( 309// agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion);
308 agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion); 310//
309 311// InventoryFolderBase linkedFolder = new InventoryFolderBase(linkedItemFolderId);
310 contents.Folders.AddRange(linkedCollection.Folders); 312// linkedFolder.Owner = agentID;
311 contents.Items.AddRange(linkedCollection.Items); 313// linkedFolder = m_InventoryService.GetFolder(linkedFolder);
312 } 314//
313 */ 315//// contents.Folders.AddRange(linkedCollection.Folders);
314 } 316//
317// contents.Folders.Add(linkedFolder);
318// contents.Items.AddRange(linkedCollection.Items);
319// }
320// }
315 } 321 }
316 } 322 }
317 else 323 else
diff --git a/OpenSim/Framework/IProfileModule.cs b/OpenSim/Framework/IProfileModule.cs
new file mode 100644
index 0000000..ef03d4a
--- /dev/null
+++ b/OpenSim/Framework/IProfileModule.cs
@@ -0,0 +1,37 @@
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 OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public interface IProfileModule
33 {
34 void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID);
35
36 }
37}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index e9e2dca..cb9692a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -56,9 +56,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
56 public IAssetService AssetService; 56 public IAssetService AssetService;
57 public UUID AgentID; 57 public UUID AgentID;
58 public IInventoryAccessModule InventoryAccessModule; 58 public IInventoryAccessModule InventoryAccessModule;
59 public OpenJPEG.J2KLayerInfo[] Layers; 59 private OpenJPEG.J2KLayerInfo[] m_layers;
60 public bool IsDecoded; 60 public bool IsDecoded { get; private set; }
61 public bool HasAsset; 61 public bool HasAsset { get; private set; }
62 public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; 62 public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle;
63 63
64 private uint m_currentPacket; 64 private uint m_currentPacket;
@@ -170,14 +170,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
170 if (DiscardLevel >= 0 || m_stopPacket == 0) 170 if (DiscardLevel >= 0 || m_stopPacket == 0)
171 { 171 {
172 // This shouldn't happen, but if it does, we really can't proceed 172 // This shouldn't happen, but if it does, we really can't proceed
173 if (Layers == null) 173 if (m_layers == null)
174 { 174 {
175 m_log.Warn("[J2KIMAGE]: RunUpdate() called with missing Layers. Canceling texture transfer"); 175 m_log.Warn("[J2KIMAGE]: RunUpdate() called with missing Layers. Canceling texture transfer");
176 m_currentPacket = m_stopPacket; 176 m_currentPacket = m_stopPacket;
177 return; 177 return;
178 } 178 }
179 179
180 int maxDiscardLevel = Math.Max(0, Layers.Length - 1); 180 int maxDiscardLevel = Math.Max(0, m_layers.Length - 1);
181 181
182 // Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel 182 // Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel
183 if (DiscardLevel < 0 && m_stopPacket == 0) 183 if (DiscardLevel < 0 && m_stopPacket == 0)
@@ -187,9 +187,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
187 DiscardLevel = (sbyte)Math.Min(DiscardLevel, maxDiscardLevel); 187 DiscardLevel = (sbyte)Math.Min(DiscardLevel, maxDiscardLevel);
188 188
189 //Calculate the m_stopPacket 189 //Calculate the m_stopPacket
190 if (Layers.Length > 0) 190 if (m_layers.Length > 0)
191 { 191 {
192 m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - DiscardLevel].End); 192 m_stopPacket = (uint)GetPacketForBytePosition(m_layers[(m_layers.Length - 1) - DiscardLevel].End);
193 //I don't know why, but the viewer seems to expect the final packet if the file 193 //I don't know why, but the viewer seems to expect the final packet if the file
194 //is just one packet bigger. 194 //is just one packet bigger.
195 if (TexturePacketCount() == m_stopPacket + 1) 195 if (TexturePacketCount() == m_stopPacket + 1)
@@ -341,7 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
341 341
342 private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) 342 private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
343 { 343 {
344 Layers = layers; 344 m_layers = layers;
345 IsDecoded = true; 345 IsDecoded = true;
346 RunUpdate(); 346 RunUpdate();
347 } 347 }
@@ -385,8 +385,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
385 string assetServerURL = string.Empty; 385 string assetServerURL = string.Empty;
386 if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) 386 if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
387 { 387 {
388 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); 388 if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
389 AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived); 389 assetServerURL = assetServerURL + "/";
390
391 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", assetServerURL + id);
392 AssetService.Get(assetServerURL + id, InventoryAccessModule, AssetReceived);
390 return; 393 return;
391 } 394 }
392 } 395 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 9e0db12..e3a881f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -39,6 +39,9 @@ using log4net;
39 39
40namespace OpenSim.Region.ClientStack.LindenUDP 40namespace OpenSim.Region.ClientStack.LindenUDP
41{ 41{
42 /// <summary>
43 /// This class handles UDP texture requests.
44 /// </summary>
42 public class LLImageManager 45 public class LLImageManager
43 { 46 {
44 private sealed class J2KImageComparer : IComparer<J2KImage> 47 private sealed class J2KImageComparer : IComparer<J2KImage>
@@ -208,7 +211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
208 211
209 #region Priority Queue Helpers 212 #region Priority Queue Helpers
210 213
211 J2KImage GetHighestPriorityImage() 214 private J2KImage GetHighestPriorityImage()
212 { 215 {
213 J2KImage image = null; 216 J2KImage image = null;
214 217
@@ -223,23 +226,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
223 return image; 226 return image;
224 } 227 }
225 228
226 void AddImageToQueue(J2KImage image) 229 private void AddImageToQueue(J2KImage image)
227 { 230 {
228 image.PriorityQueueHandle = null; 231 image.PriorityQueueHandle = null;
229 232
230 lock (m_syncRoot) 233 lock (m_syncRoot)
234 {
231 try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } 235 try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); }
232 catch (Exception) { } 236 catch (Exception) { }
237 }
233 } 238 }
234 239
235 void RemoveImageFromQueue(J2KImage image) 240 private void RemoveImageFromQueue(J2KImage image)
236 { 241 {
237 lock (m_syncRoot) 242 lock (m_syncRoot)
243 {
238 try { m_priorityQueue.Delete(image.PriorityQueueHandle); } 244 try { m_priorityQueue.Delete(image.PriorityQueueHandle); }
239 catch (Exception) { } 245 catch (Exception) { }
246 }
240 } 247 }
241 248
242 void UpdateImageInQueue(J2KImage image) 249 private void UpdateImageInQueue(J2KImage image)
243 { 250 {
244 lock (m_syncRoot) 251 lock (m_syncRoot)
245 { 252 {
@@ -254,4 +261,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
254 261
255 #endregion Priority Queue Helpers 262 #endregion Priority Queue Helpers
256 } 263 }
257} 264} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 1386e86..7dd9087 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -152,6 +152,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
152 /// <param name="j2kData">JPEG2000 data</param> 152 /// <param name="j2kData">JPEG2000 data</param>
153 private void DoJ2KDecode(UUID assetID, byte[] j2kData) 153 private void DoJ2KDecode(UUID assetID, byte[] j2kData)
154 { 154 {
155// m_log.DebugFormat(
156// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
157
155 //int DecodeTime = 0; 158 //int DecodeTime = 0;
156 //DecodeTime = Environment.TickCount; 159 //DecodeTime = Environment.TickCount;
157 OpenJPEG.J2KLayerInfo[] layers; 160 OpenJPEG.J2KLayerInfo[] layers;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 9a97925..a77646c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 IUserManagement m_uMan;
54 IUserManagement UserManagementModule
55 {
56 get
57 {
58 if (m_uMan == null)
59 m_uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
60 return m_uMan;
61 }
62 }
63
53 #region ISharedRegionModule 64 #region ISharedRegionModule
54 public override string Name 65 public override string Name
55 { 66 {
@@ -369,9 +380,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
369 protected override FriendInfo[] GetFriendsFromService(IClientAPI client) 380 protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
370 { 381 {
371// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); 382// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
383 Boolean agentIsLocal = true;
384 if (UserManagementModule != null)
385 agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId);
372 386
373 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId); 387 if (agentIsLocal)
374 if (account1 != null)
375 return base.GetFriendsFromService(client); 388 return base.GetFriendsFromService(client);
376 389
377 FriendInfo[] finfos = new FriendInfo[0]; 390 FriendInfo[] finfos = new FriendInfo[0];
@@ -392,16 +405,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
392 405
393 protected override bool StoreRights(UUID agentID, UUID friendID, int rights) 406 protected override bool StoreRights(UUID agentID, UUID friendID, int rights)
394 { 407 {
395 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 408 Boolean agentIsLocal = true;
396 UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 409 Boolean friendIsLocal = true;
410 if (UserManagementModule != null)
411 {
412 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
413 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
414 }
415
397 // Are they both local users? 416 // Are they both local users?
398 if (account1 != null && account2 != null) 417 if (agentIsLocal && friendIsLocal)
399 { 418 {
400 // local grid users 419 // local grid users
401 return base.StoreRights(agentID, friendID, rights); 420 return base.StoreRights(agentID, friendID, rights);
402 } 421 }
403 422
404 if (account1 != null) // agent is local, friend is foreigner 423 if (agentIsLocal) // agent is local, friend is foreigner
405 { 424 {
406 FriendInfo[] finfos = GetFriends(agentID); 425 FriendInfo[] finfos = GetFriends(agentID);
407 FriendInfo finfo = GetFriend(finfos, friendID); 426 FriendInfo finfo = GetFriend(finfos, friendID);
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
412 } 431 }
413 } 432 }
414 433
415 if (account2 != null) // agent is foreigner, friend is local 434 if (friendIsLocal) // agent is foreigner, friend is local
416 { 435 {
417 string agentUUI = GetUUI(friendID, agentID); 436 string agentUUI = GetUUI(friendID, agentID);
418 if (agentUUI != string.Empty) 437 if (agentUUI != string.Empty)
@@ -427,10 +446,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
427 446
428 protected override void StoreBackwards(UUID friendID, UUID agentID) 447 protected override void StoreBackwards(UUID friendID, UUID agentID)
429 { 448 {
430 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 449 Boolean agentIsLocal = true;
431 UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 450 Boolean friendIsLocal = true;
451 if (UserManagementModule != null)
452 {
453 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
454 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
455 }
456
432 // Are they both local users? 457 // Are they both local users?
433 if (account1 != null && account2 != null) 458 if (agentIsLocal && friendIsLocal)
434 { 459 {
435 // local grid users 460 // local grid users
436 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 461 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -444,10 +469,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
444 469
445 protected override void StoreFriendships(UUID agentID, UUID friendID) 470 protected override void StoreFriendships(UUID agentID, UUID friendID)
446 { 471 {
447 UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 472 Boolean agentIsLocal = true;
448 UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 473 Boolean friendIsLocal = true;
474 if (UserManagementModule != null)
475 {
476 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
477 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
478 }
479
449 // Are they both local users? 480 // Are they both local users?
450 if (agentAccount != null && friendAccount != null) 481 if (agentIsLocal && friendIsLocal)
451 { 482 {
452 // local grid users 483 // local grid users
453 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 484 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -465,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
465 string agentFriendService = string.Empty; 496 string agentFriendService = string.Empty;
466 string friendFriendService = string.Empty; 497 string friendFriendService = string.Empty;
467 498
468 if (agentClient != null) 499 if (agentIsLocal)
469 { 500 {
470 agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); 501 agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode);
471 agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); 502 agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit);
472 agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); 503 agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString();
473 } 504 }
474 if (friendClient != null) 505 if (friendIsLocal)
475 { 506 {
476 friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); 507 friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode);
477 friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); 508 friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit);
@@ -484,7 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
484 // Generate a random 8-character hex number that will sign this friendship 515 // Generate a random 8-character hex number that will sign this friendship
485 string secret = UUID.Random().ToString().Substring(0, 8); 516 string secret = UUID.Random().ToString().Substring(0, 8);
486 517
487 if (agentAccount != null) // agent is local, 'friend' is foreigner 518 if (agentIsLocal) // agent is local, 'friend' is foreigner
488 { 519 {
489 // This may happen when the agent returned home, in which case the friend is not there 520 // This may happen when the agent returned home, in which case the friend is not there
490 // We need to look for its information in the friends list itself 521 // We need to look for its information in the friends list itself
@@ -520,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
520 friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); 551 friendsConn.NewFriendship(friendID, agentUUI + ";" + secret);
521 } 552 }
522 } 553 }
523 else if (friendAccount != null) // 'friend' is local, agent is foreigner 554 else if (friendIsLocal) // 'friend' is local, agent is foreigner
524 { 555 {
525 // store in the local friends service a reference to the foreign agent 556 // store in the local friends service a reference to the foreign agent
526 FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); 557 FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1);
@@ -553,10 +584,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
553 584
554 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) 585 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID)
555 { 586 {
556 UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 587 Boolean agentIsLocal = true;
557 UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, exfriendID); 588 Boolean friendIsLocal = true;
589 if (UserManagementModule != null)
590 {
591 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
592 friendIsLocal = UserManagementModule.IsLocalGridUser(exfriendID);
593 }
594
558 // Are they both local users? 595 // Are they both local users?
559 if (agentAccount != null && friendAccount != null) 596 if (agentIsLocal && friendIsLocal)
560 { 597 {
561 // local grid users 598 // local grid users
562 return base.DeleteFriendship(agentID, exfriendID); 599 return base.DeleteFriendship(agentID, exfriendID);
@@ -566,7 +603,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
566 string agentUUI = string.Empty; 603 string agentUUI = string.Empty;
567 string friendUUI = string.Empty; 604 string friendUUI = string.Empty;
568 605
569 if (agentAccount != null) // agent is local, 'friend' is foreigner 606 if (agentIsLocal) // agent is local, 'friend' is foreigner
570 { 607 {
571 // We need to look for its information in the friends list itself 608 // We need to look for its information in the friends list itself
572 FriendInfo[] finfos = GetFriends(agentID); 609 FriendInfo[] finfos = GetFriends(agentID);
@@ -587,7 +624,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
587 return true; 624 return true;
588 } 625 }
589 } 626 }
590 else if (friendAccount != null) // agent is foreigner, 'friend' is local 627 else if (friendIsLocal) // agent is foreigner, 'friend' is local
591 { 628 {
592 agentUUI = GetUUI(exfriendID, agentID); 629 agentUUI = GetUUI(exfriendID, agentID);
593 630
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 560d913..bf1d787 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -180,10 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
180 180
181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
182 // Is the user a local user? 182 // Is the user a local user?
183 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
184 string url = string.Empty; 183 string url = string.Empty;
185 bool foreigner = false; 184 bool foreigner = false;
186 if (account == null) // foreign user 185 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(toAgentID)) // foreign user
187 { 186 {
188 url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); 187 url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI");
189 foreigner = true; 188 foreigner = true;
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
index dee0ad4..eb1e4b5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
@@ -43,7 +43,7 @@ using OpenSim.Services.Interfaces;
43namespace OpenSim.Region.CoreModules.Avatar.Profile 43namespace OpenSim.Region.CoreModules.Avatar.Profile
44{ 44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class BasicProfileModule : ISharedRegionModule 46 public class BasicProfileModule : IProfileModule, ISharedRegionModule
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
@@ -57,6 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
57 57
58 public void Initialise(IConfigSource config) 58 public void Initialise(IConfigSource config)
59 { 59 {
60 // This can be reduced later as the loader will determine
61 // whether we are needed
60 if (config.Configs["Profile"] != null) 62 if (config.Configs["Profile"] != null)
61 { 63 {
62 if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") 64 if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule")
@@ -65,14 +67,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
65 67
66 m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled"); 68 m_log.DebugFormat("[PROFILE MODULE]: Basic Profile Module enabled");
67 m_Enabled = true; 69 m_Enabled = true;
68
69 } 70 }
70 71
71 public void AddRegion(Scene scene) 72 public void AddRegion(Scene scene)
72 { 73 {
73 if (!m_Enabled) 74 if (!m_Enabled)
74 return; 75 return;
75 76
76 lock (m_Scenes) 77 lock (m_Scenes)
77 { 78 {
78 if (!m_Scenes.Contains(scene)) 79 if (!m_Scenes.Contains(scene))
@@ -80,6 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
80 m_Scenes.Add(scene); 81 m_Scenes.Add(scene);
81 // Hook up events 82 // Hook up events
82 scene.EventManager.OnNewClient += OnNewClient; 83 scene.EventManager.OnNewClient += OnNewClient;
84 scene.RegisterModuleInterface<IProfileModule>(this);
83 } 85 }
84 } 86 }
85 } 87 }
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
116 118
117 public Type ReplaceableInterface 119 public Type ReplaceableInterface
118 { 120 {
119 get { return null; } 121 get { return typeof(IProfileModule); }
120 } 122 }
121 123
122 #endregion 124 #endregion
@@ -170,4 +172,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
170 } 172 }
171 173
172 } 174 }
173} \ No newline at end of file 175}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 87f292c..cbef6ce 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -676,9 +676,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
676 Vector3 eastCross = new Vector3(boundaryDistance, 0, 0); 676 Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
677 Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0); 677 Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
678 678
679 // distance to edge that will trigger crossing
680
681
682 // distance into new region to place avatar 679 // distance into new region to place avatar
683 const float enterDistance = 0.5f; 680 const float enterDistance = 0.5f;
684 681
@@ -960,29 +957,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
960 m_log.DebugFormat( 957 m_log.DebugFormat(
961 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", 958 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
962 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); 959 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
963 960
964 pos = pos + (agent.Velocity); 961 pos = pos + agent.Velocity;
965 962 Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
963
964 agent.RemoveFromPhysicalScene();
966 SetInTransit(agent.UUID); 965 SetInTransit(agent.UUID);
967 AgentData cAgent = new AgentData(); 966
967 AgentData cAgent = new AgentData();
968 agent.CopyTo(cAgent); 968 agent.CopyTo(cAgent);
969 cAgent.Position = pos; 969 cAgent.Position = pos;
970 if (isFlying) 970 if (isFlying)
971 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 971 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
972 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + 972
973 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; 973 // We don't need the callback anymnore
974 974 cAgent.CallbackURI = String.Empty;
975
975 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) 976 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
976 { 977 {
977 // region doesn't take it 978 // region doesn't take it
978 ReInstantiateScripts(agent); 979 ReInstantiateScripts(agent);
980 agent.AddToPhysicalScene(isFlying);
979 ResetFromTransit(agent.UUID); 981 ResetFromTransit(agent.UUID);
980 return agent; 982 return agent;
981 } 983 }
982 984
983 // Next, let's close the child agent connections that are too far away.
984 agent.CloseChildAgents(neighbourx, neighboury);
985
986 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); 985 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
987 agent.ControllingClient.RequestClientInfo(); 986 agent.ControllingClient.RequestClientInfo();
988 987
@@ -999,11 +998,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
999 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); 998 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
1000 999
1001 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 1000 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
1002 1001
1003 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); 1002 IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
1004 if (eq != null) 1003 if (eq != null)
1005 { 1004 {
1006 eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, 1005 eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
1007 capsPath, agent.UUID, agent.ControllingClient.SessionId); 1006 capsPath, agent.UUID, agent.ControllingClient.SessionId);
1008 } 1007 }
1009 else 1008 else
@@ -1011,32 +1010,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1011 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, 1010 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1012 capsPath); 1011 capsPath);
1013 } 1012 }
1014 1013
1015 if (!WaitForCallback(agent.UUID)) 1014 // SUCCESS!
1016 {
1017 m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
1018 ReInstantiateScripts(agent);
1019 ResetFromTransit(agent.UUID);
1020
1021 // Yikes! We should just have a ref to scene here.
1022 //agent.Scene.InformClientOfNeighbours(agent);
1023 EnableChildAgents(agent);
1024
1025 return agent;
1026 }
1027
1028 agent.MakeChildAgent(); 1015 agent.MakeChildAgent();
1029 1016 ResetFromTransit(agent.UUID);
1017
1030 // now we have a child agent in this region. Request all interesting data about other (root) agents 1018 // now we have a child agent in this region. Request all interesting data about other (root) agents
1031 agent.SendOtherAgentsAvatarDataToMe(); 1019 agent.SendOtherAgentsAvatarDataToMe();
1032 agent.SendOtherAgentsAppearanceToMe(); 1020 agent.SendOtherAgentsAppearanceToMe();
1033 1021
1034 // Backwards compatibility 1022 // Backwards compatibility. Best effort
1035 if (version == "Unknown" || version == string.Empty) 1023 if (version == "Unknown" || version == string.Empty)
1036 { 1024 {
1037 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one..."); 1025 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1026 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
1038 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); 1027 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1039 } 1028 }
1029
1030
1031 // Next, let's close the child agent connections that are too far away.
1032 agent.CloseChildAgents(neighbourx, neighboury);
1040 1033
1041 AgentHasMovedAway(agent, false); 1034 AgentHasMovedAway(agent, false);
1042 1035
@@ -1069,16 +1062,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1069 CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; 1062 CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState;
1070 ScenePresence agent = icon.EndInvoke(iar); 1063 ScenePresence agent = icon.EndInvoke(iar);
1071 1064
1072 // If the cross was successful, this agent is a child agent 1065 //// If the cross was successful, this agent is a child agent
1073 if (agent.IsChildAgent) 1066 //if (agent.IsChildAgent)
1074 agent.Reset(); 1067 // agent.Reset();
1075 else // Not successful 1068 //else // Not successful
1076 agent.RestoreInCurrentScene(); 1069 // agent.RestoreInCurrentScene();
1077 1070
1078 // In any case 1071 // In any case
1079 agent.IsInTransit = false; 1072 agent.IsInTransit = false;
1080 1073
1081 //m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); 1074 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
1082 } 1075 }
1083 1076
1084 #endregion 1077 #endregion
@@ -1712,9 +1705,23 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1712 uint x = 0, y = 0; 1705 uint x = 0, y = 0;
1713 Utils.LongToUInts(newRegionHandle, out x, out y); 1706 Utils.LongToUInts(newRegionHandle, out x, out y);
1714 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 1707 GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
1715 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) 1708
1709 if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent))
1716 { 1710 {
1711 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
1712
1713 // We are going to move the object back to the old position so long as the old position
1714 // is in the region
1715 oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1);
1716 oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1);
1717 oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f);
1718
1717 grp.RootPart.GroupPosition = oldGroupPosition; 1719 grp.RootPart.GroupPosition = oldGroupPosition;
1720
1721 // Need to turn off the physics flags, otherwise the object will continue to attempt to
1722 // move out of the region creating an infinite loop of failed attempts to cross
1723 grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
1724
1718 grp.ScheduleGroupForFullUpdate(); 1725 grp.ScheduleGroupForFullUpdate();
1719 } 1726 }
1720 } 1727 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index cc9ba97..8d41728 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -187,8 +187,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
187 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); 187 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
188 188
189 // Let's find out if this is a foreign user or a local user 189 // Let's find out if this is a foreign user or a local user
190 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id); 190 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
191 if (account != null) 191 if (uMan != null && uMan.IsLocalGridUser(id))
192 { 192 {
193 // local grid user 193 // local grid user
194 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); 194 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
@@ -227,8 +227,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
227 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); 227 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
228 GridRegion homeGatekeeper = MakeRegion(aCircuit); 228 GridRegion homeGatekeeper = MakeRegion(aCircuit);
229 229
230 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}", 230 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
231 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); 231 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
232 232
233 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); 233 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
234 } 234 }
@@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
313 } 313 }
314 314
315 // Let's find out if this is a foreign user or a local user 315 // Let's find out if this is a foreign user or a local user
316 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
316 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); 317 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
317 if (account != null) 318 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
318 { 319 {
319 // local grid user 320 // local grid user
320 return; 321 return;
@@ -347,6 +348,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
347 348
348 region.ExternalHostName = uri.Host; 349 region.ExternalHostName = uri.Host;
349 region.HttpPort = (uint)uri.Port; 350 region.HttpPort = (uint)uri.Port;
351 region.ServerURI = uri.ToString();
350 region.RegionName = string.Empty; 352 region.RegionName = string.Empty;
351 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); 353 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
352 return region; 354 return region;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index 81b65c5..d20c9eb 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -73,7 +73,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
73 73
74 public AssetBase FetchAsset(string url, UUID assetID) 74 public AssetBase FetchAsset(string url, UUID assetID)
75 { 75 {
76 AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString()); 76 if (!url.EndsWith("/") && !url.EndsWith("="))
77 url = url + "/";
78
79 AssetBase asset = m_scene.AssetService.Get(url + assetID.ToString());
77 80
78 if (asset != null) 81 if (asset != null)
79 { 82 {
@@ -87,6 +90,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
87 { 90 {
88 if (asset != null) 91 if (asset != null)
89 { 92 {
93 if (!url.EndsWith("/") && !url.EndsWith("="))
94 url = url + "/";
95
90 // See long comment in AssetCache.AddAsset 96 // See long comment in AssetCache.AddAsset
91 if (!asset.Temporary || asset.Local) 97 if (!asset.Temporary || asset.Local)
92 { 98 {
@@ -99,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
99 Copy(asset, asset1); 105 Copy(asset, asset1);
100 try 106 try
101 { 107 {
102 asset1.ID = url + "/" + asset.ID; 108 asset1.ID = url + asset.ID;
103 } 109 }
104 catch 110 catch
105 { 111 {
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 49d484b..bf24ebc 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -124,8 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
124 124
125 protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix) 125 protected override string GenerateLandmark(ScenePresence presence, out string prefix, out string suffix)
126 { 126 {
127 UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, presence.UUID); 127 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(presence.UUID))
128 if (account == null)
129 prefix = "HG "; 128 prefix = "HG ";
130 else 129 else
131 prefix = string.Empty; 130 prefix = string.Empty;
@@ -210,12 +209,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
210 public override bool IsForeignUser(UUID userID, out string assetServerURL) 209 public override bool IsForeignUser(UUID userID, out string assetServerURL)
211 { 210 {
212 assetServerURL = string.Empty; 211 assetServerURL = string.Empty;
213 UserAccount account = null;
214 if (m_Scene.UserAccountService != null)
215 account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
216 212
217 if (account == null) // foreign 213 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
218 { 214 { // foreign
219 ScenePresence sp = null; 215 ScenePresence sp = null;
220 if (m_Scene.TryGetScenePresence(userID, out sp)) 216 if (m_Scene.TryGetScenePresence(userID, out sp))
221 { 217 {
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a40a6a4..37292d6 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -50,6 +50,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
50 public string LastName { get; set; } 50 public string LastName { get; set; }
51 public string HomeURL { get; set; } 51 public string HomeURL { get; set; }
52 public Dictionary<string, object> ServerURLs { get; set; } 52 public Dictionary<string, object> ServerURLs { get; set; }
53 public string Title { get; set; }
54 public int Flags { get; set; }
55 public int Created { get; set; }
53 } 56 }
54 57
55 public class UserManagementModule : ISharedRegionModule, IUserManagement 58 public class UserManagementModule : ISharedRegionModule, IUserManagement
@@ -281,6 +284,94 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
281 return string.Empty; 284 return string.Empty;
282 } 285 }
283 286
287 public int GetUserFlags(UUID userID)
288 {
289 UserData userdata;
290 lock (m_UserCache)
291 m_UserCache.TryGetValue(userID, out userdata);
292
293 if (userdata.Flags == -1)
294 GetUserInfo(userID);
295
296 if (userdata.Flags != -1)
297 return userdata.Flags;
298
299 return 0;
300 }
301
302 public int GetUserCreated(UUID userID)
303 {
304 UserData userdata;
305 lock (m_UserCache)
306 m_UserCache.TryGetValue(userID, out userdata);
307
308 if (userdata.Flags == -1)
309 GetUserInfo(userID);
310
311 if (userdata.Created != -1)
312 return userdata.Created;
313
314 return 0;
315 }
316
317 public string GetUserTitle(UUID userID)
318 {
319 UserData userdata;
320 lock (m_UserCache)
321 m_UserCache.TryGetValue(userID, out userdata);
322
323 if (userdata.Flags == -1)
324 GetUserInfo(userID);
325
326 if (userdata.Created != -1)
327 return userdata.Title;
328
329 return string.Empty;
330 }
331
332 // This will cache the user data
333 // Change this to return bool
334 private bool GetUserInfo(UUID userID)
335 {
336 UserData userdata;
337 lock (m_UserCache)
338 m_UserCache.TryGetValue(userID, out userdata);
339
340 if (userdata != null)
341 {
342// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
343
344 if (userdata.Flags >= 0)
345 {
346 // This is already populated
347 return true;
348 }
349
350 if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
351 {
352 m_log.DebugFormat(
353 "[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}",
354 userdata.HomeURL, userID);
355
356 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
357 Dictionary<string, object> info = uConn.GetUserInfo(userID);
358
359 // Pull our data now
360 if (info["result"].ToString() == "success")
361 {
362 userdata.Flags = (int)info["user_flags"];
363 userdata.Created = (int)info["user_created"];
364 userdata.Title = (string)info["user_title"];
365
366 return true;
367 }
368 }
369 }
370
371 return false;
372 }
373
374
284 public string GetUserUUI(UUID userID) 375 public string GetUserUUI(UUID userID)
285 { 376 {
286 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID); 377 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID);
@@ -352,6 +443,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
352 { 443 {
353 UserData user = new UserData(); 444 UserData user = new UserData();
354 user.Id = id; 445 user.Id = id;
446 user.Flags = -1;
447 user.Created = -1;
355 448
356 if (creatorData != null && creatorData != string.Empty) 449 if (creatorData != null && creatorData != string.Empty)
357 { 450 {
@@ -425,6 +518,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
425 518
426 //} 519 //}
427 520
521 public bool IsLocalGridUser(UUID uuid)
522 {
523 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
524 if (account == null || (account != null && !account.LocalToGrid))
525 return false;
526
527 return true;
528 }
529
428 #endregion IUserManagement 530 #endregion IUserManagement
429 531
430 private void HandleShowUsers(string module, string[] cmd) 532 private void HandleShowUsers(string module, string[] cmd)
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
index cabbd31..16cbbf5 100644
--- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
+++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
@@ -153,10 +153,18 @@ namespace OpenSim.Region.CoreModules.World.LightShare
153 153
154 public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) 154 public void SendProfileToClient(IClientAPI client, RegionLightShareData wl)
155 { 155 {
156 if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) 156 if (m_enableWindlight)
157 { 157 {
158 List<byte[]> param = compileWindlightSettings(wl); 158 if (m_scene.RegionInfo.WindlightSettings.valid)
159 client.SendGenericMessage("Windlight", param); 159 {
160 List<byte[]> param = compileWindlightSettings(wl);
161 client.SendGenericMessage("Windlight", param);
162 }
163 else
164 {
165 List<byte[]> param = new List<byte[]>();
166 client.SendGenericMessage("WindlightReset", param);
167 }
160 } 168 }
161 } 169 }
162 170
@@ -175,8 +183,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
175 183
176 private void EventManager_OnSaveNewWindlightProfile() 184 private void EventManager_OnSaveNewWindlightProfile()
177 { 185 {
178 if (m_scene.RegionInfo.WindlightSettings.valid) 186 m_scene.ForEachRootClient(SendProfileToClient);
179 m_scene.ForEachRootClient(SendProfileToClient);
180 } 187 }
181 188
182 public void PostInitialise() 189 public void PostInitialise()
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 43672d1..8fb5d75 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -411,8 +411,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
411 } 411 }
412 412
413 Request.Timeout = HttpTimeout; 413 Request.Timeout = HttpTimeout;
414 // execute the request 414 try
415 response = (HttpWebResponse) Request.GetResponse(); 415 {
416 // execute the request
417 response = (HttpWebResponse) Request.GetResponse();
418 }
419 catch (WebException e)
420 {
421 if (e.Status != WebExceptionStatus.ProtocolError)
422 {
423 throw;
424 }
425 response = (HttpWebResponse)e.Response;
426 }
427
428 Status = (int)response.StatusCode;
416 429
417 Stream resStream = response.GetResponseStream(); 430 Stream resStream = response.GetResponseStream();
418 431
@@ -436,17 +449,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
436 } 449 }
437 catch (Exception e) 450 catch (Exception e)
438 { 451 {
439 if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) 452 Status = (int)OSHttpStatusCode.ClientErrorJoker;
440 { 453 ResponseBody = e.Message;
441 HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response;
442 Status = (int)webRsp.StatusCode;
443 ResponseBody = webRsp.StatusDescription;
444 }
445 else
446 {
447 Status = (int)OSHttpStatusCode.ClientErrorJoker;
448 ResponseBody = e.Message;
449 }
450 454
451 _finished = true; 455 _finished = true;
452 return; 456 return;
@@ -457,7 +461,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
457 response.Close(); 461 response.Close();
458 } 462 }
459 463
460 Status = (int)OSHttpStatusCode.SuccessOk;
461 _finished = true; 464 _finished = true;
462 } 465 }
463 466
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index e31be21..8395f83 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -382,23 +382,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
382 return result; 382 return result;
383 } 383 }
384 384
385 #region IHyperAssetService
386
387 public string GetUserAssetServer(UUID userID)
388 {
389 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID);
390
391 if (account != null && account.ServiceURLs.ContainsKey("AssetServerURI") && account.ServiceURLs["AssetServerURI"] != null)
392 return account.ServiceURLs["AssetServerURI"].ToString();
393
394 return string.Empty;
395 }
396
397 public string GetSimAssetServer()
398 {
399 return m_LocalAssetServiceURI;
400 }
401
402 #endregion
403 } 385 }
404} 386}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index cc5d061..2e6ec90 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -170,6 +170,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
170 170
171 public AssetBase GetCached(string id) 171 public AssetBase GetCached(string id)
172 { 172 {
173// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
174
173 if (m_Cache != null) 175 if (m_Cache != null)
174 return m_Cache.Get(id); 176 return m_Cache.Get(id);
175 177
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
deleted file mode 100644
index dcf08e3..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ /dev/null
@@ -1,223 +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;
29using System.Collections.Generic;
30using OpenMetaverse;
31using Nini.Config;
32using log4net;
33using OpenSim.Framework;
34using OpenSim.Services.Interfaces;
35
36namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
37{
38 public abstract class BaseInventoryConnector : IInventoryService
39 {
40 protected static InventoryCache m_cache;
41 private static bool m_Initialized;
42
43 protected virtual void Init(IConfigSource source)
44 {
45 if (!m_Initialized)
46 {
47 m_cache = new InventoryCache();
48 m_cache.Init(source, this);
49 m_Initialized = true;
50 }
51 }
52
53 /// <summary>
54 /// Create the entire inventory for a given user
55 /// </summary>
56 /// <param name="user"></param>
57 /// <returns></returns>
58 public abstract bool CreateUserInventory(UUID user);
59
60 /// <summary>
61 /// Gets the skeleton of the inventory -- folders only
62 /// </summary>
63 /// <param name="userId"></param>
64 /// <returns></returns>
65 public abstract List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
66
67 /// <summary>
68 /// Synchronous inventory fetch.
69 /// </summary>
70 /// <param name="userID"></param>
71 /// <returns></returns>
72 public abstract InventoryCollection GetUserInventory(UUID userID);
73
74 /// <summary>
75 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
76 /// inventory has been received
77 /// </summary>
78 /// <param name="userID"></param>
79 /// <param name="callback"></param>
80 public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
81
82 /// <summary>
83 /// Retrieve the root inventory folder for the given user.
84 /// </summary>
85 /// <param name="userID"></param>
86 /// <returns>null if no root folder was found</returns>
87 public InventoryFolderBase GetRootFolder(UUID userID)
88 {
89 // Root folder is here as system type Folder.
90 return m_cache.GetFolderForType(userID, AssetType.Folder);
91 }
92
93 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
94
95 /// <summary>
96 /// Gets the user folder for the given folder-type
97 /// </summary>
98 /// <param name="userID"></param>
99 /// <param name="type"></param>
100 /// <returns></returns>
101 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
102 {
103 return m_cache.GetFolderForType(userID, type);
104 }
105
106 /// <summary>
107 /// Gets everything (folders and items) inside a folder
108 /// </summary>
109 /// <param name="userId"></param>
110 /// <param name="folderID"></param>
111 /// <returns></returns>
112 public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID);
113
114 /// <summary>
115 /// Gets the items inside a folder
116 /// </summary>
117 /// <param name="userID"></param>
118 /// <param name="folderID"></param>
119 /// <returns></returns>
120 public abstract List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID);
121
122 /// <summary>
123 /// Add a new folder to the user's inventory
124 /// </summary>
125 /// <param name="folder"></param>
126 /// <returns>true if the folder was successfully added</returns>
127 public abstract bool AddFolder(InventoryFolderBase folder);
128
129 /// <summary>
130 /// Update a folder in the user's inventory
131 /// </summary>
132 /// <param name="folder"></param>
133 /// <returns>true if the folder was successfully updated</returns>
134 public abstract bool UpdateFolder(InventoryFolderBase folder);
135
136 /// <summary>
137 /// Move an inventory folder to a new location
138 /// </summary>
139 /// <param name="folder">A folder containing the details of the new location</param>
140 /// <returns>true if the folder was successfully moved</returns>
141 public abstract bool MoveFolder(InventoryFolderBase folder);
142
143 /// <summary>
144 /// Delete a list of inventory folders (from trash)
145 /// </summary>
146 public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs);
147
148 /// <summary>
149 /// Purge an inventory folder of all its items and subfolders.
150 /// </summary>
151 /// <param name="folder"></param>
152 /// <returns>true if the folder was successfully purged</returns>
153 public abstract bool PurgeFolder(InventoryFolderBase folder);
154
155 /// <summary>
156 /// Add a new item to the user's inventory.
157 /// If the given item has to parent folder, it tries to find the most
158 /// suitable folder for it.
159 /// </summary>
160 /// <param name="item"></param>
161 /// <returns>true if the item was successfully added</returns>
162 public bool AddItem(InventoryItemBase item)
163 {
164 if (item == null)
165 return false;
166
167 if (item.Folder == UUID.Zero)
168 {
169 InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
170 if (f != null)
171 item.Folder = f.ID;
172 else
173 {
174 f = GetRootFolder(item.Owner);
175 if (f != null)
176 item.Folder = f.ID;
177 else
178 return false;
179 }
180 }
181
182 return AddItemPlain(item);
183 }
184
185 protected abstract bool AddItemPlain(InventoryItemBase item);
186
187 /// <summary>
188 /// Update an item in the user's inventory
189 /// </summary>
190 /// <param name="item"></param>
191 /// <returns>true if the item was successfully updated</returns>
192 public abstract bool UpdateItem(InventoryItemBase item);
193
194 public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
195
196 /// <summary>
197 /// Delete an item from the user's inventory
198 /// </summary>
199 /// <param name="item"></param>
200 /// <returns>true if the item was successfully deleted</returns>
201 public abstract bool DeleteItems(UUID ownerID, List<UUID> itemIDs);
202
203 public abstract InventoryItemBase GetItem(InventoryItemBase item);
204
205 public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
206
207 /// <summary>
208 /// Does the given user have an inventory structure?
209 /// </summary>
210 /// <param name="userID"></param>
211 /// <returns></returns>
212 public abstract bool HasInventoryForUser(UUID userID);
213
214 /// <summary>
215 /// Get the active gestures of the agent.
216 /// </summary>
217 /// <param name="userId"></param>
218 /// <returns></returns>
219 public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
220
221 public abstract int GetAssetPermissions(UUID userID, UUID assetID);
222 }
223}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 0d121ed..b5c0af6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -218,9 +218,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
218 /// <param name="userID"></param> 218 /// <param name="userID"></param>
219 private void CacheInventoryServiceURL(UUID userID) 219 private void CacheInventoryServiceURL(UUID userID)
220 { 220 {
221 if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null) 221 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
222 { 222 {
223 // The user does not have a local account; let's cache its service URL 223 // The user is not local; let's cache its service URL
224 string inventoryURL = string.Empty; 224 string inventoryURL = string.Empty;
225 ScenePresence sp = null; 225 ScenePresence sp = null;
226 foreach (Scene scene in m_Scenes) 226 foreach (Scene scene in m_Scenes)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
deleted file mode 100644
index 2322d7c..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ /dev/null
@@ -1,237 +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;
29using System.Collections.Generic;
30using System.Reflection;
31
32using OpenSim.Framework;
33using OpenSim.Framework.Client;
34using OpenSim.Region.Framework.Scenes;
35
36using OpenMetaverse;
37using Nini.Config;
38using log4net;
39
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
41{
42 public class InventoryCache
43 {
44 private static readonly ILog m_log =
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47
48 protected BaseInventoryConnector m_Connector;
49 protected List<Scene> m_Scenes;
50
51 // The cache proper
52 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
53
54 // A cache of userIDs --> ServiceURLs, for HGBroker only
55 protected Dictionary<UUID, string> m_InventoryURLs =
56 new Dictionary<UUID, string>();
57
58 public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
59 {
60 m_Scenes = new List<Scene>();
61 m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>();
62 m_Connector = connector;
63 }
64
65 public virtual void AddRegion(Scene scene)
66 {
67 m_Scenes.Add(scene);
68 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
69 scene.EventManager.OnClientClosed += OnClientClosed;
70 }
71
72 public virtual void RemoveRegion(Scene scene)
73 {
74 if ((m_Scenes != null) && m_Scenes.Contains(scene))
75 {
76 m_Scenes.Remove(scene);
77 }
78 }
79
80 void OnMakeRootAgent(ScenePresence presence)
81 {
82 // Get system folders
83
84 // First check if they're here already
85 lock (m_InventoryCache)
86 {
87 if (m_InventoryCache.ContainsKey(presence.UUID))
88 {
89 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, system folders for {0} {1} already in cache", presence.Firstname, presence.Lastname);
90 return;
91 }
92 }
93
94 // If not, go get them and place them in the cache
95 Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID);
96 CacheInventoryServiceURL(presence.Scene, presence.UUID);
97
98 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
99 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
100
101 }
102
103 void OnClientClosed(UUID clientID, Scene scene)
104 {
105 if (m_InventoryCache.ContainsKey(clientID)) // if it's still in cache
106 {
107 ScenePresence sp = null;
108 foreach (Scene s in m_Scenes)
109 {
110 s.TryGetScenePresence(clientID, out sp);
111 if ((sp != null) && !sp.IsChildAgent && (s != scene))
112 {
113 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache",
114 scene.RegionInfo.RegionName, clientID);
115 return;
116 }
117 }
118
119 m_log.DebugFormat(
120 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
121 scene.RegionInfo.RegionName, clientID);
122 DropCachedSystemFolders(clientID);
123 DropInventoryServiceURL(clientID);
124 }
125 }
126
127 /// <summary>
128 /// Cache a user's 'system' folders.
129 /// </summary>
130 /// <param name="userID"></param>
131 /// <returns>Folders cached</returns>
132 protected Dictionary<AssetType, InventoryFolderBase> CacheSystemFolders(UUID userID)
133 {
134 // If not, go get them and place them in the cache
135 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(userID);
136
137 if (folders.Count > 0)
138 lock (m_InventoryCache)
139 m_InventoryCache.Add(userID, folders);
140
141 return folders;
142 }
143
144 /// <summary>
145 /// Drop a user's cached 'system' folders
146 /// </summary>
147 /// <param name="userID"></param>
148 protected void DropCachedSystemFolders(UUID userID)
149 {
150 // Drop system folders
151 lock (m_InventoryCache)
152 if (m_InventoryCache.ContainsKey(userID))
153 m_InventoryCache.Remove(userID);
154 }
155
156 /// <summary>
157 /// Get the system folder for a particular asset type
158 /// </summary>
159 /// <param name="userID"></param>
160 /// <param name="type"></param>
161 /// <returns></returns>
162 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
163 {
164 m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID);
165
166 Dictionary<AssetType, InventoryFolderBase> folders = null;
167
168 lock (m_InventoryCache)
169 {
170 m_InventoryCache.TryGetValue(userID, out folders);
171
172 // In some situations (such as non-secured standalones), system folders can be requested without
173 // the user being logged in. So we need to try caching them here if we don't already have them.
174 if (null == folders)
175 CacheSystemFolders(userID);
176
177 m_InventoryCache.TryGetValue(userID, out folders);
178 }
179
180 if ((folders != null) && folders.ContainsKey(type))
181 {
182 m_log.DebugFormat(
183 "[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID);
184
185 return folders[type];
186 }
187
188 m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
189
190 return null;
191 }
192
193 /// <summary>
194 /// Gets the user's inventory URL from its serviceURLs, if the user is foreign,
195 /// and sticks it in the cache
196 /// </summary>
197 /// <param name="userID"></param>
198 private void CacheInventoryServiceURL(Scene scene, UUID userID)
199 {
200 if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null)
201 {
202 // The user does not have a local account; let's cache its service URL
203 string inventoryURL = string.Empty;
204 ScenePresence sp = null;
205 scene.TryGetScenePresence(userID, out sp);
206 if (sp != null)
207 {
208 AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
209 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
210 {
211 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
212 if (inventoryURL != null && inventoryURL != string.Empty)
213 {
214 inventoryURL = inventoryURL.Trim(new char[] { '/' });
215 m_InventoryURLs.Add(userID, inventoryURL);
216 }
217 }
218 }
219 }
220 }
221
222 private void DropInventoryServiceURL(UUID userID)
223 {
224 lock (m_InventoryURLs)
225 if (m_InventoryURLs.ContainsKey(userID))
226 m_InventoryURLs.Remove(userID);
227 }
228
229 public string GetInventoryServiceURL(UUID userID)
230 {
231 if (m_InventoryURLs.ContainsKey(userID))
232 return m_InventoryURLs[userID];
233
234 return null;
235 }
236 }
237}
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index c66e053..54dfaf4 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -14,6 +14,9 @@ namespace OpenSim.Region.Framework.Interfaces
14 string GetUserHomeURL(UUID uuid); 14 string GetUserHomeURL(UUID uuid);
15 string GetUserUUI(UUID uuid); 15 string GetUserUUI(UUID uuid);
16 string GetUserServerURL(UUID uuid, string serverType); 16 string GetUserServerURL(UUID uuid, string serverType);
17 int GetUserFlags(UUID userID);
18 int GetUserCreated(UUID userID);
19 string GetUserTitle(UUID userID);
17 20
18 /// <summary> 21 /// <summary>
19 /// Add a user. 22 /// Add a user.
@@ -48,5 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces
48 /// <param name="firstName"></param> 51 /// <param name="firstName"></param>
49 /// <param name="profileURL"></param> 52 /// <param name="profileURL"></param>
50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 53 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
54
55 bool IsLocalGridUser(UUID uuid);
51 } 56 }
52} 57}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6666328..0f84da9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -77,7 +77,15 @@ namespace OpenSim.Region.Framework.Scenes
77 /// Controls whether physics can be applied to prims. Even if false, prims still have entries in a 77 /// Controls whether physics can be applied to prims. Even if false, prims still have entries in a
78 /// PhysicsScene in order to perform collision detection 78 /// PhysicsScene in order to perform collision detection
79 /// </summary> 79 /// </summary>
80 public bool m_physicalPrim; 80 public bool PhysicalPrims { get; private set; }
81
82 /// <summary>
83 /// Controls whether prims can be collided with.
84 /// </summary>
85 /// <remarks>
86 /// If this is set to false then prims cannot be subject to physics either.
87 /// </summary>
88 public bool CollidablePrims { get; private set; }
81 89
82 public float m_maxNonphys = 256; 90 public float m_maxNonphys = 256;
83 public float m_maxPhys = 10; 91 public float m_maxPhys = 10;
@@ -650,7 +658,8 @@ namespace OpenSim.Region.Framework.Scenes
650 //Animation states 658 //Animation states
651 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 659 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
652 660
653 m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); 661 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
662 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
654 663
655 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 664 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
656 if (RegionInfo.NonphysPrimMax > 0) 665 if (RegionInfo.NonphysPrimMax > 0)
@@ -701,7 +710,7 @@ namespace OpenSim.Region.Framework.Scenes
701 if (maptileRefresh != 0) 710 if (maptileRefresh != 0)
702 { 711 {
703 m_mapGenerationTimer.Interval = maptileRefresh * 1000; 712 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
704 m_mapGenerationTimer.Elapsed += RegenerateMaptile; 713 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
705 m_mapGenerationTimer.AutoReset = true; 714 m_mapGenerationTimer.AutoReset = true;
706 m_mapGenerationTimer.Start(); 715 m_mapGenerationTimer.Start();
707 } 716 }
@@ -1638,21 +1647,17 @@ namespace OpenSim.Region.Framework.Scenes
1638 { 1647 {
1639 m_sceneGridService.SetScene(this); 1648 m_sceneGridService.SetScene(this);
1640 1649
1650 //// Unfortunately this needs to be here and it can't be async.
1651 //// The map tile image is stored in RegionSettings, but it also needs to be
1652 //// stored in the GridService, because that's what the world map module uses
1653 //// to send the map image UUIDs (of other regions) to the viewer...
1654 if (m_generateMaptiles)
1655 RegenerateMaptile();
1656
1641 GridRegion region = new GridRegion(RegionInfo); 1657 GridRegion region = new GridRegion(RegionInfo);
1642 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1658 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1643 if (error != String.Empty) 1659 if (error != String.Empty)
1644 {
1645 throw new Exception(error); 1660 throw new Exception(error);
1646 }
1647
1648 // Generate the maptile asynchronously, because sometimes it can be very slow and we
1649 // don't want this to delay starting the region.
1650 if (m_generateMaptiles)
1651 {
1652 Util.FireAndForget(delegate {
1653 RegenerateMaptile(null, null);
1654 });
1655 }
1656 } 1661 }
1657 1662
1658 #endregion 1663 #endregion
@@ -5023,13 +5028,24 @@ namespace OpenSim.Region.Framework.Scenes
5023 /// </summary> 5028 /// </summary>
5024 /// <param name="sender"></param> 5029 /// <param name="sender"></param>
5025 /// <param name="e"></param> 5030 /// <param name="e"></param>
5026 public void RegenerateMaptile(object sender, ElapsedEventArgs e) 5031 private void RegenerateMaptile()
5027 { 5032 {
5028 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); 5033 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
5029 if (mapModule != null) 5034 if (mapModule != null)
5030 mapModule.GenerateMaptile(); 5035 mapModule.GenerateMaptile();
5031 } 5036 }
5032 5037
5038 private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e)
5039 {
5040 RegenerateMaptile();
5041
5042 // We need to propagate the new image UUID to the grid service
5043 // so that all simulators can retrieve it
5044 string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
5045 if (error != string.Empty)
5046 throw new Exception(error);
5047 }
5048
5033 // This method is called across the simulation connector to 5049 // This method is called across the simulation connector to
5034 // determine if a given agent is allowed in this region 5050 // determine if a given agent is allowed in this region
5035 // AS A ROOT AGENT. Returning false here will prevent them 5051 // AS A ROOT AGENT. Returning false here will prevent them
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a3e4b46..1e2901b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -333,7 +333,6 @@ namespace OpenSim.Region.Framework.Scenes
333 if (rot != null) 333 if (rot != null)
334 sceneObject.UpdateGroupRotationR((Quaternion)rot); 334 sceneObject.UpdateGroupRotationR((Quaternion)rot);
335 335
336 //group.ApplyPhysics(m_physicalPrim);
337 if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) 336 if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
338 { 337 {
339 sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); 338 sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index abea788..8860764 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes
210 /// </remarks> 210 /// </remarks>
211 public bool UsesPhysics 211 public bool UsesPhysics
212 { 212 {
213 get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; } 213 get { return (RootPart.Flags & PrimFlags.Physics) != 0; }
214 } 214 }
215 215
216 /// <summary> 216 /// <summary>
@@ -669,7 +669,7 @@ namespace OpenSim.Region.Framework.Scenes
669 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); 669 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
670 } 670 }
671 671
672 ApplyPhysics(m_scene.m_physicalPrim); 672 ApplyPhysics();
673 673
674 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 674 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
675 // for the same object with very different properties. The caller must schedule the update. 675 // for the same object with very different properties. The caller must schedule the update.
@@ -1239,8 +1239,7 @@ namespace OpenSim.Region.Framework.Scenes
1239 /// <summary> 1239 /// <summary>
1240 /// Apply physics to this group 1240 /// Apply physics to this group
1241 /// </summary> 1241 /// </summary>
1242 /// <param name="m_physicalPrim"></param> 1242 public void ApplyPhysics()
1243 public void ApplyPhysics(bool m_physicalPrim)
1244 { 1243 {
1245 // Apply physics to the root prim 1244 // Apply physics to the root prim
1246 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); 1245 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b29ecc6..aea47e6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1473,6 +1473,9 @@ namespace OpenSim.Region.Framework.Scenes
1473 /// <param name="VolumeDetectActive"></param> 1473 /// <param name="VolumeDetectActive"></param>
1474 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) 1474 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive)
1475 { 1475 {
1476 if (!ParentGroup.Scene.CollidablePrims)
1477 return;
1478
1476// m_log.DebugFormat( 1479// m_log.DebugFormat(
1477// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", 1480// "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}",
1478// Name, LocalId, UUID, m_physicalPrim); 1481// Name, LocalId, UUID, m_physicalPrim);
@@ -1739,7 +1742,7 @@ namespace OpenSim.Region.Framework.Scenes
1739 /// <param name="isNew"></param> 1742 /// <param name="isNew"></param>
1740 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) 1743 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
1741 { 1744 {
1742 if (!ParentGroup.Scene.m_physicalPrim && UsePhysics) 1745 if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
1743 return; 1746 return;
1744 1747
1745 if (IsJoint()) 1748 if (IsJoint())
@@ -4318,7 +4321,7 @@ namespace OpenSim.Region.Framework.Scenes
4318 if (ParentGroup.Scene == null) 4321 if (ParentGroup.Scene == null)
4319 return; 4322 return;
4320 4323
4321 if (PhysActor == null) 4324 if (ParentGroup.Scene.CollidablePrims && PhysActor == null)
4322 { 4325 {
4323 // It's not phantom anymore. So make sure the physics engine get's knowledge of it 4326 // It's not phantom anymore. So make sure the physics engine get's knowledge of it
4324 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( 4327 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b8ae553..42cd4be 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes
118 /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is 118 /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is
119 /// necessary. 119 /// necessary.
120 /// </remarks> 120 /// </remarks>
121 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); 121 private List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
122 122
123 public Object AttachmentsSyncLock { get; private set; } 123 public Object AttachmentsSyncLock { get; private set; }
124 124
@@ -550,8 +550,12 @@ namespace OpenSim.Region.Framework.Scenes
550 } 550 }
551 } 551 }
552 552
553 m_pos = value; 553 // Don't update while sitting
554 ParentPosition = Vector3.Zero; 554 if (ParentID == 0)
555 {
556 m_pos = value;
557 ParentPosition = Vector3.Zero;
558 }
555 559
556 //m_log.DebugFormat( 560 //m_log.DebugFormat(
557 // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", 561 // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@@ -566,6 +570,15 @@ namespace OpenSim.Region.Framework.Scenes
566 public Vector3 OffsetPosition 570 public Vector3 OffsetPosition
567 { 571 {
568 get { return m_pos; } 572 get { return m_pos; }
573 // Don't remove setter. It's not currently used in core but
574 // upcoming Avination code needs it.
575 set
576 {
577 // There is no offset position when not seated
578 if (ParentID == 0)
579 return;
580 m_pos = value;
581 }
569 } 582 }
570 583
571 /// <summary> 584 /// <summary>
@@ -1161,10 +1174,10 @@ namespace OpenSim.Region.Framework.Scenes
1161 public void CompleteMovement(IClientAPI client, bool openChildAgents) 1174 public void CompleteMovement(IClientAPI client, bool openChildAgents)
1162 { 1175 {
1163// DateTime startTime = DateTime.Now; 1176// DateTime startTime = DateTime.Now;
1164 1177
1165// m_log.DebugFormat( 1178 m_log.DebugFormat(
1166// "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1179 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
1167// client.Name, Scene.RegionInfo.RegionName); 1180 client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
1168 1181
1169 Vector3 look = Velocity; 1182 Vector3 look = Velocity;
1170 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1183 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -2383,9 +2396,7 @@ namespace OpenSim.Region.Framework.Scenes
2383 m_lastVelocity = Velocity; 2396 m_lastVelocity = Velocity;
2384 } 2397 }
2385 2398
2386 // followed suggestion from mic bowman. reversed the two lines below. 2399 CheckForBorderCrossing();
2387 if (ParentID == 0 && PhysicsActor != null || ParentID != 0) // Check that we have a physics actor or we're sitting on something
2388 CheckForBorderCrossing();
2389 2400
2390 CheckForSignificantMovement(); // sends update to the modules. 2401 CheckForSignificantMovement(); // sends update to the modules.
2391 } 2402 }
@@ -2738,143 +2749,146 @@ namespace OpenSim.Region.Framework.Scenes
2738 /// </remarks> 2749 /// </remarks>
2739 protected void CheckForBorderCrossing() 2750 protected void CheckForBorderCrossing()
2740 { 2751 {
2741 if (IsChildAgent) 2752 // Check that we we are not a child
2753 if (IsChildAgent)
2742 return; 2754 return;
2743 2755
2744 Vector3 pos2 = AbsolutePosition; 2756 // If we don't have a PhysActor, we can't cross anyway
2745 Vector3 vel = Velocity; 2757 // Also don't do this while sat, sitting avatars cross with the
2746 int neighbor = 0; 2758 // object they sit on.
2747 int[] fix = new int[2]; 2759 if (ParentID != 0 || PhysicsActor == null)
2748 2760 return;
2749 float timeStep = 0.1f;
2750 pos2.X = pos2.X + (vel.X*timeStep);
2751 pos2.Y = pos2.Y + (vel.Y*timeStep);
2752 pos2.Z = pos2.Z + (vel.Z*timeStep);
2753 2761
2754 if (!IsInTransit) 2762 if (!IsInTransit)
2755 { 2763 {
2756 // Checks if where it's headed exists a region 2764 Vector3 pos2 = AbsolutePosition;
2765 Vector3 vel = Velocity;
2766 int neighbor = 0;
2767 int[] fix = new int[2];
2757 2768
2758 bool needsTransit = false; 2769 float timeStep = 0.1f;
2759 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 2770 pos2.X = pos2.X + (vel.X * timeStep);
2771 pos2.Y = pos2.Y + (vel.Y * timeStep);
2772 pos2.Z = pos2.Z + (vel.Z * timeStep);
2773
2774 if (!IsInTransit)
2760 { 2775 {
2761 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2776 // Checks if where it's headed exists a region
2762 { 2777 bool needsTransit = false;
2763 needsTransit = true; 2778 if (m_scene.TestBorderCross(pos2, Cardinals.W))
2764 neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
2765 }
2766 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2767 { 2779 {
2768 needsTransit = true; 2780 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2769 neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix); 2781 {
2782 needsTransit = true;
2783 neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
2784 }
2785 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2786 {
2787 needsTransit = true;
2788 neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
2789 }
2790 else
2791 {
2792 needsTransit = true;
2793 neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
2794 }
2770 } 2795 }
2771 else 2796 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2772 { 2797 {
2773 needsTransit = true; 2798 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2774 neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix); 2799 {
2800 needsTransit = true;
2801 neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
2802 }
2803 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2804 {
2805 needsTransit = true;
2806 neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
2807 }
2808 else
2809 {
2810 needsTransit = true;
2811 neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
2812 }
2775 } 2813 }
2776 } 2814 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2777 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
2778 {
2779 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2780 { 2815 {
2781 needsTransit = true; 2816 needsTransit = true;
2782 neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix); 2817 neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
2783 } 2818 }
2784 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2819 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2785 { 2820 {
2786 needsTransit = true; 2821 needsTransit = true;
2787 neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix); 2822 neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
2788 } 2823 }
2789 else
2790 {
2791 needsTransit = true;
2792 neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
2793 }
2794 }
2795 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2796 {
2797 needsTransit = true;
2798 neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
2799 }
2800 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2801 {
2802 needsTransit = true;
2803 neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
2804 }
2805 2824
2806 // Makes sure avatar does not end up outside region 2825 // Makes sure avatar does not end up outside region
2807 if (neighbor <= 0) 2826 if (neighbor <= 0)
2808 {
2809 if (needsTransit)
2810 { 2827 {
2811 if (m_requestedSitTargetUUID == UUID.Zero) 2828 if (needsTransit)
2812 { 2829 {
2813 bool isFlying = Flying; 2830 if (m_requestedSitTargetUUID == UUID.Zero)
2814 RemoveFromPhysicalScene(); 2831 {
2815 2832 bool isFlying = Flying;
2816 Vector3 pos = AbsolutePosition; 2833 RemoveFromPhysicalScene();
2817 if (AbsolutePosition.X < 0) 2834
2818 pos.X += Velocity.X * 2; 2835 Vector3 pos = AbsolutePosition;
2819 else if (AbsolutePosition.X > Constants.RegionSize) 2836 if (AbsolutePosition.X < 0)
2820 pos.X -= Velocity.X * 2; 2837 pos.X += Velocity.X * 2;
2821 if (AbsolutePosition.Y < 0) 2838 else if (AbsolutePosition.X > Constants.RegionSize)
2822 pos.Y += Velocity.Y * 2; 2839 pos.X -= Velocity.X * 2;
2823 else if (AbsolutePosition.Y > Constants.RegionSize) 2840 if (AbsolutePosition.Y < 0)
2824 pos.Y -= Velocity.Y * 2; 2841 pos.Y += Velocity.Y * 2;
2825 Velocity = Vector3.Zero; 2842 else if (AbsolutePosition.Y > Constants.RegionSize)
2826 AbsolutePosition = pos; 2843 pos.Y -= Velocity.Y * 2;
2827 2844 Velocity = Vector3.Zero;
2828// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); 2845 AbsolutePosition = pos;
2829 2846
2830 AddToPhysicalScene(isFlying); 2847// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
2848
2849 AddToPhysicalScene(isFlying);
2850 }
2831 } 2851 }
2832 } 2852 }
2833 } 2853 else if (neighbor > 0)
2834 else if (neighbor > 0)
2835 {
2836 if (!CrossToNewRegion())
2837 { 2854 {
2838 if (m_requestedSitTargetUUID == UUID.Zero) 2855 if (!CrossToNewRegion())
2839 { 2856 {
2840 bool isFlying = Flying; 2857 if (m_requestedSitTargetUUID == UUID.Zero)
2841 RemoveFromPhysicalScene(); 2858 {
2842 2859 bool isFlying = Flying;
2843 Vector3 pos = AbsolutePosition; 2860 RemoveFromPhysicalScene();
2844 if (AbsolutePosition.X < 0) 2861
2845 pos.X += Velocity.X * 2; 2862 Vector3 pos = AbsolutePosition;
2846 else if (AbsolutePosition.X > Constants.RegionSize) 2863 if (AbsolutePosition.X < 0)
2847 pos.X -= Velocity.X * 2; 2864 pos.X += Velocity.X * 2;
2848 if (AbsolutePosition.Y < 0) 2865 else if (AbsolutePosition.X > Constants.RegionSize)
2849 pos.Y += Velocity.Y * 2; 2866 pos.X -= Velocity.X * 2;
2850 else if (AbsolutePosition.Y > Constants.RegionSize) 2867 if (AbsolutePosition.Y < 0)
2851 pos.Y -= Velocity.Y * 2; 2868 pos.Y += Velocity.Y * 2;
2852 Velocity = Vector3.Zero; 2869 else if (AbsolutePosition.Y > Constants.RegionSize)
2853 AbsolutePosition = pos; 2870 pos.Y -= Velocity.Y * 2;
2854 2871 Velocity = Vector3.Zero;
2855 AddToPhysicalScene(isFlying); 2872 AbsolutePosition = pos;
2873
2874 AddToPhysicalScene(isFlying);
2875 }
2856 } 2876 }
2857 } 2877 }
2858 } 2878 }
2859 } 2879 else
2860 else 2880 {
2861 { 2881 // This constant has been inferred from experimentation
2862 // We must remove the agent from the physical scene if it has been placed in transit. If we don't, 2882 // I'm not sure what this value should be, so I tried a few values.
2863 // then this method continues to be called from ScenePresence.Update() until the handover of the client between 2883 timeStep = 0.04f;
2864 // regions is completed. Since this handover can take more than 1000ms (due to the 1000ms 2884 pos2 = AbsolutePosition;
2865 // event queue polling response from the server), this results in the avatar pausing on the border 2885 pos2.X = pos2.X + (vel.X * timeStep);
2866 // for the handover period. 2886 pos2.Y = pos2.Y + (vel.Y * timeStep);
2867 RemoveFromPhysicalScene(); 2887 // Don't touch the Z
2868 2888 m_pos = pos2;
2869 // This constant has been inferred from experimentation 2889 m_log.DebugFormat("[SCENE PRESENCE]: In transit m_pos={0}", m_pos);
2870 // I'm not sure what this value should be, so I tried a few values. 2890 }
2871 timeStep = 0.04f; 2891 }
2872 pos2 = AbsolutePosition;
2873 pos2.X = pos2.X + (vel.X * timeStep);
2874 pos2.Y = pos2.Y + (vel.Y * timeStep);
2875 pos2.Z = pos2.Z + (vel.Z * timeStep);
2876 m_pos = pos2;
2877 }
2878 } 2892 }
2879 2893
2880 /// <summary> 2894 /// <summary>
@@ -3104,30 +3118,28 @@ namespace OpenSim.Region.Framework.Scenes
3104 catch { } 3118 catch { }
3105 3119
3106 // Attachment objects 3120 // Attachment objects
3107 lock (m_attachments) 3121 List<SceneObjectGroup> attachments = GetAttachments();
3122 if (attachments.Count > 0)
3108 { 3123 {
3109 if (m_attachments.Count > 0) 3124 cAgent.AttachmentObjects = new List<ISceneObject>();
3110 { 3125 cAgent.AttachmentObjectStates = new List<string>();
3111 cAgent.AttachmentObjects = new List<ISceneObject>(); 3126// IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3112 cAgent.AttachmentObjectStates = new List<string>(); 3127 InTransitScriptStates.Clear();
3113 // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3114 InTransitScriptStates.Clear();
3115 3128
3116 foreach (SceneObjectGroup sog in m_attachments) 3129 foreach (SceneObjectGroup sog in attachments)
3117 { 3130 {
3118 // We need to make a copy and pass that copy 3131 // We need to make a copy and pass that copy
3119 // because of transfers withn the same sim 3132 // because of transfers withn the same sim
3120 ISceneObject clone = sog.CloneForNewScene(); 3133 ISceneObject clone = sog.CloneForNewScene();
3121 // Attachment module assumes that GroupPosition holds the offsets...! 3134 // Attachment module assumes that GroupPosition holds the offsets...!
3122 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; 3135 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3123 ((SceneObjectGroup)clone).IsAttachment = false; 3136 ((SceneObjectGroup)clone).IsAttachment = false;
3124 cAgent.AttachmentObjects.Add(clone); 3137 cAgent.AttachmentObjects.Add(clone);
3125 string state = sog.GetStateSnapshot(); 3138 string state = sog.GetStateSnapshot();
3126 cAgent.AttachmentObjectStates.Add(state); 3139 cAgent.AttachmentObjectStates.Add(state);
3127 InTransitScriptStates.Add(state); 3140 InTransitScriptStates.Add(state);
3128 // Let's remove the scripts of the original object here 3141 // Let's remove the scripts of the original object here
3129 sog.RemoveScriptInstances(true); 3142 sog.RemoveScriptInstances(true);
3130 }
3131 } 3143 }
3132 } 3144 }
3133 } 3145 }
@@ -3535,26 +3547,29 @@ namespace OpenSim.Region.Framework.Scenes
3535 /// <param name="args">The arguments for the event</param> 3547 /// <param name="args">The arguments for the event</param>
3536 public void SendScriptEventToAttachments(string eventName, Object[] args) 3548 public void SendScriptEventToAttachments(string eventName, Object[] args)
3537 { 3549 {
3538 if (m_scriptEngines.Length == 0) 3550 Util.FireAndForget(delegate(object x)
3539 return;
3540
3541 lock (m_attachments)
3542 { 3551 {
3543 foreach (SceneObjectGroup grp in m_attachments) 3552 if (m_scriptEngines.Length == 0)
3553 return;
3554
3555 lock (m_attachments)
3544 { 3556 {
3545 // 16384 is CHANGED_ANIMATION 3557 foreach (SceneObjectGroup grp in m_attachments)
3546 //
3547 // Send this to all attachment root prims
3548 //
3549 foreach (IScriptModule m in m_scriptEngines)
3550 { 3558 {
3551 if (m == null) // No script engine loaded 3559 // 16384 is CHANGED_ANIMATION
3552 continue; 3560 //
3561 // Send this to all attachment root prims
3562 //
3563 foreach (IScriptModule m in m_scriptEngines)
3564 {
3565 if (m == null) // No script engine loaded
3566 continue;
3553 3567
3554 m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); 3568 m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
3569 }
3555 } 3570 }
3556 } 3571 }
3557 } 3572 });
3558 } 3573 }
3559 3574
3560 internal void PushForce(Vector3 impulse) 3575 internal void PushForce(Vector3 impulse)
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 04ba738..228eca9 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Physics.OdePlugin
110 private const uint m_regionWidth = Constants.RegionSize; 110 private const uint m_regionWidth = Constants.RegionSize;
111 private const uint m_regionHeight = Constants.RegionSize; 111 private const uint m_regionHeight = Constants.RegionSize;
112 112
113 private float ODE_STEPSIZE = 0.020f; 113 private float ODE_STEPSIZE = 0.0178f;
114 private float metersInSpace = 29.9f; 114 private float metersInSpace = 29.9f;
115 private float m_timeDilation = 1.0f; 115 private float m_timeDilation = 1.0f;
116 116
@@ -456,7 +456,7 @@ namespace OpenSim.Region.Physics.OdePlugin
456 mAvatarObjectContactFriction = physicsconfig.GetFloat("m_avatarobjectcontact_friction", 75f); 456 mAvatarObjectContactFriction = physicsconfig.GetFloat("m_avatarobjectcontact_friction", 75f);
457 mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f); 457 mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f);
458 458
459 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", 0.020f); 459 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE);
460 m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10); 460 m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10);
461 461
462 avDensity = physicsconfig.GetFloat("av_density", 80f); 462 avDensity = physicsconfig.GetFloat("av_density", 80f);
@@ -2822,6 +2822,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2822 m_global_contactcount = 0; 2822 m_global_contactcount = 0;
2823 2823
2824 d.WorldQuickStep(world, ODE_STEPSIZE); 2824 d.WorldQuickStep(world, ODE_STEPSIZE);
2825
2825 d.JointGroupEmpty(contactgroup); 2826 d.JointGroupEmpty(contactgroup);
2826 } 2827 }
2827 catch (Exception e) 2828 catch (Exception e)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index cb0d765..77a784d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -486,6 +486,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
486 m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; 486 m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
487 if (m_host.ParentGroup.Scene.SimulationDataService != null) 487 if (m_host.ParentGroup.Scene.SimulationDataService != null)
488 m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); 488 m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
489 m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
489 } 490 }
490 /// <summary> 491 /// <summary>
491 /// Set the current Windlight scene to a target avatar 492 /// Set the current Windlight scene to a target avatar
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 07c6962..1bd3706 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
91 91
92 server.AddXmlRPCHandler("status_notification", StatusNotification, false); 92 server.AddXmlRPCHandler("status_notification", StatusNotification, false);
93 server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); 93 server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false);
94 server.AddXmlRPCHandler("get_user_info", GetUserInfo, false);
94 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); 95 server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false);
95 96
96 server.AddXmlRPCHandler("locate_user", LocateUser, false); 97 server.AddXmlRPCHandler("locate_user", LocateUser, false);
@@ -299,6 +300,38 @@ namespace OpenSim.Server.Handlers.Hypergrid
299 300
300 } 301 }
301 302
303 public XmlRpcResponse GetUserInfo(XmlRpcRequest request, IPEndPoint remoteClient)
304 {
305 Hashtable hash = new Hashtable();
306 Hashtable requestData = (Hashtable)request.Params[0];
307
308 // This needs checking!
309 if (requestData.ContainsKey("userID"))
310 {
311 string userID_str = (string)requestData["userID"];
312 UUID userID = UUID.Zero;
313 UUID.TryParse(userID_str, out userID);
314
315 //int userFlags = m_HomeUsersService.GetUserFlags(userID);
316 Dictionary<string,object> userInfo = m_HomeUsersService.GetUserInfo(userID);
317 if (userInfo.Count > 0)
318 {
319 foreach (KeyValuePair<string, object> kvp in userInfo)
320 {
321 hash[kvp.Key] = kvp.Value;
322 }
323 }
324 else
325 {
326 hash["result"] = "failure";
327 }
328 }
329
330 XmlRpcResponse response = new XmlRpcResponse();
331 response.Value = hash;
332 return response;
333 }
334
302 public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient) 335 public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient)
303 { 336 {
304 Hashtable hash = new Hashtable(); 337 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index ab383ef..3fd69ae 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
231 231
232 int userLevel = 0; 232 int userLevel = 0;
233 if (request.ContainsKey("UserLevel") && int.TryParse(request["UserLevel"].ToString(), out userLevel)) 233 if (request.ContainsKey("UserLevel") && int.TryParse(request["UserLevel"].ToString(), out userLevel))
234 existingAccount.UserFlags = userLevel; 234 existingAccount.UserLevel = userLevel;
235 235
236 int userFlags = 0; 236 int userFlags = 0;
237 if (request.ContainsKey("UserFlags") && int.TryParse(request["UserFlags"].ToString(), out userFlags)) 237 if (request.ContainsKey("UserFlags") && int.TryParse(request["UserFlags"].ToString(), out userFlags))
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index fdab254..d7b2ff8 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -100,6 +100,8 @@ namespace OpenSim.Services.Connectors
100 100
101 public AssetBase Get(string id) 101 public AssetBase Get(string id)
102 { 102 {
103// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id);
104
103 string uri = m_ServerURI + "/assets/" + id; 105 string uri = m_ServerURI + "/assets/" + id;
104 106
105 AssetBase asset = null; 107 AssetBase asset = null;
@@ -119,6 +121,8 @@ namespace OpenSim.Services.Connectors
119 121
120 public AssetBase GetCached(string id) 122 public AssetBase GetCached(string id)
121 { 123 {
124// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
125
122 if (m_Cache != null) 126 if (m_Cache != null)
123 return m_Cache.Get(id); 127 return m_Cache.Get(id);
124 128
@@ -177,6 +181,8 @@ namespace OpenSim.Services.Connectors
177 181
178 public bool Get(string id, Object sender, AssetRetrieved handler) 182 public bool Get(string id, Object sender, AssetRetrieved handler)
179 { 183 {
184// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id);
185
180 string uri = m_ServerURI + "/assets/" + id; 186 string uri = m_ServerURI + "/assets/" + id;
181 187
182 AssetBase asset = null; 188 AssetBase asset = null;
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index 5c31639..bb5d51f 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -29,7 +29,9 @@ using log4net;
29using Nini.Config; 29using Nini.Config;
30using System; 30using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Collections.Specialized;
32using System.Reflection; 33using System.Reflection;
34using System.Web;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
35using OpenSim.Services.Connectors.Hypergrid; 37using OpenSim.Services.Connectors.Hypergrid;
@@ -73,11 +75,26 @@ namespace OpenSim.Services.Connectors
73 if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && 75 if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) &&
74 assetUri.Scheme == Uri.UriSchemeHttp) 76 assetUri.Scheme == Uri.UriSchemeHttp)
75 { 77 {
76 url = "http://" + assetUri.Authority; 78 // Simian
77 assetID = assetUri.LocalPath.Trim(new char[] {'/'}); 79 if (assetUri.Query != string.Empty)
80 {
81 NameValueCollection qscoll = HttpUtility.ParseQueryString(assetUri.Query);
82 assetID = qscoll["id"];
83 if (assetID != null)
84 url = id.Replace(assetID, ""); // Malformed again, as simian expects
85 else
86 url = id; // !!! best effort
87 }
88 else // robust
89 {
90 url = "http://" + assetUri.Authority;
91 assetID = assetUri.LocalPath.Trim(new char[] { '/' });
92 }
93
78 return true; 94 return true;
79 } 95 }
80 96
97 m_log.DebugFormat("[HG ASSET SERVICE]: Malformed URL {0}", id);
81 return false; 98 return false;
82 } 99 }
83 100
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
index 7cfd6e8..c030bca 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -47,13 +47,36 @@ namespace OpenSim.Services.Connectors
47 47
48 public HeloServicesConnector(string serverURI) 48 public HeloServicesConnector(string serverURI)
49 { 49 {
50 m_ServerURI = serverURI.TrimEnd('/'); 50 if (!serverURI.EndsWith("="))
51 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
52 else
53 {
54 // Simian sends malformed urls like this:
55 // http://valley.virtualportland.org/simtest/Grid/?id=
56 //
57 try
58 {
59 Uri uri = new Uri(serverURI + "xxx");
60 if (uri.Query == string.Empty)
61 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
62 else
63 {
64 serverURI = serverURI + "xxx";
65 m_ServerURI = serverURI.Replace(uri.Query, "");
66 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/";
67 }
68 }
69 catch (UriFormatException e)
70 {
71 m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI);
72 }
73 }
51 } 74 }
52 75
53 76
54 public virtual string Helo() 77 public virtual string Helo()
55 { 78 {
56 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); 79 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
57 // Eventually we need to switch to HEAD 80 // Eventually we need to switch to HEAD
58 /* req.Method = "HEAD"; */ 81 /* req.Method = "HEAD"; */
59 82
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 0c55c2e..5b27cf6 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -334,6 +334,9 @@ namespace OpenSim.Services.Connectors.Hypergrid
334 UInt32.TryParse((string)hash["http_port"], out p); 334 UInt32.TryParse((string)hash["http_port"], out p);
335 region.HttpPort = p; 335 region.HttpPort = p;
336 } 336 }
337 if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
338 region.ServerURI = (string)hash["server_uri"];
339
337 if (hash["internal_port"] != null) 340 if (hash["internal_port"] != null)
338 { 341 {
339 int p = 0; 342 int p = 0;
@@ -558,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid
558 return online; 561 return online;
559 } 562 }
560 563
564 public Dictionary<string,object> GetUserInfo (UUID userID)
565 {
566 Hashtable hash = new Hashtable();
567 hash["userID"] = userID.ToString();
568
569 IList paramList = new ArrayList();
570 paramList.Add(hash);
571
572 XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);
573
574 Dictionary<string, object> info = new Dictionary<string, object>();
575 XmlRpcResponse response = null;
576 try
577 {
578 response = request.Send(m_ServerURL, 10000);
579 }
580 catch
581 {
582 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
583 return info;
584 }
585
586 if (response.IsFault)
587 {
588 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
589 return info;
590 }
591
592 hash = (Hashtable)response.Value;
593 try
594 {
595 if (hash == null)
596 {
597 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
598 return info;
599 }
600
601 // Here is the actual response
602 foreach (object key in hash.Keys)
603 {
604 if (hash[key] != null)
605 {
606 info.Add(key.ToString(), hash[key]);
607 }
608 }
609 }
610 catch
611 {
612 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
613 }
614
615 return info;
616 }
617
561 public Dictionary<string, object> GetServerURLs(UUID userID) 618 public Dictionary<string, object> GetServerURLs(UUID userID)
562 { 619 {
563 Hashtable hash = new Hashtable(); 620 Hashtable hash = new Hashtable();
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 9573e21..99523a1 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -86,6 +86,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
86 86
87 public SimianAssetServiceConnector(string url) 87 public SimianAssetServiceConnector(string url)
88 { 88 {
89 if (!url.EndsWith("/") && !url.EndsWith("="))
90 url = url + '/';
89 m_serverUrl = url; 91 m_serverUrl = url;
90 } 92 }
91 93
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 918544f..67a65ff 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -341,26 +341,54 @@ namespace OpenSim.Services.Connectors.SimianGrid
341 341
342 public List<GridRegion> GetHyperlinks(UUID scopeID) 342 public List<GridRegion> GetHyperlinks(UUID scopeID)
343 { 343 {
344 // Hypergrid/linked regions are not supported 344 List<GridRegion> foundRegions = new List<GridRegion>();
345 return new List<GridRegion>(); 345
346 NameValueCollection requestArgs = new NameValueCollection
347 {
348 { "RequestMethod", "GetScenes" },
349 { "HyperGrid", "true" },
350 { "Enabled", "1" }
351 };
352
353 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
354 if (response["Success"].AsBoolean())
355 {
356 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
357
358 OSDArray array = response["Scenes"] as OSDArray;
359 if (array != null)
360 {
361 for (int i = 0; i < array.Count; i++)
362 {
363 GridRegion region = ResponseToGridRegion(array[i] as OSDMap);
364 if (region != null)
365 foundRegions.Add(region);
366 }
367 }
368 }
369
370 return foundRegions;
346 } 371 }
347 372
348 public int GetRegionFlags(UUID scopeID, UUID regionID) 373 public int GetRegionFlags(UUID scopeID, UUID regionID)
349 { 374 {
350 const int REGION_ONLINE = 4;
351
352 NameValueCollection requestArgs = new NameValueCollection 375 NameValueCollection requestArgs = new NameValueCollection
353 { 376 {
354 { "RequestMethod", "GetScene" }, 377 { "RequestMethod", "GetScene" },
355 { "SceneID", regionID.ToString() } 378 { "SceneID", regionID.ToString() }
356 }; 379 };
357 380
358 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); 381 m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
359 382
360 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 383 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
361 if (response["Success"].AsBoolean()) 384 if (response["Success"].AsBoolean())
362 { 385 {
363 return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; 386 OSDMap extraData = response["ExtraData"] as OSDMap;
387 int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0;
388 int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0;
389 int flags = enabled | hypergrid;
390 m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags);
391 return flags;
364 } 392 }
365 else 393 else
366 { 394 {
@@ -411,24 +439,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
411 Vector3d minPosition = response["MinPosition"].AsVector3d(); 439 Vector3d minPosition = response["MinPosition"].AsVector3d();
412 region.RegionLocX = (int)minPosition.X; 440 region.RegionLocX = (int)minPosition.X;
413 region.RegionLocY = (int)minPosition.Y; 441 region.RegionLocY = (int)minPosition.Y;
414 442
415 Uri httpAddress = response["Address"].AsUri(); 443 if ( ! extraData["HyperGrid"] ) {
416 region.ExternalHostName = httpAddress.Host; 444 Uri httpAddress = response["Address"].AsUri();
417 region.HttpPort = (uint)httpAddress.Port; 445 region.ExternalHostName = httpAddress.Host;
418 446 region.HttpPort = (uint)httpAddress.Port;
419 region.ServerURI = extraData["ServerURI"].AsString(); 447
420 448 IPAddress internalAddress;
421 IPAddress internalAddress; 449 IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress);
422 IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); 450 if (internalAddress == null)
423 if (internalAddress == null) 451 internalAddress = IPAddress.Any;
424 internalAddress = IPAddress.Any; 452
425 453 region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger());
426 region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); 454 region.TerrainImage = extraData["MapTexture"].AsUUID();
427 region.TerrainImage = extraData["MapTexture"].AsUUID(); 455 region.Access = (byte)extraData["Access"].AsInteger();
428 region.Access = (byte)extraData["Access"].AsInteger(); 456 region.RegionSecret = extraData["RegionSecret"].AsString();
429 region.RegionSecret = extraData["RegionSecret"].AsString(); 457 region.EstateOwner = extraData["EstateOwner"].AsUUID();
430 region.EstateOwner = extraData["EstateOwner"].AsUUID(); 458 region.Token = extraData["Token"].AsString();
431 region.Token = extraData["Token"].AsString(); 459 region.ServerURI = extraData["ServerURI"].AsString();
460 } else {
461 region.ServerURI = response["Address"];
462 }
432 463
433 return region; 464 return region;
434 } 465 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 39df1f5..f828abb 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -92,7 +92,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
92 92
93 public SimianInventoryServiceConnector(string url) 93 public SimianInventoryServiceConnector(string url)
94 { 94 {
95 if (!url.EndsWith("/") && !url.EndsWith("="))
96 url = url + '/';
95 m_serverUrl = url; 97 m_serverUrl = url;
98
96 } 99 }
97 100
98 public void Initialise(IConfigSource source) 101 public void Initialise(IConfigSource source)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 91e2976..4350749 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -287,6 +287,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
287 account.UserFlags = response["UserFlags"].AsInteger(); 287 account.UserFlags = response["UserFlags"].AsInteger();
288 account.UserLevel = response["AccessLevel"].AsInteger(); 288 account.UserLevel = response["AccessLevel"].AsInteger();
289 account.UserTitle = response["UserTitle"].AsString(); 289 account.UserTitle = response["UserTitle"].AsString();
290 account.LocalToGrid = true;
291 if (response.ContainsKey("LocalToGrid"))
292 account.LocalToGrid = (response["LocalToGrid"].AsString() == "true" ? true : false);
293
290 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 294 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
291 295
292 // Cache the user account info 296 // Cache the user account info
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 90c022f..78eab3d 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -102,50 +102,45 @@ namespace OpenSim.Services.GridService
102 102
103 public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) 103 public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db)
104 { 104 {
105 IConfig modulesConfig = config.Configs["Modules"]; 105 IConfig gridConfig = config.Configs["GridService"];
106 if (modulesConfig == null) 106 if (gridConfig == null)
107 return; 107 return;
108
109 if (modulesConfig.GetString("HypergridLinker", "") != "HypergridLinker")
110 return;
111 108
112 m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); 109 if (!gridConfig.GetBoolean("HypergridLinker", false))
110 return;
113 111
114 m_Database = db; 112 m_Database = db;
115 m_GridService = gridService; 113 m_GridService = gridService;
114 m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType());
116 115
117 IConfig gridConfig = config.Configs["GridService"]; 116 string assetService = gridConfig.GetString("AssetService", string.Empty);
118 if (gridConfig != null)
119 {
120 string assetService = gridConfig.GetString("AssetService", string.Empty);
121 117
122 Object[] args = new Object[] { config }; 118 Object[] args = new Object[] { config };
123 119
124 if (assetService != string.Empty) 120 if (assetService != string.Empty)
125 m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args); 121 m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args);
126 122
127 string scope = gridConfig.GetString("ScopeID", string.Empty); 123 string scope = gridConfig.GetString("ScopeID", string.Empty);
128 if (scope != string.Empty) 124 if (scope != string.Empty)
129 UUID.TryParse(scope, out m_ScopeID); 125 UUID.TryParse(scope, out m_ScopeID);
130 126
131// m_Check4096 = gridConfig.GetBoolean("Check4096", true); 127// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
132 128
133 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); 129 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
134 130
135 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); 131 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty);
136 try 132 try
137 { 133 {
138 m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); 134 m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
139 } 135 }
140 catch 136 catch
141 { 137 {
142 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); 138 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
143 } 139 }
144 140
145 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); 141 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
146 142
147 m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); 143 m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
148 }
149 144
150 if (!string.IsNullOrEmpty(m_MapTileDirectory)) 145 if (!string.IsNullOrEmpty(m_MapTileDirectory))
151 { 146 {
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index cdc560c..f681df4 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -161,6 +161,14 @@ namespace OpenSim.Services.HypergridService
161 { 161 {
162 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", 162 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
163 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); 163 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
164
165 if (m_UserAccountService.GetUserAccount(UUID.Zero, agentCircuit.AgentID) == null)
166 {
167 m_log.WarnFormat("[USER AGENT SERVICE]: Someone attempted to lauch a foreign user from here {0} {1}", agentCircuit.firstname, agentCircuit.lastname);
168 reason = "Forbidden to launch your agents from here";
169 return false;
170 }
171
164 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 172 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
165 GridRegion region = new GridRegion(gatekeeper); 173 GridRegion region = new GridRegion(gatekeeper);
166 region.ServerURI = gatekeeper.ServerURI; 174 region.ServerURI = gatekeeper.ServerURI;
@@ -480,6 +488,31 @@ namespace OpenSim.Services.HypergridService
480 return online; 488 return online;
481 } 489 }
482 490
491 public Dictionary<string, object> GetUserInfo(UUID userID)
492 {
493 Dictionary<string, object> info = new Dictionary<string, object>();
494
495 if (m_UserAccountService == null)
496 {
497 m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get user flags because user account service is missing");
498 info["result"] = "fail";
499 info["message"] = "UserAccountService is missing!";
500 return info;
501 }
502
503 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID);
504
505 if (account != null)
506 {
507 info.Add("user_flags", (object)account.UserFlags);
508 info.Add("user_created", (object)account.Created);
509 info.Add("user_title", (object)account.UserTitle);
510 info.Add("result", "success");
511 }
512
513 return info;
514 }
515
483 public Dictionary<string, object> GetServerURLs(UUID userID) 516 public Dictionary<string, object> GetServerURLs(UUID userID)
484 { 517 {
485 if (m_UserAccountService == null) 518 if (m_UserAccountService == null)
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs
index e86ec51..5b293ac 100644
--- a/OpenSim/Services/Interfaces/IHypergridServices.cs
+++ b/OpenSim/Services/Interfaces/IHypergridServices.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.Interfaces
55 void LogoutAgent(UUID userID, UUID sessionID); 55 void LogoutAgent(UUID userID, UUID sessionID);
56 GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); 56 GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt);
57 Dictionary<string, object> GetServerURLs(UUID userID); 57 Dictionary<string, object> GetServerURLs(UUID userID);
58 Dictionary<string,object> GetUserInfo(UUID userID);
58 59
59 string LocateUser(UUID userID); 60 string LocateUser(UUID userID);
60 // Tries to get the universal user identifier for the targetUserId 61 // Tries to get the universal user identifier for the targetUserId
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 6cc8eb8..1b85980 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Services.Interfaces
91 public int UserLevel; 91 public int UserLevel;
92 public int UserFlags; 92 public int UserFlags;
93 public string UserTitle; 93 public string UserTitle;
94 public Boolean LocalToGrid = true;
94 95
95 public Dictionary<string, object> ServiceURLs; 96 public Dictionary<string, object> ServiceURLs;
96 97
@@ -119,6 +120,8 @@ namespace OpenSim.Services.Interfaces
119 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString()); 120 UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString());
120 if (kvp.ContainsKey("UserTitle")) 121 if (kvp.ContainsKey("UserTitle"))
121 UserTitle = kvp["UserTitle"].ToString(); 122 UserTitle = kvp["UserTitle"].ToString();
123 if (kvp.ContainsKey("LocalToGrid"))
124 Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid);
122 125
123 if (kvp.ContainsKey("Created")) 126 if (kvp.ContainsKey("Created"))
124 Created = Convert.ToInt32(kvp["Created"].ToString()); 127 Created = Convert.ToInt32(kvp["Created"].ToString());
@@ -152,6 +155,7 @@ namespace OpenSim.Services.Interfaces
152 result["UserLevel"] = UserLevel.ToString(); 155 result["UserLevel"] = UserLevel.ToString();
153 result["UserFlags"] = UserFlags.ToString(); 156 result["UserFlags"] = UserFlags.ToString();
154 result["UserTitle"] = UserTitle; 157 result["UserTitle"] = UserTitle;
158 result["LocalToGrid"] = LocalToGrid.ToString();
155 159
156 string str = string.Empty; 160 string str = string.Empty;
157 foreach (KeyValuePair<string, object> kvp in ServiceURLs) 161 foreach (KeyValuePair<string, object> kvp in ServiceURLs)
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 6249fae..a73fcbe 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -112,10 +112,10 @@ namespace pCampBot
112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" + 112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
113 " -password password for the bots\n" + 113 " -password password for the bots\n" +
114 " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" + 114 " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" +
115 " current options are:" + 115 " current options are:\n" +
116 " p (physics)" + 116 " p (physics)\n" +
117 " g (grab)" + 117 " g (grab)\n" +
118 " t (teleport)" + 118 " t (teleport)\n" +
119// " c (cross)" + 119// " c (cross)" +
120 " -wear set appearance folder to load from (default: no)\n" + 120 " -wear set appearance folder to load from (default: no)\n" +
121 " -h, -help show this message"); 121 " -h, -help show this message");