aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorMelanie2010-01-05 04:22:03 +0000
committerMelanie2010-01-05 04:22:03 +0000
commitaca01f541552b0f6e7521e98f5e8350175b89334 (patch)
treed9db485bd3b2d42fab68d3a30e72d27f2468ccde /OpenSim/Services/Connectors
parentAllow lists to be embedded in query strings (diff)
downloadopensim-SC_OLD-aca01f541552b0f6e7521e98f5e8350175b89334.zip
opensim-SC_OLD-aca01f541552b0f6e7521e98f5e8350175b89334.tar.gz
opensim-SC_OLD-aca01f541552b0f6e7521e98f5e8350175b89334.tar.bz2
opensim-SC_OLD-aca01f541552b0f6e7521e98f5e8350175b89334.tar.xz
Add the XInventoryServicesConnector, a new inventory connector without the cruft
of the old one that makes inventory crash on folder creation. This is just the connector part, the handler is still ont he todo list.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs198
1 files changed, 185 insertions, 13 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index 6e1d657..aac1a83 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -96,19 +96,55 @@ namespace OpenSim.Services.Connectors
96 return bool.Parse(ret["RESULT"].ToString()); 96 return bool.Parse(ret["RESULT"].ToString());
97 } 97 }
98 98
99 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 99 public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
100 { 100 {
101 return null; 101 Dictionary<string,object> ret = MakeRequest("GETINVENTORYSKELETON",
102 new Dictionary<string,object> {
103 { "PRINCIPAL", principalID.ToString() }
104 });
105
106 if (ret == null)
107 return null;
108
109 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
110
111 foreach (Object o in ret.Values)
112 folders.Add(BuildFolder((Dictionary<string,object>)o));
113
114 return folders;
102 } 115 }
103 116
104 public InventoryFolderBase GetRootFolder(UUID principalID) 117 public InventoryFolderBase GetRootFolder(UUID principalID)
105 { 118 {
106 return null; 119 Dictionary<string,object> ret = MakeRequest("GETROOTFOLDER",
120 new Dictionary<string,object> {
121 { "PRINCIPAL", principalID.ToString() }
122 });
123
124 if (ret == null)
125 return null;
126
127 if (ret.Count == 0)
128 return null;
129
130 return BuildFolder(ret);
107 } 131 }
108 132
109 public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 133 public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
110 { 134 {
111 return null; 135 Dictionary<string,object> ret = MakeRequest("GETFOLDERFORTYPE",
136 new Dictionary<string,object> {
137 { "PRINCIPAL", principalID.ToString() },
138 { "TYPE", ((int)type).ToString() }
139 });
140
141 if (ret == null)
142 return null;
143
144 if (ret.Count == 0)
145 return null;
146
147 return BuildFolder(ret);
112 } 148 }
113 149
114 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) 150 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
@@ -205,8 +241,28 @@ namespace OpenSim.Services.Connectors
205 241
206 public bool AddItem(InventoryItemBase item) 242 public bool AddItem(InventoryItemBase item)
207 { 243 {
208 Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY", 244 Dictionary<string,object> ret = MakeRequest("ADDITEM",
209 new Dictionary<string,object> { 245 new Dictionary<string,object> {
246 { "AssetID", item.AssetID.ToString() },
247 { "AssetType", item.AssetType.ToString() },
248 { "Name", item.Name.ToString() },
249 { "Owner", item.Owner.ToString() },
250 { "ID", item.ID.ToString() },
251 { "InvType", item.InvType.ToString() },
252 { "Folder", item.Folder.ToString() },
253 { "CreatorId", item.CreatorId.ToString() },
254 { "Description", item.Description.ToString() },
255 { "NextPermissions", item.NextPermissions.ToString() },
256 { "CurrentPermissions", item.CurrentPermissions.ToString() },
257 { "BasePermissions", item.BasePermissions.ToString() },
258 { "EveryOnePermissions", item.EveryOnePermissions.ToString() },
259 { "GroupPermissions", item.GroupPermissions.ToString() },
260 { "GroupID", item.GroupID.ToString() },
261 { "GroupOwned", item.GroupOwned.ToString() },
262 { "SalePrice", item.SalePrice.ToString() },
263 { "SaleType", item.SaleType.ToString() },
264 { "Flags", item.Flags.ToString() },
265 { "CreationDate", item.CreationDate.ToString() }
210 }); 266 });
211 267
212 if (ret == null) 268 if (ret == null)
@@ -217,8 +273,28 @@ namespace OpenSim.Services.Connectors
217 273
218 public bool UpdateItem(InventoryItemBase item) 274 public bool UpdateItem(InventoryItemBase item)
219 { 275 {
220 Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY", 276 Dictionary<string,object> ret = MakeRequest("UPDATEITEM",
221 new Dictionary<string,object> { 277 new Dictionary<string,object> {
278 { "AssetID", item.AssetID.ToString() },
279 { "AssetType", item.AssetType.ToString() },
280 { "Name", item.Name.ToString() },
281 { "Owner", item.Owner.ToString() },
282 { "ID", item.ID.ToString() },
283 { "InvType", item.InvType.ToString() },
284 { "Folder", item.Folder.ToString() },
285 { "CreatorId", item.CreatorId.ToString() },
286 { "Description", item.Description.ToString() },
287 { "NextPermissions", item.NextPermissions.ToString() },
288 { "CurrentPermissions", item.CurrentPermissions.ToString() },
289 { "BasePermissions", item.BasePermissions.ToString() },
290 { "EveryOnePermissions", item.EveryOnePermissions.ToString() },
291 { "GroupPermissions", item.GroupPermissions.ToString() },
292 { "GroupID", item.GroupID.ToString() },
293 { "GroupOwned", item.GroupOwned.ToString() },
294 { "SalePrice", item.SalePrice.ToString() },
295 { "SaleType", item.SaleType.ToString() },
296 { "Flags", item.Flags.ToString() },
297 { "CreationDate", item.CreationDate.ToString() }
222 }); 298 });
223 299
224 if (ret == null) 300 if (ret == null)
@@ -227,9 +303,28 @@ namespace OpenSim.Services.Connectors
227 return bool.Parse(ret["RESULT"].ToString()); 303 return bool.Parse(ret["RESULT"].ToString());
228 } 304 }
229 305
230 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) 306 public bool MoveItems(UUID principalID, List<InventoryItemBase> items)
231 { 307 {
232 return false; 308 List<string> idlist = new List<string>();
309 List<string> destlist = new List<string>();
310
311 foreach (InventoryItemBase item in items)
312 {
313 idlist.Add(item.ID.ToString());
314 destlist.Add(item.Folder.ToString());
315 }
316
317 Dictionary<string,object> ret = MakeRequest("MOVEITEMS",
318 new Dictionary<string,object> {
319 { "PrincipalID", principalID.ToString() },
320 { "IDLIST", idlist },
321 { "DESTLIST", destlist }
322 });
323
324 if (ret == null)
325 return false;
326
327 return bool.Parse(ret["RESULT"].ToString());
233 } 328 }
234 329
235 public bool DeleteItems(UUID principalID, List<UUID> itemIDs) 330 public bool DeleteItems(UUID principalID, List<UUID> itemIDs)
@@ -253,17 +348,52 @@ namespace OpenSim.Services.Connectors
253 348
254 public InventoryItemBase GetItem(InventoryItemBase item) 349 public InventoryItemBase GetItem(InventoryItemBase item)
255 { 350 {
256 return null; 351 Dictionary<string,object> ret = MakeRequest("GETITEM",
352 new Dictionary<string,object> {
353 { "ID", item.ID.ToString() }
354 });
355
356 if (ret == null)
357 return null;
358
359 if (ret.Count == 0)
360 return null;
361
362 return BuildItem(ret);
257 } 363 }
258 364
259 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 365 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
260 { 366 {
261 return null; 367 Dictionary<string,object> ret = MakeRequest("GETFOLDER",
368 new Dictionary<string,object> {
369 { "ID", folder.ID.ToString() }
370 });
371
372 if (ret == null)
373 return null;
374
375 if (ret.Count == 0)
376 return null;
377
378 return BuildFolder(ret);
262 } 379 }
263 380
264 public List<InventoryItemBase> GetActiveGestures(UUID userId) 381 public List<InventoryItemBase> GetActiveGestures(UUID principalID)
265 { 382 {
266 return null; 383 Dictionary<string,object> ret = MakeRequest("GETACTIVEGESTURES",
384 new Dictionary<string,object> {
385 { "PRINCIPAL", principalID.ToString() }
386 });
387
388 if (ret == null)
389 return null;
390
391 List<InventoryItemBase> items = new List<InventoryItemBase>();
392
393 foreach (Object o in ret.Values)
394 items.Add(BuildItem((Dictionary<string,object>)o));
395
396 return items;
267 } 397 }
268 398
269 public int GetAssetPermissions(UUID principalID, UUID assetID) 399 public int GetAssetPermissions(UUID principalID, UUID assetID)
@@ -275,7 +405,7 @@ namespace OpenSim.Services.Connectors
275 }); 405 });
276 406
277 if (ret == null) 407 if (ret == null)
278 return false; 408 return 0;
279 409
280 return int.Parse(ret["RESULT"].ToString()); 410 return int.Parse(ret["RESULT"].ToString());
281 } 411 }
@@ -313,5 +443,47 @@ namespace OpenSim.Services.Connectors
313 443
314 return replyData; 444 return replyData;
315 } 445 }
446
447 InventoryFolderBase BuildFolder(Dictionary<string,object> data)
448 {
449 InventoryFolderBase folder = new InventoryFolderBase();
450
451 folder.ParentID = new UUID(data["ParentID"].ToString());
452 folder.Type = short.Parse(data["Type"].ToString());
453 folder.Version = ushort.Parse(data["Version"].ToString());
454 folder.Name = data["Name"].ToString();
455 folder.Owner = new UUID(data["Owner"].ToString());
456 folder.ID = new UUID(data["ID"].ToString());
457
458 return folder;
459 }
460
461 InventoryItemBase BuildItem(Dictionary<string,object> data)
462 {
463 InventoryItemBase item = new InventoryItemBase();
464
465 item.AssetID = new UUID(data["AssetID"].ToString());
466 item.AssetType = int.Parse(data["AssetType"].ToString());
467 item.Name = data["Name"].ToString();
468 item.Owner = new UUID(data["Owner"].ToString());
469 item.ID = new UUID(data["ID"].ToString());
470 item.InvType = int.Parse(data["InvType"].ToString());
471 item.Folder = new UUID(data["Folder"].ToString());
472 item.CreatorId = data["CreatorId"].ToString();
473 item.Description = data["Description"].ToString();
474 item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
475 item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());
476 item.BasePermissions = uint.Parse(data["BasePermissions"].ToString());
477 item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString());
478 item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString());
479 item.GroupID = new UUID(data["GroupID"].ToString());
480 item.GroupOwned = bool.Parse(data["GroupOwned"].ToString());
481 item.SalePrice = int.Parse(data["SalePrice"].ToString());
482 item.SaleType = byte.Parse(data["SaleType"].ToString());
483 item.Flags = uint.Parse(data["Flags"].ToString());
484 item.CreationDate = int.Parse(data["CreationDate"].ToString());
485
486 return item;
487 }
316 } 488 }
317} 489}