aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs148
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs18
-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/Framework/EntityTransfer/HGEntityTransferModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs18
-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.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs33
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs1
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs2
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs4
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs55
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs4
25 files changed, 262 insertions, 649 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/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 30d4f21..2bbc6c7 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)
@@ -203,7 +203,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
203 } 203 }
204 204
205 //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way) 205 //Give them at least two packets, to play nice with some broken viewers (SL also behaves this way)
206 if (m_stopPacket == 1 && Layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++; 206 if (m_stopPacket == 1 && m_layers[0].End > FIRST_PACKET_SIZE) m_stopPacket++;
207 207
208 m_currentPacket = StartPacket; 208 m_currentPacket = StartPacket;
209 } 209 }
@@ -344,7 +344,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
344 344
345 private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) 345 private void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
346 { 346 {
347 Layers = layers; 347 m_layers = layers;
348 IsDecoded = true; 348 IsDecoded = true;
349 RunUpdate(); 349 RunUpdate();
350 } 350 }
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/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 37b36f6..b16d0d3 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -192,8 +192,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
192 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); 192 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
193 193
194 // Let's find out if this is a foreign user or a local user 194 // Let's find out if this is a foreign user or a local user
195 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id); 195 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
196 if (account != null) 196 if (uMan != null && uMan.IsLocalGridUser(id))
197 { 197 {
198 // local grid user 198 // local grid user
199 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); 199 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
@@ -231,8 +231,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
231 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); 231 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
232 GridRegion homeGatekeeper = MakeRegion(aCircuit); 232 GridRegion homeGatekeeper = MakeRegion(aCircuit);
233 233
234 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}", 234 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
235 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); 235 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
236 236
237 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); 237 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
238 return true; 238 return true;
@@ -318,8 +318,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
318 } 318 }
319 319
320 // Let's find out if this is a foreign user or a local user 320 // Let's find out if this is a foreign user or a local user
321 IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
321 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId); 322 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
322 if (account != null) 323 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
323 { 324 {
324 // local grid user 325 // local grid user
325 return; 326 return;
@@ -352,6 +353,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
352 353
353 region.ExternalHostName = uri.Host; 354 region.ExternalHostName = uri.Host;
354 region.HttpPort = (uint)uri.Port; 355 region.HttpPort = (uint)uri.Port;
356 region.ServerURI = uri.ToString();
355 region.RegionName = string.Empty; 357 region.RegionName = string.Empty;
356 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); 358 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
357 return region; 359 return region;
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..dbe2560 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -425,6 +425,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
425 425
426 //} 426 //}
427 427
428 public bool IsLocalGridUser(UUID uuid)
429 {
430 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
431 if (account == null || (account != null && !account.LocalToGrid))
432 return false;
433
434 return true;
435 }
436
428 #endregion IUserManagement 437 #endregion IUserManagement
429 438
430 private void HandleShowUsers(string module, string[] cmd) 439 private void HandleShowUsers(string module, string[] cmd)
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 84ff22b..2fe36c1 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -415,8 +415,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
415 } 415 }
416 416
417 Request.Timeout = HttpTimeout; 417 Request.Timeout = HttpTimeout;
418 // execute the request 418 try
419 response = (HttpWebResponse) Request.GetResponse(); 419 {
420 // execute the request
421 response = (HttpWebResponse) Request.GetResponse();
422 }
423 catch (WebException e)
424 {
425 if (e.Status != WebExceptionStatus.ProtocolError)
426 {
427 throw;
428 }
429 response = (HttpWebResponse)e.Response;
430 }
431
432 Status = (int)response.StatusCode;
420 433
421 Stream resStream = response.GetResponseStream(); 434 Stream resStream = response.GetResponseStream();
422 435
@@ -473,7 +486,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
473 response.Close(); 486 response.Close();
474 } 487 }
475 488
476 Status = (int)OSHttpStatusCode.SuccessOk;
477 _finished = true; 489 _finished = true;
478 } 490 }
479 491
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..ea0ba59 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -48,5 +48,7 @@ namespace OpenSim.Region.Framework.Interfaces
48 /// <param name="firstName"></param> 48 /// <param name="firstName"></param>
49 /// <param name="profileURL"></param> 49 /// <param name="profileURL"></param>
50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL); 50 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
51
52 bool IsLocalGridUser(UUID uuid);
51 } 53 }
52} 54}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b828f39..26f915b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -737,7 +737,7 @@ namespace OpenSim.Region.Framework.Scenes
737 if (maptileRefresh != 0) 737 if (maptileRefresh != 0)
738 { 738 {
739 m_mapGenerationTimer.Interval = maptileRefresh * 1000; 739 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
740 m_mapGenerationTimer.Elapsed += RegenerateMaptile; 740 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
741 m_mapGenerationTimer.AutoReset = true; 741 m_mapGenerationTimer.AutoReset = true;
742 m_mapGenerationTimer.Start(); 742 m_mapGenerationTimer.Start();
743 } 743 }
@@ -1697,21 +1697,17 @@ namespace OpenSim.Region.Framework.Scenes
1697 { 1697 {
1698 m_sceneGridService.SetScene(this); 1698 m_sceneGridService.SetScene(this);
1699 1699
1700 //// Unfortunately this needs to be here and it can't be async.
1701 //// The map tile image is stored in RegionSettings, but it also needs to be
1702 //// stored in the GridService, because that's what the world map module uses
1703 //// to send the map image UUIDs (of other regions) to the viewer...
1704 if (m_generateMaptiles)
1705 RegenerateMaptile();
1706
1700 GridRegion region = new GridRegion(RegionInfo); 1707 GridRegion region = new GridRegion(RegionInfo);
1701 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); 1708 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1702 if (error != String.Empty) 1709 if (error != String.Empty)
1703 {
1704 throw new Exception(error); 1710 throw new Exception(error);
1705 }
1706
1707 // Generate the maptile asynchronously, because sometimes it can be very slow and we
1708 // don't want this to delay starting the region.
1709 if (m_generateMaptiles)
1710 {
1711 Util.FireAndForget(delegate {
1712 RegenerateMaptile(null, null);
1713 });
1714 }
1715 } 1711 }
1716 1712
1717 #endregion 1713 #endregion
@@ -5251,7 +5247,7 @@ Environment.Exit(1);
5251 /// </summary> 5247 /// </summary>
5252 /// <param name="sender"></param> 5248 /// <param name="sender"></param>
5253 /// <param name="e"></param> 5249 /// <param name="e"></param>
5254 public void RegenerateMaptile(object sender, ElapsedEventArgs e) 5250 private void RegenerateMaptile()
5255 { 5251 {
5256 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); 5252 IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
5257 if (mapModule != null) 5253 if (mapModule != null)
@@ -5306,6 +5302,17 @@ Environment.Exit(1);
5306 } 5302 }
5307 } 5303 }
5308 5304
5305 private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e)
5306 {
5307 RegenerateMaptile();
5308
5309 // We need to propagate the new image UUID to the grid service
5310 // so that all simulators can retrieve it
5311 string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
5312 if (error != string.Empty)
5313 throw new Exception(error);
5314 }
5315
5309 // This method is called across the simulation connector to 5316 // This method is called across the simulation connector to
5310 // determine if a given agent is allowed in this region 5317 // determine if a given agent is allowed in this region
5311 // AS A ROOT AGENT. Returning false here will prevent them 5318 // AS A ROOT AGENT. Returning false here will prevent them
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 2194ff0..228eca9 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -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/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 c753c6a..c3268d1 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -199,6 +199,8 @@ namespace OpenSim.Services.Connectors
199 199
200 public AssetBase GetCached(string id) 200 public AssetBase GetCached(string id)
201 { 201 {
202// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
203
202 if (m_Cache != null) 204 if (m_Cache != null)
203 return m_Cache.Get(id); 205 return m_Cache.Get(id);
204 206
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
index 8ac89cc..c030bca 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors
62 else 62 else
63 { 63 {
64 serverURI = serverURI + "xxx"; 64 serverURI = serverURI + "xxx";
65 m_ServerURI = serverURI.Replace("?" + uri.Query, ""); 65 m_ServerURI = serverURI.Replace(uri.Query, "");
66 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; 66 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/";
67 } 67 }
68 } 68 }
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index afbd093..a73bf9e 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -332,6 +332,9 @@ namespace OpenSim.Services.Connectors.Hypergrid
332 UInt32.TryParse((string)hash["http_port"], out p); 332 UInt32.TryParse((string)hash["http_port"], out p);
333 region.HttpPort = p; 333 region.HttpPort = p;
334 } 334 }
335 if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
336 region.ServerURI = (string)hash["server_uri"];
337
335 if (hash["internal_port"] != null) 338 if (hash["internal_port"] != null)
336 { 339 {
337 int p = 0; 340 int p = 0;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 801b424..f38ebe8 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -292,6 +292,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
292 account.UserFlags = response["UserFlags"].AsInteger(); 292 account.UserFlags = response["UserFlags"].AsInteger();
293 account.UserLevel = response["AccessLevel"].AsInteger(); 293 account.UserLevel = response["AccessLevel"].AsInteger();
294 account.UserTitle = response["UserTitle"].AsString(); 294 account.UserTitle = response["UserTitle"].AsString();
295 account.LocalToGrid = true;
296 if (response.ContainsKey("LocalToGrid"))
297 account.LocalToGrid = (response["LocalToGrid"].AsString() == "true" ? true : false);
298
295 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 299 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
296 300
297 // Cache the user account info 301 // Cache the user account info
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index b70b425..46d68c2 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/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index d0fddee..6d5d2a0 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -92,6 +92,7 @@ namespace OpenSim.Services.Interfaces
92 public int UserFlags; 92 public int UserFlags;
93 public string UserTitle; 93 public string UserTitle;
94 public string UserCountry; 94 public string UserCountry;
95 public Boolean LocalToGrid = true;
95 96
96 public Dictionary<string, object> ServiceURLs; 97 public Dictionary<string, object> ServiceURLs;
97 98
@@ -122,6 +123,8 @@ namespace OpenSim.Services.Interfaces
122 UserTitle = kvp["UserTitle"].ToString(); 123 UserTitle = kvp["UserTitle"].ToString();
123 if (kvp.ContainsKey("UserCountry")) 124 if (kvp.ContainsKey("UserCountry"))
124 UserCountry = kvp["UserCountry"].ToString(); 125 UserCountry = kvp["UserCountry"].ToString();
126 if (kvp.ContainsKey("LocalToGrid"))
127 Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid);
125 128
126 if (kvp.ContainsKey("Created")) 129 if (kvp.ContainsKey("Created"))
127 Created = Convert.ToInt32(kvp["Created"].ToString()); 130 Created = Convert.ToInt32(kvp["Created"].ToString());
@@ -156,6 +159,7 @@ namespace OpenSim.Services.Interfaces
156 result["UserFlags"] = UserFlags.ToString(); 159 result["UserFlags"] = UserFlags.ToString();
157 result["UserTitle"] = UserTitle; 160 result["UserTitle"] = UserTitle;
158 result["UserCountry"] = UserCountry; 161 result["UserCountry"] = UserCountry;
162 result["LocalToGrid"] = LocalToGrid.ToString();
159 163
160 string str = string.Empty; 164 string str = string.Empty;
161 foreach (KeyValuePair<string, object> kvp in ServiceURLs) 165 foreach (KeyValuePair<string, object> kvp in ServiceURLs)