aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-19 14:43:18 -0400
committerTeravus Ovares (Dan Olivares)2009-08-19 14:43:18 -0400
commit289439c8329d992251769aa83e3d7809f651de26 (patch)
tree8a1e596190f197fa5f70f21a8c968d2c55004cde /OpenSim/Region
parentAdd Border (a virtual border management class) (diff)
parentAdded MoveItems, which is most useful upon viewer-delete inventory operation.... (diff)
downloadopensim-SC_OLD-289439c8329d992251769aa83e3d7809f651de26.zip
opensim-SC_OLD-289439c8329d992251769aa83e3d7809f651de26.tar.gz
opensim-SC_OLD-289439c8329d992251769aa83e3d7809f651de26.tar.bz2
opensim-SC_OLD-289439c8329d992251769aa83e3d7809f651de26.tar.xz
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-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
14 files changed, 248 insertions, 116 deletions
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: