diff options
author | Arthur Valadares | 2009-08-25 10:28:22 -0300 |
---|---|---|
committer | Arthur Valadares | 2009-08-25 10:28:22 -0300 |
commit | 9c9fa51b0f005f570df2e3e3b84dfa3974935995 (patch) | |
tree | 49553fb3d3513f826f360eb426e1be7242a92aaf /OpenSim | |
parent | Adds osDrawPolygon to OSSL. Works a little different then other OS Drawing fu... (diff) | |
parent | Closed the web request and stream in SynchronousRestSessionObjectPoster -- ma... (diff) | |
download | opensim-SC-9c9fa51b0f005f570df2e3e3b84dfa3974935995.zip opensim-SC-9c9fa51b0f005f570df2e3e3b84dfa3974935995.tar.gz opensim-SC-9c9fa51b0f005f570df2e3e3b84dfa3974935995.tar.bz2 opensim-SC-9c9fa51b0f005f570df2e3e3b84dfa3974935995.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim into arthursv
Diffstat (limited to '')
26 files changed, 276 insertions, 41 deletions
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 6f86704..57a908e 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -532,6 +532,11 @@ namespace OpenSim.Framework.Communications.Tests | |||
532 | return false; | 532 | return false; |
533 | } | 533 | } |
534 | 534 | ||
535 | public bool DeleteFolders(UUID ownerID, List<UUID> ids) | ||
536 | { | ||
537 | return false; | ||
538 | } | ||
539 | |||
535 | public bool PurgeFolder(InventoryFolderBase folder) | 540 | public bool PurgeFolder(InventoryFolderBase folder) |
536 | { | 541 | { |
537 | return false; | 542 | return false; |
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 3387013..06136ff 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -576,7 +576,7 @@ namespace OpenSim.Framework.Console | |||
576 | 576 | ||
577 | public void Prompt() | 577 | public void Prompt() |
578 | { | 578 | { |
579 | string line = ReadLine(m_defaultPrompt, true, true); | 579 | string line = ReadLine(m_defaultPrompt + "# ", true, true); |
580 | 580 | ||
581 | if (line != String.Empty) | 581 | if (line != String.Empty) |
582 | { | 582 | { |
@@ -592,7 +592,7 @@ namespace OpenSim.Framework.Console | |||
592 | 592 | ||
593 | public override string ReadLine(string p, bool isCommand, bool e) | 593 | public override string ReadLine(string p, bool isCommand, bool e) |
594 | { | 594 | { |
595 | System.Console.Write("{0}", prompt); | 595 | System.Console.Write("{0}", p); |
596 | string cmdinput = System.Console.ReadLine(); | 596 | string cmdinput = System.Console.ReadLine(); |
597 | 597 | ||
598 | if (isCommand) | 598 | if (isCommand) |
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index 5e258ae..0a51266 100644 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console | |||
48 | /// </summary> | 48 | /// </summary> |
49 | public string DefaultPrompt | 49 | public string DefaultPrompt |
50 | { | 50 | { |
51 | set { m_defaultPrompt = value + "# "; } | 51 | set { m_defaultPrompt = value; } |
52 | get { return m_defaultPrompt; } | 52 | get { return m_defaultPrompt; } |
53 | } | 53 | } |
54 | protected string m_defaultPrompt; | 54 | protected string m_defaultPrompt; |
@@ -123,7 +123,7 @@ namespace OpenSim.Framework.Console | |||
123 | 123 | ||
124 | public virtual string ReadLine(string p, bool isCommand, bool e) | 124 | public virtual string ReadLine(string p, bool isCommand, bool e) |
125 | { | 125 | { |
126 | System.Console.Write("{0}", prompt); | 126 | System.Console.Write("{0}", p); |
127 | string cmdinput = System.Console.ReadLine(); | 127 | string cmdinput = System.Console.ReadLine(); |
128 | 128 | ||
129 | return cmdinput; | 129 | return cmdinput; |
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index da8556a..1810614 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs | |||
@@ -217,6 +217,12 @@ namespace OpenSim.Framework.Console | |||
217 | id.AppendChild(xmldoc.CreateTextNode(sessionID.ToString())); | 217 | id.AppendChild(xmldoc.CreateTextNode(sessionID.ToString())); |
218 | 218 | ||
219 | rootElement.AppendChild(id); | 219 | rootElement.AppendChild(id); |
220 | |||
221 | XmlElement prompt = xmldoc.CreateElement("", "Prompt", ""); | ||
222 | prompt.AppendChild(xmldoc.CreateTextNode(DefaultPrompt)); | ||
223 | |||
224 | rootElement.AppendChild(prompt); | ||
225 | |||
220 | rootElement.AppendChild(MainConsole.Instance.Commands.GetXml(xmldoc)); | 226 | rootElement.AppendChild(MainConsole.Instance.Commands.GetXml(xmldoc)); |
221 | 227 | ||
222 | reply["str_response_string"] = xmldoc.InnerXml; | 228 | reply["str_response_string"] = xmldoc.InnerXml; |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c6cdcaa..444adf9 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -260,7 +260,7 @@ namespace OpenSim.Framework | |||
260 | IClientAPI remoteClient, List<UUID> itemIDs); | 260 | IClientAPI remoteClient, List<UUID> itemIDs); |
261 | 261 | ||
262 | public delegate void RemoveInventoryFolder( | 262 | public delegate void RemoveInventoryFolder( |
263 | IClientAPI remoteClient, UUID folderID); | 263 | IClientAPI remoteClient, List<UUID> folderIDs); |
264 | 264 | ||
265 | public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest); | 265 | public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest); |
266 | 266 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index ec2f9ec..2ef4a36 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
75 | WebRequest request = WebRequest.Create(requestUrl); | 75 | WebRequest request = WebRequest.Create(requestUrl); |
76 | request.Method = verb; | 76 | request.Method = verb; |
77 | request.ContentType = "text/xml"; | 77 | request.ContentType = "text/xml"; |
78 | request.Timeout = 20000; | ||
78 | 79 | ||
79 | MemoryStream buffer = new MemoryStream(); | 80 | MemoryStream buffer = new MemoryStream(); |
80 | 81 | ||
@@ -98,7 +99,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
98 | { | 99 | { |
99 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 100 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
100 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); | 101 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); |
102 | resp.Close(); | ||
101 | } | 103 | } |
104 | requestStream.Close(); | ||
102 | return deserial; | 105 | return deserial; |
103 | } | 106 | } |
104 | } | 107 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index 09ef95b..ec9bd4f 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
62 | WebRequest request = WebRequest.Create(requestUrl); | 62 | WebRequest request = WebRequest.Create(requestUrl); |
63 | request.Method = verb; | 63 | request.Method = verb; |
64 | 64 | ||
65 | if (verb == "POST") | 65 | if ((verb == "POST") || (verb == "PUT")) |
66 | { | 66 | { |
67 | request.ContentType = "text/xml"; | 67 | request.ContentType = "text/xml"; |
68 | 68 | ||
diff --git a/OpenSim/Framework/Communications/Cache/AuthedSessionCache.cs b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs index d56e48a..dadf34a 100644 --- a/OpenSim/Framework/Communications/Cache/AuthedSessionCache.cs +++ b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs | |||
@@ -28,7 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | 30 | ||
31 | namespace OpenSim.Framework.Communications.Cache | 31 | namespace OpenSim.Grid.InventoryServer |
32 | { | 32 | { |
33 | public class AuthedSessionCache | 33 | public class AuthedSessionCache |
34 | { | 34 | { |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs index 309c415..f8b4949 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs | |||
@@ -30,8 +30,10 @@ using System.Reflection; | |||
30 | using log4net; | 30 | using log4net; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Data; | 32 | using OpenSim.Data; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
33 | 35 | ||
34 | namespace OpenSim.Framework.Communications | 36 | namespace OpenSim.Grid.InventoryServer |
35 | { | 37 | { |
36 | /// <summary> | 38 | /// <summary> |
37 | /// Abstract base class used by local and grid implementations of an inventory service. | 39 | /// Abstract base class used by local and grid implementations of an inventory service. |
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index c8035a4..f2631a7 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -65,6 +65,7 @@ namespace OpenSim.Grid.MessagingServer | |||
65 | { | 65 | { |
66 | ArgvConfigSource argvSource = new ArgvConfigSource(args); | 66 | ArgvConfigSource argvSource = new ArgvConfigSource(args); |
67 | argvSource.AddSwitch("Startup", "console", "c"); | 67 | argvSource.AddSwitch("Startup", "console", "c"); |
68 | argvSource.AddSwitch("Startup", "xmlfile", "x"); | ||
68 | 69 | ||
69 | IConfig startupConfig = argvSource.Configs["Startup"]; | 70 | IConfig startupConfig = argvSource.Configs["Startup"]; |
70 | if (startupConfig != null) | 71 | if (startupConfig != null) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a7a5aa3..dd01780 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -7090,14 +7090,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7090 | if (OnRemoveInventoryFolder != null) | 7090 | if (OnRemoveInventoryFolder != null) |
7091 | { | 7091 | { |
7092 | handlerRemoveInventoryFolder = null; | 7092 | handlerRemoveInventoryFolder = null; |
7093 | List<UUID> uuids = new List<UUID>(); | ||
7093 | foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) | 7094 | foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) |
7094 | { | 7095 | { |
7095 | handlerRemoveInventoryFolder = OnRemoveInventoryFolder; | 7096 | uuids.Add(datablock.FolderID); |
7096 | 7097 | } | |
7097 | if (handlerRemoveInventoryFolder != null) | 7098 | handlerRemoveInventoryFolder = OnRemoveInventoryFolder; |
7098 | { | 7099 | if (handlerRemoveInventoryFolder != null) |
7099 | handlerRemoveInventoryFolder(this, datablock.FolderID); | 7100 | { |
7100 | } | 7101 | handlerRemoveInventoryFolder(this, uuids); |
7101 | } | 7102 | } |
7102 | } | 7103 | } |
7103 | break; | 7104 | break; |
@@ -7114,14 +7115,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7114 | if (OnRemoveInventoryFolder != null) | 7115 | if (OnRemoveInventoryFolder != null) |
7115 | { | 7116 | { |
7116 | handlerRemoveInventoryFolder = null; | 7117 | handlerRemoveInventoryFolder = null; |
7118 | List<UUID> uuids = new List<UUID>(); | ||
7117 | foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) | 7119 | foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) |
7118 | { | 7120 | { |
7119 | handlerRemoveInventoryFolder = OnRemoveInventoryFolder; | 7121 | uuids.Add(datablock.FolderID); |
7120 | 7122 | } | |
7121 | if (handlerRemoveInventoryFolder != null) | 7123 | handlerRemoveInventoryFolder = OnRemoveInventoryFolder; |
7122 | { | 7124 | if (handlerRemoveInventoryFolder != null) |
7123 | handlerRemoveInventoryFolder(this, datablock.FolderID); | 7125 | { |
7124 | } | 7126 | handlerRemoveInventoryFolder(this, uuids); |
7125 | } | 7127 | } |
7126 | } | 7128 | } |
7127 | 7129 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index d4cb616..bd32f3b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs | |||
@@ -139,6 +139,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
139 | public abstract bool MoveFolder(InventoryFolderBase folder); | 139 | public abstract bool MoveFolder(InventoryFolderBase folder); |
140 | 140 | ||
141 | /// <summary> | 141 | /// <summary> |
142 | /// Delete a list of inventory folders (from trash) | ||
143 | /// </summary> | ||
144 | public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs); | ||
145 | |||
146 | /// <summary> | ||
142 | /// Purge an inventory folder of all its items and subfolders. | 147 | /// Purge an inventory folder of all its items and subfolders. |
143 | /// </summary> | 148 | /// </summary> |
144 | /// <param name="folder"></param> | 149 | /// <param name="folder"></param> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 787c6c8..1c66254 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -330,6 +330,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
330 | } | 330 | } |
331 | } | 331 | } |
332 | 332 | ||
333 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
334 | { | ||
335 | if (folderIDs == null) | ||
336 | return false; | ||
337 | if (folderIDs.Count == 0) | ||
338 | return false; | ||
339 | |||
340 | if (IsLocalGridUser(ownerID)) | ||
341 | return m_GridService.DeleteFolders(ownerID, folderIDs); | ||
342 | else | ||
343 | { | ||
344 | UUID sessionID = GetSessionID(ownerID); | ||
345 | string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); | ||
346 | return m_HGService.DeleteFolders(uri, folderIDs, sessionID); | ||
347 | } | ||
348 | } | ||
349 | |||
333 | public override bool MoveFolder(InventoryFolderBase folder) | 350 | public override bool MoveFolder(InventoryFolderBase folder) |
334 | { | 351 | { |
335 | if (folder == null) | 352 | if (folder == null) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index e6edcf2..66d11dd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -258,6 +258,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
258 | return m_InventoryService.MoveFolder(folder); | 258 | return m_InventoryService.MoveFolder(folder); |
259 | } | 259 | } |
260 | 260 | ||
261 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
262 | { | ||
263 | return m_InventoryService.DeleteFolders(ownerID, folderIDs); | ||
264 | } | ||
265 | |||
261 | /// <summary> | 266 | /// <summary> |
262 | /// Purge an inventory folder of all its items and subfolders. | 267 | /// Purge an inventory folder of all its items and subfolders. |
263 | /// </summary> | 268 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 201442c..0d32c77 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs | |||
@@ -243,6 +243,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
243 | return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); | 243 | return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); |
244 | } | 244 | } |
245 | 245 | ||
246 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
247 | { | ||
248 | if (folderIDs == null) | ||
249 | return false; | ||
250 | if (folderIDs.Count == 0) | ||
251 | return false; | ||
252 | |||
253 | UUID sessionID = GetSessionID(ownerID); | ||
254 | return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID); | ||
255 | } | ||
256 | |||
257 | |||
246 | public override bool PurgeFolder(InventoryFolderBase folder) | 258 | public override bool PurgeFolder(InventoryFolderBase folder) |
247 | { | 259 | { |
248 | if (folder == null) | 260 | if (folder == null) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a9d361b..3301536 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -789,23 +789,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
789 | } | 789 | } |
790 | 790 | ||
791 | /// <summary> | 791 | /// <summary> |
792 | /// Removes an inventory folder. Although there is a packet in the Linden protocol for this, it may be | 792 | /// Removes an inventory folder. This packet is sent when the user |
793 | /// legacy and not currently used (purge folder is used to remove folders from trash instead). | 793 | /// right-clicks a folder that's already in trash and chooses "purge" |
794 | /// </summary> | 794 | /// </summary> |
795 | /// <param name="remoteClient"></param> | 795 | /// <param name="remoteClient"></param> |
796 | /// <param name="folderID"></param> | 796 | /// <param name="folderID"></param> |
797 | private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) | 797 | private void RemoveInventoryFolder(IClientAPI remoteClient, List<UUID> folderIDs) |
798 | { | 798 | { |
799 | // Unclear is this handler is ever called by the Linden client, but it might | 799 | m_log.DebugFormat("[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count); |
800 | 800 | InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs); | |
801 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | ||
802 | folder.Owner = remoteClient.AgentId; | ||
803 | InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); | ||
804 | if (trash != null) | ||
805 | { | ||
806 | folder.ParentID = trash.ID; | ||
807 | InventoryService.MoveFolder(folder); | ||
808 | } | ||
809 | } | 801 | } |
810 | 802 | ||
811 | private SceneObjectGroup GetGroupByPrim(uint localID) | 803 | private SceneObjectGroup GetGroupByPrim(uint localID) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2b815a2..d3e414f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -552,7 +552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
552 | 552 | ||
553 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | 553 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) |
554 | { | 554 | { |
555 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 555 | InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); |
556 | folder = InventoryService.GetFolder(folder); | 556 | folder = InventoryService.GetFolder(folder); |
557 | if (folder != null) | 557 | if (folder != null) |
558 | { | 558 | { |
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 6ef1d9d..998b322 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | |||
@@ -106,6 +106,10 @@ namespace OpenSim.Server.Handlers.Inventory | |||
106 | 106 | ||
107 | m_httpServer.AddStreamHandler( | 107 | m_httpServer.AddStreamHandler( |
108 | new RestDeserialiseSecureHandler<List<Guid>, bool>( | 108 | new RestDeserialiseSecureHandler<List<Guid>, bool>( |
109 | "POST", "/DeleteFolders/", DeleteFolders, CheckAuthSession)); | ||
110 | |||
111 | m_httpServer.AddStreamHandler( | ||
112 | new RestDeserialiseSecureHandler<List<Guid>, bool>( | ||
109 | "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); | 113 | "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); |
110 | 114 | ||
111 | m_httpServer.AddStreamHandler( | 115 | m_httpServer.AddStreamHandler( |
@@ -143,6 +147,9 @@ namespace OpenSim.Server.Handlers.Inventory | |||
143 | m_httpServer.AddStreamHandler( | 147 | m_httpServer.AddStreamHandler( |
144 | new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>( | 148 | new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>( |
145 | "POST", "/MoveItems/", MoveItems, CheckAuthSession)); | 149 | "POST", "/MoveItems/", MoveItems, CheckAuthSession)); |
150 | |||
151 | m_httpServer.AddStreamHandler(new InventoryServerMoveItemsHandler(m_InventoryService)); | ||
152 | |||
146 | 153 | ||
147 | // for persistent active gestures | 154 | // for persistent active gestures |
148 | m_httpServer.AddStreamHandler( | 155 | m_httpServer.AddStreamHandler( |
@@ -251,6 +258,15 @@ namespace OpenSim.Server.Handlers.Inventory | |||
251 | return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); | 258 | return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); |
252 | } | 259 | } |
253 | 260 | ||
261 | public bool DeleteFolders(List<Guid> items) | ||
262 | { | ||
263 | List<UUID> uuids = new List<UUID>(); | ||
264 | foreach (Guid g in items) | ||
265 | uuids.Add(new UUID(g)); | ||
266 | // oops we lost the user info here. Bad bad handlers | ||
267 | return m_InventoryService.DeleteFolders(UUID.Zero, uuids); | ||
268 | } | ||
269 | |||
254 | public bool DeleteItems(List<Guid> items) | 270 | public bool DeleteItems(List<Guid> items) |
255 | { | 271 | { |
256 | List<UUID> uuids = new List<UUID>(); | 272 | List<UUID> uuids = new List<UUID>(); |
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs new file mode 100644 index 0000000..850bf14 --- /dev/null +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs | |||
@@ -0,0 +1,81 @@ | |||
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 | |||
28 | using Nini.Config; | ||
29 | using log4net; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using System.IO; | ||
34 | using System.Net; | ||
35 | using System.Text; | ||
36 | using System.Text.RegularExpressions; | ||
37 | using System.Xml; | ||
38 | using System.Xml.Serialization; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using OpenSim.Framework; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | ||
43 | using OpenMetaverse; | ||
44 | |||
45 | namespace OpenSim.Server.Handlers.Inventory | ||
46 | { | ||
47 | public class InventoryServerMoveItemsHandler : BaseStreamHandler | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private IInventoryService m_InventoryService; | ||
52 | |||
53 | public InventoryServerMoveItemsHandler(IInventoryService service) : | ||
54 | base("PUT", "/inventory") | ||
55 | { | ||
56 | m_InventoryService = service; | ||
57 | } | ||
58 | |||
59 | public override byte[] Handle(string path, Stream request, | ||
60 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
61 | { | ||
62 | XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>)); | ||
63 | List<InventoryItemBase> items = (List<InventoryItemBase>)xs.Deserialize(request); | ||
64 | |||
65 | bool result = false; | ||
66 | string[] p = SplitParams(path); | ||
67 | |||
68 | if (p.Length > 0) | ||
69 | { | ||
70 | UUID ownerID = UUID.Zero; | ||
71 | UUID.TryParse(p[0], out ownerID); | ||
72 | result = m_InventoryService.MoveItems(ownerID, items); | ||
73 | } | ||
74 | else | ||
75 | m_log.WarnFormat("[MOVEITEMS HANDLER]: ownerID not provided in request. Unable to serve."); | ||
76 | |||
77 | xs = new XmlSerializer(typeof(bool)); | ||
78 | return ServerUtils.SerializeResult(xs, result); | ||
79 | } | ||
80 | } | ||
81 | } | ||
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 45e921a..1004fb9 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs | |||
@@ -201,6 +201,19 @@ namespace OpenSim.Services.Connectors.Inventory | |||
201 | return false; | 201 | return false; |
202 | } | 202 | } |
203 | 203 | ||
204 | public bool DeleteFolders(string id, List<UUID> folders, UUID sessionID) | ||
205 | { | ||
206 | string url = string.Empty; | ||
207 | string userID = string.Empty; | ||
208 | |||
209 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
210 | { | ||
211 | ISessionAuthInventoryService connector = GetConnector(url); | ||
212 | return connector.DeleteFolders(userID, folders, sessionID); | ||
213 | } | ||
214 | return false; | ||
215 | } | ||
216 | |||
204 | public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) | 217 | public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) |
205 | { | 218 | { |
206 | string url = string.Empty; | 219 | string url = string.Empty; |
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index c89c9b7..da8c7e2 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs | |||
@@ -89,6 +89,11 @@ namespace OpenSim.Services.Connectors | |||
89 | bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); | 89 | bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Delete a list of inventory folders (from trash) | ||
93 | /// </summary> | ||
94 | bool DeleteFolders(string userID, List<UUID> folders, UUID session_id); | ||
95 | |||
96 | /// <summary> | ||
92 | /// Purge an inventory folder of all its items and subfolders. | 97 | /// Purge an inventory folder of all its items and subfolders. |
93 | /// </summary> | 98 | /// </summary> |
94 | /// <param name="folder"></param> | 99 | /// <param name="folder"></param> |
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index b573a06..a2261ba 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -229,6 +229,11 @@ namespace OpenSim.Services.Connectors | |||
229 | return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( | 229 | return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( |
230 | "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); | 230 | "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); |
231 | } | 231 | } |
232 | catch (TimeoutException e) | ||
233 | { | ||
234 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation to {0} timed out {0} {1}.", m_ServerURI, | ||
235 | e.Source, e.Message); | ||
236 | } | ||
232 | catch (Exception e) | 237 | catch (Exception e) |
233 | { | 238 | { |
234 | // Maybe we're talking to an old inventory server. Try this other thing. | 239 | // Maybe we're talking to an old inventory server. Try this other thing. |
@@ -308,6 +313,25 @@ namespace OpenSim.Services.Connectors | |||
308 | return false; | 313 | return false; |
309 | } | 314 | } |
310 | 315 | ||
316 | public bool DeleteFolders(string userID, List<UUID> folderIDs, UUID sessionID) | ||
317 | { | ||
318 | try | ||
319 | { | ||
320 | List<Guid> guids = new List<Guid>(); | ||
321 | foreach (UUID u in folderIDs) | ||
322 | guids.Add(u.Guid); | ||
323 | return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject( | ||
324 | "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID); | ||
325 | } | ||
326 | catch (Exception e) | ||
327 | { | ||
328 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}", | ||
329 | e.Source, e.Message); | ||
330 | } | ||
331 | |||
332 | return false; | ||
333 | } | ||
334 | |||
311 | public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 335 | public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) |
312 | { | 336 | { |
313 | try | 337 | try |
@@ -397,13 +421,28 @@ namespace OpenSim.Services.Connectors | |||
397 | 421 | ||
398 | private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID) | 422 | private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID) |
399 | { | 423 | { |
424 | if (items == null) | ||
425 | { | ||
426 | m_log.WarnFormat("[INVENTORY CONNECTOR]: request to move items got a null list."); | ||
427 | return; | ||
428 | } | ||
429 | |||
400 | try | 430 | try |
401 | { | 431 | { |
402 | SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject( | 432 | //SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject( |
403 | "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); | 433 | // "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); |
434 | |||
435 | //// Success | ||
436 | //return; | ||
437 | string uri = m_ServerURI + "/inventory/" + userID; | ||
438 | if (SynchronousRestObjectRequester. | ||
439 | MakeRequest<List<InventoryItemBase>, bool>("PUT", uri, items)) | ||
440 | m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster succeeded {1}", items.Count, uri); | ||
441 | else | ||
442 | m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster failed {1}", items.Count, uri); ; | ||
404 | 443 | ||
405 | // Success | ||
406 | return; | 444 | return; |
445 | |||
407 | } | 446 | } |
408 | catch (Exception e) | 447 | catch (Exception e) |
409 | { | 448 | { |
@@ -466,12 +505,12 @@ namespace OpenSim.Services.Connectors | |||
466 | return null; | 505 | return null; |
467 | } | 506 | } |
468 | 507 | ||
469 | public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID sessionID) | 508 | public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID) |
470 | { | 509 | { |
471 | try | 510 | try |
472 | { | 511 | { |
473 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject( | 512 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject( |
474 | "POST", m_ServerURI + "/QueryFolder/", item, sessionID.ToString(), item.Owner.ToString()); | 513 | "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID); |
475 | } | 514 | } |
476 | catch (Exception e) | 515 | catch (Exception e) |
477 | { | 516 | { |
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index cd283ff..a7aa138 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | |||
@@ -136,6 +136,12 @@ namespace OpenSim.Services.Connectors | |||
136 | return false; | 136 | return false; |
137 | } | 137 | } |
138 | 138 | ||
139 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | |||
144 | |||
139 | public bool PurgeFolder(InventoryFolderBase folder) | 145 | public bool PurgeFolder(InventoryFolderBase folder) |
140 | { | 146 | { |
141 | return false; | 147 | return false; |
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index ebdb09a..c775090 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs | |||
@@ -122,6 +122,14 @@ namespace OpenSim.Services.Interfaces | |||
122 | bool MoveFolder(InventoryFolderBase folder); | 122 | bool MoveFolder(InventoryFolderBase folder); |
123 | 123 | ||
124 | /// <summary> | 124 | /// <summary> |
125 | /// Delete an item from the user's inventory | ||
126 | /// </summary> | ||
127 | /// <param name="item"></param> | ||
128 | /// <returns>true if the item was successfully deleted</returns> | ||
129 | //bool DeleteItem(InventoryItemBase item); | ||
130 | bool DeleteFolders(UUID userID, List<UUID> folderIDs); | ||
131 | |||
132 | /// <summary> | ||
125 | /// Purge an inventory folder of all its items and subfolders. | 133 | /// Purge an inventory folder of all its items and subfolders. |
126 | /// </summary> | 134 | /// </summary> |
127 | /// <param name="folder"></param> | 135 | /// <param name="folder"></param> |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 45bbd37..19b1fd8 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -425,15 +425,27 @@ namespace OpenSim.Services.InventoryService | |||
425 | return null; | 425 | return null; |
426 | } | 426 | } |
427 | 427 | ||
428 | public virtual InventoryFolderBase GetFolder(InventoryFolderBase item) | 428 | public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) |
429 | { | 429 | { |
430 | InventoryFolderBase result = m_Database.getInventoryFolder(item.ID); | 430 | InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID); |
431 | if (result != null) | 431 | if (result != null) |
432 | return result; | 432 | return result; |
433 | 433 | ||
434 | m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID); | ||
434 | return null; | 435 | return null; |
435 | } | 436 | } |
436 | 437 | ||
438 | public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
439 | { | ||
440 | foreach (UUID id in folderIDs) | ||
441 | { | ||
442 | InventoryFolderBase folder = new InventoryFolderBase(id, ownerID); | ||
443 | PurgeFolder(folder); | ||
444 | m_Database.deleteInventoryFolder(id); | ||
445 | } | ||
446 | return true; | ||
447 | } | ||
448 | |||
437 | /// <summary> | 449 | /// <summary> |
438 | /// Purge a folder of all items items and subfolders. | 450 | /// Purge a folder of all items items and subfolders. |
439 | /// | 451 | /// |
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs index ee22e5e..5a0ee7c 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryService.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs | |||
@@ -128,6 +128,11 @@ namespace OpenSim.Tests.Common.Mock | |||
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | 130 | ||
131 | public bool DeleteFolders(UUID ownerID, List<UUID> ids) | ||
132 | { | ||
133 | return false; | ||
134 | } | ||
135 | |||
131 | public bool PurgeFolder(InventoryFolderBase folder) | 136 | public bool PurgeFolder(InventoryFolderBase folder) |
132 | { | 137 | { |
133 | return false; | 138 | return false; |