aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorFreaky Tech2015-03-03 22:46:25 +0100
committerBlueWall2015-03-03 19:09:30 -0500
commit53100b93c7c13f42e59c4133e6bb72cb20299899 (patch)
tree81d53a5914a5078692eabdaa35f788a3d4c53d37
parentcorrected osMakeNotecard(string data) text length was calculated wrong. The L... (diff)
downloadopensim-SC_OLD-53100b93c7c13f42e59c4133e6bb72cb20299899.zip
opensim-SC_OLD-53100b93c7c13f42e59c4133e6bb72cb20299899.tar.gz
opensim-SC_OLD-53100b93c7c13f42e59c4133e6bb72cb20299899.tar.bz2
opensim-SC_OLD-53100b93c7c13f42e59c4133e6bb72cb20299899.tar.xz
corrected bug that viewer cannot correctly fetch ItemData when being a HG visitor
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs14
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs71
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs20
3 files changed, 10 insertions, 95 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
index 2c91328..b67b326 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs
@@ -25,20 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenMetaverse; 28using OpenMetaverse;
35using OpenMetaverse.StructuredData; 29using OpenMetaverse.StructuredData;
36using OpenSim.Framework; 30using OpenSim.Framework;
37using OpenSim.Framework.Capabilities; 31using OpenSim.Framework.Capabilities;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Framework.Servers.HttpServer; 32using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Services.Interfaces; 33using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps;
42using OSDArray = OpenMetaverse.StructuredData.OSDArray; 34using OSDArray = OpenMetaverse.StructuredData.OSDArray;
43using OSDMap = OpenMetaverse.StructuredData.OSDMap; 35using OSDMap = OpenMetaverse.StructuredData.OSDMap;
44 36
@@ -49,10 +41,12 @@ namespace OpenSim.Capabilities.Handlers
49// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 42
51 private IInventoryService m_inventoryService; 43 private IInventoryService m_inventoryService;
44 private UUID m_agentID;
52 45
53 public FetchInventory2Handler(IInventoryService invService) 46 public FetchInventory2Handler(IInventoryService invService, UUID agentId)
54 { 47 {
55 m_inventoryService = invService; 48 m_inventoryService = invService;
49 m_agentID = agentId;
56 } 50 }
57 51
58 public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 52 public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
@@ -69,7 +63,7 @@ namespace OpenSim.Capabilities.Handlers
69 { 63 {
70 UUID itemId = osdItemId["item_id"].AsUUID(); 64 UUID itemId = osdItemId["item_id"].AsUUID();
71 65
72 InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId)); 66 InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId, m_agentID));
73 67
74 if (item != null) 68 if (item != null)
75 { 69 {
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs
deleted file mode 100644
index 5bab52f..0000000
--- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs
+++ /dev/null
@@ -1,71 +0,0 @@
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 Nini.Config;
30using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base;
34using OpenMetaverse;
35
36namespace OpenSim.Capabilities.Handlers
37{
38 public class FetchInventory2ServerConnector : ServiceConnector
39 {
40 private IInventoryService m_InventoryService;
41 private string m_ConfigName = "CapsService";
42
43 public FetchInventory2ServerConnector(IConfigSource config, IHttpServer server, string configName)
44 : base(config, server, configName)
45 {
46 if (configName != String.Empty)
47 m_ConfigName = configName;
48
49 IConfig serverConfig = config.Configs[m_ConfigName];
50 if (serverConfig == null)
51 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
52
53 string invService = serverConfig.GetString("InventoryService", String.Empty);
54
55 if (invService == String.Empty)
56 throw new Exception("No InventoryService in config file");
57
58 Object[] args = new Object[] { config };
59 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
60
61 if (m_InventoryService == null)
62 throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
63
64 FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService);
65 IRequestHandler reqHandler
66 = new RestStreamHandler(
67 "POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null);
68 server.AddStreamHandler(reqHandler);
69 }
70 }
71}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
index 87d3d1c..e0a11cc 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
@@ -25,20 +25,16 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using Mono.Addins; 28using Mono.Addins;
29using Nini.Config;
34using OpenMetaverse; 30using OpenMetaverse;
35using OpenSim.Framework; 31using OpenSim.Capabilities.Handlers;
36using OpenSim.Framework.Servers.HttpServer; 32using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
36using System;
40using Caps = OpenSim.Framework.Capabilities.Caps; 37using Caps = OpenSim.Framework.Capabilities.Caps;
41using OpenSim.Capabilities.Handlers;
42 38
43namespace OpenSim.Region.ClientStack.Linden 39namespace OpenSim.Region.ClientStack.Linden
44{ 40{
@@ -58,8 +54,6 @@ namespace OpenSim.Region.ClientStack.Linden
58 54
59 private string m_fetchInventory2Url; 55 private string m_fetchInventory2Url;
60 56
61 private FetchInventory2Handler m_fetchHandler;
62
63 #region ISharedRegionModule Members 57 #region ISharedRegionModule Members
64 58
65 public void Initialise(IConfigSource source) 59 public void Initialise(IConfigSource source)
@@ -98,10 +92,6 @@ namespace OpenSim.Region.ClientStack.Linden
98 92
99 m_inventoryService = m_scene.InventoryService; 93 m_inventoryService = m_scene.InventoryService;
100 94
101 // We'll reuse the same handler for all requests.
102 if (m_fetchInventory2Url == "localhost")
103 m_fetchHandler = new FetchInventory2Handler(m_inventoryService);
104
105 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 95 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
106 } 96 }
107 97
@@ -131,9 +121,11 @@ namespace OpenSim.Region.ClientStack.Linden
131 { 121 {
132 capUrl = "/CAPS/" + UUID.Random(); 122 capUrl = "/CAPS/" + UUID.Random();
133 123
124 FetchInventory2Handler fetchHandler = new FetchInventory2Handler(m_inventoryService, agentID);
125
134 IRequestHandler reqHandler 126 IRequestHandler reqHandler
135 = new RestStreamHandler( 127 = new RestStreamHandler(
136 "POST", capUrl, m_fetchHandler.FetchInventoryRequest, capName, agentID.ToString()); 128 "POST", capUrl, fetchHandler.FetchInventoryRequest, capName, agentID.ToString());
137 129
138 caps.RegisterHandler(capName, reqHandler); 130 caps.RegisterHandler(capName, reqHandler);
139 } 131 }