aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r--OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs14
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs92
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs456
-rw-r--r--OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs12
4 files changed, 515 insertions, 59 deletions
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 490a13a..47bc860 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -86,14 +86,14 @@ namespace OpenSim.Server.Handlers.Authentication
86 86
87 private byte[] DoPlainMethods(string body) 87 private byte[] DoPlainMethods(string body)
88 { 88 {
89 Dictionary<string, string> request = 89 Dictionary<string, object> request =
90 ServerUtils.ParseQueryString(body); 90 ServerUtils.ParseQueryString(body);
91 91
92 int lifetime = 30; 92 int lifetime = 30;
93 93
94 if (request.ContainsKey("LIFETIME")) 94 if (request.ContainsKey("LIFETIME"))
95 { 95 {
96 lifetime = Convert.ToInt32(request["LIFETIME"]); 96 lifetime = Convert.ToInt32(request["LIFETIME"].ToString());
97 if (lifetime > 30) 97 if (lifetime > 30)
98 lifetime = 30; 98 lifetime = 30;
99 } 99 }
@@ -103,12 +103,12 @@ namespace OpenSim.Server.Handlers.Authentication
103 if (!request.ContainsKey("PRINCIPAL")) 103 if (!request.ContainsKey("PRINCIPAL"))
104 return FailureResult(); 104 return FailureResult();
105 105
106 string method = request["METHOD"]; 106 string method = request["METHOD"].ToString();
107 107
108 UUID principalID; 108 UUID principalID;
109 string token; 109 string token;
110 110
111 if (!UUID.TryParse(request["PRINCIPAL"], out principalID)) 111 if (!UUID.TryParse(request["PRINCIPAL"].ToString(), out principalID))
112 return FailureResult(); 112 return FailureResult();
113 113
114 switch (method) 114 switch (method)
@@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Authentication
117 if (!request.ContainsKey("PASSWORD")) 117 if (!request.ContainsKey("PASSWORD"))
118 return FailureResult(); 118 return FailureResult();
119 119
120 token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"], lifetime); 120 token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime);
121 121
122 if (token != String.Empty) 122 if (token != String.Empty)
123 return SuccessResult(token); 123 return SuccessResult(token);
@@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Authentication
126 if (!request.ContainsKey("TOKEN")) 126 if (!request.ContainsKey("TOKEN"))
127 return FailureResult(); 127 return FailureResult();
128 128
129 if (m_AuthenticationService.Verify(principalID, request["TOKEN"], lifetime)) 129 if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime))
130 return SuccessResult(); 130 return SuccessResult();
131 131
132 return FailureResult(); 132 return FailureResult();
@@ -134,7 +134,7 @@ namespace OpenSim.Server.Handlers.Authentication
134 if (!request.ContainsKey("TOKEN")) 134 if (!request.ContainsKey("TOKEN"))
135 return FailureResult(); 135 return FailureResult();
136 136
137 if (m_AuthenticationService.Release(principalID, request["TOKEN"])) 137 if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString()))
138 return SuccessResult(); 138 return SuccessResult();
139 139
140 return FailureResult(); 140 return FailureResult();
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 433ed0b..d99b791 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -69,13 +69,13 @@ namespace OpenSim.Server.Handlers.Grid
69 69
70 try 70 try
71 { 71 {
72 Dictionary<string, string> request = 72 Dictionary<string, object> request =
73 ServerUtils.ParseQueryString(body); 73 ServerUtils.ParseQueryString(body);
74 74
75 if (!request.ContainsKey("METHOD")) 75 if (!request.ContainsKey("METHOD"))
76 return FailureResult(); 76 return FailureResult();
77 77
78 string method = request["METHOD"]; 78 string method = request["METHOD"].ToString();
79 79
80 switch (method) 80 switch (method)
81 { 81 {
@@ -117,22 +117,22 @@ namespace OpenSim.Server.Handlers.Grid
117 117
118 #region Method-specific handlers 118 #region Method-specific handlers
119 119
120 byte[] Register(Dictionary<string, string> request) 120 byte[] Register(Dictionary<string, object> request)
121 { 121 {
122 UUID scopeID = UUID.Zero; 122 UUID scopeID = UUID.Zero;
123 if (request.ContainsKey("SCOPEID")) 123 if (request.ContainsKey("SCOPEID"))
124 UUID.TryParse(request["SCOPEID"], out scopeID); 124 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
125 else 125 else
126 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); 126 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region");
127 127
128 int versionNumberMin = 0, versionNumberMax = 0; 128 int versionNumberMin = 0, versionNumberMax = 0;
129 if (request.ContainsKey("VERSIONMIN")) 129 if (request.ContainsKey("VERSIONMIN"))
130 Int32.TryParse(request["VERSIONMIN"], out versionNumberMin); 130 Int32.TryParse(request["VERSIONMIN"].ToString(), out versionNumberMin);
131 else 131 else
132 m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region"); 132 m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region");
133 133
134 if (request.ContainsKey("VERSIONMAX")) 134 if (request.ContainsKey("VERSIONMAX"))
135 Int32.TryParse(request["VERSIONMAX"], out versionNumberMax); 135 Int32.TryParse(request["VERSIONMAX"].ToString(), out versionNumberMax);
136 else 136 else
137 m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region"); 137 m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region");
138 138
@@ -147,8 +147,8 @@ namespace OpenSim.Server.Handlers.Grid
147 GridRegion rinfo = null; 147 GridRegion rinfo = null;
148 try 148 try
149 { 149 {
150 foreach (KeyValuePair<string, string> kvp in request) 150 foreach (KeyValuePair<string, object> kvp in request)
151 rinfoData[kvp.Key] = kvp.Value; 151 rinfoData[kvp.Key] = kvp.Value.ToString();
152 rinfo = new GridRegion(rinfoData); 152 rinfo = new GridRegion(rinfoData);
153 } 153 }
154 catch (Exception e) 154 catch (Exception e)
@@ -166,11 +166,11 @@ namespace OpenSim.Server.Handlers.Grid
166 return FailureResult(); 166 return FailureResult();
167 } 167 }
168 168
169 byte[] Deregister(Dictionary<string, string> request) 169 byte[] Deregister(Dictionary<string, object> request)
170 { 170 {
171 UUID regionID = UUID.Zero; 171 UUID regionID = UUID.Zero;
172 if (request["REGIONID"] != null) 172 if (request.ContainsKey("REGIONID"))
173 UUID.TryParse(request["REGIONID"], out regionID); 173 UUID.TryParse(request["REGIONID"].ToString(), out regionID);
174 else 174 else
175 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region"); 175 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region");
176 176
@@ -183,17 +183,17 @@ namespace OpenSim.Server.Handlers.Grid
183 183
184 } 184 }
185 185
186 byte[] GetNeighbours(Dictionary<string, string> request) 186 byte[] GetNeighbours(Dictionary<string, object> request)
187 { 187 {
188 UUID scopeID = UUID.Zero; 188 UUID scopeID = UUID.Zero;
189 if (request["SCOPEID"] != null) 189 if (request.ContainsKey("SCOPEID"))
190 UUID.TryParse(request["SCOPEID"], out scopeID); 190 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
191 else 191 else
192 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); 192 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
193 193
194 UUID regionID = UUID.Zero; 194 UUID regionID = UUID.Zero;
195 if (request["REGIONID"] != null) 195 if (request.ContainsKey("REGIONID"))
196 UUID.TryParse(request["REGIONID"], out regionID); 196 UUID.TryParse(request["REGIONID"].ToString(), out regionID);
197 else 197 else
198 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); 198 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
199 199
@@ -221,17 +221,17 @@ namespace OpenSim.Server.Handlers.Grid
221 221
222 } 222 }
223 223
224 byte[] GetRegionByUUID(Dictionary<string, string> request) 224 byte[] GetRegionByUUID(Dictionary<string, object> request)
225 { 225 {
226 UUID scopeID = UUID.Zero; 226 UUID scopeID = UUID.Zero;
227 if (request["SCOPEID"] != null) 227 if (request.ContainsKey("SCOPEID"))
228 UUID.TryParse(request["SCOPEID"], out scopeID); 228 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
229 else 229 else
230 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); 230 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
231 231
232 UUID regionID = UUID.Zero; 232 UUID regionID = UUID.Zero;
233 if (request["REGIONID"] != null) 233 if (request.ContainsKey("REGIONID"))
234 UUID.TryParse(request["REGIONID"], out regionID); 234 UUID.TryParse(request["REGIONID"].ToString(), out regionID);
235 else 235 else
236 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); 236 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
237 237
@@ -250,21 +250,21 @@ namespace OpenSim.Server.Handlers.Grid
250 return encoding.GetBytes(xmlString); 250 return encoding.GetBytes(xmlString);
251 } 251 }
252 252
253 byte[] GetRegionByPosition(Dictionary<string, string> request) 253 byte[] GetRegionByPosition(Dictionary<string, object> request)
254 { 254 {
255 UUID scopeID = UUID.Zero; 255 UUID scopeID = UUID.Zero;
256 if (request["SCOPEID"] != null) 256 if (request.ContainsKey("SCOPEID"))
257 UUID.TryParse(request["SCOPEID"], out scopeID); 257 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
258 else 258 else
259 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); 259 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position");
260 260
261 int x = 0, y = 0; 261 int x = 0, y = 0;
262 if (request["X"] != null) 262 if (request.ContainsKey("X"))
263 Int32.TryParse(request["X"], out x); 263 Int32.TryParse(request["X"].ToString(), out x);
264 else 264 else
265 m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); 265 m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position");
266 if (request["Y"] != null) 266 if (request.ContainsKey("Y"))
267 Int32.TryParse(request["Y"], out y); 267 Int32.TryParse(request["Y"].ToString(), out y);
268 else 268 else
269 m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); 269 m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
270 270
@@ -283,17 +283,17 @@ namespace OpenSim.Server.Handlers.Grid
283 return encoding.GetBytes(xmlString); 283 return encoding.GetBytes(xmlString);
284 } 284 }
285 285
286 byte[] GetRegionByName(Dictionary<string, string> request) 286 byte[] GetRegionByName(Dictionary<string, object> request)
287 { 287 {
288 UUID scopeID = UUID.Zero; 288 UUID scopeID = UUID.Zero;
289 if (request["SCOPEID"] != null) 289 if (request.ContainsKey("SCOPEID"))
290 UUID.TryParse(request["SCOPEID"], out scopeID); 290 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
291 else 291 else
292 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); 292 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name");
293 293
294 string regionName = string.Empty; 294 string regionName = string.Empty;
295 if (request["NAME"] != null) 295 if (request.ContainsKey("NAME"))
296 regionName = request["NAME"]; 296 regionName = request["NAME"].ToString();
297 else 297 else
298 m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); 298 m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
299 299
@@ -312,23 +312,23 @@ namespace OpenSim.Server.Handlers.Grid
312 return encoding.GetBytes(xmlString); 312 return encoding.GetBytes(xmlString);
313 } 313 }
314 314
315 byte[] GetRegionsByName(Dictionary<string, string> request) 315 byte[] GetRegionsByName(Dictionary<string, object> request)
316 { 316 {
317 UUID scopeID = UUID.Zero; 317 UUID scopeID = UUID.Zero;
318 if (request["SCOPEID"] != null) 318 if (request.ContainsKey("SCOPEID"))
319 UUID.TryParse(request["SCOPEID"], out scopeID); 319 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
320 else 320 else
321 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); 321 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name");
322 322
323 string regionName = string.Empty; 323 string regionName = string.Empty;
324 if (request["NAME"] != null) 324 if (request.ContainsKey("NAME"))
325 regionName = request["NAME"]; 325 regionName = request["NAME"].ToString();
326 else 326 else
327 m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); 327 m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name");
328 328
329 int max = 0; 329 int max = 0;
330 if (request["MAX"] != null) 330 if (request.ContainsKey("MAX"))
331 Int32.TryParse(request["MAX"], out max); 331 Int32.TryParse(request["MAX"].ToString(), out max);
332 else 332 else
333 m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); 333 m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name");
334 334
@@ -355,30 +355,30 @@ namespace OpenSim.Server.Handlers.Grid
355 return encoding.GetBytes(xmlString); 355 return encoding.GetBytes(xmlString);
356 } 356 }
357 357
358 byte[] GetRegionRange(Dictionary<string, string> request) 358 byte[] GetRegionRange(Dictionary<string, object> request)
359 { 359 {
360 //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); 360 //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange");
361 UUID scopeID = UUID.Zero; 361 UUID scopeID = UUID.Zero;
362 if (request.ContainsKey("SCOPEID")) 362 if (request.ContainsKey("SCOPEID"))
363 UUID.TryParse(request["SCOPEID"], out scopeID); 363 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
364 else 364 else
365 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); 365 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range");
366 366
367 int xmin = 0, xmax = 0, ymin = 0, ymax = 0; 367 int xmin = 0, xmax = 0, ymin = 0, ymax = 0;
368 if (request.ContainsKey("XMIN")) 368 if (request.ContainsKey("XMIN"))
369 Int32.TryParse(request["XMIN"], out xmin); 369 Int32.TryParse(request["XMIN"].ToString(), out xmin);
370 else 370 else
371 m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); 371 m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range");
372 if (request.ContainsKey("XMAX")) 372 if (request.ContainsKey("XMAX"))
373 Int32.TryParse(request["XMAX"], out xmax); 373 Int32.TryParse(request["XMAX"].ToString(), out xmax);
374 else 374 else
375 m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); 375 m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range");
376 if (request.ContainsKey("YMIN")) 376 if (request.ContainsKey("YMIN"))
377 Int32.TryParse(request["YMIN"], out ymin); 377 Int32.TryParse(request["YMIN"].ToString(), out ymin);
378 else 378 else
379 m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); 379 m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range");
380 if (request.ContainsKey("YMAX")) 380 if (request.ContainsKey("YMAX"))
381 Int32.TryParse(request["YMAX"], out ymax); 381 Int32.TryParse(request["YMAX"].ToString(), out ymax);
382 else 382 else
383 m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); 383 m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range");
384 384
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
new file mode 100644
index 0000000..c7d5ff1
--- /dev/null
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -0,0 +1,456 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using System.Text;
31using System.Xml;
32using System.Collections.Generic;
33using System.IO;
34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Server.Handlers.Base;
40using log4net;
41using OpenMetaverse;
42
43namespace OpenSim.Server.Handlers.Asset
44{
45 public class XInventoryInConnector : ServiceConnector
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private IInventoryService m_InventoryService;
50 private string m_ConfigName = "InventoryService";
51
52 public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) :
53 base(config, server, configName)
54 {
55 if (configName != String.Empty)
56 m_ConfigName = configName;
57
58 IConfig serverConfig = config.Configs[m_ConfigName];
59 if (serverConfig == null)
60 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
61
62 string inventoryService = serverConfig.GetString("LocalServiceModule",
63 String.Empty);
64
65 if (inventoryService == String.Empty)
66 throw new Exception("No InventoryService in config file");
67
68 Object[] args = new Object[] { config };
69 m_InventoryService =
70 ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);
71
72 server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService));
73 }
74 }
75
76 public class XInventoryConnectorPostHandler : BaseStreamHandler
77 {
78 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
79
80 private IInventoryService m_InventoryService;
81
82 public XInventoryConnectorPostHandler(IInventoryService service) :
83 base("POST", "/xinventory")
84 {
85 m_InventoryService = service;
86 }
87
88 public override byte[] Handle(string path, Stream requestData,
89 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
90 {
91 StreamReader sr = new StreamReader(requestData);
92 string body = sr.ReadToEnd();
93 sr.Close();
94 body = body.Trim();
95
96 m_log.DebugFormat("[XXX]: query String: {0}", body);
97
98 try
99 {
100 Dictionary<string, object> request =
101 ServerUtils.ParseQueryString(body);
102
103 if (!request.ContainsKey("METHOD"))
104 return FailureResult();
105
106 string method = request["METHOD"].ToString();
107 request.Remove("METHOD");
108
109 switch (method)
110 {
111 case "CREATEUSERINVENTORY":
112 return HandleCreateUserInventory(request);
113 case "GETINVENTORYSKELETON":
114 return HandleGetInventorySkeleton(request);
115 case "GETROOTFOLDER":
116 return HandleGetRootFolder(request);
117 case "GETFOLDERFORTYPE":
118 return HandleGetFolderForType(request);
119 case "GETFOLDERCONTENT":
120 return HandleGetFolderContent(request);
121 case "GETFOLDERITEMS":
122 return HandleGetFolderItems(request);
123 case "ADDFOLDER":
124 return HandleAddFolder(request);
125 case "UPDATEFOLDER":
126 return HandleUpdateFolder(request);
127 case "MOVEFOLDER":
128 return HandleMoveFolder(request);
129 case "DELETEFOLDERS":
130 return HandleDeleteFolders(request);
131 case "PURGEFOLDER":
132 return HandlePurgeFolder(request);
133 case "ADDITEM":
134 return HandleAddItem(request);
135 case "UPDATEITEM":
136 return HandleUpdateItem(request);
137 case "MOVEITEMS":
138 return HandleMoveItems(request);
139 case "DELETEITEMS":
140 return HandleDeleteItems(request);
141 case "GETITEM":
142 return HandleGetItem(request);
143 case "GETFOLDER":
144 return HandleGetFolder(request);
145 case "GETACTIVEGESTURES":
146 return HandleGetActiveGestures(request);
147 case "GETASSETPERMISSIONS":
148 return HandleGetAssetPermissions(request);
149 }
150 m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
151 }
152 catch (Exception e)
153 {
154 m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e);
155 }
156
157 return FailureResult();
158 }
159
160 private byte[] FailureResult()
161 {
162 XmlDocument doc = new XmlDocument();
163
164 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
165 "", "");
166
167 doc.AppendChild(xmlnode);
168
169 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
170 "");
171
172 doc.AppendChild(rootElement);
173
174 XmlElement result = doc.CreateElement("", "RESULT", "");
175 result.AppendChild(doc.CreateTextNode("False"));
176
177 rootElement.AppendChild(result);
178
179 return DocToBytes(doc);
180 }
181
182 private byte[] DocToBytes(XmlDocument doc)
183 {
184 MemoryStream ms = new MemoryStream();
185 XmlTextWriter xw = new XmlTextWriter(ms, null);
186 xw.Formatting = Formatting.Indented;
187 doc.WriteTo(xw);
188 xw.Flush();
189
190 return ms.ToArray();
191 }
192
193 byte[] HandleCreateUserInventory(Dictionary<string,object> request)
194 {
195 Dictionary<string,object> result = new Dictionary<string,object>();
196
197 if (!request.ContainsKey("PRINCIPAL"))
198 return FailureResult();
199
200 if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString())))
201 result["RESULT"] = "True";
202 else
203 result["RESULT"] = "False";
204
205 string xmlString = ServerUtils.BuildXmlResponse(result);
206 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
207 UTF8Encoding encoding = new UTF8Encoding();
208 return encoding.GetBytes(xmlString);
209 }
210
211 byte[] HandleGetInventorySkeleton(Dictionary<string,object> request)
212 {
213 Dictionary<string,object> result = new Dictionary<string,object>();
214
215 if (!request.ContainsKey("PRINCIPAL"))
216 return FailureResult();
217
218
219 List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString()));
220
221 foreach (InventoryFolderBase f in folders)
222 result[f.ID.ToString()] = EncodeFolder(f);
223
224 string xmlString = ServerUtils.BuildXmlResponse(result);
225 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
226 UTF8Encoding encoding = new UTF8Encoding();
227 return encoding.GetBytes(xmlString);
228 }
229
230 byte[] HandleGetRootFolder(Dictionary<string,object> request)
231 {
232 Dictionary<string,object> result = new Dictionary<string,object>();
233
234 string xmlString = ServerUtils.BuildXmlResponse(result);
235 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
236 UTF8Encoding encoding = new UTF8Encoding();
237 return encoding.GetBytes(xmlString);
238 }
239
240 byte[] HandleGetFolderForType(Dictionary<string,object> request)
241 {
242 Dictionary<string,object> result = new Dictionary<string,object>();
243
244 string xmlString = ServerUtils.BuildXmlResponse(result);
245 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
246 UTF8Encoding encoding = new UTF8Encoding();
247 return encoding.GetBytes(xmlString);
248 }
249
250 byte[] HandleGetFolderContent(Dictionary<string,object> request)
251 {
252 Dictionary<string,object> result = new Dictionary<string,object>();
253
254 string xmlString = ServerUtils.BuildXmlResponse(result);
255 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
256 UTF8Encoding encoding = new UTF8Encoding();
257 return encoding.GetBytes(xmlString);
258 }
259
260 byte[] HandleGetFolderItems(Dictionary<string,object> request)
261 {
262 Dictionary<string,object> result = new Dictionary<string,object>();
263
264 string xmlString = ServerUtils.BuildXmlResponse(result);
265 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
266 UTF8Encoding encoding = new UTF8Encoding();
267 return encoding.GetBytes(xmlString);
268 }
269
270 byte[] HandleAddFolder(Dictionary<string,object> request)
271 {
272 Dictionary<string,object> result = new Dictionary<string,object>();
273
274 string xmlString = ServerUtils.BuildXmlResponse(result);
275 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
276 UTF8Encoding encoding = new UTF8Encoding();
277 return encoding.GetBytes(xmlString);
278 }
279
280 byte[] HandleUpdateFolder(Dictionary<string,object> request)
281 {
282 Dictionary<string,object> result = new Dictionary<string,object>();
283
284 string xmlString = ServerUtils.BuildXmlResponse(result);
285 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
286 UTF8Encoding encoding = new UTF8Encoding();
287 return encoding.GetBytes(xmlString);
288 }
289
290 byte[] HandleMoveFolder(Dictionary<string,object> request)
291 {
292 Dictionary<string,object> result = new Dictionary<string,object>();
293
294 string xmlString = ServerUtils.BuildXmlResponse(result);
295 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
296 UTF8Encoding encoding = new UTF8Encoding();
297 return encoding.GetBytes(xmlString);
298 }
299
300 byte[] HandleDeleteFolders(Dictionary<string,object> request)
301 {
302 Dictionary<string,object> result = new Dictionary<string,object>();
303
304 string xmlString = ServerUtils.BuildXmlResponse(result);
305 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
306 UTF8Encoding encoding = new UTF8Encoding();
307 return encoding.GetBytes(xmlString);
308 }
309
310 byte[] HandlePurgeFolder(Dictionary<string,object> request)
311 {
312 Dictionary<string,object> result = new Dictionary<string,object>();
313
314 string xmlString = ServerUtils.BuildXmlResponse(result);
315 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
316 UTF8Encoding encoding = new UTF8Encoding();
317 return encoding.GetBytes(xmlString);
318 }
319
320 byte[] HandleAddItem(Dictionary<string,object> request)
321 {
322 Dictionary<string,object> result = new Dictionary<string,object>();
323
324 string xmlString = ServerUtils.BuildXmlResponse(result);
325 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
326 UTF8Encoding encoding = new UTF8Encoding();
327 return encoding.GetBytes(xmlString);
328 }
329
330 byte[] HandleUpdateItem(Dictionary<string,object> request)
331 {
332 Dictionary<string,object> result = new Dictionary<string,object>();
333
334 string xmlString = ServerUtils.BuildXmlResponse(result);
335 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
336 UTF8Encoding encoding = new UTF8Encoding();
337 return encoding.GetBytes(xmlString);
338 }
339
340 byte[] HandleMoveItems(Dictionary<string,object> request)
341 {
342 Dictionary<string,object> result = new Dictionary<string,object>();
343
344 string xmlString = ServerUtils.BuildXmlResponse(result);
345 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
346 UTF8Encoding encoding = new UTF8Encoding();
347 return encoding.GetBytes(xmlString);
348 }
349
350 byte[] HandleDeleteItems(Dictionary<string,object> request)
351 {
352 Dictionary<string,object> result = new Dictionary<string,object>();
353
354 string xmlString = ServerUtils.BuildXmlResponse(result);
355 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
356 UTF8Encoding encoding = new UTF8Encoding();
357 return encoding.GetBytes(xmlString);
358 }
359
360 byte[] HandleGetItem(Dictionary<string,object> request)
361 {
362 Dictionary<string,object> result = new Dictionary<string,object>();
363
364 string xmlString = ServerUtils.BuildXmlResponse(result);
365 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
366 UTF8Encoding encoding = new UTF8Encoding();
367 return encoding.GetBytes(xmlString);
368 }
369
370 byte[] HandleGetFolder(Dictionary<string,object> request)
371 {
372 Dictionary<string,object> result = new Dictionary<string,object>();
373
374 string xmlString = ServerUtils.BuildXmlResponse(result);
375 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
376 UTF8Encoding encoding = new UTF8Encoding();
377 return encoding.GetBytes(xmlString);
378 }
379
380 byte[] HandleGetActiveGestures(Dictionary<string,object> request)
381 {
382 Dictionary<string,object> result = new Dictionary<string,object>();
383
384 string xmlString = ServerUtils.BuildXmlResponse(result);
385 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
386 UTF8Encoding encoding = new UTF8Encoding();
387 return encoding.GetBytes(xmlString);
388 }
389
390 byte[] HandleGetAssetPermissions(Dictionary<string,object> request)
391 {
392 Dictionary<string,object> result = new Dictionary<string,object>();
393
394 string xmlString = ServerUtils.BuildXmlResponse(result);
395 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
396 UTF8Encoding encoding = new UTF8Encoding();
397 return encoding.GetBytes(xmlString);
398 }
399
400 private Dictionary<string, object> EncodeFolder(InventoryFolderBase f)
401 {
402 Dictionary<string, object> ret = new Dictionary<string, object>();
403
404 ret["ParentID"] = f.ParentID.ToString();
405 ret["Type"] = f.Type.ToString();
406 ret["Version"] = f.Version.ToString();
407 ret["Name"] = f.Name;
408 ret["Owner"] = f.Owner.ToString();
409 ret["ID"] = f.ID.ToString();
410
411 return ret;
412 }
413
414 private InventoryFolderBase BuildFolder(Dictionary<string,object> data)
415 {
416 InventoryFolderBase folder = new InventoryFolderBase();
417
418 folder.ParentID = new UUID(data["ParentID"].ToString());
419 folder.Type = short.Parse(data["Type"].ToString());
420 folder.Version = ushort.Parse(data["Version"].ToString());
421 folder.Name = data["Name"].ToString();
422 folder.Owner = new UUID(data["Owner"].ToString());
423 folder.ID = new UUID(data["ID"].ToString());
424
425 return folder;
426 }
427
428 private InventoryItemBase BuildItem(Dictionary<string,object> data)
429 {
430 InventoryItemBase item = new InventoryItemBase();
431
432 item.AssetID = new UUID(data["AssetID"].ToString());
433 item.AssetType = int.Parse(data["AssetType"].ToString());
434 item.Name = data["Name"].ToString();
435 item.Owner = new UUID(data["Owner"].ToString());
436 item.ID = new UUID(data["ID"].ToString());
437 item.InvType = int.Parse(data["InvType"].ToString());
438 item.Folder = new UUID(data["Folder"].ToString());
439 item.CreatorId = data["CreatorId"].ToString();
440 item.Description = data["Description"].ToString();
441 item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
442 item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());
443 item.BasePermissions = uint.Parse(data["BasePermissions"].ToString());
444 item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString());
445 item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString());
446 item.GroupID = new UUID(data["GroupID"].ToString());
447 item.GroupOwned = bool.Parse(data["GroupOwned"].ToString());
448 item.SalePrice = int.Parse(data["SalePrice"].ToString());
449 item.SaleType = byte.Parse(data["SaleType"].ToString());
450 item.Flags = uint.Parse(data["Flags"].ToString());
451 item.CreationDate = int.Parse(data["CreationDate"].ToString());
452
453 return item;
454 }
455 }
456}
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 2558fa0..b5ae54a 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -68,13 +68,13 @@ namespace OpenSim.Server.Handlers.Presence
68 68
69 try 69 try
70 { 70 {
71 Dictionary<string, string> request = 71 Dictionary<string, object> request =
72 ServerUtils.ParseQueryString(body); 72 ServerUtils.ParseQueryString(body);
73 73
74 if (!request.ContainsKey("METHOD")) 74 if (!request.ContainsKey("METHOD"))
75 return FailureResult(); 75 return FailureResult();
76 76
77 string method = request["METHOD"]; 77 string method = request["METHOD"].ToString();
78 78
79 switch (method) 79 switch (method)
80 { 80 {
@@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Presence
92 92
93 } 93 }
94 94
95 byte[] Report(Dictionary<string, string> request) 95 byte[] Report(Dictionary<string, object> request)
96 { 96 {
97 PresenceInfo info = new PresenceInfo(); 97 PresenceInfo info = new PresenceInfo();
98 info.Data = new Dictionary<string, string>(); 98 info.Data = new Dictionary<string, string>();
99 99
100 if (request["PrincipalID"] == null || request["RegionID"] == null) 100 if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID"))
101 return FailureResult(); 101 return FailureResult();
102 102
103 if (!UUID.TryParse(request["PrincipalID"].ToString(), 103 if (!UUID.TryParse(request["PrincipalID"].ToString(),
@@ -108,14 +108,14 @@ namespace OpenSim.Server.Handlers.Presence
108 out info.RegionID)) 108 out info.RegionID))
109 return FailureResult(); 109 return FailureResult();
110 110
111 foreach (KeyValuePair<string, string> kvp in request) 111 foreach (KeyValuePair<string, object> kvp in request)
112 { 112 {
113 if (kvp.Key == "METHOD" || 113 if (kvp.Key == "METHOD" ||
114 kvp.Key == "PrincipalID" || 114 kvp.Key == "PrincipalID" ||
115 kvp.Key == "RegionID") 115 kvp.Key == "RegionID")
116 continue; 116 continue;
117 117
118 info.Data[kvp.Key] = kvp.Value; 118 info.Data[kvp.Key] = kvp.Value.ToString();
119 } 119 }
120 120
121 if (m_PresenceService.Report(info)) 121 if (m_PresenceService.Report(info))