Bug fix: change HGBroker to a INonSharedRegionModule

slimupdates
Diva Canto 2010-01-30 15:43:10 -08:00
parent 42f978a478
commit a0d79e621c
3 changed files with 82 additions and 71 deletions

View File

@ -183,7 +183,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public bool IsForeignUser(UUID userID, out string assetServerURL)
{
assetServerURL = string.Empty;
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
UserAccount account = null;
if (m_Scene.UserAccountService != null)
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
if (account == null) // foreign
{
ScenePresence sp = null;
@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
{
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
return true;
assetServerURL = assetServerURL.Trim(new char[] { '/' }); return true;
}
}
}

View File

@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{
public abstract class BaseInventoryConnector : IInventoryService
{
protected InventoryCache m_cache;
protected static InventoryCache m_cache;
private static bool m_Initialized;
protected virtual void Init(IConfigSource source)
{
if (!m_Initialized)
{
m_cache = new InventoryCache();
m_cache.Init(source, this);
m_Initialized = true;
}
}
/// <summary>

View File

@ -41,20 +41,21 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{
public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService
public class HGInventoryBroker : BaseInventoryConnector, INonSharedRegionModule, IInventoryService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private bool m_Initialized = false;
private static bool m_Initialized = false;
private static bool m_Enabled = false;
private static IInventoryService m_GridService;
private static ISessionAuthInventoryService m_HGService;
private Scene m_Scene;
private IUserAccountService m_UserAccountService;
private IInventoryService m_GridService;
private ISessionAuthInventoryService m_HGService;
public Type ReplaceableInterface
{
get { return null; }
@ -66,6 +67,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
public void Initialise(IConfigSource source)
{
if (!m_Initialized)
{
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
@ -125,6 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
}
}
m_Initialized = true;
}
}
public void PostInitialise()
@ -140,14 +145,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
if (!m_Enabled)
return;
if (!m_Initialized)
{
m_Scene = scene;
m_UserAccountService = m_Scene.UserAccountService;
m_Initialized = true;
}
scene.RegisterModuleInterface<IInventoryService>(this);
m_cache.AddRegion(scene);
}
@ -514,7 +514,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
private bool IsForeignUser(UUID userID, out string inventoryURL)
{
inventoryURL = string.Empty;
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
UserAccount account = null;
if (m_Scene.UserAccountService != null)
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
if (account == null) // foreign user
{
ScenePresence sp = null;