diff options
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index d9a021f..44906b4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -39,7 +40,8 @@ using OpenSim.Services.Interfaces; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | 41 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer |
41 | { | 42 | { |
42 | public class InventoryTransferModule : IInventoryTransferModule, IRegionModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
44 | public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule | ||
43 | { | 45 | { |
44 | private static readonly ILog m_log | 46 | private static readonly ILog m_log |
45 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -50,10 +52,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
50 | new Dictionary<UUID, Scene>(); | 52 | new Dictionary<UUID, Scene>(); |
51 | 53 | ||
52 | private IMessageTransferModule m_TransferModule = null; | 54 | private IMessageTransferModule m_TransferModule = null; |
55 | private bool m_enabled = true; | ||
53 | 56 | ||
54 | #region IRegionModule Members | 57 | #region ISharedRegionModule Members |
55 | 58 | ||
56 | public void Initialise(Scene scene, IConfigSource config) | 59 | public void Initialise(IConfigSource config) |
57 | { | 60 | { |
58 | if (config.Configs["Messaging"] != null) | 61 | if (config.Configs["Messaging"] != null) |
59 | { | 62 | { |
@@ -62,31 +65,61 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
62 | if (config.Configs["Messaging"].GetString( | 65 | if (config.Configs["Messaging"].GetString( |
63 | "InventoryTransferModule", "InventoryTransferModule") != | 66 | "InventoryTransferModule", "InventoryTransferModule") != |
64 | "InventoryTransferModule") | 67 | "InventoryTransferModule") |
65 | return; | 68 | m_enabled = false; |
66 | } | 69 | } |
70 | } | ||
71 | |||
72 | public Type ReplaceableInterface | ||
73 | { | ||
74 | get { return null; } | ||
75 | } | ||
67 | 76 | ||
68 | if (!m_Scenelist.Contains(scene)) | 77 | public void AddRegion(Scene scene) |
78 | { | ||
79 | if (m_enabled) | ||
69 | { | 80 | { |
70 | m_Scenelist.Add(scene); | 81 | if (!m_Scenelist.Contains(scene)) |
82 | { | ||
83 | m_Scenelist.Add(scene); | ||
71 | 84 | ||
72 | scene.RegisterModuleInterface<IInventoryTransferModule>(this); | 85 | scene.RegisterModuleInterface<IInventoryTransferModule>(this); |
73 | 86 | ||
74 | scene.EventManager.OnNewClient += OnNewClient; | 87 | scene.EventManager.OnNewClient += OnNewClient; |
75 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 88 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
76 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 89 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
90 | } | ||
77 | } | 91 | } |
78 | } | 92 | } |
79 | 93 | ||
80 | public void PostInitialise() | 94 | public void RegionLoaded(Scene scene) |
81 | { | 95 | { |
82 | if (m_Scenelist.Count > 0) | 96 | if (m_enabled) |
83 | { | 97 | { |
84 | m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>(); | 98 | if (m_Scenelist.Count > 0) |
85 | if (m_TransferModule == null) | 99 | { |
86 | m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); | 100 | m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>(); |
101 | if (m_TransferModule == null) | ||
102 | m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); | ||
103 | } | ||
87 | } | 104 | } |
88 | } | 105 | } |
89 | 106 | ||
107 | public void RemoveRegion(Scene scene) | ||
108 | { | ||
109 | if (m_Scenelist.Contains(scene)) | ||
110 | m_Scenelist.Remove(scene); | ||
111 | |||
112 | scene.UnregisterModuleInterface<IInventoryTransferModule>(this); | ||
113 | |||
114 | scene.EventManager.OnNewClient -= OnNewClient; | ||
115 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | ||
116 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | ||
117 | } | ||
118 | |||
119 | public void PostInitialise() | ||
120 | { | ||
121 | } | ||
122 | |||
90 | public void Close() | 123 | public void Close() |
91 | { | 124 | { |
92 | } | 125 | } |