diff options
author | Diva Canto | 2010-01-17 11:35:27 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-17 11:35:27 -0800 |
commit | 5e034f5933fd23d6023167cdb24a141eac1f2e85 (patch) | |
tree | b05dbf1d2009a7714fbb111c0288b47c9121f61e /OpenSim | |
parent | HG agent transfers are starting to work. Gatekeeper handlers are missing. (diff) | |
download | opensim-SC-5e034f5933fd23d6023167cdb24a141eac1f2e85.zip opensim-SC-5e034f5933fd23d6023167cdb24a141eac1f2e85.tar.gz opensim-SC-5e034f5933fd23d6023167cdb24a141eac1f2e85.tar.bz2 opensim-SC-5e034f5933fd23d6023167cdb24a141eac1f2e85.tar.xz |
Oops, forgot this one.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs new file mode 100644 index 0000000..5d88311 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Services.Connectors.Hypergrid; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | |||
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
38 | |||
39 | using OpenMetaverse; | ||
40 | using log4net; | ||
41 | using Nini.Config; | ||
42 | |||
43 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | ||
44 | { | ||
45 | public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule | ||
46 | { | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private bool m_Enabled = false; | ||
50 | private IHypergridService m_HypergridService; | ||
51 | private IHypergridService HyperGridService | ||
52 | { | ||
53 | get | ||
54 | { | ||
55 | if (m_HypergridService == null) | ||
56 | m_HypergridService = m_aScene.RequestModuleInterface<IHypergridService>(); | ||
57 | return m_HypergridService; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | #region ISharedRegionModule | ||
62 | |||
63 | public override string Name | ||
64 | { | ||
65 | get { return "HGEntityTransferModule"; } | ||
66 | } | ||
67 | |||
68 | public override void Initialise(IConfigSource source) | ||
69 | { | ||
70 | IConfig moduleConfig = source.Configs["Modules"]; | ||
71 | if (moduleConfig != null) | ||
72 | { | ||
73 | string name = moduleConfig.GetString("EntityTransferModule", ""); | ||
74 | if (name == Name) | ||
75 | { | ||
76 | m_agentsInTransit = new List<UUID>(); | ||
77 | m_Enabled = true; | ||
78 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public override void PostInitialise() | ||
84 | { | ||
85 | } | ||
86 | |||
87 | public override void AddRegion(Scene scene) | ||
88 | { | ||
89 | if (!m_Enabled) | ||
90 | return; | ||
91 | |||
92 | if (m_aScene == null) | ||
93 | m_aScene = scene; | ||
94 | |||
95 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | ||
96 | } | ||
97 | |||
98 | public override void Close() | ||
99 | { | ||
100 | if (!m_Enabled) | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | |||
105 | public override void RemoveRegion(Scene scene) | ||
106 | { | ||
107 | if (!m_Enabled) | ||
108 | return; | ||
109 | if (scene == m_aScene) | ||
110 | m_aScene = null; | ||
111 | } | ||
112 | |||
113 | public override void RegionLoaded(Scene scene) | ||
114 | { | ||
115 | if (!m_Enabled) | ||
116 | return; | ||
117 | |||
118 | } | ||
119 | |||
120 | #endregion | ||
121 | |||
122 | #region HG overrides | ||
123 | |||
124 | protected override GridRegion GetFinalDestination(GridRegion region) | ||
125 | { | ||
126 | return HyperGridService.GetHyperlinkRegion(region, region.RegionID); | ||
127 | } | ||
128 | |||
129 | protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | ||
130 | { | ||
131 | return true; | ||
132 | } | ||
133 | |||
134 | |||
135 | #endregion | ||
136 | } | ||
137 | } | ||