aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs129
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
3 files changed, 34 insertions, 99 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 5d20e63..83209fc 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -268,6 +268,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
268 268
269 fromAgentName = (string)requestData["from_agent_name"]; 269 fromAgentName = (string)requestData["from_agent_name"];
270 message = (string)requestData["message"]; 270 message = (string)requestData["message"];
271 if (message == null)
272 message = string.Empty;
271 273
272 // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them. 274 // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
273 string requestData1 = (string)requestData["dialog"]; 275 string requestData1 = (string)requestData["dialog"];
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index be89740..c333812 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -145,10 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
145 { 145 {
146 ScenePresence presence = scene.GetScenePresence(agentId); 146 ScenePresence presence = scene.GetScenePresence(agentId);
147 if (presence != null) 147 if (presence != null)
148 { 148 return scene;
149 if (!presence.IsChildAgent)
150 return scene;
151 }
152 } 149 }
153 } 150 }
154 return null; 151 return null;
@@ -156,7 +153,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
156 153
157 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 154 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
158 { 155 {
159 m_log.InfoFormat("OnInstantMessage {0}", im.dialog); 156 m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog);
160 Scene scene = FindClientScene(client.AgentId); 157 Scene scene = FindClientScene(client.AgentId);
161 158
162 if (scene == null) // Something seriously wrong here. 159 if (scene == null) // Something seriously wrong here.
@@ -167,8 +164,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
167 if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) 164 if (im.dialog == (byte) InstantMessageDialog.InventoryOffered)
168 { 165 {
169 //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); 166 //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0]));
170 167
171 ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); 168 UUID receipientID = new UUID(im.toAgentID);
169 ScenePresence user = scene.GetScenePresence(receipientID);
172 UUID copyID; 170 UUID copyID;
173 171
174 // First byte is the asset type 172 // First byte is the asset type
@@ -183,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
183 folderID, new UUID(im.toAgentID)); 181 folderID, new UUID(im.toAgentID));
184 182
185 InventoryFolderBase folderCopy 183 InventoryFolderBase folderCopy
186 = scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero); 184 = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero);
187 185
188 if (folderCopy == null) 186 if (folderCopy == null)
189 { 187 {
@@ -199,20 +197,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
199 im.binaryBucket[0] = (byte)AssetType.Folder; 197 im.binaryBucket[0] = (byte)AssetType.Folder;
200 Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length); 198 Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length);
201 199
202 if (user != null && !user.IsChildAgent) 200 if (user != null)
203 { 201 {
204 user.ControllingClient.SendBulkUpdateInventory(folderCopy); 202 user.ControllingClient.SendBulkUpdateInventory(folderCopy);
205 } 203 }
204
205 // HACK!!
206 im.imSessionID = folderID.Guid;
206 } 207 }
207 else 208 else
208 { 209 {
209 // First byte of the array is probably the item type 210 // First byte of the array is probably the item type
210 // Next 16 bytes are the UUID 211 // Next 16 bytes are the UUID
211 m_log.Info("OnInstantMessage - giving item");
212 212
213 UUID itemID = new UUID(im.binaryBucket, 1); 213 UUID itemID = new UUID(im.binaryBucket, 1);
214 214
215 m_log.DebugFormat("[AGENT INVENTORY]: Inserting item {0} "+ 215 m_log.DebugFormat("[AGENT INVENTORY]: (giving) Inserting item {0} "+
216 "into agent {1}'s inventory", 216 "into agent {1}'s inventory",
217 itemID, new UUID(im.toAgentID)); 217 itemID, new UUID(im.toAgentID));
218 218
@@ -229,29 +229,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
229 copyID = itemCopy.ID; 229 copyID = itemCopy.ID;
230 Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); 230 Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16);
231 231
232 if (user != null && !user.IsChildAgent) 232 if (user != null)
233 { 233 {
234 user.ControllingClient.SendBulkUpdateInventory(itemCopy); 234 user.ControllingClient.SendBulkUpdateInventory(itemCopy);
235 } 235 }
236
237 // HACK!!
238 im.imSessionID = itemID.Guid;
236 } 239 }
237 240
238 // Send the IM to the recipient. The item is already 241 // Send the IM to the recipient. The item is already
239 // in their inventory, so it will not be lost if 242 // in their inventory, so it will not be lost if
240 // they are offline. 243 // they are offline.
241 // 244 //
242 if (user != null && !user.IsChildAgent) 245 if (user != null)
243 { 246 {
244 // And notify. Transaction ID is the item ID. We get that
245 // same ID back on the reply so we know what to act on
246 //
247 user.ControllingClient.SendInstantMessage(im); 247 user.ControllingClient.SendInstantMessage(im);
248
249 return; 248 return;
250 } 249 }
251 else 250 else
252 { 251 {
253 if (m_TransferModule != null) 252 if (m_TransferModule != null)
254 m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); 253 m_TransferModule.SendInstantMessage(im, delegate(bool success)
254 {
255 if (!success)
256 client.SendAlertMessage("User not online. Inventory has been saved");
257 });
255 } 258 }
256 } 259 }
257 else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) 260 else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
@@ -282,10 +285,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
282 285
283 InventoryFolderBase trashFolder = 286 InventoryFolderBase trashFolder =
284 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); 287 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
285
286 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
287 288
288 InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId); 289 UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
290
291 InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
289 item = invService.GetItem(item); 292 item = invService.GetItem(item);
290 InventoryFolderBase folder = null; 293 InventoryFolderBase folder = null;
291 294
@@ -301,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
301 } 304 }
302 else 305 else
303 { 306 {
304 folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); 307 folder = new InventoryFolderBase(inventoryID, client.AgentId);
305 folder = invService.GetFolder(folder); 308 folder = invService.GetFolder(folder);
306 309
307 if (folder != null & trashFolder != null) 310 if (folder != null & trashFolder != null)
@@ -417,90 +420,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
417 { 420 {
418 // Check if this is ours to handle 421 // Check if this is ours to handle
419 // 422 //
420 m_log.Info("OnFridInstantMessage"); 423 m_log.Info("OnGridInstantMessage");
421 if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered)
422 return;
423
424 if (msg.binaryBucket.Length < 17) // Invalid
425 return;
426 424
427 Scene scene = FindClientScene(new UUID(msg.toAgentID)); 425 Scene scene = FindClientScene(new UUID(msg.toAgentID));
428 426
427 if (scene == null)
428 return;
429
429 // Find agent to deliver to 430 // Find agent to deliver to
430 // 431 //
431 ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); 432 ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID));
432 433
433 if (user == null) // Shouldn't happen 434 // Just forward to local handling
434 { 435 OnInstantMessage(user.ControllingClient, msg);
435 m_log.Debug("[INVENTORY TRANSFER] Can't find recipient");
436 return;
437 }
438
439 //CachedUserInfo userInfo =
440 // scene.CommsManager.UserProfileCacheService.
441 // GetUserDetails(user.ControllingClient.AgentId);
442 436
443 //if (userInfo == null)
444 //{
445 // m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
446 // return;
447 //}
448
449 AssetType assetType = (AssetType)msg.binaryBucket[0];
450 IInventoryService invService = scene.InventoryService;
451
452 if (AssetType.Folder == assetType)
453 {
454 UUID folderID = new UUID(msg.binaryBucket, 1);
455 InventoryFolderBase folder = new InventoryFolderBase();
456
457 folder.ID = folderID;
458 folder.Owner = user.ControllingClient.AgentId;
459
460 // Fetch from service
461 //
462 folder = invService.GetFolder(folder);
463 if (folder == null)
464 {
465 m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
466 return;
467 }
468
469 user.ControllingClient.SendBulkUpdateInventory(folder);
470
471 //// This unelegant, slow kludge is to reload the folders and
472 //// items. Since a folder give can transfer subfolders and
473 //// items, this is the easiest way to pull that stuff in
474 ////
475 //userInfo.DropInventory();
476 //userInfo.FetchInventory();
477
478 // Deliver message
479 //
480 user.ControllingClient.SendInstantMessage(msg);
481 }
482 else
483 {
484 UUID itemID = new UUID(msg.binaryBucket, 1);
485 InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId);
486
487 // Fetch from service
488 //
489 item = invService.GetItem(item);
490 if (item == null)
491 {
492 m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
493 return;
494 }
495
496 // Update item to viewer (makes it appear in proper folder)
497 //
498 user.ControllingClient.SendBulkUpdateInventory(item);
499
500 // Deliver message
501 //
502 user.ControllingClient.SendInstantMessage(msg);
503 }
504 } 437 }
505 } 438 }
506} 439}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4180d5e..64bdc99 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes
203 // Update item with new asset 203 // Update item with new asset
204 item.AssetID = asset.FullID; 204 item.AssetID = asset.FullID;
205 if (group.UpdateInventoryItem(item)) 205 if (group.UpdateInventoryItem(item))
206 remoteClient.SendAgentAlertMessage("Notecard saved", false); 206 remoteClient.SendAgentAlertMessage("Script saved", false);
207 207
208 part.GetProperties(remoteClient); 208 part.GetProperties(remoteClient);
209 209