diff options
author | MW | 2007-07-22 11:44:36 +0000 |
---|---|---|
committer | MW | 2007-07-22 11:44:36 +0000 |
commit | 70fa30204272e874b8e3acccdc2e22cd4e42b2b2 (patch) | |
tree | 2f6c3c0f3b3bd60d5972f8dea6b3abeae4dc9065 /OpenSim/Framework | |
parent | * Aerobic erosion now uses Navier Stokes algorithms for wind calculations. (diff) | |
download | opensim-SC-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.zip opensim-SC-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.gz opensim-SC-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.bz2 opensim-SC-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.xz |
* Some work in progress code: Inventory cache, start of inventory server/service, userprofile cache, inventory handling. (non of it is enabled yet (or at least it shouldn't be).
* Fixed some of the problems with crossing regions when flying: you should no longer sink to ground level when crossing (should keep roughly your right height). Should no longer sometimes get sent back to the centre of the current region when attempting to border cross. But instead sometimes you will find you avatar stop at the edge of region and you will need to start moving again to retry the crossing (which should then work). This code is partly based on Babblefrog's issue #212 patch. [I think I have some ideas of how to solve the stopping at edges problem, just want to get the inventory code done first]
* Capabilities code has now been moved to the OpenSim.Framework.Communications project as some of the caps code will be tightly tied to inventory/asset handling and it was causing a two way reference problem when it was in its own project/dll.
This is a Big commit as I was going to keep my inventory work local until I had it in a working state, in case it brakes anything, but its getting harder to keep in sync with svn.
Diffstat (limited to '')
29 files changed, 1243 insertions, 1317 deletions
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 06a4bd5..3b1cc6a 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -1,330 +1,359 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using System.IO; | 32 | using System.IO; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
37 | using OpenSim.Region.Caches; | 37 | using OpenSim.Framework.Communications.Caches; |
38 | 38 | ||
39 | namespace OpenSim.Region.Capabilities | 39 | namespace OpenSim.Region.Capabilities |
40 | { | 40 | { |
41 | public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data); | 41 | public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data); |
42 | 42 | ||
43 | public class Caps | 43 | public class Caps |
44 | { | 44 | { |
45 | private string m_httpListenerHostName; | 45 | private string m_httpListenerHostName; |
46 | private int m_httpListenPort; | 46 | private int m_httpListenPort; |
47 | private string m_capsObjectPath = "00001-"; | 47 | private string m_capsObjectPath = "00001-"; |
48 | private string m_requestPath = "0000/"; | 48 | private string m_requestPath = "0000/"; |
49 | private string m_mapLayerPath = "0001/"; | 49 | private string m_mapLayerPath = "0001/"; |
50 | private string m_newInventory = "0002/"; | 50 | private string m_newInventory = "0002/"; |
51 | // private string m_requestTexture = "0003/"; | 51 | // private string m_requestTexture = "0003/"; |
52 | //private string eventQueue = "0100/"; | 52 | private string m_notecardUpdatePath = "0004/"; |
53 | private BaseHttpServer httpListener; | 53 | //private string eventQueue = "0100/"; |
54 | private LLUUID agentID; | 54 | private BaseHttpServer httpListener; |
55 | private AssetCache assetCache; | 55 | private LLUUID agentID; |
56 | private int eventQueueCount = 1; | 56 | private AssetCache assetCache; |
57 | private Queue<string> CapsEventQueue = new Queue<string>(); | 57 | private int eventQueueCount = 1; |
58 | 58 | private Queue<string> CapsEventQueue = new Queue<string>(); | |
59 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) | 59 | |
60 | { | 60 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) |
61 | assetCache = assetCach; | 61 | { |
62 | m_capsObjectPath = capsPath; | 62 | assetCache = assetCach; |
63 | httpListener = httpServer; | 63 | m_capsObjectPath = capsPath; |
64 | m_httpListenerHostName = httpListen; | 64 | httpListener = httpServer; |
65 | m_httpListenPort = httpPort; | 65 | m_httpListenerHostName = httpListen; |
66 | agentID = agent; | 66 | m_httpListenPort = httpPort; |
67 | } | 67 | agentID = agent; |
68 | 68 | } | |
69 | /// <summary> | 69 | |
70 | /// | 70 | /// <summary> |
71 | /// </summary> | 71 | /// |
72 | public void RegisterHandlers() | 72 | /// </summary> |
73 | { | 73 | public void RegisterHandlers() |
74 | Console.WriteLine("registering CAPS handlers"); | 74 | { |
75 | string capsBase = "/CAPS/" + m_capsObjectPath; | 75 | Console.WriteLine("registering CAPS handlers"); |
76 | 76 | string capsBase = "/CAPS/" + m_capsObjectPath; | |
77 | httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); | 77 | |
78 | httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); | 78 | httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); |
79 | 79 | httpListener.AddStreamHandler( new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); | |
80 | AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); | 80 | |
81 | } | 81 | AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); |
82 | 82 | AddLegacyCapsHandler(httpListener, m_notecardUpdatePath, NoteCardAgentInventory); | |
83 | [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] | 83 | } |
84 | private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) | 84 | |
85 | { | 85 | [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] |
86 | string capsBase = "/CAPS/" + m_capsObjectPath; | 86 | private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) |
87 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); | 87 | { |
88 | } | 88 | string capsBase = "/CAPS/" + m_capsObjectPath; |
89 | 89 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); | |
90 | /// <summary> | 90 | } |
91 | /// | 91 | |
92 | /// </summary> | 92 | /// <summary> |
93 | /// <param name="request"></param> | 93 | /// |
94 | /// <param name="path"></param> | 94 | /// </summary> |
95 | /// <param name="param"></param> | 95 | /// <param name="request"></param> |
96 | /// <returns></returns> | 96 | /// <param name="path"></param> |
97 | public string CapsRequest(string request, string path, string param) | 97 | /// <param name="param"></param> |
98 | { | 98 | /// <returns></returns> |
99 | // Console.WriteLine("caps request " + request); | 99 | public string CapsRequest(string request, string path, string param) |
100 | string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); | 100 | { |
101 | return result; | 101 | //Console.WriteLine("caps request " + request); |
102 | } | 102 | string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); |
103 | 103 | return result; | |
104 | /// <summary> | 104 | } |
105 | /// | 105 | |
106 | /// </summary> | 106 | /// <summary> |
107 | /// <returns></returns> | 107 | /// |
108 | protected LLSDCapsDetails GetCapabilities() | 108 | /// </summary> |
109 | { | 109 | /// <returns></returns> |
110 | LLSDCapsDetails caps = new LLSDCapsDetails(); | 110 | protected LLSDCapsDetails GetCapabilities() |
111 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; | 111 | { |
112 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; | 112 | LLSDCapsDetails caps = new LLSDCapsDetails(); |
113 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; | 113 | string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; |
114 | //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; | 114 | caps.MapLayer = capsBaseUrl + m_mapLayerPath; |
115 | // caps.ChatSessionRequest = capsBaseUrl + m_requestTexture; | 115 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; |
116 | return caps; | 116 | //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; |
117 | } | 117 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
118 | 118 | return caps; | |
119 | /// <summary> | 119 | } |
120 | /// | 120 | |
121 | /// </summary> | 121 | /// <summary> |
122 | /// <param name="mapReq"></param> | 122 | /// |
123 | /// <returns></returns> | 123 | /// </summary> |
124 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) | 124 | /// <param name="mapReq"></param> |
125 | { | 125 | /// <returns></returns> |
126 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | 126 | public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) |
127 | mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); | 127 | { |
128 | return mapResponse; | 128 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); |
129 | } | 129 | mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); |
130 | 130 | return mapResponse; | |
131 | /// <summary> | 131 | } |
132 | /// | 132 | |
133 | /// </summary> | 133 | /// <summary> |
134 | /// <returns></returns> | 134 | /// |
135 | protected LLSDMapLayer GetLLSDMapLayerResponse() | 135 | /// </summary> |
136 | { | 136 | /// <returns></returns> |
137 | LLSDMapLayer mapLayer = new LLSDMapLayer(); | 137 | protected LLSDMapLayer GetLLSDMapLayerResponse() |
138 | mapLayer.Right = 5000; | 138 | { |
139 | mapLayer.Top = 5000; | 139 | LLSDMapLayer mapLayer = new LLSDMapLayer(); |
140 | mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 140 | mapLayer.Right = 5000; |
141 | return mapLayer; | 141 | mapLayer.Top = 5000; |
142 | } | 142 | mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
143 | 143 | return mapLayer; | |
144 | /// <summary> | 144 | } |
145 | /// | 145 | |
146 | /// </summary> | 146 | /// <summary> |
147 | /// <param name="request"></param> | 147 | /// |
148 | /// <param name="path"></param> | 148 | /// </summary> |
149 | /// <param name="param"></param> | 149 | /// <param name="request"></param> |
150 | /// <returns></returns> | 150 | /// <param name="path"></param> |
151 | public string RequestTexture(string request, string path, string param) | 151 | /// <param name="param"></param> |
152 | { | 152 | /// <returns></returns> |
153 | Console.WriteLine("texture request " + request); | 153 | public string RequestTexture(string request, string path, string param) |
154 | // Needs implementing (added to remove compiler warning) | 154 | { |
155 | return ""; | 155 | Console.WriteLine("texture request " + request); |
156 | } | 156 | // Needs implementing (added to remove compiler warning) |
157 | 157 | return ""; | |
158 | #region EventQueue (Currently not enabled) | 158 | } |
159 | /// <summary> | 159 | |
160 | /// | 160 | #region EventQueue (Currently not enabled) |
161 | /// </summary> | 161 | /// <summary> |
162 | /// <param name="request"></param> | 162 | /// |
163 | /// <param name="path"></param> | 163 | /// </summary> |
164 | /// <param name="param"></param> | 164 | /// <param name="request"></param> |
165 | /// <returns></returns> | 165 | /// <param name="path"></param> |
166 | public string ProcessEventQueue(string request, string path, string param) | 166 | /// <param name="param"></param> |
167 | { | 167 | /// <returns></returns> |
168 | string res = ""; | 168 | public string ProcessEventQueue(string request, string path, string param) |
169 | 169 | { | |
170 | if (this.CapsEventQueue.Count > 0) | 170 | string res = ""; |
171 | { | 171 | |
172 | lock (this.CapsEventQueue) | 172 | if (this.CapsEventQueue.Count > 0) |
173 | { | 173 | { |
174 | string item = CapsEventQueue.Dequeue(); | 174 | lock (this.CapsEventQueue) |
175 | res = item; | 175 | { |
176 | } | 176 | string item = CapsEventQueue.Dequeue(); |
177 | } | 177 | res = item; |
178 | else | 178 | } |
179 | { | 179 | } |
180 | res = this.CreateEmptyEventResponse(); | 180 | else |
181 | } | 181 | { |
182 | return res; | 182 | res = this.CreateEmptyEventResponse(); |
183 | } | 183 | } |
184 | 184 | return res; | |
185 | /// <summary> | 185 | } |
186 | /// | 186 | |
187 | /// </summary> | 187 | /// <summary> |
188 | /// <param name="caps"></param> | 188 | /// |
189 | /// <param name="ipAddressPort"></param> | 189 | /// </summary> |
190 | /// <returns></returns> | 190 | /// <param name="caps"></param> |
191 | public string CreateEstablishAgentComms(string caps, string ipAddressPort) | 191 | /// <param name="ipAddressPort"></param> |
192 | { | 192 | /// <returns></returns> |
193 | LLSDCapEvent eventItem = new LLSDCapEvent(); | 193 | public string CreateEstablishAgentComms(string caps, string ipAddressPort) |
194 | eventItem.id = eventQueueCount; | 194 | { |
195 | //should be creating a EstablishAgentComms item, but there isn't a class for it yet | 195 | LLSDCapEvent eventItem = new LLSDCapEvent(); |
196 | eventItem.events.Array.Add(new LLSDEmpty()); | 196 | eventItem.id = eventQueueCount; |
197 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | 197 | //should be creating a EstablishAgentComms item, but there isn't a class for it yet |
198 | eventQueueCount++; | 198 | eventItem.events.Array.Add(new LLSDEmpty()); |
199 | 199 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | |
200 | this.CapsEventQueue.Enqueue(res); | 200 | eventQueueCount++; |
201 | return res; | 201 | |
202 | } | 202 | this.CapsEventQueue.Enqueue(res); |
203 | 203 | return res; | |
204 | /// <summary> | 204 | } |
205 | /// | 205 | |
206 | /// </summary> | 206 | /// <summary> |
207 | /// <returns></returns> | 207 | /// |
208 | public string CreateEmptyEventResponse() | 208 | /// </summary> |
209 | { | 209 | /// <returns></returns> |
210 | LLSDCapEvent eventItem = new LLSDCapEvent(); | 210 | public string CreateEmptyEventResponse() |
211 | eventItem.id = eventQueueCount; | 211 | { |
212 | eventItem.events.Array.Add(new LLSDEmpty()); | 212 | LLSDCapEvent eventItem = new LLSDCapEvent(); |
213 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); | 213 | eventItem.id = eventQueueCount; |
214 | eventQueueCount++; | 214 | eventItem.events.Array.Add(new LLSDEmpty()); |
215 | return res; | 215 | string res = LLSDHelpers.SerialiseLLSDReply(eventItem); |
216 | } | 216 | eventQueueCount++; |
217 | #endregion | 217 | return res; |
218 | 218 | } | |
219 | /// <summary> | 219 | #endregion |
220 | /// | 220 | |
221 | /// </summary> | 221 | /// <summary> |
222 | /// <param name="llsdRequest"></param> | 222 | /// |
223 | /// <returns></returns> | 223 | /// </summary> |
224 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | 224 | /// <param name="request"></param> |
225 | { | 225 | /// <param name="path"></param> |
226 | // Console.WriteLine("asset upload request via CAPS"); | 226 | /// <param name="param"></param> |
227 | string assetName = llsdRequest.name; | 227 | /// <returns></returns> |
228 | string capsBase = "/CAPS/" + m_capsObjectPath; | 228 | public string NoteCardAgentInventory(string request, string path, string param) |
229 | LLUUID newAsset = LLUUID.Random(); | 229 | { |
230 | LLUUID newInvItem = LLUUID.Random(); | 230 | Console.WriteLine("notecard update request " + request); |
231 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 231 | string assetName = "notecardupdate"; |
232 | 232 | string capsBase = "/CAPS/" + m_capsObjectPath; | |
233 | AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); | 233 | LLUUID newAsset = LLUUID.Random(); |
234 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 234 | LLUUID newInvItem = LLUUID.Random(); |
235 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | 235 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
236 | 236 | ||
237 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | 237 | AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); |
238 | uploadResponse.uploader = uploaderURL; | 238 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
239 | uploadResponse.state = "upload"; | 239 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; |
240 | uploader.OnUpLoad += this.UploadCompleteHandler; | 240 | |
241 | return uploadResponse; | 241 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
242 | } | 242 | uploadResponse.uploader = uploaderURL; |
243 | 243 | uploadResponse.state = "upload"; | |
244 | /// <summary> | 244 | // uploader.OnUpLoad += this.UploadCompleteHandler; |
245 | /// | 245 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
246 | /// </summary> | 246 | } |
247 | /// <param name="assetID"></param> | 247 | |
248 | /// <param name="inventoryItem"></param> | 248 | /// <summary> |
249 | /// <param name="data"></param> | 249 | /// |
250 | public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data) | 250 | /// </summary> |
251 | { | 251 | /// <param name="llsdRequest"></param> |
252 | AssetBase asset; | 252 | /// <returns></returns> |
253 | asset = new AssetBase(); | 253 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) |
254 | asset.FullID = assetID; | 254 | { |
255 | asset.Type = 0; | 255 | // Console.WriteLine("asset upload request via CAPS"); |
256 | asset.InvType = 0; | 256 | string assetName = llsdRequest.name; |
257 | asset.Name = assetName; | 257 | string capsBase = "/CAPS/" + m_capsObjectPath; |
258 | asset.Data = data; | 258 | LLUUID newAsset = LLUUID.Random(); |
259 | this.assetCache.AddAsset(asset); | 259 | LLUUID newInvItem = LLUUID.Random(); |
260 | } | 260 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
261 | 261 | ||
262 | public class AssetUploader | 262 | AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); |
263 | { | 263 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
264 | public event UpLoadedTexture OnUpLoad; | 264 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; |
265 | 265 | ||
266 | private string uploaderPath = ""; | 266 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); |
267 | private LLUUID newAssetID; | 267 | uploadResponse.uploader = uploaderURL; |
268 | private LLUUID inventoryItemID; | 268 | uploadResponse.state = "upload"; |
269 | private BaseHttpServer httpListener; | 269 | uploader.OnUpLoad += this.UploadCompleteHandler; |
270 | private bool SaveImages = false; | 270 | return uploadResponse; |
271 | private string m_assetName = ""; | 271 | } |
272 | 272 | ||
273 | /// <summary> | 273 | /// <summary> |
274 | /// | 274 | /// |
275 | /// </summary> | 275 | /// </summary> |
276 | /// <param name="assetID"></param> | 276 | /// <param name="assetID"></param> |
277 | /// <param name="inventoryItem"></param> | 277 | /// <param name="inventoryItem"></param> |
278 | /// <param name="path"></param> | 278 | /// <param name="data"></param> |
279 | /// <param name="httpServer"></param> | 279 | public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data) |
280 | public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) | 280 | { |
281 | { | 281 | AssetBase asset; |
282 | m_assetName = assetName; | 282 | asset = new AssetBase(); |
283 | newAssetID = assetID; | 283 | asset.FullID = assetID; |
284 | inventoryItemID = inventoryItem; | 284 | asset.Type = 0; |
285 | uploaderPath = path; | 285 | asset.InvType = 0; |
286 | httpListener = httpServer; | 286 | asset.Name = assetName; |
287 | } | 287 | asset.Data = data; |
288 | 288 | this.assetCache.AddAsset(asset); | |
289 | /// <summary> | 289 | } |
290 | /// | 290 | |
291 | /// </summary> | 291 | public class AssetUploader |
292 | /// <param name="data"></param> | 292 | { |
293 | /// <param name="path"></param> | 293 | public event UpLoadedTexture OnUpLoad; |
294 | /// <param name="param"></param> | 294 | |
295 | /// <returns></returns> | 295 | private string uploaderPath = ""; |
296 | public string uploaderCaps(byte[] data, string path, string param) | 296 | private LLUUID newAssetID; |
297 | { | 297 | private LLUUID inventoryItemID; |
298 | LLUUID inv = this.inventoryItemID; | 298 | private BaseHttpServer httpListener; |
299 | string res = ""; | 299 | private bool SaveImages = true; |
300 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); | 300 | private string m_assetName = ""; |
301 | uploadComplete.new_asset = newAssetID.ToStringHyphenated(); | 301 | |
302 | uploadComplete.new_inventory_item = inv; | 302 | /// <summary> |
303 | uploadComplete.state = "complete"; | 303 | /// |
304 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 304 | /// </summary> |
305 | 305 | /// <param name="assetID"></param> | |
306 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 306 | /// <param name="inventoryItem"></param> |
307 | 307 | /// <param name="path"></param> | |
308 | if(this.SaveImages) | 308 | /// <param name="httpServer"></param> |
309 | this.SaveImageToFile(m_assetName + ".jp2", data); | 309 | public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) |
310 | 310 | { | |
311 | if (OnUpLoad != null) | 311 | m_assetName = assetName; |
312 | { | 312 | newAssetID = assetID; |
313 | OnUpLoad(m_assetName, newAssetID, inv, data); | 313 | inventoryItemID = inventoryItem; |
314 | } | 314 | uploaderPath = path; |
315 | 315 | httpListener = httpServer; | |
316 | return res; | 316 | } |
317 | } | 317 | |
318 | 318 | /// <summary> | |
319 | private void SaveImageToFile(string filename, byte[] data) | 319 | /// |
320 | { | 320 | /// </summary> |
321 | 321 | /// <param name="data"></param> | |
322 | FileStream fs = File.Create(filename); | 322 | /// <param name="path"></param> |
323 | BinaryWriter bw = new BinaryWriter(fs); | 323 | /// <param name="param"></param> |
324 | bw.Write(data); | 324 | /// <returns></returns> |
325 | bw.Close(); | 325 | public string uploaderCaps(byte[] data, string path, string param) |
326 | fs.Close(); | 326 | { |
327 | } | 327 | LLUUID inv = this.inventoryItemID; |
328 | } | 328 | string res = ""; |
329 | } | 329 | LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); |
330 | } | 330 | uploadComplete.new_asset = newAssetID.ToStringHyphenated(); |
331 | uploadComplete.new_inventory_item = inv; | ||
332 | uploadComplete.state = "complete"; | ||
333 | |||
334 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
335 | |||
336 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
337 | |||
338 | if(this.SaveImages) | ||
339 | this.SaveImageToFile(m_assetName + ".jp2", data); | ||
340 | |||
341 | if (OnUpLoad != null) | ||
342 | { | ||
343 | OnUpLoad(m_assetName, newAssetID, inv, data); | ||
344 | } | ||
345 | |||
346 | return res; | ||
347 | } | ||
348 | |||
349 | private void SaveImageToFile(string filename, byte[] data) | ||
350 | { | ||
351 | FileStream fs = File.Create(filename); | ||
352 | BinaryWriter bw = new BinaryWriter(fs); | ||
353 | bw.Write(data); | ||
354 | bw.Close(); | ||
355 | fs.Close(); | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs index d3e1979..e04849f 100644 --- a/OpenSim/Region/Capabilities/LLSDArray.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs | |||
@@ -1,42 +1,42 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections; | 28 | using System.Collections; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Region.Capabilities |
31 | { | 31 | { |
32 | [LLSDType("ARRAY")] | 32 | [LLSDType("ARRAY")] |
33 | public class LLSDArray | 33 | public class LLSDArray |
34 | { | 34 | { |
35 | public ArrayList Array = new ArrayList(); | 35 | public ArrayList Array = new ArrayList(); |
36 | 36 | ||
37 | public LLSDArray() | 37 | public LLSDArray() |
38 | { | 38 | { |
39 | 39 | ||
40 | } | 40 | } |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs index 5718b8f..ce373c0 100644 --- a/OpenSim/Region/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs | |||
@@ -1,44 +1,45 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Region.Capabilities |
31 | { | 31 | { |
32 | [LLSDType("MAP")] | 32 | [LLSDType("MAP")] |
33 | public class LLSDAssetUploadComplete | 33 | public class LLSDAssetUploadComplete |
34 | { | 34 | { |
35 | public string new_asset = ""; | 35 | public string new_asset = ""; |
36 | public LLUUID new_inventory_item = LLUUID.Zero; | 36 | public LLUUID new_inventory_item = LLUUID.Zero; |
37 | public string state = ""; | 37 | public string state = ""; |
38 | 38 | //public bool success = false; | |
39 | public LLSDAssetUploadComplete() | 39 | |
40 | { | 40 | public LLSDAssetUploadComplete() |
41 | 41 | { | |
42 | } | 42 | |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs index 0096fb1..7ef77cb 100644 --- a/OpenSim/Region/Capabilities/LLSDAssetUploadRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs | |||
@@ -1,21 +1,21 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Capabilities | 6 | namespace OpenSim.Region.Capabilities |
7 | { | 7 | { |
8 | [LLSDMap] | 8 | [LLSDMap] |
9 | public class LLSDAssetUploadRequest | 9 | public class LLSDAssetUploadRequest |
10 | { | 10 | { |
11 | public string asset_type = ""; | 11 | public string asset_type = ""; |
12 | public string description = ""; | 12 | public string description = ""; |
13 | public LLUUID folder_id = LLUUID.Zero; | 13 | public LLUUID folder_id = LLUUID.Zero; |
14 | public string inventory_type = ""; | 14 | public string inventory_type = ""; |
15 | public string name = ""; | 15 | public string name = ""; |
16 | 16 | ||
17 | public LLSDAssetUploadRequest() | 17 | public LLSDAssetUploadRequest() |
18 | { | 18 | { |
19 | } | 19 | } |
20 | } | 20 | } |
21 | } | 21 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs index 2a2a5d1..1a620ae 100644 --- a/OpenSim/Region/Capabilities/LLSDAssetUploadResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs | |||
@@ -1,18 +1,18 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Capabilities | 5 | namespace OpenSim.Region.Capabilities |
6 | { | 6 | { |
7 | [LLSDMap] | 7 | [LLSDMap] |
8 | public class LLSDAssetUploadResponse | 8 | public class LLSDAssetUploadResponse |
9 | { | 9 | { |
10 | public string uploader = ""; | 10 | public string uploader = ""; |
11 | public string state = ""; | 11 | public string state = ""; |
12 | 12 | ||
13 | public LLSDAssetUploadResponse() | 13 | public LLSDAssetUploadResponse() |
14 | { | 14 | { |
15 | 15 | ||
16 | } | 16 | } |
17 | } | 17 | } |
18 | } | 18 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs index 2c2689b..51b4fe0 100644 --- a/OpenSim/Region/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs | |||
@@ -1,41 +1,41 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Region.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDCapEvent | 31 | public class LLSDCapEvent |
32 | { | 32 | { |
33 | public int id = 0; | 33 | public int id = 0; |
34 | public LLSDArray events = new LLSDArray(); | 34 | public LLSDArray events = new LLSDArray(); |
35 | 35 | ||
36 | public LLSDCapEvent() | 36 | public LLSDCapEvent() |
37 | { | 37 | { |
38 | 38 | ||
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs index 132b8f7..3b6a629 100644 --- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs | |||
@@ -1,17 +1,18 @@ | |||
1 | namespace OpenSim.Region.Capabilities | 1 | namespace OpenSim.Region.Capabilities |
2 | { | 2 | { |
3 | [LLSDType("MAP")] | 3 | [LLSDType("MAP")] |
4 | public class LLSDCapsDetails | 4 | public class LLSDCapsDetails |
5 | { | 5 | { |
6 | public string MapLayer = ""; | 6 | public string MapLayer = ""; |
7 | public string NewFileAgentInventory = ""; | 7 | public string NewFileAgentInventory = ""; |
8 | //public string EventQueueGet = ""; | 8 | //public string EventQueueGet = ""; |
9 | //public string RequestTextureDownload = ""; | 9 | //public string RequestTextureDownload = ""; |
10 | //public string ChatSessionRequest = ""; | 10 | //public string ChatSessionRequest = ""; |
11 | 11 | public string UpdateNotecardAgentInventory = ""; | |
12 | public LLSDCapsDetails() | 12 | |
13 | { | 13 | public LLSDCapsDetails() |
14 | 14 | { | |
15 | } | 15 | |
16 | } | 16 | } |
17 | } | 17 | } |
18 | } | ||
diff --git a/OpenSim/Region/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs index ca27c9d..d79c09e 100644 --- a/OpenSim/Region/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs | |||
@@ -1,38 +1,38 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Region.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDEmpty | 31 | public class LLSDEmpty |
32 | { | 32 | { |
33 | public LLSDEmpty() | 33 | public LLSDEmpty() |
34 | { | 34 | { |
35 | 35 | ||
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index efeb9b1..19ef0c9 100644 --- a/OpenSim/Region/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs | |||
@@ -1,164 +1,164 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Xml; | 32 | using System.Xml; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | 34 | ||
35 | namespace OpenSim.Region.Capabilities | 35 | namespace OpenSim.Region.Capabilities |
36 | { | 36 | { |
37 | public class LLSDHelpers | 37 | public class LLSDHelpers |
38 | { | 38 | { |
39 | public static string SerialiseLLSDReply(object obj) | 39 | public static string SerialiseLLSDReply(object obj) |
40 | { | 40 | { |
41 | StringWriter sw = new StringWriter(); | 41 | StringWriter sw = new StringWriter(); |
42 | XmlTextWriter writer = new XmlTextWriter(sw); | 42 | XmlTextWriter writer = new XmlTextWriter(sw); |
43 | writer.Formatting = Formatting.None; | 43 | writer.Formatting = Formatting.None; |
44 | writer.WriteStartElement(String.Empty, "llsd", String.Empty); | 44 | writer.WriteStartElement(String.Empty, "llsd", String.Empty); |
45 | SerializeLLSDType(writer, obj); | 45 | SerializeLLSDType(writer, obj); |
46 | writer.WriteEndElement(); | 46 | writer.WriteEndElement(); |
47 | writer.Close(); | 47 | writer.Close(); |
48 | return sw.ToString(); | 48 | return sw.ToString(); |
49 | } | 49 | } |
50 | 50 | ||
51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) | 51 | public static void SerializeLLSDType(XmlTextWriter writer, object obj) |
52 | { | 52 | { |
53 | Type myType = obj.GetType(); | 53 | Type myType = obj.GetType(); |
54 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | 54 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); |
55 | if (llsdattributes.Length > 0) | 55 | if (llsdattributes.Length > 0) |
56 | { | 56 | { |
57 | switch (llsdattributes[0].ObjectType) | 57 | switch (llsdattributes[0].ObjectType) |
58 | { | 58 | { |
59 | case "MAP": | 59 | case "MAP": |
60 | writer.WriteStartElement(String.Empty, "map", String.Empty); | 60 | writer.WriteStartElement(String.Empty, "map", String.Empty); |
61 | FieldInfo[] fields = myType.GetFields(); | 61 | FieldInfo[] fields = myType.GetFields(); |
62 | for (int i = 0; i < fields.Length; i++) | 62 | for (int i = 0; i < fields.Length; i++) |
63 | { | 63 | { |
64 | object fieldValue = fields[i].GetValue(obj); | 64 | object fieldValue = fields[i].GetValue(obj); |
65 | LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); | 65 | LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); |
66 | if (fieldAttributes.Length > 0) | 66 | if (fieldAttributes.Length > 0) |
67 | { | 67 | { |
68 | writer.WriteStartElement(String.Empty, "key", String.Empty); | 68 | writer.WriteStartElement(String.Empty, "key", String.Empty); |
69 | writer.WriteString(fields[i].Name); | 69 | writer.WriteString(fields[i].Name); |
70 | writer.WriteEndElement(); | 70 | writer.WriteEndElement(); |
71 | SerializeLLSDType(writer, fieldValue); | 71 | SerializeLLSDType(writer, fieldValue); |
72 | } | 72 | } |
73 | else | 73 | else |
74 | { | 74 | { |
75 | writer.WriteStartElement(String.Empty, "key", String.Empty); | 75 | writer.WriteStartElement(String.Empty, "key", String.Empty); |
76 | writer.WriteString(fields[i].Name); | 76 | writer.WriteString(fields[i].Name); |
77 | writer.WriteEndElement(); | 77 | writer.WriteEndElement(); |
78 | LLSD.LLSDWriteOne(writer, fieldValue); | 78 | LLSD.LLSDWriteOne(writer, fieldValue); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | writer.WriteEndElement(); | 81 | writer.WriteEndElement(); |
82 | break; | 82 | break; |
83 | case "ARRAY": | 83 | case "ARRAY": |
84 | // LLSDArray arrayObject = obj as LLSDArray; | 84 | // LLSDArray arrayObject = obj as LLSDArray; |
85 | // ArrayList a = arrayObject.Array; | 85 | // ArrayList a = arrayObject.Array; |
86 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); | 86 | ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); |
87 | if (a != null) | 87 | if (a != null) |
88 | { | 88 | { |
89 | writer.WriteStartElement(String.Empty, "array", String.Empty); | 89 | writer.WriteStartElement(String.Empty, "array", String.Empty); |
90 | foreach (object item in a) | 90 | foreach (object item in a) |
91 | { | 91 | { |
92 | SerializeLLSDType(writer, item); | 92 | SerializeLLSDType(writer, item); |
93 | } | 93 | } |
94 | writer.WriteEndElement(); | 94 | writer.WriteEndElement(); |
95 | } | 95 | } |
96 | break; | 96 | break; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | LLSD.LLSDWriteOne(writer, obj); | 101 | LLSD.LLSDWriteOne(writer, obj); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) | 105 | public static object DeserialiseLLSDMap(Hashtable llsd, object obj) |
106 | { | 106 | { |
107 | Type myType = obj.GetType(); | 107 | Type myType = obj.GetType(); |
108 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); | 108 | LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); |
109 | if (llsdattributes.Length > 0) | 109 | if (llsdattributes.Length > 0) |
110 | { | 110 | { |
111 | switch (llsdattributes[0].ObjectType) | 111 | switch (llsdattributes[0].ObjectType) |
112 | { | 112 | { |
113 | case "MAP": | 113 | case "MAP": |
114 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); | 114 | IDictionaryEnumerator enumerator = llsd.GetEnumerator(); |
115 | while (enumerator.MoveNext()) | 115 | while (enumerator.MoveNext()) |
116 | { | 116 | { |
117 | FieldInfo field = myType.GetField((string)enumerator.Key); | 117 | FieldInfo field = myType.GetField((string)enumerator.Key); |
118 | if (field != null) | 118 | if (field != null) |
119 | { | 119 | { |
120 | if (enumerator.Value is Hashtable) | 120 | if (enumerator.Value is Hashtable) |
121 | { | 121 | { |
122 | object fieldValue = field.GetValue(obj); | 122 | object fieldValue = field.GetValue(obj); |
123 | DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); | 123 | DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue); |
124 | } | 124 | } |
125 | else if (enumerator.Value is ArrayList) | 125 | else if (enumerator.Value is ArrayList) |
126 | { | 126 | { |
127 | object fieldValue = field.GetValue(obj); | 127 | object fieldValue = field.GetValue(obj); |
128 | fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); | 128 | fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); |
129 | //TODO | 129 | //TODO |
130 | // the LLSD map/array types in the array need to be deserialised | 130 | // the LLSD map/array types in the array need to be deserialised |
131 | // but first we need to know the right class to deserialise them into. | 131 | // but first we need to know the right class to deserialise them into. |
132 | } | 132 | } |
133 | else | 133 | else |
134 | { | 134 | { |
135 | field.SetValue(obj, enumerator.Value); | 135 | field.SetValue(obj, enumerator.Value); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | } | 138 | } |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | return obj; | 142 | return obj; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | 149 | ||
150 | 150 | ||
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | ||
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | 158 | ||
159 | 159 | ||
160 | 160 | ||
161 | 161 | ||
162 | 162 | ||
163 | 163 | ||
164 | } | 164 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs index e0c006c..566d0e9 100644 --- a/OpenSim/Region/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs | |||
@@ -1,46 +1,46 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Region.Capabilities |
31 | { | 31 | { |
32 | [LLSDType("MAP")] | 32 | [LLSDType("MAP")] |
33 | public class LLSDMapLayer | 33 | public class LLSDMapLayer |
34 | { | 34 | { |
35 | public int Left = 0; | 35 | public int Left = 0; |
36 | public int Right = 0; | 36 | public int Right = 0; |
37 | public int Top = 0; | 37 | public int Top = 0; |
38 | public int Bottom = 0; | 38 | public int Bottom = 0; |
39 | public LLUUID ImageID = LLUUID.Zero; | 39 | public LLUUID ImageID = LLUUID.Zero; |
40 | 40 | ||
41 | public LLSDMapLayer() | 41 | public LLSDMapLayer() |
42 | { | 42 | { |
43 | 43 | ||
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs index 8b9837b..ce746ae 100644 --- a/OpenSim/Region/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs | |||
@@ -1,41 +1,41 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Region.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDMapLayerResponse | 31 | public class LLSDMapLayerResponse |
32 | { | 32 | { |
33 | public LLSDMapRequest AgentData = new LLSDMapRequest(); | 33 | public LLSDMapRequest AgentData = new LLSDMapRequest(); |
34 | public LLSDArray LayerData = new LLSDArray(); | 34 | public LLSDArray LayerData = new LLSDArray(); |
35 | 35 | ||
36 | public LLSDMapLayerResponse() | 36 | public LLSDMapLayerResponse() |
37 | { | 37 | { |
38 | 38 | ||
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs index 8ac7943..fb739cd 100644 --- a/OpenSim/Region/Capabilities/LLSDMapRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs | |||
@@ -1,13 +1,13 @@ | |||
1 | namespace OpenSim.Region.Capabilities | 1 | namespace OpenSim.Region.Capabilities |
2 | { | 2 | { |
3 | [LLSDType("MAP")] | 3 | [LLSDType("MAP")] |
4 | public class LLSDMapRequest | 4 | public class LLSDMapRequest |
5 | { | 5 | { |
6 | public int Flags = 0; | 6 | public int Flags = 0; |
7 | 7 | ||
8 | public LLSDMapRequest() | 8 | public LLSDMapRequest() |
9 | { | 9 | { |
10 | 10 | ||
11 | } | 11 | } |
12 | } | 12 | } |
13 | } | 13 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs index 068d539..5f42f44 100644 --- a/OpenSim/Region/Capabilities/LLSDMethod.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs | |||
@@ -1,8 +1,8 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.Capabilities | 5 | namespace OpenSim.Region.Capabilities |
6 | { | 6 | { |
7 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); | 7 | public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); |
8 | } | 8 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs index d98e23f..7d99b6e 100644 --- a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs | |||
@@ -1,42 +1,42 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Framework.Servers; | 4 | using OpenSim.Framework.Servers; |
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Collections; | 6 | using System.Collections; |
7 | using libsecondlife; | 7 | using libsecondlife; |
8 | 8 | ||
9 | namespace OpenSim.Region.Capabilities | 9 | namespace OpenSim.Region.Capabilities |
10 | { | 10 | { |
11 | public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler | 11 | public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler |
12 | where TRequest : new() | 12 | where TRequest : new() |
13 | { | 13 | { |
14 | private LLSDMethod<TRequest, TResponse> m_method; | 14 | private LLSDMethod<TRequest, TResponse> m_method; |
15 | 15 | ||
16 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) | 16 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) |
17 | : base(httpMethod, path ) | 17 | : base(httpMethod, path ) |
18 | { | 18 | { |
19 | m_method = method; | 19 | m_method = method; |
20 | } | 20 | } |
21 | 21 | ||
22 | public override byte[] Handle(string path, Stream request) | 22 | public override byte[] Handle(string path, Stream request) |
23 | { | 23 | { |
24 | //Encoding encoding = Encoding.UTF8; | 24 | //Encoding encoding = Encoding.UTF8; |
25 | //StreamReader streamReader = new StreamReader(request, false); | 25 | //StreamReader streamReader = new StreamReader(request, false); |
26 | 26 | ||
27 | //string requestBody = streamReader.ReadToEnd(); | 27 | //string requestBody = streamReader.ReadToEnd(); |
28 | //streamReader.Close(); | 28 | //streamReader.Close(); |
29 | 29 | ||
30 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); | 30 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); |
31 | TRequest llsdRequest = new TRequest(); | 31 | TRequest llsdRequest = new TRequest(); |
32 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 32 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
33 | 33 | ||
34 | TResponse response = m_method(llsdRequest); | 34 | TResponse response = m_method(llsdRequest); |
35 | 35 | ||
36 | Encoding encoding = new UTF8Encoding(false); | 36 | Encoding encoding = new UTF8Encoding(false); |
37 | 37 | ||
38 | return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); | 38 | return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); |
39 | 39 | ||
40 | } | 40 | } |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs index 78ccf67..f23e327 100644 --- a/OpenSim/Region/Capabilities/LLSDTest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs | |||
@@ -1,41 +1,41 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | namespace OpenSim.Region.Capabilities | 28 | namespace OpenSim.Region.Capabilities |
29 | { | 29 | { |
30 | [LLSDType("MAP")] | 30 | [LLSDType("MAP")] |
31 | public class LLSDTest | 31 | public class LLSDTest |
32 | { | 32 | { |
33 | public int Test1 = 20; | 33 | public int Test1 = 20; |
34 | public int Test2 = 10; | 34 | public int Test2 = 10; |
35 | 35 | ||
36 | public LLSDTest() | 36 | public LLSDTest() |
37 | { | 37 | { |
38 | 38 | ||
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/OpenSim/Region/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs index 04f4d9a..c58a937 100644 --- a/OpenSim/Region/Capabilities/LLSDType.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs | |||
@@ -1,59 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | 29 | ||
30 | namespace OpenSim.Region.Capabilities | 30 | namespace OpenSim.Region.Capabilities |
31 | { | 31 | { |
32 | [AttributeUsage(AttributeTargets.Class)] | 32 | [AttributeUsage(AttributeTargets.Class)] |
33 | public class LLSDType : Attribute | 33 | public class LLSDType : Attribute |
34 | { | 34 | { |
35 | protected string myType; | 35 | protected string myType; |
36 | 36 | ||
37 | public LLSDType(string type) | 37 | public LLSDType(string type) |
38 | { | 38 | { |
39 | myType = type; | 39 | myType = type; |
40 | 40 | ||
41 | } | 41 | } |
42 | 42 | ||
43 | public string ObjectType | 43 | public string ObjectType |
44 | { | 44 | { |
45 | get | 45 | get |
46 | { | 46 | { |
47 | return myType; | 47 | return myType; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | [AttributeUsage(AttributeTargets.Class)] | 52 | [AttributeUsage(AttributeTargets.Class)] |
53 | public class LLSDMap : LLSDType | 53 | public class LLSDMap : LLSDType |
54 | { | 54 | { |
55 | public LLSDMap() : base( "MAP" ) | 55 | public LLSDMap() : base( "MAP" ) |
56 | { | 56 | { |
57 | } | 57 | } |
58 | } | 58 | } |
59 | } | 59 | } |
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index db34d1b..e220e17 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Framework.Interfaces; | |||
33 | using OpenSim.Framework.Types; | 33 | using OpenSim.Framework.Types; |
34 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
35 | using OpenSim.Framework.Communications.Caches; | 35 | using OpenSim.Framework.Communications.Caches; |
36 | |||
36 | 37 | ||
37 | namespace OpenSim.Framework.Communications | 38 | namespace OpenSim.Framework.Communications |
38 | { | 39 | { |
@@ -44,11 +45,13 @@ namespace OpenSim.Framework.Communications | |||
44 | public IInventoryServices InventoryServer; | 45 | public IInventoryServices InventoryServer; |
45 | public IInterRegionCommunications InterRegion; | 46 | public IInterRegionCommunications InterRegion; |
46 | public UserProfileCache UserProfilesCache; | 47 | public UserProfileCache UserProfilesCache; |
48 | public AssetCache AssetCache; | ||
47 | 49 | ||
48 | public NetworkServersInfo ServersInfo; | 50 | public NetworkServersInfo ServersInfo; |
49 | public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer) | 51 | public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) |
50 | { | 52 | { |
51 | ServersInfo = serversInfo; | 53 | ServersInfo = serversInfo; |
54 | this.AssetCache = assetCache; | ||
52 | UserProfilesCache = new UserProfileCache(this); | 55 | UserProfilesCache = new UserProfileCache(this); |
53 | } | 56 | } |
54 | 57 | ||
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 7758f2b..d82fa19 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs | |||
@@ -30,9 +30,10 @@ using OpenSim.Framework.Types; | |||
30 | 30 | ||
31 | namespace OpenSim.Framework.Communications | 31 | namespace OpenSim.Framework.Communications |
32 | { | 32 | { |
33 | public interface IInterRegionCommunications | 33 | public interface IInterRegionCommunications |
34 | { | 34 | { |
35 | bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); | 35 | bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); |
36 | bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position); | 36 | bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
37 | bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID); | ||
37 | } | 38 | } |
38 | } | 39 | } |
diff --git a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs deleted file mode 100644 index b8d8847..0000000 --- a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Data; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenSim.Framework.Communications.Caches | ||
8 | { | ||
9 | public class CachedUserInfo | ||
10 | { | ||
11 | public UserProfileData UserProfile; | ||
12 | //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>(); | ||
13 | public InventoryFolder RootFolder; | ||
14 | |||
15 | public CachedUserInfo() | ||
16 | { | ||
17 | |||
18 | } | ||
19 | |||
20 | /// <summary> | ||
21 | /// | ||
22 | /// </summary> | ||
23 | /// <param name="userID"></param> | ||
24 | /// <param name="folderInfo"></param> | ||
25 | public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) | ||
26 | { | ||
27 | if (userID == UserProfile.UUID) | ||
28 | { | ||
29 | if (this.RootFolder == null) | ||
30 | { | ||
31 | if (folderInfo.parentID == LLUUID.Zero) | ||
32 | { | ||
33 | this.RootFolder = folderInfo; | ||
34 | } | ||
35 | } | ||
36 | else | ||
37 | { | ||
38 | if (this.RootFolder.folderID == folderInfo.parentID) | ||
39 | { | ||
40 | this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | ||
41 | } | ||
42 | else | ||
43 | { | ||
44 | InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID); | ||
45 | if (pFolder != null) | ||
46 | { | ||
47 | pFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | |||
54 | public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) | ||
55 | { | ||
56 | if (userID == UserProfile.UUID) | ||
57 | { | ||
58 | if (this.RootFolder != null) | ||
59 | { | ||
60 | if (itemInfo.parentFolderID == this.RootFolder.folderID) | ||
61 | { | ||
62 | this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); | ||
67 | if (pFolder != null) | ||
68 | { | ||
69 | pFolder.Items.Add(itemInfo.inventoryID, itemInfo); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | } | ||
75 | } | ||
76 | } | ||
77 | } | ||
diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs deleted file mode 100644 index 8978cee..0000000 --- a/OpenSim/Framework/Communications/caches/InventoryFolder.cs +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Data; | ||
6 | |||
7 | namespace OpenSim.Framework.Communications.Caches | ||
8 | { | ||
9 | public class InventoryFolder : InventoryFolderBase | ||
10 | { | ||
11 | public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); | ||
12 | public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); | ||
13 | |||
14 | public InventoryFolder() | ||
15 | { | ||
16 | } | ||
17 | |||
18 | public InventoryFolder HasSubFolder(LLUUID folderID) | ||
19 | { | ||
20 | InventoryFolder returnFolder = null; | ||
21 | if (this.SubFolders.ContainsKey(folderID)) | ||
22 | { | ||
23 | returnFolder = this.SubFolders[folderID]; | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | foreach (InventoryFolder folder in this.SubFolders.Values) | ||
28 | { | ||
29 | returnFolder = folder.HasSubFolder(folderID); | ||
30 | if (returnFolder != null) | ||
31 | { | ||
32 | break; | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | return returnFolder; | ||
37 | } | ||
38 | |||
39 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type ) | ||
40 | { | ||
41 | InventoryFolder subFold = new InventoryFolder(); | ||
42 | subFold.name = folderName; | ||
43 | subFold.folderID = folderID; | ||
44 | subFold.type = type; | ||
45 | subFold.parentID = this.folderID; | ||
46 | subFold.agentID = this.agentID; | ||
47 | this.SubFolders.Add(subFold.folderID, subFold); | ||
48 | return subFold; | ||
49 | } | ||
50 | |||
51 | public List<InventoryItemBase> RequestListOfItems() | ||
52 | { | ||
53 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); | ||
54 | foreach (InventoryItemBase item in this.Items.Values) | ||
55 | { | ||
56 | itemList.Add(item); | ||
57 | } | ||
58 | return itemList; | ||
59 | } | ||
60 | } | ||
61 | } | ||
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs deleted file mode 100644 index bfb6f07..0000000 --- a/OpenSim/Framework/Communications/caches/UserProfileCache.cs +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Interfaces; | ||
6 | using OpenSim.Framework.Data; | ||
7 | using OpenSim.Framework.Communications; | ||
8 | |||
9 | namespace OpenSim.Framework.Communications.Caches | ||
10 | { | ||
11 | public class UserProfileCache | ||
12 | { | ||
13 | public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>(); | ||
14 | |||
15 | private CommunicationsManager m_parent; | ||
16 | |||
17 | public UserProfileCache(CommunicationsManager parent) | ||
18 | { | ||
19 | m_parent = parent; | ||
20 | } | ||
21 | |||
22 | /// <summary> | ||
23 | /// A new user has moved into a region in this instance | ||
24 | /// so get info from servers | ||
25 | /// </summary> | ||
26 | /// <param name="userID"></param> | ||
27 | public void AddNewUser(LLUUID userID) | ||
28 | { | ||
29 | if (!this.UserProfiles.ContainsKey(userID)) | ||
30 | { | ||
31 | CachedUserInfo userInfo = new CachedUserInfo(); | ||
32 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); | ||
33 | |||
34 | if (userInfo.UserProfile != null) | ||
35 | { | ||
36 | this.RequestInventoryForUser(userID, userInfo); | ||
37 | this.UserProfiles.Add(userID, userInfo); | ||
38 | } | ||
39 | else | ||
40 | { | ||
41 | //no profile for this user, what do we do now? | ||
42 | Console.WriteLine("UserProfileCache.cs: user profile for user not found"); | ||
43 | |||
44 | } | ||
45 | } | ||
46 | else | ||
47 | { | ||
48 | //already have a cached profile for this user | ||
49 | //we should make sure its upto date with the user server version | ||
50 | } | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// A new user has moved into a region in this instance | ||
55 | /// so get info from servers | ||
56 | /// </summary> | ||
57 | /// <param name="firstName"></param> | ||
58 | /// <param name="lastName"></param> | ||
59 | public void AddNewUser(string firstName, string lastName) | ||
60 | { | ||
61 | |||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// A user has left this instance | ||
66 | /// so make sure servers have been updated | ||
67 | /// Then remove cached info | ||
68 | /// </summary> | ||
69 | /// <param name="userID"></param> | ||
70 | public void UserLogOut(LLUUID userID) | ||
71 | { | ||
72 | |||
73 | } | ||
74 | |||
75 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) | ||
76 | { | ||
77 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | ||
78 | { | ||
79 | CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId]; | ||
80 | if (userInfo.RootFolder.folderID == parentID) | ||
81 | { | ||
82 | userInfo.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(parentID); | ||
87 | if (parentFolder != null) | ||
88 | { | ||
89 | parentFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | ||
96 | { | ||
97 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | ||
98 | { | ||
99 | CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId]; | ||
100 | if (userInfo.RootFolder.folderID == folderID) | ||
101 | { | ||
102 | if (fetchItems) | ||
103 | { | ||
104 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, userInfo.RootFolder.RequestListOfItems()); | ||
105 | } | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(folderID); | ||
110 | if(parentFolder != null) | ||
111 | { | ||
112 | if(fetchItems) | ||
113 | { | ||
114 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, parentFolder.RequestListOfItems()); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | |||
121 | /// <summary> | ||
122 | /// Request the user profile from User server | ||
123 | /// </summary> | ||
124 | /// <param name="userID"></param> | ||
125 | private UserProfileData RequestUserProfileForUser(LLUUID userID) | ||
126 | { | ||
127 | return this.m_parent.UserServer.GetUserProfile(userID); | ||
128 | } | ||
129 | |||
130 | /// <summary> | ||
131 | /// Request Iventory Info from Inventory server | ||
132 | /// </summary> | ||
133 | /// <param name="userID"></param> | ||
134 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) | ||
135 | { | ||
136 | // this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | ||
137 | |||
138 | //for now we manually create the root folder, | ||
139 | // but should be requesting all inventory from inventory server. | ||
140 | InventoryFolder rootFolder = new InventoryFolder(); | ||
141 | rootFolder.agentID = userID; | ||
142 | rootFolder.folderID = userInfo.UserProfile.rootInventoryFolderID; | ||
143 | rootFolder.name = "My Inventory"; | ||
144 | rootFolder.parentID = LLUUID.Zero; | ||
145 | rootFolder.type = 8; | ||
146 | rootFolder.version = 1; | ||
147 | userInfo.FolderReceive(userID, rootFolder); | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
151 | /// Make sure UserProfile is updated on user server | ||
152 | /// </summary> | ||
153 | /// <param name="userID"></param> | ||
154 | private void UpdateUserProfileToServer(LLUUID userID) | ||
155 | { | ||
156 | |||
157 | } | ||
158 | |||
159 | /// <summary> | ||
160 | /// Update Inventory data to Inventory server | ||
161 | /// </summary> | ||
162 | /// <param name="userID"></param> | ||
163 | private void UpdateInventoryToServer(LLUUID userID) | ||
164 | { | ||
165 | |||
166 | } | ||
167 | } | ||
168 | } | ||
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index d32db1b..d8bfc4d 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -152,6 +152,40 @@ namespace OpenSim.Framework.Data.MySQL | |||
152 | } | 152 | } |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
155 | /// Returns the users inventory root folder. | ||
156 | /// </summary> | ||
157 | /// <param name="user"></param> | ||
158 | /// <returns></returns> | ||
159 | public InventoryFolderBase getUserRootFolder(LLUUID user) | ||
160 | { | ||
161 | try | ||
162 | { | ||
163 | lock (database) | ||
164 | { | ||
165 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
166 | param["?uuid"] = user.ToStringHyphenated(); | ||
167 | param["?zero"] = LLUUID.Zero.ToStringHyphenated(); | ||
168 | |||
169 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); | ||
170 | IDataReader reader = result.ExecuteReader(); | ||
171 | |||
172 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | ||
173 | InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). | ||
174 | reader.Close(); | ||
175 | result.Dispose(); | ||
176 | |||
177 | return rootFolder; | ||
178 | } | ||
179 | } | ||
180 | catch (Exception e) | ||
181 | { | ||
182 | database.Reconnect(); | ||
183 | Console.WriteLine(e.ToString()); | ||
184 | return null; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | /// <summary> | ||
155 | /// Returns a list of folders in a users inventory contained within the specified folder | 189 | /// Returns a list of folders in a users inventory contained within the specified folder |
156 | /// </summary> | 190 | /// </summary> |
157 | /// <param name="parentID">The folder to search</param> | 191 | /// <param name="parentID">The folder to search</param> |
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs index f6aeb58..87013cf 100644 --- a/OpenSim/Framework/Data/InventoryData.cs +++ b/OpenSim/Framework/Data/InventoryData.cs | |||
@@ -143,13 +143,20 @@ namespace OpenSim.Framework.Data | |||
143 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); | 143 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); |
144 | 144 | ||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Returns a list of folders in the users inventory root. | 146 | /// Returns a list of the root folders within a users inventory |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | 148 | /// <param name="user">The user whos inventory is to be searched</param> |
149 | /// <returns>A list of folders</returns> | 149 | /// <returns>A list of folder objects</returns> |
150 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); | 150 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// Returns the users inventory root folder. | ||
154 | /// </summary> | ||
155 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | ||
156 | /// <returns>Root inventory folder</returns> | ||
157 | InventoryFolderBase getUserRootFolder(LLUUID user); | ||
158 | |||
159 | /// <summary> | ||
153 | /// Returns a list of inventory folders contained in the folder 'parentID' | 160 | /// Returns a list of inventory folders contained in the folder 'parentID' |
154 | /// </summary> | 161 | /// </summary> |
155 | /// <param name="parentID">The folder to get subfolders for</param> | 162 | /// <param name="parentID">The folder to get subfolders for</param> |
diff --git a/OpenSim/Framework/General/IRegionCommsListener.cs b/OpenSim/Framework/General/IRegionCommsListener.cs index 81da5d4..b746671 100644 --- a/OpenSim/Framework/General/IRegionCommsListener.cs +++ b/OpenSim/Framework/General/IRegionCommsListener.cs | |||
@@ -34,13 +34,15 @@ namespace OpenSim.Framework | |||
34 | { | 34 | { |
35 | public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); | 35 | public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); |
36 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); | 36 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); |
37 | public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position); | 37 | public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); |
38 | public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); | ||
38 | 39 | ||
39 | public interface IRegionCommsListener | 40 | public interface IRegionCommsListener |
40 | { | 41 | { |
41 | event ExpectUserDelegate OnExpectUser; | 42 | event ExpectUserDelegate OnExpectUser; |
42 | event GenericCall2 OnExpectChildAgent; | 43 | event GenericCall2 OnExpectChildAgent; |
43 | event AgentCrossing OnAvatarCrossingIntoRegion; | 44 | event AgentCrossing OnAvatarCrossingIntoRegion; |
45 | event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; | ||
44 | event UpdateNeighbours OnNeighboursUpdate; | 46 | event UpdateNeighbours OnNeighboursUpdate; |
45 | } | 47 | } |
46 | } | 48 | } |
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index df65027..c2af2f4 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -81,8 +81,9 @@ namespace OpenSim.Framework.Interfaces | |||
81 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); | 81 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); |
82 | 82 | ||
83 | public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); | 83 | public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); |
84 | public delegate void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); | ||
84 | public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); | 85 | public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); |
85 | 86 | public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); | |
86 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); | 87 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); |
87 | 88 | ||
88 | public interface IClientAPI | 89 | public interface IClientAPI |
@@ -128,8 +129,10 @@ namespace OpenSim.Framework.Interfaces | |||
128 | event NewAvatar OnNewAvatar; | 129 | event NewAvatar OnNewAvatar; |
129 | event GenericCall6 OnRemoveAvatar; | 130 | event GenericCall6 OnRemoveAvatar; |
130 | 131 | ||
132 | event CreateNewInventoryItem OnCreateNewInventoryItem; | ||
131 | event CreateInventoryFolder OnCreateNewInventoryFolder; | 133 | event CreateInventoryFolder OnCreateNewInventoryFolder; |
132 | event FetchInventoryDescendents OnFetchInventoryDescendents; | 134 | event FetchInventoryDescendents OnFetchInventoryDescendents; |
135 | event FetchInventory OnFetchInventory; | ||
133 | event RequestTaskInventory OnRequestTaskInventory; | 136 | event RequestTaskInventory OnRequestTaskInventory; |
134 | 137 | ||
135 | event UUIDNameRequest OnNameFromUUIDRequest; | 138 | event UUIDNameRequest OnNameFromUUIDRequest; |
@@ -194,7 +197,7 @@ namespace OpenSim.Framework.Interfaces | |||
194 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); | 197 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); |
195 | 198 | ||
196 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); | 199 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); |
197 | void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); | 200 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); |
198 | void SendInventoryItemUpdate(InventoryItemBase Item); | 201 | void SendInventoryItemUpdate(InventoryItemBase Item); |
199 | void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); | 202 | void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); |
200 | 203 | ||
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index 18ac527..1b42064 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -52,8 +52,10 @@ namespace OpenSim.Framework | |||
52 | public event NewAvatar OnNewAvatar; | 52 | public event NewAvatar OnNewAvatar; |
53 | public event GenericCall6 OnRemoveAvatar; | 53 | public event GenericCall6 OnRemoveAvatar; |
54 | 54 | ||
55 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | ||
55 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 56 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
56 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 57 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
58 | public event FetchInventory OnFetchInventory; | ||
57 | public event RequestTaskInventory OnRequestTaskInventory; | 59 | public event RequestTaskInventory OnRequestTaskInventory; |
58 | 60 | ||
59 | public event UUIDNameRequest OnNameFromUUIDRequest; | 61 | public event UUIDNameRequest OnNameFromUUIDRequest; |
@@ -127,7 +129,7 @@ namespace OpenSim.Framework | |||
127 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){} | 129 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){} |
128 | 130 | ||
129 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} | 131 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} |
130 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){} | 132 | public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){} |
131 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | 133 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } |
132 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | 134 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } |
133 | 135 | ||
diff --git a/OpenSim/Framework/General/RegionCommsListener.cs b/OpenSim/Framework/General/RegionCommsListener.cs index f5b8272..f7edb7e 100644 --- a/OpenSim/Framework/General/RegionCommsListener.cs +++ b/OpenSim/Framework/General/RegionCommsListener.cs | |||
@@ -39,6 +39,7 @@ namespace OpenSim.Framework | |||
39 | public event GenericCall2 OnExpectChildAgent; | 39 | public event GenericCall2 OnExpectChildAgent; |
40 | public event AgentCrossing OnAvatarCrossingIntoRegion; | 40 | public event AgentCrossing OnAvatarCrossingIntoRegion; |
41 | public event UpdateNeighbours OnNeighboursUpdate; | 41 | public event UpdateNeighbours OnNeighboursUpdate; |
42 | public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; | ||
42 | 43 | ||
43 | /// <summary> | 44 | /// <summary> |
44 | /// | 45 | /// |
@@ -57,11 +58,21 @@ namespace OpenSim.Framework | |||
57 | return false; | 58 | return false; |
58 | } | 59 | } |
59 | 60 | ||
60 | public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 61 | public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
61 | { | 62 | { |
62 | if (OnAvatarCrossingIntoRegion != null) | 63 | if (OnAvatarCrossingIntoRegion != null) |
63 | { | 64 | { |
64 | OnAvatarCrossingIntoRegion(regionHandle, agentID, position); | 65 | OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); |
66 | return true; | ||
67 | } | ||
68 | return false; | ||
69 | } | ||
70 | |||
71 | public virtual bool TriggerAcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) | ||
72 | { | ||
73 | if (OnAcknowledgeAgentCrossed != null) | ||
74 | { | ||
75 | OnAcknowledgeAgentCrossed(regionHandle, agentID); | ||
65 | return true; | 76 | return true; |
66 | } | 77 | } |
67 | return false; | 78 | return false; |
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs new file mode 100644 index 0000000..d407cdb --- /dev/null +++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs | |||
@@ -0,0 +1,136 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Console; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Data; | ||
9 | |||
10 | namespace OpenSim.Framework.InventoryServiceBase | ||
11 | { | ||
12 | public class InventoryServiceBase | ||
13 | { | ||
14 | protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); | ||
15 | protected IAssetServer m_assetServer; | ||
16 | |||
17 | public InventoryServiceBase(IAssetServer assetServer) | ||
18 | { | ||
19 | m_assetServer = assetServer; | ||
20 | } | ||
21 | |||
22 | /// <summary> | ||
23 | /// Adds a new user server plugin - plugins will be requested in the order they were loaded. | ||
24 | /// </summary> | ||
25 | /// <param name="FileName">The filename to the user server plugin DLL</param> | ||
26 | public void AddPlugin(string FileName) | ||
27 | { | ||
28 | MainLog.Instance.Verbose("Inventorytorage: Attempting to load " + FileName); | ||
29 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
30 | |||
31 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
32 | { | ||
33 | if (!pluginType.IsAbstract) | ||
34 | { | ||
35 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); | ||
36 | |||
37 | if (typeInterface != null) | ||
38 | { | ||
39 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
40 | plug.Initialise(); | ||
41 | this.m_plugins.Add(plug.getName(), plug); | ||
42 | MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface"); | ||
43 | } | ||
44 | |||
45 | typeInterface = null; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | pluginAssembly = null; | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// | ||
54 | /// </summary> | ||
55 | /// <param name="userID"></param> | ||
56 | /// <returns></returns> | ||
57 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) | ||
58 | { | ||
59 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); | ||
60 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
61 | { | ||
62 | InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID); | ||
63 | if (rootFolder != null) | ||
64 | { | ||
65 | inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID); | ||
66 | inventoryList.Insert(0, rootFolder); | ||
67 | return inventoryList; | ||
68 | } | ||
69 | } | ||
70 | return inventoryList; | ||
71 | } | ||
72 | |||
73 | /// <summary> | ||
74 | /// | ||
75 | /// </summary> | ||
76 | public InventoryFolderBase RequestUsersRoot(LLUUID userID) | ||
77 | { | ||
78 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
79 | { | ||
80 | return plugin.Value.getUserRootFolder(userID); | ||
81 | } | ||
82 | return null; | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// | ||
87 | /// </summary> | ||
88 | /// <param name="parentFolderID"></param> | ||
89 | /// <returns></returns> | ||
90 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) | ||
91 | { | ||
92 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); | ||
93 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
94 | { | ||
95 | return plugin.Value.getInventoryFolders(parentFolderID); | ||
96 | } | ||
97 | return inventoryList; | ||
98 | } | ||
99 | |||
100 | public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) | ||
101 | { | ||
102 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); | ||
103 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
104 | { | ||
105 | itemsList = plugin.Value.getInventoryInFolder(folderID); | ||
106 | return itemsList; | ||
107 | } | ||
108 | return itemsList; | ||
109 | } | ||
110 | |||
111 | /// <summary> | ||
112 | /// | ||
113 | /// </summary> | ||
114 | /// <param name="inventory"></param> | ||
115 | public void AddNewInventorySet(UsersInventory inventory) | ||
116 | { | ||
117 | |||
118 | } | ||
119 | |||
120 | public class UsersInventory | ||
121 | { | ||
122 | public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>(); | ||
123 | public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); | ||
124 | |||
125 | public UsersInventory() | ||
126 | { | ||
127 | |||
128 | } | ||
129 | |||
130 | protected virtual void CreateNewInventorySet() | ||
131 | { | ||
132 | |||
133 | } | ||
134 | } | ||
135 | } | ||
136 | } | ||
diff --git a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs b/OpenSim/Framework/InventoryServiceBase/Properties/AssemblyInfo.cs index 4ba42b9..35cca07 100644 --- a/OpenSim/Region/Caches/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/InventoryServiceBase/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,35 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.CompilerServices; |
3 | // General Information about an assembly is controlled through the following | 3 | using System.Runtime.InteropServices; |
4 | // set of attributes. Change these attribute values to modify the information | 4 | |
5 | // associated with an assembly. | 5 | // General Information about an assembly is controlled through the following |
6 | [assembly: AssemblyTitle("OpenSim.Region.Caches")] | 6 | // set of attributes. Change these attribute values to modify the information |
7 | [assembly: AssemblyDescription("")] | 7 | // associated with an assembly. |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyTitle("InventoryServiceBase")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyDescription("")] |
10 | [assembly: AssemblyProduct("OpenSim.Region.Caches")] | 10 | [assembly: AssemblyConfiguration("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCompany("")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyProduct("InventoryServiceBase")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCopyright("Copyright © 2007")] |
14 | 14 | [assembly: AssemblyTrademark("")] | |
15 | // Setting ComVisible to false makes the types in this assembly not visible | 15 | [assembly: AssemblyCulture("")] |
16 | // to COM components. If you need to access a type in this assembly from | 16 | |
17 | // COM, set the ComVisible attribute to true on that type. | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | [assembly: ComVisible(false)] | 18 | // to COM components. If you need to access a type in this assembly from |
19 | 19 | // COM, set the ComVisible attribute to true on that type. | |
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 20 | [assembly: ComVisible(false)] |
21 | [assembly: Guid("2b15ddbf-0341-49a6-85c0-cece268a4518")] | 21 | |
22 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | |
23 | // Version information for an assembly consists of the following four values: | 23 | [assembly: Guid("7e1fbd0b-4a25-4804-a01f-89b04eb5b349")] |
24 | // | 24 | |
25 | // Major Version | 25 | // Version information for an assembly consists of the following four values: |
26 | // Minor Version | 26 | // |
27 | // Build Number | 27 | // Major Version |
28 | // Revision | 28 | // Minor Version |
29 | // | 29 | // Build Number |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 30 | // Revision |
31 | // by using the '*' as shown below: | 31 | // |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | // You can specify all the values or you can default the Revision and Build Numbers |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | // by using the '*' as shown below: |
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||