diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | 9 | ||||
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs | 26 |
2 files changed, 17 insertions, 18 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 791cfcd..c40ea0e 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using IUserService = OpenSim.Framework.Communications.IUserService; | 38 | using IUserService = OpenSim.Framework.Communications.IUserService; |
39 | using IAvatarService = OpenSim.Framework.Communications.IAvatarService; | 39 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; |
40 | 40 | ||
41 | namespace OpenSim.ApplicationPlugins.Rest.Inventory | 41 | namespace OpenSim.ApplicationPlugins.Rest.Inventory |
42 | { | 42 | { |
@@ -93,11 +93,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
93 | /// initializes. | 93 | /// initializes. |
94 | /// </summary> | 94 | /// </summary> |
95 | 95 | ||
96 | internal static CommunicationsManager Comms | ||
97 | { | ||
98 | get { return main.CommunicationsManager; } | ||
99 | } | ||
100 | |||
101 | internal static IInventoryService InventoryServices | 96 | internal static IInventoryService InventoryServices |
102 | { | 97 | { |
103 | get { return main.SceneManager.CurrentOrFirstScene.InventoryService; } | 98 | get { return main.SceneManager.CurrentOrFirstScene.InventoryService; } |
@@ -115,7 +110,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
115 | 110 | ||
116 | internal static IAvatarService AvatarServices | 111 | internal static IAvatarService AvatarServices |
117 | { | 112 | { |
118 | get { return Comms.AvatarService; } | 113 | get { return main.SceneManager.CurrentOrFirstScene.AvatarService; } |
119 | } | 114 | } |
120 | 115 | ||
121 | internal static IAssetService AssetServices | 116 | internal static IAssetService AssetServices |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 0a45eff..5429890 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs | |||
@@ -32,6 +32,7 @@ using OpenMetaverse; | |||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
34 | using OpenSim.Framework.Servers.HttpServer; | 34 | using OpenSim.Framework.Servers.HttpServer; |
35 | using OpenSim.Services.Interfaces; | ||
35 | 36 | ||
36 | namespace OpenSim.ApplicationPlugins.Rest.Inventory | 37 | namespace OpenSim.ApplicationPlugins.Rest.Inventory |
37 | { | 38 | { |
@@ -295,15 +296,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
295 | 296 | ||
296 | private void DoGet(AppearanceRequestData rdata) | 297 | private void DoGet(AppearanceRequestData rdata) |
297 | { | 298 | { |
299 | AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID); | ||
298 | 300 | ||
299 | rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); | 301 | if (adata == null) |
300 | |||
301 | if (rdata.userAppearance == null) | ||
302 | { | 302 | { |
303 | rdata.Fail(Rest.HttpStatusCodeNoContent, | 303 | rdata.Fail(Rest.HttpStatusCodeNoContent, |
304 | String.Format("appearance data not found for user {0} {1}", | 304 | String.Format("appearance data not found for user {0} {1}", |
305 | rdata.userProfile.FirstName, rdata.userProfile.SurName)); | 305 | rdata.userProfile.FirstName, rdata.userProfile.SurName)); |
306 | } | 306 | } |
307 | rdata.userAppearance = adata.ToAvatarAppearance(); | ||
307 | 308 | ||
308 | rdata.initXmlWriter(); | 309 | rdata.initXmlWriter(); |
309 | 310 | ||
@@ -342,18 +343,20 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
342 | // increasingly doubtful that it is appropriate for REST. If I attempt to | 343 | // increasingly doubtful that it is appropriate for REST. If I attempt to |
343 | // add a new record, and it already exists, then it seems to me that the | 344 | // add a new record, and it already exists, then it seems to me that the |
344 | // attempt should fail, rather than update the existing record. | 345 | // attempt should fail, rather than update the existing record. |
345 | 346 | AvatarData adata = null; | |
346 | if (GetUserAppearance(rdata)) | 347 | if (GetUserAppearance(rdata)) |
347 | { | 348 | { |
348 | modified = rdata.userAppearance != null; | 349 | modified = rdata.userAppearance != null; |
349 | created = !modified; | 350 | created = !modified; |
350 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); | 351 | adata = new AvatarData(rdata.userAppearance); |
352 | Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); | ||
351 | // Rest.UserServices.UpdateUserProfile(rdata.userProfile); | 353 | // Rest.UserServices.UpdateUserProfile(rdata.userProfile); |
352 | } | 354 | } |
353 | else | 355 | else |
354 | { | 356 | { |
355 | created = true; | 357 | created = true; |
356 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); | 358 | adata = new AvatarData(rdata.userAppearance); |
359 | Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); | ||
357 | // Rest.UserServices.UpdateUserProfile(rdata.userProfile); | 360 | // Rest.UserServices.UpdateUserProfile(rdata.userProfile); |
358 | } | 361 | } |
359 | 362 | ||
@@ -439,21 +442,22 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
439 | 442 | ||
440 | private void DoDelete(AppearanceRequestData rdata) | 443 | private void DoDelete(AppearanceRequestData rdata) |
441 | { | 444 | { |
445 | AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID); | ||
442 | 446 | ||
443 | AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); | 447 | if (adata != null) |
444 | |||
445 | if (old != null) | ||
446 | { | 448 | { |
449 | AvatarAppearance old = adata.ToAvatarAppearance(); | ||
447 | rdata.userAppearance = new AvatarAppearance(); | 450 | rdata.userAppearance = new AvatarAppearance(); |
448 | |||
449 | rdata.userAppearance.Owner = old.Owner; | 451 | rdata.userAppearance.Owner = old.Owner; |
452 | adata = new AvatarData(rdata.userAppearance); | ||
450 | 453 | ||
451 | Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); | 454 | Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); |
452 | 455 | ||
453 | rdata.Complete(); | 456 | rdata.Complete(); |
454 | } | 457 | } |
455 | else | 458 | else |
456 | { | 459 | { |
460 | |||
457 | rdata.Complete(Rest.HttpStatusCodeNoContent); | 461 | rdata.Complete(Rest.HttpStatusCodeNoContent); |
458 | } | 462 | } |
459 | 463 | ||