diff options
Diffstat (limited to 'OpenSim/Region')
17 files changed, 145 insertions, 546 deletions
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 | ||
40 | namespace OpenSim.Region.ClientStack.LindenUDP | 40 | namespace 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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using Nini.Config; | ||
32 | using log4net; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | |||
36 | namespace 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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Client; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | |||
36 | using OpenMetaverse; | ||
37 | using Nini.Config; | ||
38 | using log4net; | ||
39 | |||
40 | namespace 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..ea0ba593 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) |