aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorMelanie2011-06-20 03:08:56 +0200
committerMelanie2011-06-20 03:08:56 +0200
commitf4f55c4d6bdbe9a86b5343159916977b331fefe0 (patch)
tree08fb85f2aa0193bf8549e684b98501c2c52faa1a /OpenSim/Region/ClientStack
parentAdd some flags to control content in search better (diff)
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.zip
opensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.tar.gz
opensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.tar.bz2
opensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs152
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs50
2 files changed, 192 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
new file mode 100644
index 0000000..9f78948
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -0,0 +1,152 @@
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
28using System;
29using System.Collections;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using Mono.Addins;
34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
36using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps;
42
43namespace OpenSim.Region.ClientStack.Linden
44{
45 /// <summary>
46 /// SimulatorFeatures capability. This is required for uploading Mesh.
47 /// Since is accepts an open-ended response, we also send more information
48 /// for viewers that care to interpret it.
49 ///
50 /// NOTE: Part of this code was adapted from the Aurora project, specifically
51 /// the normal part of the response in the capability handler.
52 /// </summary>
53 ///
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
55 public class SimulatorFeaturesModule : ISharedRegionModule
56 {
57 private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 private Scene m_scene;
60
61 private string m_MapImageServerURL = string.Empty;
62 private string m_SearchURL = string.Empty;
63
64 #region ISharedRegionModule Members
65
66 public void Initialise(IConfigSource source)
67 {
68 IConfig config = source.Configs["SimulatorFeatures"];
69 if (config == null)
70 return;
71
72 m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
73 if (m_MapImageServerURL != string.Empty)
74 {
75 m_MapImageServerURL = m_MapImageServerURL.Trim();
76 if (!m_MapImageServerURL.EndsWith("/"))
77 m_MapImageServerURL = m_MapImageServerURL + "/";
78 }
79
80 m_SearchURL = config.GetString("SearchServerURI", string.Empty);
81 }
82
83 public void AddRegion(Scene s)
84 {
85 m_scene = s;
86 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
87 }
88
89 public void RemoveRegion(Scene s)
90 {
91 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
92 }
93
94 public void RegionLoaded(Scene s)
95 {
96 }
97
98 public void PostInitialise()
99 {
100 }
101
102 public void Close() { }
103
104 public string Name { get { return "SimulatorFeaturesModule"; } }
105
106 public Type ReplaceableInterface
107 {
108 get { return null; }
109 }
110
111 #endregion
112
113 public void RegisterCaps(UUID agentID, Caps caps)
114 {
115 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures);
116 caps.RegisterHandler("SimulatorFeatures", reqHandler);
117 }
118
119 private Hashtable SimulatorFeatures(Hashtable mDhttpMethod)
120 {
121 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
122 OSDMap data = new OSDMap();
123 data["MeshRezEnabled"] = true;
124 data["MeshUploadEnabled"] = true;
125 data["MeshXferEnabled"] = true;
126 data["PhysicsMaterialsEnabled"] = true;
127
128 OSDMap typesMap = new OSDMap();
129 typesMap["convex"] = true;
130 typesMap["none"] = true;
131 typesMap["prim"] = true;
132 data["PhysicsShapeTypes"] = typesMap;
133
134 // Extra information for viewers that want to use it
135 OSDMap gridServicesMap = new OSDMap();
136 if (m_MapImageServerURL != string.Empty)
137 gridServicesMap["map-server-url"] = m_MapImageServerURL;
138 if (m_SearchURL != string.Empty)
139 gridServicesMap["search"] = m_SearchURL;
140 data["GridServices"] = gridServicesMap;
141
142 //Send back data
143 Hashtable responsedata = new Hashtable();
144 responsedata["int_response_code"] = 200;
145 responsedata["content_type"] = "text/plain";
146 responsedata["keepalive"] = false;
147 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
148 return responsedata;
149 }
150
151 }
152}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 05e6d27..6048518 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -438,6 +438,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
438 438
439 #endregion Properties 439 #endregion Properties
440 440
441// ~LLClientView()
442// {
443// m_log.DebugFormat("[LLCLIENTVIEW]: Destructor called for {0}, circuit code {1}", Name, CircuitCode);
444// }
445
441 /// <summary> 446 /// <summary>
442 /// Constructor 447 /// Constructor
443 /// </summary> 448 /// </summary>
@@ -1476,6 +1481,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1476 money.MoneyData.TransactionSuccess = success; 1481 money.MoneyData.TransactionSuccess = success;
1477 money.MoneyData.Description = description; 1482 money.MoneyData.Description = description;
1478 money.MoneyData.MoneyBalance = balance; 1483 money.MoneyData.MoneyBalance = balance;
1484 money.TransactionInfo.ItemDescription = Util.StringToBytes256("NONE");
1479 OutPacket(money, ThrottleOutPacketType.Task); 1485 OutPacket(money, ThrottleOutPacketType.Task);
1480 } 1486 }
1481 1487
@@ -2231,7 +2237,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2231 OutPacket(loadURL, ThrottleOutPacketType.Task); 2237 OutPacket(loadURL, ThrottleOutPacketType.Task);
2232 } 2238 }
2233 2239
2234 public void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) 2240 public void SendDialog(
2241 string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg,
2242 UUID textureID, int ch, string[] buttonlabels)
2235 { 2243 {
2236 ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); 2244 ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog);
2237 dialog.Data.ObjectID = objectID; 2245 dialog.Data.ObjectID = objectID;
@@ -2249,6 +2257,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2249 buttons[i].ButtonLabel = Util.StringToBytes256(buttonlabels[i]); 2257 buttons[i].ButtonLabel = Util.StringToBytes256(buttonlabels[i]);
2250 } 2258 }
2251 dialog.Buttons = buttons; 2259 dialog.Buttons = buttons;
2260
2261 dialog.OwnerData = new ScriptDialogPacket.OwnerDataBlock[1];
2262 dialog.OwnerData[0] = new ScriptDialogPacket.OwnerDataBlock();
2263 dialog.OwnerData[0].OwnerID = ownerID;
2264
2252 OutPacket(dialog, ThrottleOutPacketType.Task); 2265 OutPacket(dialog, ThrottleOutPacketType.Task);
2253 } 2266 }
2254 2267
@@ -2320,8 +2333,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2320 OrbitalPosition = (OrbitalPosition - m_sunPainDaHalfOrbitalCutoff) * 0.6666666667f + m_sunPainDaHalfOrbitalCutoff; 2333 OrbitalPosition = (OrbitalPosition - m_sunPainDaHalfOrbitalCutoff) * 0.6666666667f + m_sunPainDaHalfOrbitalCutoff;
2321 } 2334 }
2322 2335
2323
2324
2325 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 2336 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
2326 viewertime.TimeInfo.SunDirection = Position; 2337 viewertime.TimeInfo.SunDirection = Position;
2327 viewertime.TimeInfo.SunAngVelocity = Velocity; 2338 viewertime.TimeInfo.SunAngVelocity = Velocity;
@@ -8358,16 +8369,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8358 AssetLandmark lm; 8369 AssetLandmark lm;
8359 if (lmid != UUID.Zero) 8370 if (lmid != UUID.Zero)
8360 { 8371 {
8372
8361 //AssetBase lma = m_assetCache.GetAsset(lmid, false); 8373 //AssetBase lma = m_assetCache.GetAsset(lmid, false);
8362 AssetBase lma = m_assetService.Get(lmid.ToString()); 8374 AssetBase lma = m_assetService.Get(lmid.ToString());
8363 8375
8364 if (lma == null) 8376 if (lma == null)
8365 { 8377 {
8366 // Failed to find landmark 8378 // Failed to find landmark
8367 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 8379
8368 tpCancel.Info.SessionID = tpReq.Info.SessionID; 8380 // Let's try to search in the user's home asset server
8369 tpCancel.Info.AgentID = tpReq.Info.AgentID; 8381 lma = FindAssetInUserAssetServer(lmid.ToString());
8370 OutPacket(tpCancel, ThrottleOutPacketType.Task); 8382
8383 if (lma == null)
8384 {
8385 // Really doesn't exist
8386 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
8387 tpCancel.Info.SessionID = tpReq.Info.SessionID;
8388 tpCancel.Info.AgentID = tpReq.Info.AgentID;
8389 OutPacket(tpCancel, ThrottleOutPacketType.Task);
8390 }
8371 } 8391 }
8372 8392
8373 try 8393 try
@@ -8398,13 +8418,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8398 TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; 8418 TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
8399 if (handlerTeleportLandmarkRequest != null) 8419 if (handlerTeleportLandmarkRequest != null)
8400 { 8420 {
8401 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position); 8421 handlerTeleportLandmarkRequest(this, lm);
8402 } 8422 }
8403 else 8423 else
8404 { 8424 {
8405 //no event handler so cancel request 8425 //no event handler so cancel request
8406
8407
8408 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 8426 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
8409 tpCancel.Info.AgentID = tpReq.Info.AgentID; 8427 tpCancel.Info.AgentID = tpReq.Info.AgentID;
8410 tpCancel.Info.SessionID = tpReq.Info.SessionID; 8428 tpCancel.Info.SessionID = tpReq.Info.SessionID;
@@ -8414,6 +8432,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8414 return true; 8432 return true;
8415 } 8433 }
8416 8434
8435 private AssetBase FindAssetInUserAssetServer(string id)
8436 {
8437 AgentCircuitData aCircuit = ((Scene)Scene).AuthenticateHandler.GetAgentCircuitData(CircuitCode);
8438 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
8439 {
8440 string assetServer = aCircuit.ServiceURLs["AssetServerURI"].ToString();
8441 return ((Scene)Scene).AssetService.Get(assetServer + "/" + id);
8442 }
8443
8444 return null;
8445 }
8446
8417 private bool HandleTeleportLocationRequest(IClientAPI sender, Packet Pack) 8447 private bool HandleTeleportLocationRequest(IClientAPI sender, Packet Pack)
8418 { 8448 {
8419 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 8449 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;