mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
This commit is contained in:
@@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -41,10 +42,11 @@ using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
/// <summary>
|
||||
/// This module loads and saves OpenSimulator inventory archives
|
||||
/// </summary>
|
||||
public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule
|
||||
public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -82,18 +84,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
DisablePresenceChecks = disablePresenceChecks;
|
||||
}
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_scenes.Count == 0)
|
||||
{
|
||||
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
|
||||
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
||||
|
||||
|
||||
scene.AddCommand(
|
||||
this, "load iar",
|
||||
"load iar <first> <last> <inventory path> <password> [<archive path>]",
|
||||
"Load user inventory archive.", HandleLoadInvConsoleCommand);
|
||||
|
||||
"Load user inventory archive.", HandleLoadInvConsoleCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "save iar",
|
||||
"save iar <first> <last> <inventory path> <password> [<archive path>]",
|
||||
@@ -101,10 +113,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
m_aScene = scene;
|
||||
}
|
||||
|
||||
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
scene.UnregisterModuleInterface<IInventoryArchiverModule>(this);
|
||||
if(m_scenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
m_scenes.Remove(scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void PostInitialise() {}
|
||||
|
||||
public void Close() {}
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -39,7 +40,8 @@ using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
{
|
||||
public class InventoryTransferModule : IInventoryTransferModule, IRegionModule
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||
public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
@@ -50,10 +52,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
new Dictionary<UUID, Scene>();
|
||||
|
||||
private IMessageTransferModule m_TransferModule = null;
|
||||
private bool m_enabled = true;
|
||||
|
||||
#region IRegionModule Members
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
if (config.Configs["Messaging"] != null)
|
||||
{
|
||||
@@ -62,29 +65,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
if (config.Configs["Messaging"].GetString(
|
||||
"InventoryTransferModule", "InventoryTransferModule") !=
|
||||
"InventoryTransferModule")
|
||||
return;
|
||||
m_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_Scenelist.Contains(scene))
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_Scenelist.Add(scene);
|
||||
if (!m_Scenelist.Contains(scene))
|
||||
{
|
||||
m_Scenelist.Add(scene);
|
||||
|
||||
scene.RegisterModuleInterface<IInventoryTransferModule>(this);
|
||||
scene.RegisterModuleInterface<IInventoryTransferModule>(this);
|
||||
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
if (m_Scenelist.Count > 0)
|
||||
{
|
||||
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
|
||||
if (m_TransferModule == null)
|
||||
m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (m_Scenelist.Contains(scene))
|
||||
m_Scenelist.Remove(scene);
|
||||
|
||||
scene.UnregisterModuleInterface<IInventoryTransferModule>(this);
|
||||
|
||||
scene.EventManager.OnNewClient -= OnNewClient;
|
||||
scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_Scenelist.Count > 0)
|
||||
{
|
||||
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
|
||||
if (m_TransferModule == null)
|
||||
m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
Reference in New Issue
Block a user