diff options
Start of trying to make Region/Scene more modular.
Added preliminary IRegionModule interface.
Also have a work in progress way of Modules registering optional API methods (kind of like Apache optional functions). But there must be a cleaner/nicer way in c# of doing these than the current way.
Added three work in progress modules: ChatModule (simple handles in world chat, but by moving this to a module, we could support other types of chat modules, ie like a irc - opensim bridge module. ) , AvatarProfilesModule and XferModule.
Moved most of the code from Scene.ModifyTerrain() into the BasicTerrain library, as the start of trying to make that more modular.
Stopped Child agents showing up as part of the "show users" command.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/XferModule.cs (renamed from OpenSim/Region/Environment/XferManager.cs) | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/XferManager.cs b/OpenSim/Region/Environment/XferModule.cs index c49601c..beb72120 100644 --- a/OpenSim/Region/Environment/XferManager.cs +++ b/OpenSim/Region/Environment/XferModule.cs | |||
@@ -5,17 +5,50 @@ using System.Text; | |||
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Region.Environment.Scenes; | ||
9 | using OpenSim.Region.Environment.Interfaces; | ||
8 | 10 | ||
9 | namespace OpenSim.Region.Environment | 11 | namespace OpenSim.Region.Environment |
10 | { | 12 | { |
11 | public class XferManager | 13 | public class XferModule : IRegionModule |
12 | { | 14 | { |
13 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 15 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); |
14 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 16 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
15 | 17 | ||
16 | public XferManager() | 18 | private Scene m_scene; |
19 | |||
20 | public XferModule() | ||
21 | { | ||
22 | |||
23 | } | ||
24 | |||
25 | public void Initialise(Scene scene) | ||
26 | { | ||
27 | m_scene = scene; | ||
28 | m_scene.EventManager.OnNewClient += NewClient; | ||
29 | |||
30 | m_scene.RegisterAPIMethod("API_AddXferFile", new ModuleAPIMethod<bool, string, byte[]>(this.AddNewFile)); | ||
31 | } | ||
32 | |||
33 | public void PostInitialise() | ||
34 | { | ||
35 | |||
36 | } | ||
37 | |||
38 | public void CloseDown() | ||
39 | { | ||
40 | |||
41 | } | ||
42 | |||
43 | public string GetName() | ||
17 | { | 44 | { |
45 | return "XferModule"; | ||
46 | } | ||
18 | 47 | ||
48 | public void NewClient(IClientAPI client) | ||
49 | { | ||
50 | client.OnRequestXfer += RequestXfer; | ||
51 | client.OnConfirmXfer += AckPacket; | ||
19 | } | 52 | } |
20 | 53 | ||
21 | /// <summary> | 54 | /// <summary> |
@@ -50,7 +83,7 @@ namespace OpenSim.Region.Environment | |||
50 | } | 83 | } |
51 | } | 84 | } |
52 | 85 | ||
53 | public void AddNewFile(string fileName, byte[] data) | 86 | public bool AddNewFile(string fileName, byte[] data) |
54 | { | 87 | { |
55 | lock (NewFiles) | 88 | lock (NewFiles) |
56 | { | 89 | { |
@@ -63,8 +96,10 @@ namespace OpenSim.Region.Environment | |||
63 | NewFiles.Add(fileName, data); | 96 | NewFiles.Add(fileName, data); |
64 | } | 97 | } |
65 | } | 98 | } |
99 | return true; | ||
66 | } | 100 | } |
67 | 101 | ||
102 | |||
68 | public class XferDownLoad | 103 | public class XferDownLoad |
69 | { | 104 | { |
70 | public byte[] Data = new byte[0]; | 105 | public byte[] Data = new byte[0]; |