aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs92
1 files changed, 49 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 1fdf1ef..0c5097a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -31,7 +31,7 @@ using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34
35using OpenSim.Server.Base; 35using OpenSim.Server.Base;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
50 private bool m_Enabled = false; 50 private bool m_Enabled = false;
51 private bool m_Initialized = false; 51 private bool m_Initialized = false;
52 private Scene m_Scene; 52 private Scene m_Scene;
53 private UserProfileCacheService m_UserProfileService; // This should change to IUserProfileService 53 private IUserAccountService m_UserAccountService; // This should change to IUserProfileService
54 54
55 private IInventoryService m_GridService; 55 private IInventoryService m_GridService;
56 private ISessionAuthInventoryService m_HGService; 56 private ISessionAuthInventoryService m_HGService;
@@ -61,9 +61,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
61 { 61 {
62 get 62 get
63 { 63 {
64 if (m_LocalGridInventoryURI == null || m_LocalGridInventoryURI == "") 64 return string.Empty;
65 m_LocalGridInventoryURI = m_Scene.CommsManager.NetworkServersInfo.InventoryURL; 65 // REFACTORING PROBLEM
66 return m_LocalGridInventoryURI; 66 //if (m_LocalGridInventoryURI == null || m_LocalGridInventoryURI == "")
67 // m_LocalGridInventoryURI = m_Scene.CommsManager.NetworkServersInfo.InventoryURL;
68 //return m_LocalGridInventoryURI;
67 } 69 }
68 } 70 }
69 71
@@ -157,11 +159,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
157 if (!m_Initialized) 159 if (!m_Initialized)
158 { 160 {
159 m_Scene = scene; 161 m_Scene = scene;
160 // HACK for now. Ugh! 162 m_UserAccountService = m_Scene.UserAccountService;
161 m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
162 // ugh!
163 m_UserProfileService.SetInventoryService(this);
164 scene.CommsManager.UserService.SetInventoryService(this);
165 163
166 m_Initialized = true; 164 m_Initialized = true;
167 } 165 }
@@ -515,58 +513,66 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
515 513
516 private UUID GetSessionID(UUID userID) 514 private UUID GetSessionID(UUID userID)
517 { 515 {
518 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 516 ScenePresence sp = null;
519 if (uinfo != null) 517 if (m_Scene.TryGetAvatar(userID, out sp))
520 return uinfo.SessionID; 518 {
519 return sp.ControllingClient.SessionId;
520 }
521 521
522 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID); 522 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID);
523 return UUID.Zero; 523 return UUID.Zero;
524 } 524 }
525 525
526 private bool IsLocalGridUser(UUID userID) 526 private bool IsLocalGridUser(UUID userID)
527 { 527 {
528 if (m_UserProfileService == null) 528 return true;
529 {
530 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false.");
531 return false;
532 }
533 529
534 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 530 // REFACTORING PROBLEM. This needs to be rewritten
535 if (uinfo == null)
536 {
537 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID);
538 return true;
539 }
540 531
541 if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == "")) 532 //if (m_UserAccountService == null)
542 // this happens in standalone profiles, apparently 533 //{
543 return true; 534 // m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no user account service. Returning false.");
535 // return false;
536 //}
537
538 //UserAccount uinfo = m_UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
539 //if (uinfo == null)
540 //{
541 // m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no account for user {0}. Returning false.", userID);
542 // return false;
543 //}
544
545 //if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
546 // // this happens in standalone profiles, apparently
547 // return true;
544 548
545 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI); 549 //string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
546 550
547 string uri = LocalGridInventory.TrimEnd('/'); 551 //string uri = LocalGridInventory.TrimEnd('/');
548 552
549 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 553 //if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
550 { 554 //{
551 return true; 555 // return true;
552 } 556 //}
553 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri); 557 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
554 return false; 558 //return false;
555 } 559 }
556 560
557 private string GetUserInventoryURI(UUID userID) 561 private string GetUserInventoryURI(UUID userID)
558 { 562 {
559 string invURI = LocalGridInventory; 563 string invURI = LocalGridInventory;
564 // REFACTORING PROBLEM!!! This needs to be rewritten
565
566 //CachedUserInfo uinfo = m_UserAccountService.GetUserDetails(userID);
567 //if ((uinfo == null) || (uinfo.UserProfile == null))
568 // return invURI;
560 569
561 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 570 //string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
562 if ((uinfo == null) || (uinfo.UserProfile == null))
563 return invURI;
564 571
565 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI); 572 //if ((userInventoryServerURI != null) &&
573 // (userInventoryServerURI != ""))
574 // invURI = userInventoryServerURI;
566 575
567 if ((userInventoryServerURI != null) &&
568 (userInventoryServerURI != ""))
569 invURI = userInventoryServerURI;
570 return invURI; 576 return invURI;
571 } 577 }
572 578