aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs81
1 files changed, 43 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 7584dd8..5ed2b7a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -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;
@@ -157,10 +157,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
157 if (!m_Initialized) 157 if (!m_Initialized)
158 { 158 {
159 m_Scene = scene; 159 m_Scene = scene;
160 // HACK for now. Ugh! 160 m_UserAccountService = m_Scene.UserAccountService;
161 m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
162 // ugh!
163 m_UserProfileService.SetInventoryService(this);
164 161
165 m_Initialized = true; 162 m_Initialized = true;
166 } 163 }
@@ -514,58 +511,66 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
514 511
515 private UUID GetSessionID(UUID userID) 512 private UUID GetSessionID(UUID userID)
516 { 513 {
517 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 514 ScenePresence sp = null;
518 if (uinfo != null) 515 if (m_Scene.TryGetAvatar(userID, out sp))
519 return uinfo.SessionID; 516 {
517 return sp.ControllingClient.SessionId;
518 }
520 519
521 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID); 520 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID);
522 return UUID.Zero; 521 return UUID.Zero;
523 } 522 }
524 523
525 private bool IsLocalGridUser(UUID userID) 524 private bool IsLocalGridUser(UUID userID)
526 { 525 {
527 if (m_UserProfileService == null) 526 return true;
528 {
529 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false.");
530 return false;
531 }
532 527
533 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 528 // REFACTORING PROBLEM. This needs to be rewritten
534 if (uinfo == null)
535 {
536 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID);
537 return true;
538 }
539 529
540 if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == "")) 530 //if (m_UserAccountService == null)
541 // this happens in standalone profiles, apparently 531 //{
542 return true; 532 // m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no user account service. Returning false.");
533 // return false;
534 //}
535
536 //UserAccount uinfo = m_UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
537 //if (uinfo == null)
538 //{
539 // m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no account for user {0}. Returning false.", userID);
540 // return false;
541 //}
542
543 //if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
544 // // this happens in standalone profiles, apparently
545 // return true;
543 546
544 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI); 547 //string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
545 548
546 string uri = LocalGridInventory.TrimEnd('/'); 549 //string uri = LocalGridInventory.TrimEnd('/');
547 550
548 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 551 //if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
549 { 552 //{
550 return true; 553 // return true;
551 } 554 //}
552 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri); 555 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
553 return false; 556 //return false;
554 } 557 }
555 558
556 private string GetUserInventoryURI(UUID userID) 559 private string GetUserInventoryURI(UUID userID)
557 { 560 {
558 string invURI = LocalGridInventory; 561 string invURI = LocalGridInventory;
562 // REFACTORING PROBLEM!!! This needs to be rewritten
563
564 //CachedUserInfo uinfo = m_UserAccountService.GetUserDetails(userID);
565 //if ((uinfo == null) || (uinfo.UserProfile == null))
566 // return invURI;
559 567
560 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 568 //string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
561 if ((uinfo == null) || (uinfo.UserProfile == null))
562 return invURI;
563 569
564 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI); 570 //if ((userInventoryServerURI != null) &&
571 // (userInventoryServerURI != ""))
572 // invURI = userInventoryServerURI;
565 573
566 if ((userInventoryServerURI != null) &&
567 (userInventoryServerURI != ""))
568 invURI = userInventoryServerURI;
569 return invURI; 574 return invURI;
570 } 575 }
571 576