Fix interface registration/deregistration mechanics

0.6.5-rc1
Melanie Thielker 2009-05-12 23:49:42 +00:00
parent 55dd6d4334
commit 88371e4f98
2 changed files with 16 additions and 9 deletions

View File

@ -107,6 +107,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.User
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
scene.RegisterModuleInterface<IUserService>(m_UserService);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)

View File

@ -368,11 +368,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="mod"></param> /// <param name="mod"></param>
public void RegisterModuleInterface<M>(M mod) public void RegisterModuleInterface<M>(M mod)
{ {
if (!ModuleInterfaces.ContainsKey(typeof(M))) List<Object> l = null;
if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
{ {
List<Object> l = new List<Object>(); l = new List<Object>();
l.Add(mod);
ModuleInterfaces.Add(typeof(M), l); ModuleInterfaces.Add(typeof(M), l);
}
if (l.Count > 0)
return;
l.Add(mod);
if (mod is IEntityCreator) if (mod is IEntityCreator)
{ {
@ -383,7 +389,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
}
public void UnregisterModuleInterface<M>(M mod) public void UnregisterModuleInterface<M>(M mod)
{ {