aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Hypergrid
diff options
context:
space:
mode:
authorDr Scofield2009-02-10 13:10:57 +0000
committerDr Scofield2009-02-10 13:10:57 +0000
commit180be7de07014aa33bc6066f12a0819b731c1c9d (patch)
tree3aa13af3cda4b808fa9453655875327699b61311 /OpenSim/Region/CoreModules/Hypergrid
parentStopgap measure: To use gridlaunch, or GUI, start opensim with (diff)
downloadopensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.zip
opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.gz
opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.bz2
opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.xz
this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what has happened is that OpenSim.Region.Environment.Modules has been split in two: - OpenSim.Region.CoreModules: all those modules that are either directly or indirectly referenced from other OpenSim packages, or that provide functionality that the OpenSim developer community considers core functionality: CoreModules/Agent/AssetTransaction CoreModules/Agent/Capabilities CoreModules/Agent/TextureDownload CoreModules/Agent/TextureSender CoreModules/Agent/TextureSender/Tests CoreModules/Agent/Xfer CoreModules/Avatar/AvatarFactory CoreModules/Avatar/Chat/ChatModule CoreModules/Avatar/Combat CoreModules/Avatar/Currency/SampleMoney CoreModules/Avatar/Dialog CoreModules/Avatar/Friends CoreModules/Avatar/Gestures CoreModules/Avatar/Groups CoreModules/Avatar/InstantMessage CoreModules/Avatar/Inventory CoreModules/Avatar/Inventory/Archiver CoreModules/Avatar/Inventory/Transfer CoreModules/Avatar/Lure CoreModules/Avatar/ObjectCaps CoreModules/Avatar/Profiles CoreModules/Communications/Local CoreModules/Communications/REST CoreModules/Framework/EventQueue CoreModules/Framework/InterfaceCommander CoreModules/Hypergrid CoreModules/InterGrid CoreModules/Scripting/DynamicTexture CoreModules/Scripting/EMailModules CoreModules/Scripting/HttpRequest CoreModules/Scripting/LoadImageURL CoreModules/Scripting/VectorRender CoreModules/Scripting/WorldComm CoreModules/Scripting/XMLRPC CoreModules/World/Archiver CoreModules/World/Archiver/Tests CoreModules/World/Estate CoreModules/World/Land CoreModules/World/Permissions CoreModules/World/Serialiser CoreModules/World/Sound CoreModules/World/Sun CoreModules/World/Terrain CoreModules/World/Terrain/DefaultEffects CoreModules/World/Terrain/DefaultEffects/bin CoreModules/World/Terrain/DefaultEffects/bin/Debug CoreModules/World/Terrain/Effects CoreModules/World/Terrain/FileLoaders CoreModules/World/Terrain/FloodBrushes CoreModules/World/Terrain/PaintBrushes CoreModules/World/Terrain/Tests CoreModules/World/Vegetation CoreModules/World/Wind CoreModules/World/WorldMap - OpenSim.Region.OptionalModules: all those modules that are not core modules: OptionalModules/Avatar/Chat/IRC-stuff OptionalModules/Avatar/Concierge OptionalModules/Avatar/Voice/AsterixVoice OptionalModules/Avatar/Voice/SIPVoice OptionalModules/ContentManagementSystem OptionalModules/Grid/Interregion OptionalModules/Python OptionalModules/SvnSerialiser OptionalModules/World/NPC OptionalModules/World/TreePopulator
Diffstat (limited to 'OpenSim/Region/CoreModules/Hypergrid')
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs201
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs314
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs178
3 files changed, 693 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs
new file mode 100644
index 0000000..13efe6b
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs
@@ -0,0 +1,201 @@
1/**
2 * Copyright (c) 2008, Contributors. All rights reserved.
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29using System;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33
34using log4net;
35using Nini.Config;
36
37using OpenMetaverse;
38
39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Cache;
42using OpenSim.Framework.Servers;
43using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes;
45using OpenSim.Grid.AssetServer;
46using OpenSim.Data;
47
48namespace OpenSim.Region.CoreModules.Hypergrid
49{
50 public class HGStandaloneAssetService : IRegionModule
51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private static bool initialized = false;
54 private static bool enabled = false;
55
56 Scene m_scene;
57 //AssetService m_assetService;
58
59 #region IRegionModule interface
60
61 public void Initialise(Scene scene, IConfigSource config)
62 {
63 if (!initialized)
64 {
65 initialized = true;
66 m_scene = scene;
67
68 // This module is only on for standalones in hypergrid mode
69 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
70 }
71 }
72
73 public void PostInitialise()
74 {
75 if (enabled)
76 {
77 m_log.Info("[HGStandaloneAssetService]: Starting...");
78
79 //m_assetService = new AssetService(m_scene);
80 new AssetService(m_scene);
81 }
82 }
83
84 public void Close()
85 {
86 }
87
88 public string Name
89 {
90 get { return "HGStandaloneAssetService"; }
91 }
92
93 public bool IsSharedModule
94 {
95 get { return true; }
96 }
97
98 #endregion
99
100 }
101
102 public class AssetService
103 {
104 private IUserService m_userService;
105 private bool m_doLookup = false;
106
107 public bool DoLookup
108 {
109 get { return m_doLookup; }
110 set { m_doLookup = value; }
111 }
112 private static readonly ILog m_log
113 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
114
115 public AssetService(Scene m_scene)
116 {
117 AddHttpHandlers(m_scene);
118 m_userService = m_scene.CommsManager.UserService;
119 }
120
121 protected void AddHttpHandlers(Scene m_scene)
122 {
123 IAssetDataPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin;
124
125 BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
126 httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
127 httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
128
129 }
130
131 ///// <summary>
132 ///// Check that the source of an inventory request is one that we trust.
133 ///// </summary>
134 ///// <param name="peer"></param>
135 ///// <returns></returns>
136 //public bool CheckTrustSource(IPEndPoint peer)
137 //{
138 // if (m_doLookup)
139 // {
140 // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer);
141 // UriBuilder ub = new UriBuilder(m_userserver_url);
142 // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host);
143 // foreach (IPAddress uaddr in uaddrs)
144 // {
145 // if (uaddr.Equals(peer.Address))
146 // {
147 // return true;
148 // }
149 // }
150
151 // m_log.WarnFormat(
152 // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources",
153 // peer);
154
155 // return false;
156 // }
157 // else
158 // {
159 // return true;
160 // }
161 //}
162
163 /// <summary>
164 /// Check that the source of an inventory request for a particular agent is a current session belonging to
165 /// that agent.
166 /// </summary>
167 /// <param name="session_id"></param>
168 /// <param name="avatar_id"></param>
169 /// <returns></returns>
170 public bool CheckAuthSession(string session_id, string avatar_id)
171 {
172 if (m_doLookup)
173 {
174 m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id);
175 UUID userID = UUID.Zero;
176 UUID sessionID = UUID.Zero;
177 UUID.TryParse(avatar_id, out userID);
178 UUID.TryParse(session_id, out sessionID);
179 if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero))
180 {
181 m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id);
182 return false;
183 }
184 UserProfileData userProfile = m_userService.GetUserProfile(userID);
185 if (userProfile != null && userProfile.CurrentAgent != null &&
186 userProfile.CurrentAgent.SessionID == sessionID)
187 {
188 m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access.");
189 return true;
190 }
191
192 m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected");
193 return false;
194 }
195 else
196 {
197 return true;
198 }
199 }
200 }
201}
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs
new file mode 100644
index 0000000..dfc859e
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs
@@ -0,0 +1,314 @@
1/**
2 * Copyright (c) 2008, Contributors. All rights reserved.
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29using System;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Servers;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes;
42
43namespace OpenSim.Region.CoreModules.Hypergrid
44{
45 public class HGStandaloneInventoryService : IRegionModule
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private static bool initialized = false;
49 private static bool enabled = false;
50
51 Scene m_scene;
52 //InventoryService m_inventoryService;
53
54 #region IRegionModule interface
55
56 public void Initialise(Scene scene, IConfigSource config)
57 {
58 if (!initialized)
59 {
60 initialized = true;
61 m_scene = scene;
62
63 // This module is only on for standalones
64 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
65 }
66 }
67
68 public void PostInitialise()
69 {
70 if (enabled)
71 {
72 m_log.Info("[HGStandaloneInvService]: Starting...");
73 //m_inventoryService = new InventoryService(m_scene);
74 new InventoryService(m_scene);
75 }
76 }
77
78 public void Close()
79 {
80 }
81
82 public string Name
83 {
84 get { return "HGStandaloneInventoryService"; }
85 }
86
87 public bool IsSharedModule
88 {
89 get { return true; }
90 }
91
92 #endregion
93 }
94
95 public class InventoryService
96 {
97 private static readonly ILog m_log
98 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
99
100 private InventoryServiceBase m_inventoryService;
101 private IUserService m_userService;
102 private bool m_doLookup = false;
103
104 public bool DoLookup
105 {
106 get { return m_doLookup; }
107 set { m_doLookup = value; }
108 }
109
110 public InventoryService(Scene m_scene)
111 {
112 m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
113 m_userService = m_scene.CommsManager.UserService;
114 AddHttpHandlers(m_scene);
115 }
116
117 protected void AddHttpHandlers(Scene m_scene)
118 {
119 BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
120
121 httpServer.AddStreamHandler(
122 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
123 "POST", "/GetInventory/", GetUserInventory, CheckAuthSession));
124
125 httpServer.AddStreamHandler(
126 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
127 "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession));
128
129 httpServer.AddStreamHandler(
130 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
131 "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession));
132
133 httpServer.AddStreamHandler(
134 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
135 "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession));
136
137 httpServer.AddStreamHandler(
138 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
139 "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession));
140
141 httpServer.AddStreamHandler(
142 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
143 "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession));
144
145 httpServer.AddStreamHandler(
146 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
147 "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession));
148
149 //// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
150 //// system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
151 //// It would have been better to rename this request, but complexities in the BaseHttpServer
152 //// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier
153 //// to do this for now.
154 //m_scene.AddStreamHandler(
155 // new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
156 // ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource));
157
158 //// for persistent active gestures
159 //m_scene.AddStreamHandler(
160 // new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
161 // ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource));
162 }
163
164
165 ///// <summary>
166 ///// Check that the source of an inventory request is one that we trust.
167 ///// </summary>
168 ///// <param name="peer"></param>
169 ///// <returns></returns>
170 //public bool CheckTrustSource(IPEndPoint peer)
171 //{
172 // if (m_doLookup)
173 // {
174 // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer);
175 // UriBuilder ub = new UriBuilder(m_userserver_url);
176 // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host);
177 // foreach (IPAddress uaddr in uaddrs)
178 // {
179 // if (uaddr.Equals(peer.Address))
180 // {
181 // return true;
182 // }
183 // }
184
185 // m_log.WarnFormat(
186 // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources",
187 // peer);
188
189 // return false;
190 // }
191 // else
192 // {
193 // return true;
194 // }
195 //}
196
197 /// <summary>
198 /// Check that the source of an inventory request for a particular agent is a current session belonging to
199 /// that agent.
200 /// </summary>
201 /// <param name="session_id"></param>
202 /// <param name="avatar_id"></param>
203 /// <returns></returns>
204 public bool CheckAuthSession(string session_id, string avatar_id)
205 {
206 if (m_doLookup)
207 {
208 m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id);
209 UUID userID = UUID.Zero;
210 UUID sessionID = UUID.Zero;
211 UUID.TryParse(avatar_id, out userID);
212 UUID.TryParse(session_id, out sessionID);
213 if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero))
214 {
215 m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id);
216 return false;
217 }
218 UserProfileData userProfile = m_userService.GetUserProfile(userID);
219 if (userProfile != null && userProfile.CurrentAgent != null &&
220 userProfile.CurrentAgent.SessionID == sessionID)
221 {
222 m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access.");
223 return true;
224 }
225
226 m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected");
227 return false;
228 }
229 else
230 {
231 return true;
232 }
233 }
234
235
236 /// <summary>
237 /// Return a user's entire inventory
238 /// </summary>
239 /// <param name="rawUserID"></param>
240 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
241 public InventoryCollection GetUserInventory(Guid rawUserID)
242 {
243 UUID userID = new UUID(rawUserID);
244
245 m_log.Info("[HGStandaloneInvService]: Processing request for inventory of " + userID);
246
247 // Uncomment me to simulate a slow responding inventory server
248 //Thread.Sleep(16000);
249
250 InventoryCollection invCollection = new InventoryCollection();
251
252 List<InventoryFolderBase> allFolders = ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID);
253
254 if (null == allFolders)
255 {
256 m_log.WarnFormat("[HGStandaloneInvService]: No inventory found for user {0}", rawUserID);
257
258 return invCollection;
259 }
260
261 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
262
263 foreach (InventoryFolderBase folder in allFolders)
264 {
265 List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(folder.ID);
266
267 if (items != null)
268 {
269 allItems.InsertRange(0, items);
270 }
271 }
272
273 invCollection.UserID = userID;
274 invCollection.Folders = allFolders;
275 invCollection.Items = allItems;
276
277 // foreach (InventoryFolderBase folder in invCollection.Folders)
278 // {
279 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
280 // }
281 //
282 // foreach (InventoryItemBase item in invCollection.Items)
283 // {
284 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
285 // }
286
287 m_log.InfoFormat(
288 "[HGStandaloneInvService]: Sending back inventory response to user {0} containing {1} folders and {2} items",
289 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
290
291 return invCollection;
292 }
293
294 /// <summary>
295 /// Guid to UUID wrapper for same name IInventoryServices method
296 /// </summary>
297 /// <param name="rawUserID"></param>
298 /// <returns></returns>
299 public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID)
300 {
301 UUID userID = new UUID(rawUserID);
302 return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID);
303 }
304
305 public List<InventoryItemBase> GetActiveGestures(Guid rawUserID)
306 {
307 UUID userID = new UUID(rawUserID);
308
309 m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID);
310
311 return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID);
312 }
313 }
314}
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
new file mode 100644
index 0000000..5540cc3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -0,0 +1,178 @@
1/**
2 * Copyright (c) 2008, Contributors. All rights reserved.
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using System.Drawing;
34using System.Drawing.Imaging;
35using System.IO;
36using System.Net;
37using System.Reflection;
38using System.Threading;
39using OpenMetaverse;
40using OpenMetaverse.Imaging;
41using OpenMetaverse.StructuredData;
42using log4net;
43using Nini.Config;
44using Nwc.XmlRpc;
45
46using OpenSim.Framework;
47using OpenSim.Framework.Communications.Cache;
48using OpenSim.Framework.Communications.Capabilities;
49using OpenSim.Framework.Servers;
50using OpenSim.Region.Framework.Interfaces;
51using OpenSim.Region.Framework.Scenes;
52using OpenSim.Region.Framework.Scenes.Types;
53using OpenSim.Region.CoreModules.World.WorldMap;
54using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
55
56using OSD = OpenMetaverse.StructuredData.OSD;
57using OSDMap = OpenMetaverse.StructuredData.OSDMap;
58using OSDArray = OpenMetaverse.StructuredData.OSDArray;
59
60namespace OpenSim.Region.CoreModules.Hypergrid
61{
62 public class HGWorldMapModule : WorldMapModule, IRegionModule
63 {
64 private static readonly ILog m_log =
65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66
67 #region IRegionModule Members
68
69 public override void Initialise(Scene scene, IConfigSource config)
70 {
71 IConfig startupConfig = config.Configs["Startup"];
72 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap")
73 m_Enabled = true;
74
75 if (!m_Enabled)
76 return;
77 m_log.Info("[HGMap] Initializing...");
78 m_scene = scene;
79 }
80
81
82 public override string Name
83 {
84 get { return "HGWorldMap"; }
85 }
86
87
88 #endregion
89
90 /// <summary>
91 /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
92 /// </summary>
93 /// <param name="minX"></param>
94 /// <param name="minY"></param>
95 /// <param name="maxX"></param>
96 /// <param name="maxY"></param>
97 public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
98 {
99 //
100 // WARNING!!! COPY & PASTE FROM SUPERCLASS
101 // The only difference is at the very end
102 //
103
104 m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY);
105
106 //m_scene.ForEachScenePresence(delegate (ScenePresence sp) {
107 // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId)
108 // {
109 // Console.WriteLine("XXX Root agent");
110 // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag);
111 // }
112 //};
113
114 List<MapBlockData> mapBlocks;
115 if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible
116 {
117 List<MapBlockData> response = new List<MapBlockData>();
118
119 // this should return one mapblock at most. But make sure: Look whether the one we requested is in there
120 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
121 if (mapBlocks != null)
122 {
123 foreach (MapBlockData block in mapBlocks)
124 {
125 if (block.X == minX && block.Y == minY)
126 {
127 // found it => add it to response
128 response.Add(block);
129 break;
130 }
131 }
132 }
133 response = mapBlocks;
134 if (response.Count == 0)
135 {
136 // response still empty => couldn't find the map-tile the user clicked on => tell the client
137 MapBlockData block = new MapBlockData();
138 block.X = (ushort)minX;
139 block.Y = (ushort)minY;
140 block.Access = 254; // == not there
141 response.Add(block);
142 }
143 remoteClient.SendMapBlock(response, 0);
144 }
145 else
146 {
147 // normal mapblock request. Use the provided values
148 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4);
149
150 // Different from super
151 FillInMap(mapBlocks, minX, minY, maxX, maxY);
152 //
153
154 remoteClient.SendMapBlock(mapBlocks, flag);
155 }
156 }
157
158
159 private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY)
160 {
161 for (int x = minX; x <= maxX; x++)
162 for (int y = minY; y <= maxY; y++)
163 {
164 MapBlockData mblock = mapBlocks.Find(delegate(MapBlockData mb) { return ((mb.X == x) && (mb.Y == y)); });
165 if (mblock == null)
166 {
167 mblock = new MapBlockData();
168 mblock.X = (ushort)x;
169 mblock.Y = (ushort)y;
170 mblock.Name = "";
171 mblock.Access = 254; // not here???
172 mblock.MapImageId = UUID.Zero;
173 mapBlocks.Add(mblock);
174 }
175 }
176 }
177 }
178}