aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs8
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs4
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs7
-rw-r--r--OpenSim/Framework/GridConfig.cs16
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/InventoryFolderBase.cs6
-rw-r--r--OpenSim/Framework/MessageServerConfig.cs16
-rw-r--r--OpenSim/Framework/UserConfig.cs14
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs27
-rw-r--r--OpenSim/Grid/GridServer/Program.cs12
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs79
-rw-r--r--OpenSim/Grid/UserServer/Main.cs38
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs48
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs36
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs47
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs87
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs28
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs34
-rw-r--r--OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs30
-rw-r--r--OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs11
-rw-r--r--OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs68
-rw-r--r--OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs7
-rw-r--r--OpenSim/Services/Interfaces/IInventoryService.cs5
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs30
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryService.cs7
35 files changed, 649 insertions, 166 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index aec06be..59431bb 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -851,7 +851,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
851 851
852 // Delete the old item 852 // Delete the old item
853 853
854 Rest.InventoryServices.DeleteItem(uri); 854 List<UUID> uuids = new List<UUID>();
855 uuids.Add(uri.ID);
856 Rest.InventoryServices.DeleteItems(uri.Owner, uuids);
855 857
856 // Add the new item to the inventory 858 // Add the new item to the inventory
857 859
@@ -927,7 +929,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
927 InventoryItemBase item = (InventoryItemBase) InventoryNode; 929 InventoryItemBase item = (InventoryItemBase) InventoryNode;
928 Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted", 930 Rest.Log.DebugFormat("{0} {1}: Item {2} will be deleted",
929 MsgId, rdata.method, rdata.path); 931 MsgId, rdata.method, rdata.path);
930 Rest.InventoryServices.DeleteItem(item); 932 List<UUID> uuids = new List<UUID>();
933 uuids.Add(item.ID);
934 Rest.InventoryServices.DeleteItems(item.Owner, uuids);
931 rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1} <p>", item.Name, item.ID)); 935 rdata.appendStatus(String.Format("<p>Deleted item {0} UUID {1} <p>", item.Name, item.ID));
932 } 936 }
933 937
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index ca641d0..238810a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -653,7 +653,9 @@ namespace OpenSim.Framework.Communications.Cache
653 653
654 if (RootFolder.DeleteItem(item.ID)) 654 if (RootFolder.DeleteItem(item.ID))
655 { 655 {
656 return m_InventoryService.DeleteItem(item); 656 List<UUID> uuids = new List<UUID>();
657 uuids.Add(itemID);
658 return m_InventoryService.DeleteItems(this.UserProfile.ID, uuids);
657 } 659 }
658 } 660 }
659 else 661 else
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 22dcef9..6f86704 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -547,7 +547,12 @@ namespace OpenSim.Framework.Communications.Tests
547 return false; 547 return false;
548 } 548 }
549 549
550 public bool DeleteItem(InventoryItemBase item) 550 public bool MoveItems(UUID owner, List<InventoryItemBase> items)
551 {
552 return false;
553 }
554
555 public bool DeleteItems(UUID owner, List<UUID> items)
551 { 556 {
552 return false; 557 return false;
553 } 558 }
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
index a3c1032..87fd3f0 100644
--- a/OpenSim/Framework/GridConfig.cs
+++ b/OpenSim/Framework/GridConfig.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Framework
45 public string SimSendKey = String.Empty; 45 public string SimSendKey = String.Empty;
46 public string UserRecvKey = String.Empty; 46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty; 47 public string UserSendKey = String.Empty;
48 public string ConsoleUser = String.Empty;
49 public string ConsolePass = String.Empty;
48 50
49 public GridConfig(string description, string filename) 51 public GridConfig(string description, string filename)
50 { 52 {
@@ -95,6 +97,12 @@ namespace OpenSim.Framework
95 "Allow regions to register immediately upon grid server startup? true/false", 97 "Allow regions to register immediately upon grid server startup? true/false",
96 "True", 98 "True",
97 false); 99 false);
100 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
101 "Remote console access user name [Default: disabled]", "0", false);
102
103 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Remote console access password [Default: disabled]", "0", false);
105
98 } 106 }
99 107
100 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 108 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -140,9 +148,15 @@ namespace OpenSim.Framework
140 case "allow_region_registration": 148 case "allow_region_registration":
141 AllowRegionRegistration = (bool)configuration_result; 149 AllowRegionRegistration = (bool)configuration_result;
142 break; 150 break;
151 case "console_user":
152 ConsoleUser = (string)configuration_result;
153 break;
154 case "console_pass":
155 ConsolePass = (string)configuration_result;
156 break;
143 } 157 }
144 158
145 return true; 159 return true;
146 } 160 }
147 } 161 }
148} \ No newline at end of file 162}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index e451dd8..c6cdcaa 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -254,10 +254,10 @@ namespace OpenSim.Framework
254 string newName); 254 string newName);
255 255
256 public delegate void MoveInventoryItem( 256 public delegate void MoveInventoryItem(
257 IClientAPI remoteClient, UUID folderID, UUID itemID, int length, string newName); 257 IClientAPI remoteClient, List<InventoryItemBase> items);
258 258
259 public delegate void RemoveInventoryItem( 259 public delegate void RemoveInventoryItem(
260 IClientAPI remoteClient, UUID itemID); 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, UUID folderID);
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index 05f11a4..1869d48 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -78,6 +78,12 @@ namespace OpenSim.Framework
78 ID = id; 78 ID = id;
79 } 79 }
80 80
81 public InventoryFolderBase(UUID id, UUID owner)
82 {
83 ID = id;
84 Owner = owner;
85 }
86
81 public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) 87 public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
82 { 88 {
83 ID = id; 89 ID = id;
diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs
index d0ceebc..61e5ea7 100644
--- a/OpenSim/Framework/MessageServerConfig.cs
+++ b/OpenSim/Framework/MessageServerConfig.cs
@@ -46,6 +46,8 @@ namespace OpenSim.Framework
46 public string UserRecvKey = String.Empty; 46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty; 47 public string UserSendKey = String.Empty;
48 public string UserServerURL = String.Empty; 48 public string UserServerURL = String.Empty;
49 public string ConsoleUser = String.Empty;
50 public string ConsolePass = String.Empty;
49 51
50 public MessageServerConfig(string description, string filename) 52 public MessageServerConfig(string description, string filename)
51 { 53 {
@@ -88,6 +90,12 @@ namespace OpenSim.Framework
88 "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false); 90 "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false);
89 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 91 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
90 "My Published IP Address", "127.0.0.1", false); 92 "My Published IP Address", "127.0.0.1", false);
93 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
94 "Remote console access user name [Default: disabled]", "0", false);
95
96 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
97 "Remote console access password [Default: disabled]", "0", false);
98
91 } 99 }
92 100
93 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 101 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -130,9 +138,15 @@ namespace OpenSim.Framework
130 case "published_ip": 138 case "published_ip":
131 MessageServerIP = (string) configuration_result; 139 MessageServerIP = (string) configuration_result;
132 break; 140 break;
141 case "console_user":
142 ConsoleUser = (string)configuration_result;
143 break;
144 case "console_pass":
145 ConsolePass = (string)configuration_result;
146 break;
133 } 147 }
134 148
135 return true; 149 return true;
136 } 150 }
137 } 151 }
138} \ No newline at end of file 152}
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
index 31838ad..b9e3665 100644
--- a/OpenSim/Framework/UserConfig.cs
+++ b/OpenSim/Framework/UserConfig.cs
@@ -46,6 +46,8 @@ namespace OpenSim.Framework
46 public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL; 46 public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL;
47 public uint DefaultUserLevel = 0; 47 public uint DefaultUserLevel = 0;
48 public string LibraryXmlfile = ""; 48 public string LibraryXmlfile = "";
49 public string ConsoleUser = String.Empty;
50 public string ConsolePass = String.Empty;
49 51
50 private Uri m_inventoryUrl; 52 private Uri m_inventoryUrl;
51 53
@@ -155,6 +157,12 @@ namespace OpenSim.Framework
155 m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 157 m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
156 "Minimum Level a user should have to login [0 default]", "0", false); 158 "Minimum Level a user should have to login [0 default]", "0", false);
157 159
160 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
161 "Remote console access user name [Default: disabled]", "0", false);
162
163 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
164 "Remote console access password [Default: disabled]", "0", false);
165
158 } 166 }
159 167
160 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 168 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -209,6 +217,12 @@ namespace OpenSim.Framework
209 case "library_location": 217 case "library_location":
210 LibraryXmlfile = (string)configuration_result; 218 LibraryXmlfile = (string)configuration_result;
211 break; 219 break;
220 case "console_user":
221 ConsoleUser = (string)configuration_result;
222 break;
223 case "console_pass":
224 ConsolePass = (string)configuration_result;
225 break;
212 } 226 }
213 227
214 return true; 228 return true;
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index c41a728..e3ad52a 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Timers; 32using System.Timers;
33using log4net; 33using log4net;
34using Nini.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
@@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 48
48 protected GridConfig m_config; 49 protected GridConfig m_config;
50 public string m_consoleType = "local";
51 public IConfigSource m_configSource = null;
49 52
50 public GridConfig Config 53 public GridConfig Config
51 { 54 {
@@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer
71 74
72 public GridServerBase() 75 public GridServerBase()
73 { 76 {
74 m_console = new LocalConsole("Grid");
75 MainConsole.Instance = m_console;
76 } 77 }
77 78
78 protected override void StartupSpecific() 79 protected override void StartupSpecific()
79 { 80 {
81 switch (m_consoleType)
82 {
83 case "rest":
84 m_console = new RemoteConsole("Grid");
85 break;
86 case "basic":
87 m_console = new CommandConsole("Grid");
88 break;
89 default:
90 m_console = new LocalConsole("Grid");
91 break;
92 }
93 MainConsole.Instance = m_console;
80 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 94 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
81 95
82 m_log.Info("[GRID]: Starting HTTP process"); 96 m_log.Info("[GRID]: Starting HTTP process");
83 m_httpServer = new BaseHttpServer(m_config.HttpPort); 97 m_httpServer = new BaseHttpServer(m_config.HttpPort);
98 if (m_console is RemoteConsole)
99 {
100 RemoteConsole c = (RemoteConsole)m_console;
101 c.SetServer(m_httpServer);
102 IConfig netConfig = m_configSource.AddConfig("Network");
103 netConfig.Set("ConsoleUser", m_config.ConsoleUser);
104 netConfig.Set("ConsolePass", m_config.ConsolePass);
105 c.ReadConfig(m_configSource);
106 }
84 107
85 LoadPlugins(); 108 LoadPlugins();
86 109
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs
index 9618b85..c7ba897 100644
--- a/OpenSim/Grid/GridServer/Program.cs
+++ b/OpenSim/Grid/GridServer/Program.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using log4net.Config; 28using log4net.Config;
29using Nini.Config;
29 30
30namespace OpenSim.Grid.GridServer 31namespace OpenSim.Grid.GridServer
31{ 32{
@@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer
33 { 34 {
34 public static void Main(string[] args) 35 public static void Main(string[] args)
35 { 36 {
37 ArgvConfigSource argvSource = new ArgvConfigSource(args);
38 argvSource.AddSwitch("Startup", "console", "c");
39
36 XmlConfigurator.Configure(); 40 XmlConfigurator.Configure();
37 41
38 GridServerBase app = new GridServerBase(); 42 GridServerBase app = new GridServerBase();
39 43
44 IConfig startupConfig = argvSource.Configs["Startup"];
45 if (startupConfig != null)
46 {
47 app.m_consoleType = startupConfig.GetString("console", "local");
48 }
49
50 app.m_configSource = argvSource;
51
40// if (args.Length > 0 && args[0] == "-setuponly") 52// if (args.Length > 0 && args[0] == "-setuponly")
41// { 53// {
42// app.Config(); 54// app.Config();
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index dcefeea..654e770 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Nini.Config;
33using log4net.Config; 34using log4net.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -56,8 +57,22 @@ namespace OpenSim.Grid.MessagingServer
56 57
57 // private UUID m_lastCreatedUser = UUID.Random(); 58 // private UUID m_lastCreatedUser = UUID.Random();
58 59
60 protected static string m_consoleType = "local";
61 protected static IConfigSource m_config = null;
62
59 public static void Main(string[] args) 63 public static void Main(string[] args)
60 { 64 {
65 ArgvConfigSource argvSource = new ArgvConfigSource(args);
66 argvSource.AddSwitch("Startup", "console", "c");
67
68 IConfig startupConfig = argvSource.Configs["Startup"];
69 if (startupConfig != null)
70 {
71 m_consoleType = startupConfig.GetString("console", "local");
72 }
73
74 m_config = argvSource;
75
61 XmlConfigurator.Configure(); 76 XmlConfigurator.Configure();
62 77
63 m_log.Info("[SERVER]: Launching MessagingServer..."); 78 m_log.Info("[SERVER]: Launching MessagingServer...");
@@ -70,7 +85,18 @@ namespace OpenSim.Grid.MessagingServer
70 85
71 public OpenMessage_Main() 86 public OpenMessage_Main()
72 { 87 {
73 m_console = new LocalConsole("Messaging"); 88 switch (m_consoleType)
89 {
90 case "rest":
91 m_console = new RemoteConsole("Messaging");
92 break;
93 case "basic":
94 m_console = new CommandConsole("Messaging");
95 break;
96 default:
97 m_console = new LocalConsole("Messaging");
98 break;
99 }
74 MainConsole.Instance = m_console; 100 MainConsole.Instance = m_console;
75 } 101 }
76 102
@@ -88,20 +114,33 @@ namespace OpenSim.Grid.MessagingServer
88 { 114 {
89 if (m_userServerModule.registerWithUserServer()) 115 if (m_userServerModule.registerWithUserServer())
90 { 116 {
91 m_log.Info("[SERVER]: Starting HTTP process"); 117 if (m_httpServer == null)
92 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 118 {
93 119 m_log.Info("[SERVER]: Starting HTTP process");
94 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); 120 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
95 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); 121
96 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); 122 if (m_console is RemoteConsole)
97 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); 123 {
98 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); 124 RemoteConsole c = (RemoteConsole)m_console;
99 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); 125 c.SetServer(m_httpServer);
100 126 IConfig netConfig = m_config.AddConfig("Network");
101 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); 127 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
102 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); 128 netConfig.Set("ConsolePass", Cfg.ConsolePass);
103 129 c.ReadConfig(m_config);
104 m_httpServer.Start(); 130 }
131
132 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
133 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
134 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
135 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
136 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
137 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
138
139 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
140 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
141
142 m_httpServer.Start();
143 }
105 m_log.Info("[SERVER]: Userserver registration was successful"); 144 m_log.Info("[SERVER]: Userserver registration was successful");
106 } 145 }
107 else 146 else
@@ -114,12 +153,12 @@ namespace OpenSim.Grid.MessagingServer
114 private void deregisterFromUserServer() 153 private void deregisterFromUserServer()
115 { 154 {
116 m_userServerModule.deregisterWithUserServer(); 155 m_userServerModule.deregisterWithUserServer();
117 if (m_httpServer != null) 156// if (m_httpServer != null)
118 { 157// {
119 // try a completely fresh registration, with fresh handlers, too 158 // try a completely fresh registration, with fresh handlers, too
120 m_httpServer.Stop(); 159// m_httpServer.Stop();
121 m_httpServer = null; 160// m_httpServer = null;
122 } 161// }
123 m_console.Output("[SERVER]: Deregistered from userserver."); 162 m_console.Output("[SERVER]: Deregistered from userserver.");
124 } 163 }
125 164
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 86c2abb..1ee53ef 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics;
43using OpenSim.Grid.Communications.OGS1; 43using OpenSim.Grid.Communications.OGS1;
44using OpenSim.Grid.Framework; 44using OpenSim.Grid.Framework;
45using OpenSim.Grid.UserServer.Modules; 45using OpenSim.Grid.UserServer.Modules;
46using Nini.Config;
46 47
47namespace OpenSim.Grid.UserServer 48namespace OpenSim.Grid.UserServer
48{ 49{
@@ -73,8 +74,22 @@ namespace OpenSim.Grid.UserServer
73 74
74 protected AvatarCreationModule m_appearanceModule; 75 protected AvatarCreationModule m_appearanceModule;
75 76
77 protected static string m_consoleType = "local";
78 protected static IConfigSource m_config = null;
79
76 public static void Main(string[] args) 80 public static void Main(string[] args)
77 { 81 {
82 ArgvConfigSource argvSource = new ArgvConfigSource(args);
83 argvSource.AddSwitch("Startup", "console", "c");
84
85 IConfig startupConfig = argvSource.Configs["Startup"];
86 if (startupConfig != null)
87 {
88 m_consoleType = startupConfig.GetString("console", "local");
89 }
90
91 m_config = argvSource;
92
78 XmlConfigurator.Configure(); 93 XmlConfigurator.Configure();
79 94
80 m_log.Info("Launching UserServer..."); 95 m_log.Info("Launching UserServer...");
@@ -87,7 +102,18 @@ namespace OpenSim.Grid.UserServer
87 102
88 public OpenUser_Main() 103 public OpenUser_Main()
89 { 104 {
90 m_console = new LocalConsole("User"); 105 switch (m_consoleType)
106 {
107 case "rest":
108 m_console = new RemoteConsole("User");
109 break;
110 case "basic":
111 m_console = new CommandConsole("User");
112 break;
113 default:
114 m_console = new LocalConsole("User");
115 break;
116 }
91 MainConsole.Instance = m_console; 117 MainConsole.Instance = m_console;
92 } 118 }
93 119
@@ -129,6 +155,16 @@ namespace OpenSim.Grid.UserServer
129 155
130 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 156 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
131 157
158 if (m_console is RemoteConsole)
159 {
160 RemoteConsole c = (RemoteConsole)m_console;
161 c.SetServer(m_httpServer);
162 IConfig netConfig = m_config.AddConfig("Network");
163 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
164 netConfig.Set("ConsolePass", Cfg.ConsolePass);
165 c.ReadConfig(m_config);
166 }
167
132 RegisterInterface<CommandConsole>(m_console); 168 RegisterInterface<CommandConsole>(m_console);
133 RegisterInterface<UserConfig>(Cfg); 169 RegisterInterface<UserConfig>(Cfg);
134 170
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 06bea3d..6969a3d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6633,9 +6633,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6633 } 6633 }
6634 else // Agent 6634 else // Agent
6635 { 6635 {
6636 //InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
6637 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); 6636 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
6638 InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID)); 6637 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
6638 assetRequestItem = invService.GetItem(assetRequestItem);
6639 if (assetRequestItem == null) 6639 if (assetRequestItem == null)
6640 { 6640 {
6641 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 6641 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
@@ -7027,14 +7027,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7027 if (OnMoveInventoryItem != null) 7027 if (OnMoveInventoryItem != null)
7028 { 7028 {
7029 handlerMoveInventoryItem = null; 7029 handlerMoveInventoryItem = null;
7030 InventoryItemBase itm = null;
7031 List<InventoryItemBase> items = new List<InventoryItemBase>();
7030 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 7032 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
7031 { 7033 {
7032 handlerMoveInventoryItem = OnMoveInventoryItem; 7034 itm = new InventoryItemBase(datablock.ItemID, AgentId);
7033 if (handlerMoveInventoryItem != null) 7035 itm.Folder = datablock.FolderID;
7034 { 7036 itm.Name = Util.FieldToString(datablock.NewName);
7035 handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, 7037 // weird, comes out as empty string
7036 Util.FieldToString(datablock.NewName)); 7038 //m_log.DebugFormat("[XXX] new name: {0}", itm.Name);
7037 } 7039 items.Add(itm);
7040 }
7041 handlerMoveInventoryItem = OnMoveInventoryItem;
7042 if (handlerMoveInventoryItem != null)
7043 {
7044 handlerMoveInventoryItem(this, items);
7038 } 7045 }
7039 } 7046 }
7040 break; 7047 break;
@@ -7053,14 +7060,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7053 if (OnRemoveInventoryItem != null) 7060 if (OnRemoveInventoryItem != null)
7054 { 7061 {
7055 handlerRemoveInventoryItem = null; 7062 handlerRemoveInventoryItem = null;
7063 List<UUID> uuids = new List<UUID>();
7056 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) 7064 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
7057 { 7065 {
7058 handlerRemoveInventoryItem = OnRemoveInventoryItem; 7066 uuids.Add(datablock.ItemID);
7059 if (handlerRemoveInventoryItem != null)
7060 {
7061 handlerRemoveInventoryItem(this, datablock.ItemID);
7062 }
7063 } 7067 }
7068 handlerRemoveInventoryItem = OnRemoveInventoryItem;
7069 if (handlerRemoveInventoryItem != null)
7070 {
7071 handlerRemoveInventoryItem(this, uuids);
7072 }
7073
7064 } 7074 }
7065 break; 7075 break;
7066 case PacketType.RemoveInventoryFolder: 7076 case PacketType.RemoveInventoryFolder:
@@ -7116,13 +7126,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7116 if (OnRemoveInventoryItem != null) 7126 if (OnRemoveInventoryItem != null)
7117 { 7127 {
7118 handlerRemoveInventoryItem = null; 7128 handlerRemoveInventoryItem = null;
7129 List<UUID> uuids = new List<UUID>();
7119 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData) 7130 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData)
7120 { 7131 {
7121 handlerRemoveInventoryItem = OnRemoveInventoryItem; 7132 uuids.Add(datablock.ItemID);
7122 if (handlerRemoveInventoryItem != null) 7133 }
7123 { 7134 handlerRemoveInventoryItem = OnRemoveInventoryItem;
7124 handlerRemoveInventoryItem(this, datablock.ItemID); 7135 if (handlerRemoveInventoryItem != null)
7125 } 7136 {
7137 handlerRemoveInventoryItem(this, uuids);
7126 } 7138 }
7127 } 7139 }
7128 break; 7140 break;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
index bf0b06d..798c1e7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
@@ -128,28 +128,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
128 // Store the throttle multiplier for posterity. 128 // Store the throttle multiplier for posterity.
129 throttleMultiplier = userSettings.ClientThrottleMultipler; 129 throttleMultiplier = userSettings.ClientThrottleMultipler;
130 130
131
132 int throttleMaxBPS = 1500000;
133 if (userSettings.TotalThrottleSettings != null)
134 throttleMaxBPS = userSettings.TotalThrottleSettings.Max;
135
131 // Set up the throttle classes (min, max, current) in bits per second 136 // Set up the throttle classes (min, max, current) in bits per second
132 ResendThrottle = new LLPacketThrottle(5000, 100000, 16000, userSettings.ClientThrottleMultipler); 137 ResendThrottle = new LLPacketThrottle(5000, throttleMaxBPS / 15, 16000, userSettings.ClientThrottleMultipler);
133 LandThrottle = new LLPacketThrottle(1000, 100000, 2000, userSettings.ClientThrottleMultipler); 138 LandThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 15, 2000, userSettings.ClientThrottleMultipler);
134 WindThrottle = new LLPacketThrottle(0, 100000, 0, userSettings.ClientThrottleMultipler); 139 WindThrottle = new LLPacketThrottle(0, throttleMaxBPS / 15, 0, userSettings.ClientThrottleMultipler);
135 CloudThrottle = new LLPacketThrottle(0, 100000, 0, userSettings.ClientThrottleMultipler); 140 CloudThrottle = new LLPacketThrottle(0, throttleMaxBPS / 15, 0, userSettings.ClientThrottleMultipler);
136 TaskThrottle = new LLPacketThrottle(1000, 800000, 3000, userSettings.ClientThrottleMultipler); 141 TaskThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 3000, userSettings.ClientThrottleMultipler);
137 AssetThrottle = new LLPacketThrottle(1000, 800000, 1000, userSettings.ClientThrottleMultipler); 142 AssetThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 1000, userSettings.ClientThrottleMultipler);
138 TextureThrottle = new LLPacketThrottle(1000, 800000, 4000, userSettings.ClientThrottleMultipler); 143 TextureThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 4000, userSettings.ClientThrottleMultipler);
139 144
140 // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second. 145
146 // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second.
147
148
141 ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings; 149 ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings;
142 if (null == totalThrottleSettings) 150 if (null == totalThrottleSettings)
143 { 151 {
144 totalThrottleSettings = new ThrottleSettings(0, 1500000, 28000); 152 totalThrottleSettings = new ThrottleSettings(0, throttleMaxBPS, 28000);
145 } 153 }
146 154
147 TotalThrottle 155 TotalThrottle
148 = new LLPacketThrottle( 156 = new LLPacketThrottle(
149 totalThrottleSettings.Min, totalThrottleSettings.Max, totalThrottleSettings.Current, 157 totalThrottleSettings.Min, totalThrottleSettings.Max, totalThrottleSettings.Current,
150 userSettings.ClientThrottleMultipler); 158 userSettings.ClientThrottleMultipler);
151 159
152 throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor)); 160 throttleTimer = new Timer((int)(throttletimems / throttleTimeDivisor));
153 throttleTimer.Elapsed += ThrottleTimerElapsed; 161 throttleTimer.Elapsed += ThrottleTimerElapsed;
154 throttleTimer.Start(); 162 throttleTimer.Start();
155 163
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 5184e35..9ee8df5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -152,11 +152,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
152 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 152 ClientStackUserSettings userSettings = new ClientStackUserSettings();
153 153
154 IConfig config = configSource.Configs["ClientStack.LindenUDP"]; 154 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
155 155
156 if (config != null) 156 if (config != null)
157 { 157 {
158 if (config.Contains("client_throttle_max_bps"))
159 {
160 int maxBPS = config.GetInt("client_throttle_max_bps", 1500000);
161 userSettings.TotalThrottleSettings = new ThrottleSettings(0, maxBPS,
162 maxBPS > 28000 ? maxBPS : 28000);
163 }
164
158 if (config.Contains("client_throttle_multiplier")) 165 if (config.Contains("client_throttle_multiplier"))
159 userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier"); 166 userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier");
160 if (config.Contains("client_socket_rcvbuf_size")) 167 if (config.Contains("client_socket_rcvbuf_size"))
161 m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size"); 168 m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size");
162 } 169 }
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 582beee..35c59aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -130,7 +130,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
130 } 130 }
131 else 131 else
132 { 132 {
133 InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID)); 133 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
134 baseItem = invService.GetItem(baseItem);
134 135
135 if (baseItem != null) 136 if (baseItem != null)
136 { 137 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index a68db1b..ff12361 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -65,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
65 { 65 {
66 IInventoryService invService = m_scene.InventoryService; 66 IInventoryService invService = m_scene.InventoryService;
67 67
68 InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId)); 68 InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId);
69 item = invService.GetItem(item);
69 if (item != null) 70 if (item != null)
70 { 71 {
71 item.Flags = 1; 72 item.Flags = 1;
@@ -80,7 +81,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
80 { 81 {
81 IInventoryService invService = m_scene.InventoryService; 82 IInventoryService invService = m_scene.InventoryService;
82 83
83 InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId)); 84 InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId);
85 item = invService.GetItem(item);
84 if (item != null) 86 if (item != null)
85 { 87 {
86 item.Flags = 0; 88 item.Flags = 0;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 5315c11..5afbf68 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -257,8 +257,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
257 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); 257 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
258 258
259 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip 259 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
260 260
261 InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID)); 261 InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId);
262 item = invService.GetItem(item);
262 InventoryFolderBase folder = null; 263 InventoryFolderBase folder = null;
263 264
264 if (item != null && trashFolder != null) 265 if (item != null && trashFolder != null)
@@ -266,12 +267,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
266 item.Folder = trashFolder.ID; 267 item.Folder = trashFolder.ID;
267 268
268 // Diva comment: can't we just update this item??? 269 // Diva comment: can't we just update this item???
269 invService.DeleteItem(item); 270 List<UUID> uuids = new List<UUID>();
271 uuids.Add(item.ID);
272 invService.DeleteItems(item.Owner, uuids);
270 scene.AddInventoryItem(client, item); 273 scene.AddInventoryItem(client, item);
271 } 274 }
272 else 275 else
273 { 276 {
274 folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID)); 277 folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
278 folder = invService.GetFolder(folder);
275 279
276 if (folder != null & trashFolder != null) 280 if (folder != null & trashFolder != null)
277 { 281 {
@@ -451,10 +455,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
451 else 455 else
452 { 456 {
453 UUID itemID = new UUID(msg.binaryBucket, 1); 457 UUID itemID = new UUID(msg.binaryBucket, 1);
454 InventoryItemBase item = new InventoryItemBase(); 458 InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId);
455
456 item.ID = itemID;
457 item.Owner = user.ControllingClient.AgentId;
458 459
459 // Fetch from service 460 // Fetch from service
460 // 461 //
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index ef5ffe1..d4cb616 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -181,12 +181,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
181 /// <returns>true if the item was successfully updated</returns> 181 /// <returns>true if the item was successfully updated</returns>
182 public abstract bool UpdateItem(InventoryItemBase item); 182 public abstract bool UpdateItem(InventoryItemBase item);
183 183
184 public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
185
184 /// <summary> 186 /// <summary>
185 /// Delete an item from the user's inventory 187 /// Delete an item from the user's inventory
186 /// </summary> 188 /// </summary>
187 /// <param name="item"></param> 189 /// <param name="item"></param>
188 /// <returns>true if the item was successfully deleted</returns> 190 /// <returns>true if the item was successfully deleted</returns>
189 public abstract bool DeleteItem(InventoryItemBase item); 191 public abstract bool DeleteItems(UUID ownerID, List<UUID> itemIDs);
190 192
191 public abstract InventoryItemBase GetItem(InventoryItemBase item); 193 public abstract InventoryItemBase GetItem(InventoryItemBase item);
192 194
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index dd451ef..787c6c8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -290,7 +290,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
290 290
291 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 291 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
292 { 292 {
293 return new List<InventoryItemBase>(); 293 if (IsLocalGridUser(userID))
294 return m_GridService.GetFolderItems(userID, folderID);
295 else
296 {
297 UUID sessionID = GetSessionID(userID);
298 string uri = GetUserInventoryURI(userID) + "/" + userID;
299 return m_HGService.GetFolderItems(uri, folderID, sessionID);
300 }
294 } 301 }
295 302
296 public override bool AddFolder(InventoryFolderBase folder) 303 public override bool AddFolder(InventoryFolderBase folder)
@@ -386,18 +393,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
386 } 393 }
387 } 394 }
388 395
389 public override bool DeleteItem(InventoryItemBase item) 396 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
390 { 397 {
391 if (item == null) 398 if (items == null)
392 return false; 399 return false;
400 if (items.Count == 0)
401 return true;
393 402
394 if (IsLocalGridUser(item.Owner)) 403 if (IsLocalGridUser(ownerID))
395 return m_GridService.DeleteItem(item); 404 return m_GridService.MoveItems(ownerID, items);
396 else 405 else
397 { 406 {
398 UUID sessionID = GetSessionID(item.Owner); 407 UUID sessionID = GetSessionID(ownerID);
399 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 408 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
400 return m_HGService.DeleteItem(uri, item, sessionID); 409 return m_HGService.MoveItems(uri, items, sessionID);
410 }
411 }
412
413 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
414 {
415 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
416
417 if (itemIDs == null)
418 return false;
419 if (itemIDs.Count == 0)
420 return true;
421
422 if (IsLocalGridUser(ownerID))
423 return m_GridService.DeleteItems(ownerID, itemIDs);
424 else
425 {
426 UUID sessionID = GetSessionID(ownerID);
427 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
428 return m_HGService.DeleteItems(uri, itemIDs, sessionID);
401 } 429 }
402 } 430 }
403 431
@@ -483,12 +511,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
483 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 511 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
484 string uri = m_LocalGridInventoryURI.TrimEnd('/'); 512 string uri = m_LocalGridInventoryURI.TrimEnd('/');
485 513
486 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri);
487
488 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 514 if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
489 { 515 {
490 return true; 516 return true;
491 } 517 }
518 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
492 return false; 519 return false;
493 } 520 }
494 521
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 2fbc5fe..562c5dd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -289,14 +289,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
289 return m_InventoryService.UpdateItem(item); 289 return m_InventoryService.UpdateItem(item);
290 } 290 }
291 291
292
293 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
294 {
295 return m_InventoryService.MoveItems(ownerID, items);
296 }
297
292 /// <summary> 298 /// <summary>
293 /// Delete an item from the user's inventory 299 /// Delete an item from the user's inventory
294 /// </summary> 300 /// </summary>
295 /// <param name="item"></param> 301 /// <param name="item"></param>
296 /// <returns>true if the item was successfully deleted</returns> 302 /// <returns>true if the item was successfully deleted</returns>
297 public override bool DeleteItem(InventoryItemBase item) 303 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
298 { 304 {
299 return m_InventoryService.DeleteItem(item); 305 return m_InventoryService.DeleteItems(ownerID, itemIDs);
300 } 306 }
301 307
302 public override InventoryItemBase GetItem(InventoryItemBase item) 308 public override InventoryItemBase GetItem(InventoryItemBase item)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index bef716b..201442c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
212 212
213 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 213 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
214 { 214 {
215 return new List<InventoryItemBase>(); 215 UUID sessionID = GetSessionID(userID);
216 return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID);
216 } 217 }
217 218
218 public override bool AddFolder(InventoryFolderBase folder) 219 public override bool AddFolder(InventoryFolderBase folder)
@@ -272,13 +273,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
272 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); 273 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
273 } 274 }
274 275
275 public override bool DeleteItem(InventoryItemBase item) 276 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
276 { 277 {
277 if (item == null) 278 if (items == null)
278 return false; 279 return false;
279 280
280 UUID sessionID = GetSessionID(item.Owner); 281 UUID sessionID = GetSessionID(ownerID);
281 return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); 282 return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID);
283 }
284
285
286 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
287 {
288 if (itemIDs == null)
289 return false;
290 if (itemIDs.Count == 0)
291 return true;
292
293 UUID sessionID = GetSessionID(ownerID);
294 return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID);
282 } 295 }
283 296
284 public override InventoryItemBase GetItem(InventoryItemBase item) 297 public override InventoryItemBase GetItem(InventoryItemBase item)
@@ -320,14 +333,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
320 333
321 private UUID GetSessionID(UUID userID) 334 private UUID GetSessionID(UUID userID)
322 { 335 {
323 if (m_Scene == null) 336 //if (m_Scene == null)
324 { 337 //{
325 m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); 338 // m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
326 } 339 //}
327 340
328 if (m_UserProfileService == null) 341 if (m_UserProfileService == null)
329 { 342 {
330 m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); 343 //m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
331 return UUID.Zero; 344 return UUID.Zero;
332 } 345 }
333 346
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 9c71b41..f360577 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -966,7 +966,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
966 if (objectID == UUID.Zero) // User inventory 966 if (objectID == UUID.Zero) // User inventory
967 { 967 {
968 IInventoryService invService = m_scene.InventoryService; 968 IInventoryService invService = m_scene.InventoryService;
969 InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); 969 InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
970 assetRequestItem = invService.GetItem(assetRequestItem);
970 if (assetRequestItem == null) // Library item 971 if (assetRequestItem == null) // Library item
971 { 972 {
972 assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); 973 assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
@@ -1385,7 +1386,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1385 if (objectID == UUID.Zero) // User inventory 1386 if (objectID == UUID.Zero) // User inventory
1386 { 1387 {
1387 IInventoryService invService = m_scene.InventoryService; 1388 IInventoryService invService = m_scene.InventoryService;
1388 InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script)); 1389 InventoryItemBase assetRequestItem = new InventoryItemBase(script, user);
1390 assetRequestItem = invService.GetItem(assetRequestItem);
1389 if (assetRequestItem == null) // Library item 1391 if (assetRequestItem == null) // Library item
1390 { 1392 {
1391 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); 1393 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script);
@@ -1479,7 +1481,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1479 if (objectID == UUID.Zero) // User inventory 1481 if (objectID == UUID.Zero) // User inventory
1480 { 1482 {
1481 IInventoryService invService = m_scene.InventoryService; 1483 IInventoryService invService = m_scene.InventoryService;
1482 InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); 1484 InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user);
1485 assetRequestItem = invService.GetItem(assetRequestItem);
1483 if (assetRequestItem == null) // Library item 1486 if (assetRequestItem == null) // Library item
1484 { 1487 {
1485 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); 1488 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 46777e1..a119efc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -140,7 +140,8 @@ namespace OpenSim.Region.Framework.Scenes
140 /// <returns></returns> 140 /// <returns></returns>
141 public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) 141 public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
142 { 142 {
143 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 143 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
144 item = InventoryService.GetItem(item);
144 145
145 if (item != null) 146 if (item != null)
146 { 147 {
@@ -315,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes
315 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, 316 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
316 UUID itemID, InventoryItemBase itemUpd) 317 UUID itemID, InventoryItemBase itemUpd)
317 { 318 {
318 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 319 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
320 item = InventoryService.GetItem(item);
319 321
320 if (item != null) 322 if (item != null)
321 { 323 {
@@ -408,7 +410,8 @@ namespace OpenSim.Region.Framework.Scenes
408 { 410 {
409 Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); 411 Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
410 412
411 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemId)); 413 InventoryItemBase item = new InventoryItemBase(itemId, senderId);
414 item = InventoryService.GetItem(item);
412 415
413 if ((item != null) && (item.Owner == senderId)) 416 if ((item != null) && (item.Owner == senderId))
414 { 417 {
@@ -474,7 +477,11 @@ namespace OpenSim.Region.Framework.Scenes
474 if (!Permissions.BypassPermissions()) 477 if (!Permissions.BypassPermissions())
475 { 478 {
476 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 479 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
477 InventoryService.DeleteItem(new InventoryItemBase(itemId)); 480 {
481 List<UUID> items = new List<UUID>();
482 items.Add(itemId);
483 InventoryService.DeleteItems(senderId, items);
484 }
478 } 485 }
479 486
480 return itemCopy; 487 return itemCopy;
@@ -558,7 +565,8 @@ namespace OpenSim.Region.Framework.Scenes
558 565
559 if (item == null) 566 if (item == null)
560 { 567 {
561 item = InventoryService.GetItem(new InventoryItemBase(oldItemID)); 568 item = new InventoryItemBase(oldItemID, remoteClient.AgentId);
569 item = InventoryService.GetItem(item);
562 570
563 if (item == null) 571 if (item == null)
564 { 572 {
@@ -630,33 +638,13 @@ namespace OpenSim.Region.Framework.Scenes
630 /// <param name="itemID"></param> 638 /// <param name="itemID"></param>
631 /// <param name="length"></param> 639 /// <param name="length"></param>
632 /// <param name="newName"></param> 640 /// <param name="newName"></param>
633 public void MoveInventoryItem(IClientAPI remoteClient, UUID folderID, UUID itemID, int length, 641 public void MoveInventoryItem(IClientAPI remoteClient, List<InventoryItemBase> items)
634 string newName)
635 { 642 {
636 m_log.DebugFormat( 643 m_log.DebugFormat(
637 "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); 644 "[AGENT INVENTORY]: Moving {0} items for user {1}", items.Count, remoteClient.AgentId);
638
639 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
640 645
641 if (item != null) 646 if (!InventoryService.MoveItems(remoteClient.AgentId, items))
642 { 647 m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + remoteClient.AgentId);
643 if (newName != String.Empty)
644 {
645 item.Name = newName;
646 }
647 item.Folder = folderID;
648
649 // Diva comment: can't we just update?
650 InventoryService.DeleteItem(item);
651
652 AddInventoryItem(remoteClient, item);
653 }
654 else
655 {
656 m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
657
658 return;
659 }
660 } 648 }
661 649
662 /// <summary> 650 /// <summary>
@@ -794,9 +782,10 @@ namespace OpenSim.Region.Framework.Scenes
794 /// </summary> 782 /// </summary>
795 /// <param name="remoteClient"></param> 783 /// <param name="remoteClient"></param>
796 /// <param name="itemID"></param> 784 /// <param name="itemID"></param>
797 private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) 785 private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs)
798 { 786 {
799 InventoryService.DeleteItem(new InventoryItemBase(itemID)); 787 //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId);
788 InventoryService.DeleteItems(remoteClient.AgentId, itemIDs);
800 } 789 }
801 790
802 /// <summary> 791 /// <summary>
@@ -1224,7 +1213,8 @@ namespace OpenSim.Region.Framework.Scenes
1224 UUID copyID = UUID.Random(); 1213 UUID copyID = UUID.Random();
1225 if (itemID != UUID.Zero) 1214 if (itemID != UUID.Zero)
1226 { 1215 {
1227 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1216 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1217 item = InventoryService.GetItem(item);
1228 1218
1229 // Try library 1219 // Try library
1230 if (null == item) 1220 if (null == item)
@@ -1242,7 +1232,11 @@ namespace OpenSim.Region.Framework.Scenes
1242 if (!Permissions.BypassPermissions()) 1232 if (!Permissions.BypassPermissions())
1243 { 1233 {
1244 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1234 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1245 RemoveInventoryItem(remoteClient, itemID); 1235 {
1236 List<UUID> uuids = new List<UUID>();
1237 uuids.Add(itemID);
1238 RemoveInventoryItem(remoteClient, uuids);
1239 }
1246 } 1240 }
1247 } 1241 }
1248 else 1242 else
@@ -1287,7 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes
1287 1281
1288 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory 1282 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
1289 { 1283 {
1290 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1284 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1285 item = InventoryService.GetItem(item);
1291 1286
1292 // Try library 1287 // Try library
1293 // XXX clumsy, possibly should be one call 1288 // XXX clumsy, possibly should be one call
@@ -1672,7 +1667,7 @@ namespace OpenSim.Region.Framework.Scenes
1672 1667
1673 if (DeRezAction.SaveToExistingUserInventoryItem == action) 1668 if (DeRezAction.SaveToExistingUserInventoryItem == action)
1674 { 1669 {
1675 item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID); 1670 item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID);
1676 item = InventoryService.GetItem(item); 1671 item = InventoryService.GetItem(item);
1677 1672
1678 //item = userInfo.RootFolder.FindItem( 1673 //item = userInfo.RootFolder.FindItem(
@@ -1834,7 +1829,8 @@ namespace OpenSim.Region.Framework.Scenes
1834 1829
1835 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); 1830 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
1836 1831
1837 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1832 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1833 item = InventoryService.GetItem(item);
1838 1834
1839 if (item != null) 1835 if (item != null)
1840 { 1836 {
@@ -1984,7 +1980,8 @@ namespace OpenSim.Region.Framework.Scenes
1984 BypassRayCast, bRayEndIsIntersection,true,scale, false); 1980 BypassRayCast, bRayEndIsIntersection,true,scale, false);
1985 1981
1986 // Rez object 1982 // Rez object
1987 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1983 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1984 item = InventoryService.GetItem(item);
1988 1985
1989 if (item != null) 1986 if (item != null)
1990 { 1987 {
@@ -2135,7 +2132,11 @@ namespace OpenSim.Region.Framework.Scenes
2135 // copy ones will be lost, so avoid it 2132 // copy ones will be lost, so avoid it
2136 // 2133 //
2137 if (!attachment) 2134 if (!attachment)
2138 InventoryService.DeleteItem(item); 2135 {
2136 List<UUID> uuids = new List<UUID>();
2137 uuids.Add(item.ID);
2138 InventoryService.DeleteItems(item.Owner, uuids);
2139 }
2139 } 2140 }
2140 } 2141 }
2141 2142
@@ -2309,7 +2310,8 @@ namespace OpenSim.Region.Framework.Scenes
2309 ScenePresence presence; 2310 ScenePresence presence;
2310 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2311 if (TryGetAvatar(remoteClient.AgentId, out presence))
2311 { 2312 {
2312 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID, remoteClient.AgentId)); 2313 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2314 item = InventoryService.GetItem(item);
2313 2315
2314 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2316 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2315 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2317 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
@@ -2360,7 +2362,8 @@ namespace OpenSim.Region.Framework.Scenes
2360 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2362 if (TryGetAvatar(remoteClient.AgentId, out presence))
2361 { 2363 {
2362 // XXYY!! 2364 // XXYY!!
2363 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 2365 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2366 item = InventoryService.GetItem(item);
2364 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2367 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2365 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2368 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
2366 if (ava != null) 2369 if (ava != null)
@@ -2393,7 +2396,9 @@ namespace OpenSim.Region.Framework.Scenes
2393 } 2396 }
2394 part.ParentGroup.DetachToGround(); 2397 part.ParentGroup.DetachToGround();
2395 2398
2396 InventoryService.DeleteItem(new InventoryItemBase(inventoryID)); 2399 List<UUID> uuids = new List<UUID>();
2400 uuids.Add(inventoryID);
2401 InventoryService.DeleteItems(remoteClient.AgentId, uuids);
2397 remoteClient.SendRemoveInventoryItem(inventoryID); 2402 remoteClient.SendRemoveInventoryItem(inventoryID);
2398 } 2403 }
2399 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); 2404 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index fde922f..77b980c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Threading; 30using System.Threading;
30using OpenMetaverse; 31using OpenMetaverse;
@@ -404,7 +405,8 @@ namespace OpenSim.Region.Framework.Scenes
404 return; 405 return;
405 } 406 }
406 407
407 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 408 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
409 item = InventoryService.GetItem(item);
408 410
409 if (item != null) 411 if (item != null)
410 { 412 {
@@ -557,15 +559,34 @@ namespace OpenSim.Region.Framework.Scenes
557 /// <param name="remoteClient"></param> 559 /// <param name="remoteClient"></param>
558 /// <param name="folderID"></param> 560 /// <param name="folderID"></param>
559 561
562 delegate void PurgeFolderDelegate(UUID userID, UUID folder);
563
560 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) 564 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
561 { 565 {
562 InventoryFolderBase folder = new InventoryFolderBase(folderID); 566 PurgeFolderDelegate d = PurgeFolderAsync;
567 try
568 {
569 d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d);
570 }
571 catch (Exception e)
572 {
573 m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
574 }
575 }
576
577
578 private void PurgeFolderAsync(UUID userID, UUID folderID)
579 {
580 InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);
563 581
564 if (InventoryService.PurgeFolder(folder)) 582 if (InventoryService.PurgeFolder(folder))
565 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); 583 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
566 else 584 else
567 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); 585 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
568 } 586 }
569 587
588 private void PurgeFolderCompleted(IAsyncResult iar)
589 {
590 }
570 } 591 }
571} 592}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2dbbf70..4e665e9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,6 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1979 } 1979 }
1980 1980
1981 private LSL_Rotation GetPartRot( SceneObjectPart part )
1982 {
1983 Quaternion q;
1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
1985 {
1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0)
1987 {
1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
1989 if (avatar != null)
1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1991 q = avatar.CameraRotation; // Mouselook
1992 else
1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1994 else
1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1996 }
1997 else
1998 q = part.ParentGroup.GroupRotation; // just the group rotation
1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2000 }
2001 q = part.GetWorldRotation();
2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2003 }
2004
1981 public LSL_Rotation llGetLocalRot() 2005 public LSL_Rotation llGetLocalRot()
1982 { 2006 {
1983 m_host.AddScriptLPS(1); 2007 m_host.AddScriptLPS(1);
@@ -7299,7 +7323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7299 break; 7323 break;
7300 7324
7301 case (int)ScriptBaseClass.PRIM_ROTATION: 7325 case (int)ScriptBaseClass.PRIM_ROTATION:
7302 res.Add(llGetRot()); 7326 res.Add(GetPartRot(part));
7303 break; 7327 break;
7304 7328
7305 case (int)ScriptBaseClass.PRIM_TYPE: 7329 case (int)ScriptBaseClass.PRIM_TYPE:
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 619c2d1..1d9eb0d 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -65,6 +65,10 @@ namespace OpenSim.Server.Base
65 // 65 //
66 private bool m_Running = true; 66 private bool m_Running = true;
67 67
68 // PID file
69 //
70 private string m_pidFile = String.Empty;
71
68 // Handle all the automagical stuff 72 // Handle all the automagical stuff
69 // 73 //
70 public ServicesServerBase(string prompt, string[] args) 74 public ServicesServerBase(string prompt, string[] args)
@@ -211,6 +215,11 @@ namespace OpenSim.Server.Base
211 } 215 }
212 } 216 }
213 217
218 if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty)
219 {
220 CreatePIDFile(startupConfig.GetString("PIDFile"));
221 }
222
214 // Register the quit command 223 // Register the quit command
215 // 224 //
216 MainConsole.Instance.Commands.AddCommand("base", false, "quit", 225 MainConsole.Instance.Commands.AddCommand("base", false, "quit",
@@ -230,6 +239,8 @@ namespace OpenSim.Server.Base
230 MainConsole.Instance.Prompt(); 239 MainConsole.Instance.Prompt();
231 } 240 }
232 241
242 if (m_pidFile != String.Empty)
243 File.Delete(m_pidFile);
233 return 0; 244 return 0;
234 } 245 }
235 246
@@ -246,5 +257,22 @@ namespace OpenSim.Server.Base
246 protected virtual void Initialise() 257 protected virtual void Initialise()
247 { 258 {
248 } 259 }
260
261 protected void CreatePIDFile(string path)
262 {
263 try
264 {
265 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
266 FileStream fs = File.Create(path);
267 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
268 Byte[] buf = enc.GetBytes(pidstring);
269 fs.Write(buf, 0, buf.Length);
270 fs.Close();
271 m_pidFile = path;
272 }
273 catch (Exception)
274 {
275 }
276 }
249 } 277 }
250} 278}
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
index 30b3cae..6ef1d9d 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
@@ -105,8 +105,8 @@ namespace OpenSim.Server.Handlers.Inventory
105 "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession)); 105 "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession));
106 106
107 m_httpServer.AddStreamHandler( 107 m_httpServer.AddStreamHandler(
108 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 108 new RestDeserialiseSecureHandler<List<Guid>, bool>(
109 "POST", "/DeleteItem/", m_InventoryService.DeleteItem, CheckAuthSession)); 109 "POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
110 110
111 m_httpServer.AddStreamHandler( 111 m_httpServer.AddStreamHandler(
112 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( 112 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
@@ -125,8 +125,8 @@ namespace OpenSim.Server.Handlers.Inventory
125 "POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession)); 125 "POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession));
126 126
127 m_httpServer.AddStreamHandler( 127 m_httpServer.AddStreamHandler(
128 new RestDeserialiseTrustedHandler<InventoryFolderBase, bool>( 128 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
129 "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckTrustSource)); 129 "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckAuthSession));
130 130
131 m_httpServer.AddStreamHandler( 131 m_httpServer.AddStreamHandler(
132 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 132 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
@@ -137,9 +137,13 @@ namespace OpenSim.Server.Handlers.Inventory
137 "POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource)); 137 "POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource));
138 138
139 m_httpServer.AddStreamHandler( 139 m_httpServer.AddStreamHandler(
140 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>( 140 new RestDeserialiseSecureHandler<Guid, List<InventoryItemBase>>(
141 "POST", "/GetItems/", GetFolderItems, CheckTrustSource)); 141 "POST", "/GetItems/", GetFolderItems, CheckAuthSession));
142 142
143 m_httpServer.AddStreamHandler(
144 new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>(
145 "POST", "/MoveItems/", MoveItems, CheckAuthSession));
146
143 // for persistent active gestures 147 // for persistent active gestures
144 m_httpServer.AddStreamHandler( 148 m_httpServer.AddStreamHandler(
145 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> 149 new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
@@ -247,6 +251,24 @@ namespace OpenSim.Server.Handlers.Inventory
247 return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); 251 return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
248 } 252 }
249 253
254 public bool DeleteItems(List<Guid> items)
255 {
256 List<UUID> uuids = new List<UUID>();
257 foreach (Guid g in items)
258 uuids.Add(new UUID(g));
259 // oops we lost the user info here. Bad bad handlers
260 return m_InventoryService.DeleteItems(UUID.Zero, uuids);
261 }
262
263 public bool MoveItems(List<InventoryItemBase> items)
264 {
265 // oops we lost the user info here. Bad bad handlers
266 // let's peek at one item
267 UUID ownerID = UUID.Zero;
268 if (items.Count > 0)
269 ownerID = items[0].Owner;
270 return m_InventoryService.MoveItems(ownerID, items);
271 }
250 #endregion 272 #endregion
251 273
252 /// <summary> 274 /// <summary>
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
index 94b4ad9..45e921a 100644
--- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
@@ -214,6 +214,19 @@ namespace OpenSim.Services.Connectors.Inventory
214 return false; 214 return false;
215 } 215 }
216 216
217 public List<InventoryItemBase> GetFolderItems(string id, UUID folderID, UUID sessionID)
218 {
219 string url = string.Empty;
220 string userID = string.Empty;
221
222 if (StringToUrlAndUserID(id, out url, out userID))
223 {
224 ISessionAuthInventoryService connector = GetConnector(url);
225 return connector.GetFolderItems(userID, folderID, sessionID);
226 }
227 return new List<InventoryItemBase>();
228 }
229
217 public bool AddItem(string id, InventoryItemBase item, UUID sessionID) 230 public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
218 { 231 {
219 string url = string.Empty; 232 string url = string.Empty;
@@ -240,7 +253,7 @@ namespace OpenSim.Services.Connectors.Inventory
240 return false; 253 return false;
241 } 254 }
242 255
243 public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) 256 public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID)
244 { 257 {
245 string url = string.Empty; 258 string url = string.Empty;
246 string userID = string.Empty; 259 string userID = string.Empty;
@@ -248,7 +261,20 @@ namespace OpenSim.Services.Connectors.Inventory
248 if (StringToUrlAndUserID(id, out url, out userID)) 261 if (StringToUrlAndUserID(id, out url, out userID))
249 { 262 {
250 ISessionAuthInventoryService connector = GetConnector(url); 263 ISessionAuthInventoryService connector = GetConnector(url);
251 return connector.UpdateItem(userID, item, sessionID); 264 return connector.MoveItems(userID, items, sessionID);
265 }
266 return false;
267 }
268
269 public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID)
270 {
271 string url = string.Empty;
272 string userID = string.Empty;
273
274 if (StringToUrlAndUserID(id, out url, out userID))
275 {
276 ISessionAuthInventoryService connector = GetConnector(url);
277 return connector.DeleteItems(userID, itemIDs, sessionID);
252 } 278 }
253 return false; 279 return false;
254 } 280 }
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
index f50bcf5..c89c9b7 100644
--- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
+++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
@@ -96,6 +96,13 @@ namespace OpenSim.Services.Connectors
96 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id); 96 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id);
97 97
98 /// <summary> 98 /// <summary>
99 /// Get items from a folder.
100 /// </summary>
101 /// <param name="folder"></param>
102 /// <returns>true if the folder was successfully purged</returns>
103 List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID session_id);
104
105 /// <summary>
99 /// Add a new item to the user's inventory 106 /// Add a new item to the user's inventory
100 /// </summary> 107 /// </summary>
101 /// <param name="item"></param> 108 /// <param name="item"></param>
@@ -109,12 +116,14 @@ namespace OpenSim.Services.Connectors
109 /// <returns>true if the item was successfully updated</returns> 116 /// <returns>true if the item was successfully updated</returns>
110 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); 117 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id);
111 118
119 bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id);
120
112 /// <summary> 121 /// <summary>
113 /// Delete an item from the user's inventory 122 /// Delete an item from the user's inventory
114 /// </summary> 123 /// </summary>
115 /// <param name="item"></param> 124 /// <param name="item"></param>
116 /// <returns>true if the item was successfully deleted</returns> 125 /// <returns>true if the item was successfully deleted</returns>
117 bool DeleteItem(string userID, InventoryItemBase item, UUID session_id); 126 bool DeleteItems(string userID, List<UUID> itemIDs, UUID session_id);
118 127
119 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id); 128 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id);
120 129
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
index 5d94eac..bcf9d87 100644
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
@@ -334,6 +334,23 @@ namespace OpenSim.Services.Connectors
334 return false; 334 return false;
335 } 335 }
336 336
337 public List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID sessionID)
338 {
339 try
340 {
341 InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID));
342 return SynchronousRestSessionObjectPoster<InventoryFolderBase, List<InventoryItemBase>>.BeginPostObject(
343 "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID);
344 }
345 catch (Exception e)
346 {
347 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}",
348 e.Source, e.Message);
349 }
350
351 return null;
352 }
353
337 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) 354 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID)
338 { 355 {
339 try 356 try
@@ -366,12 +383,57 @@ namespace OpenSim.Services.Connectors
366 return false; 383 return false;
367 } 384 }
368 385
369 public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID) 386 /**
387 * MoveItems Async group
388 */
389
390 delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID);
391
392 private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID)
370 { 393 {
371 try 394 try
372 { 395 {
373 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( 396 SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject(
374 "POST", m_ServerURI + "/DeleteItem/", item, sessionID.ToString(), item.Owner.ToString()); 397 "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString());
398
399 // Success
400 return;
401 }
402 catch (Exception e)
403 {
404 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.",
405 e.Source, e.Message);
406 }
407
408 foreach (InventoryItemBase item in items)
409 {
410 InventoryItemBase itm = this.QueryItem(userID, item, sessionID);
411 itm.Name = item.Name;
412 itm.Folder = item.Folder;
413 this.UpdateItem(userID, itm, sessionID);
414 }
415 }
416
417 private void MoveItemsCompleted(IAsyncResult iar)
418 {
419 }
420
421 public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID)
422 {
423 MoveItemsDelegate d = MoveItemsAsync;
424 d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d);
425 return true;
426 }
427
428 public bool DeleteItems(string userID, List<UUID> items, UUID sessionID)
429 {
430 try
431 {
432 List<Guid> guids = new List<Guid>();
433 foreach (UUID u in items)
434 guids.Add(u.Guid);
435 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
436 "POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID);
375 } 437 }
376 catch (Exception e) 438 catch (Exception e)
377 { 439 {
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
index 5cbd307..cd283ff 100644
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
@@ -151,7 +151,12 @@ namespace OpenSim.Services.Connectors
151 return false; 151 return false;
152 } 152 }
153 153
154 public bool DeleteItem(InventoryItemBase item) 154 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
155 {
156 return false;
157 }
158
159 public bool DeleteItems(UUID owner, List<UUID> itemIDs)
155 { 160 {
156 return false; 161 return false;
157 } 162 }
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index a89a238..ebdb09a 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -142,12 +142,15 @@ namespace OpenSim.Services.Interfaces
142 /// <returns>true if the item was successfully updated</returns> 142 /// <returns>true if the item was successfully updated</returns>
143 bool UpdateItem(InventoryItemBase item); 143 bool UpdateItem(InventoryItemBase item);
144 144
145 bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
146
145 /// <summary> 147 /// <summary>
146 /// Delete an item from the user's inventory 148 /// Delete an item from the user's inventory
147 /// </summary> 149 /// </summary>
148 /// <param name="item"></param> 150 /// <param name="item"></param>
149 /// <returns>true if the item was successfully deleted</returns> 151 /// <returns>true if the item was successfully deleted</returns>
150 bool DeleteItem(InventoryItemBase item); 152 //bool DeleteItem(InventoryItemBase item);
153 bool DeleteItems(UUID userID, List<UUID> itemIDs);
151 154
152 /// <summary> 155 /// <summary>
153 /// Get an item, given by its UUID 156 /// Get an item, given by its UUID
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 65c2d96..e0217f6 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -386,13 +386,33 @@ namespace OpenSim.Services.InventoryService
386 return true; 386 return true;
387 } 387 }
388 388
389 public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
390 {
391 m_log.InfoFormat(
392 "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID);
393
394 InventoryItemBase itm = null;
395 foreach (InventoryItemBase item in items)
396 {
397 itm = GetInventoryItem(item.ID);
398 itm.Folder = item.Folder;
399 if ((item.Name != null) && !item.Name.Equals(string.Empty))
400 itm.Name = item.Name;
401 m_Database.updateInventoryItem(itm);
402 }
403
404 return true;
405 }
406
389 // See IInventoryServices 407 // See IInventoryServices
390 public virtual bool DeleteItem(InventoryItemBase item) 408 public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs)
391 { 409 {
392 m_log.InfoFormat( 410 m_log.InfoFormat(
393 "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); 411 "[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner);
394 412
395 m_Database.deleteInventoryItem(item.ID); 413 // uhh.....
414 foreach (UUID uuid in itemIDs)
415 m_Database.deleteInventoryItem(uuid);
396 416
397 // FIXME: Should return false on failure 417 // FIXME: Should return false on failure
398 return true; 418 return true;
@@ -439,10 +459,12 @@ namespace OpenSim.Services.InventoryService
439 459
440 List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID); 460 List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID);
441 461
462 List<UUID> uuids = new List<UUID>();
442 foreach (InventoryItemBase item in items) 463 foreach (InventoryItemBase item in items)
443 { 464 {
444 DeleteItem(item); 465 uuids.Add(item.ID);
445 } 466 }
467 DeleteItems(folder.Owner, uuids);
446 468
447 // FIXME: Should return false on failure 469 // FIXME: Should return false on failure
448 return true; 470 return true;
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs
index ba9cbe9..ee22e5e 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryService.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs
@@ -143,7 +143,12 @@ namespace OpenSim.Tests.Common.Mock
143 return false; 143 return false;
144 } 144 }
145 145
146 public bool DeleteItem(InventoryItemBase item) 146 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
147 {
148 return false;
149 }
150
151 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
147 { 152 {
148 return false; 153 return false;
149 } 154 }