diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 63 |
2 files changed, 77 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ecd60bd..a04ab22 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
@@ -41,10 +42,11 @@ using OpenSim.Services.Interfaces; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 43 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
44 | /// <summary> | 46 | /// <summary> |
45 | /// This module loads and saves OpenSimulator inventory archives | 47 | /// This module loads and saves OpenSimulator inventory archives |
46 | /// </summary> | 48 | /// </summary> |
47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule | 49 | public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule |
48 | { | 50 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 52 | ||
@@ -82,18 +84,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
82 | DisablePresenceChecks = disablePresenceChecks; | 84 | DisablePresenceChecks = disablePresenceChecks; |
83 | } | 85 | } |
84 | 86 | ||
85 | public void Initialise(Scene scene, IConfigSource source) | 87 | public void Initialise(IConfigSource source) |
88 | { | ||
89 | |||
90 | } | ||
91 | |||
92 | public Type ReplaceableInterface | ||
93 | { | ||
94 | get { return null; } | ||
95 | } | ||
96 | |||
97 | public void AddRegion(Scene scene) | ||
86 | { | 98 | { |
87 | if (m_scenes.Count == 0) | 99 | if (m_scenes.Count == 0) |
88 | { | 100 | { |
89 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 101 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
90 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 102 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
91 | 103 | ||
92 | scene.AddCommand( | 104 | scene.AddCommand( |
93 | this, "load iar", | 105 | this, "load iar", |
94 | "load iar <first> <last> <inventory path> <password> [<archive path>]", | 106 | "load iar <first> <last> <inventory path> <password> [<archive path>]", |
95 | "Load user inventory archive.", HandleLoadInvConsoleCommand); | 107 | "Load user inventory archive.", HandleLoadInvConsoleCommand); |
96 | 108 | ||
97 | scene.AddCommand( | 109 | scene.AddCommand( |
98 | this, "save iar", | 110 | this, "save iar", |
99 | "save iar <first> <last> <inventory path> <password> [<archive path>]", | 111 | "save iar <first> <last> <inventory path> <password> [<archive path>]", |
@@ -101,10 +113,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
101 | 113 | ||
102 | m_aScene = scene; | 114 | m_aScene = scene; |
103 | } | 115 | } |
104 | 116 | ||
105 | m_scenes[scene.RegionInfo.RegionID] = scene; | 117 | m_scenes[scene.RegionInfo.RegionID] = scene; |
106 | } | 118 | } |
107 | 119 | ||
120 | public void RegionLoaded(Scene scene) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | public void RemoveRegion(Scene scene) | ||
125 | { | ||
126 | scene.UnregisterModuleInterface<IInventoryArchiverModule>(this); | ||
127 | if(m_scenes.ContainsKey(scene.RegionInfo.RegionID)) | ||
128 | m_scenes.Remove(scene.RegionInfo.RegionID); | ||
129 | } | ||
130 | |||
108 | public void PostInitialise() {} | 131 | public void PostInitialise() {} |
109 | 132 | ||
110 | public void Close() {} | 133 | public void Close() {} |
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 | } |