aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs13
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs84
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs158
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs87
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs11
6 files changed, 349 insertions, 12 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 5687e01..17d9510 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -576,6 +576,9 @@ namespace OpenSim.Framework
576 576
577 void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 577 void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
578 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp); 578 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp);
579 void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
580 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp,
581 byte[] binaryBucket);
579 582
580 void SendLayerData(float[] map); 583 void SendLayerData(float[] map);
581 void SendLayerData(int px, int py, float[] map); 584 void SendLayerData(int px, int py, float[] map);
@@ -620,7 +623,7 @@ namespace OpenSim.Framework
620 623
621 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 624 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
622 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); 625 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity);
623 626
624 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, 627 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
625 List<InventoryFolderBase> folders, bool fetchFolders, 628 List<InventoryFolderBase> folders, bool fetchFolders,
626 bool fetchItems); 629 bool fetchItems);
@@ -635,6 +638,14 @@ namespace OpenSim.Framework
635 638
636 void SendRemoveInventoryItem(LLUUID itemID); 639 void SendRemoveInventoryItem(LLUUID itemID);
637 void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); 640 void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
641
642 /// <summary>
643 /// Used by the server to inform the client of a new inventory item. Used when transferring items
644 /// between avatars, possibly among other things.
645 /// </summary>
646 /// <param name="item"></param>
647 void SendBulkUpdateInventory(InventoryItemBase item);
648
638 void SendXferPacket(ulong xferID, uint packet, byte[] data); 649 void SendXferPacket(ulong xferID, uint packet, byte[] data);
639 void SendAvatarPickerReply(AvatarPickerReplyPacket Pack); 650 void SendAvatarPickerReply(AvatarPickerReplyPacket Pack);
640 651
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index a67c247..c98eb84 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -482,6 +482,11 @@ namespace OpenSim.Region.ClientStack
482 return result; 482 return result;
483 } 483 }
484 484
485 /// <summary>
486 /// Try to process a packet using registered packet handlers
487 /// </summary>
488 /// <param name="packet"></param>
489 /// <returns>True if a handler was found which successfully processed the packet.</returns>
485 protected virtual bool ProcessPacketMethod(Packet packet) 490 protected virtual bool ProcessPacketMethod(Packet packet)
486 { 491 {
487 bool result = false; 492 bool result = false;
@@ -865,14 +870,30 @@ namespace OpenSim.Region.ClientStack
865 } 870 }
866 871
867 /// <summary> 872 /// <summary>
868 /// 873 /// Send an instant message to this client
869 /// </summary> 874 /// </summary>
870 /// <param name="message"></param> 875 /// <param name="message"></param>
871 /// <param name="target"></param> 876 /// <param name="target"></param>
872 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 877 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
873 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 878 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
874 { 879 {
875 ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); 880 SendInstantMessage(
881 fromAgent, fromAgentSession, message, toAgent,
882 imSessionID, fromName, dialog, timeStamp, new byte[0]);
883 }
884
885 /// <summary>
886 /// Send an instant message to this client
887 /// </summary>
888 /// <param name="message"></param>
889 /// <param name="target"></param>
890 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
891 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp,
892 byte[] binaryBucket)
893 {
894 ImprovedInstantMessagePacket msg
895 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
896
876 msg.AgentData.AgentID = fromAgent; 897 msg.AgentData.AgentID = fromAgent;
877 msg.AgentData.SessionID = fromAgentSession; 898 msg.AgentData.SessionID = fromAgentSession;
878 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); 899 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
@@ -886,7 +907,7 @@ namespace OpenSim.Region.ClientStack
886 msg.MessageBlock.Timestamp = timeStamp; 907 msg.MessageBlock.Timestamp = timeStamp;
887 msg.MessageBlock.ToAgentID = toAgent; 908 msg.MessageBlock.ToAgentID = toAgent;
888 msg.MessageBlock.Message = Helpers.StringToField(message); 909 msg.MessageBlock.Message = Helpers.StringToField(message);
889 msg.MessageBlock.BinaryBucket = new byte[0]; 910 msg.MessageBlock.BinaryBucket = binaryBucket;
890 911
891 OutPacket(msg, ThrottleOutPacketType.Task); 912 OutPacket(msg, ThrottleOutPacketType.Task);
892 } 913 }
@@ -1374,12 +1395,67 @@ namespace OpenSim.Region.ClientStack
1374 1395
1375 OutPacket(inventoryReply, ThrottleOutPacketType.Asset); 1396 OutPacket(inventoryReply, ThrottleOutPacketType.Asset);
1376 } 1397 }
1398
1399 /// <see>IClientAPI.SendBulkUpdateInventory(InventoryItemBase)</see>
1400 public void SendBulkUpdateInventory(InventoryItemBase item)
1401 {
1402 uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
1403
1404 BulkUpdateInventoryPacket bulkUpdate
1405 = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory);
1406
1407 bulkUpdate.AgentData.AgentID = AgentId;
1408 bulkUpdate.AgentData.TransactionID = LLUUID.Random();
1409
1410 bulkUpdate.FolderData = new BulkUpdateInventoryPacket.FolderDataBlock[1];
1411 bulkUpdate.FolderData[0] = new BulkUpdateInventoryPacket.FolderDataBlock();
1412 bulkUpdate.FolderData[0].FolderID = LLUUID.Zero;
1413 bulkUpdate.FolderData[0].ParentID = LLUUID.Zero;
1414 bulkUpdate.FolderData[0].Type = -1;
1415 bulkUpdate.FolderData[0].Name = new byte[0];
1416
1417 bulkUpdate.ItemData = new BulkUpdateInventoryPacket.ItemDataBlock[1];
1418 bulkUpdate.ItemData[0] = new BulkUpdateInventoryPacket.ItemDataBlock();
1419 bulkUpdate.ItemData[0].ItemID = item.inventoryID;
1420 bulkUpdate.ItemData[0].AssetID = item.assetID;
1421 bulkUpdate.ItemData[0].CreatorID = item.creatorsID;
1422 bulkUpdate.ItemData[0].BaseMask = item.inventoryBasePermissions;
1423 bulkUpdate.ItemData[0].CreationDate = 1000;
1424 bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.inventoryDescription);
1425 bulkUpdate.ItemData[0].EveryoneMask = item.inventoryEveryOnePermissions;
1426 bulkUpdate.ItemData[0].Flags = 0;
1427 bulkUpdate.ItemData[0].FolderID = item.parentFolderID;
1428 bulkUpdate.ItemData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1429 bulkUpdate.ItemData[0].GroupMask = 0;
1430 bulkUpdate.ItemData[0].InvType = (sbyte)item.invType;
1431 bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.inventoryName);
1432 bulkUpdate.ItemData[0].NextOwnerMask = item.inventoryNextPermissions;
1433 bulkUpdate.ItemData[0].OwnerID = item.avatarID;
1434 bulkUpdate.ItemData[0].OwnerMask = item.inventoryCurrentPermissions;
1435 bulkUpdate.ItemData[0].SalePrice = 100;
1436 bulkUpdate.ItemData[0].SaleType = 0;
1437 bulkUpdate.ItemData[0].Type = (sbyte)item.assetType;
1438 bulkUpdate.ItemData[0].CRC =
1439 Helpers.InventoryCRC(1000, 0, bulkUpdate.ItemData[0].InvType,
1440 bulkUpdate.ItemData[0].Type, bulkUpdate.ItemData[0].AssetID,
1441 bulkUpdate.ItemData[0].GroupID, 100,
1442 bulkUpdate.ItemData[0].OwnerID, bulkUpdate.ItemData[0].CreatorID,
1443 bulkUpdate.ItemData[0].ItemID, bulkUpdate.ItemData[0].FolderID,
1444 FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
1445 FULL_MASK_PERMISSIONS);
1446
1447 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
1448 }
1377 1449
1378 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> 1450 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
1379 public void SendInventoryItemCreateUpdate(InventoryItemBase Item) 1451 public void SendInventoryItemCreateUpdate(InventoryItemBase Item)
1380 { 1452 {
1381 uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; 1453 uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
1382 UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem); 1454
1455 UpdateCreateInventoryItemPacket InventoryReply
1456 = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(
1457 PacketType.UpdateCreateInventoryItem);
1458
1383 // TODO: don't create new blocks if recycling an old packet 1459 // TODO: don't create new blocks if recycling an old packet
1384 InventoryReply.AgentData.AgentID = AgentId; 1460 InventoryReply.AgentData.AgentID = AgentId;
1385 InventoryReply.AgentData.SimApproved = true; 1461 InventoryReply.AgentData.SimApproved = true;
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 53d9fd9..6f7235e 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -70,13 +70,17 @@ namespace OpenSim.Region.Environment.Modules
70 uint ParentEstateID, LLVector3 Position, LLUUID RegionID, 70 uint ParentEstateID, LLVector3 Position, LLUUID RegionID,
71 byte[] binaryBucket) 71 byte[] binaryBucket)
72 { 72 {
73 bool FriendDialog = ((dialog == (byte)38) || (dialog == (byte)39) || (dialog == (byte)40)); 73 bool dialogHandledElsewhere
74 = ((dialog == (byte)38) || (dialog == (byte)39) || (dialog == (byte)40)
75 || dialog == (byte)InstantMessageDialog.InventoryOffered
76 || dialog == (byte)InstantMessageDialog.InventoryAccepted
77 || dialog == (byte)InstantMessageDialog.InventoryDeclined);
74 78
75 // IM dialogs need to be pre-processed and have their sessionID filled by the server 79 // IM dialogs need to be pre-processed and have their sessionID filled by the server
76 // so the sim can match the transaction on the return packet. 80 // so the sim can match the transaction on the return packet.
77 81
78 // Don't send a Friend Dialog IM with a LLUUID.Zero session. 82 // Don't send a Friend Dialog IM with a LLUUID.Zero session.
79 if (!(FriendDialog && imSessionID == LLUUID.Zero)) 83 if (!(dialogHandledElsewhere && imSessionID == LLUUID.Zero))
80 { 84 {
81 foreach (Scene scene in m_scenes) 85 foreach (Scene scene in m_scenes)
82 { 86 {
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index a0f3832..eadbb4f 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -25,7 +25,13 @@
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;
29using System.Collections.Generic;
30
31using libsecondlife;
28using Nini.Config; 32using Nini.Config;
33
34using OpenSim.Framework;
29using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
31 37
@@ -33,11 +39,22 @@ namespace OpenSim.Region.Environment.Modules
33{ 39{
34 public class InventoryModule : IRegionModule 40 public class InventoryModule : IRegionModule
35 { 41 {
42 private static readonly log4net.ILog m_log
43 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44
36 private Scene m_scene; 45 private Scene m_scene;
46
47 /// <summary>
48 /// We need to keep track of the pending item offers between clients since the itemId offered only
49 /// occurs in the initial offer message, not the accept message. So this dictionary links
50 /// IM Session Ids to ItemIds
51 /// </summary>
52 private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
37 53
38 public void Initialise(Scene scene, IConfigSource config) 54 public void Initialise(Scene scene, IConfigSource config)
39 { 55 {
40 m_scene = scene; 56 m_scene = scene;
57 scene.EventManager.OnNewClient += OnNewClient;
41 } 58 }
42 59
43 public void PostInitialise() 60 public void PostInitialise()
@@ -57,5 +74,144 @@ namespace OpenSim.Region.Environment.Modules
57 { 74 {
58 get { return false; } 75 get { return false; }
59 } 76 }
77
78 private void OnNewClient(IClientAPI client)
79 {
80 // Inventory giving is conducted via instant message
81 client.OnInstantMessage += OnInstantMessage;
82 }
83
84 private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID,
85 LLUUID fromAgentSession, LLUUID toAgentID,
86 LLUUID imSessionID, uint timestamp, string fromAgentName,
87 string message, byte dialog, bool fromGroup, byte offline,
88 uint ParentEstateID, LLVector3 Position, LLUUID RegionID,
89 byte[] binaryBucket)
90 {
91 if (dialog == (byte)InstantMessageDialog.InventoryOffered)
92 {
93 m_log.DebugFormat(
94 "[AGENT INVENTORY]: Routing inventory offering message from {0}, {1} to {2}",
95 client.AgentId, client.Name, toAgentID);
96
97 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
98 {
99 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
100
101 if (!user.IsChildAgent)
102 {
103 //byte[] rawId = new byte[16];
104
105 // First byte of the array is probably the item type
106 // Next 16 bytes are the UUID
107 //Array.Copy(binaryBucket, 1, rawId, 0, 16);
108
109 //LLUUID itemId = new LLUUID(new Guid(rawId));
110 LLUUID itemId = new LLUUID(binaryBucket, 1);
111
112 m_log.DebugFormat(
113 "[AGENT INVENTORY]: ItemId for giving is {0}", itemId);
114
115 m_pendingOffers[imSessionID] = itemId;
116
117 user.ControllingClient.SendInstantMessage(
118 fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromAgentName,
119 dialog, timestamp, binaryBucket);
120
121 return;
122 }
123 else
124 {
125 m_log.WarnFormat(
126 "[AGENT INVENTORY]: Agent {0} targeted for inventory give by {1}, {2} of {3} was a child agent!",
127 toAgentID, client.AgentId, client.Name, message);
128 }
129 }
130 else
131 {
132 m_log.WarnFormat(
133 "[AGENT INVENTORY]: Could not find agent {0} for user {1}, {2} to give {3}",
134 toAgentID, client.AgentId, client.Name, message);
135 }
136 }
137 else if (dialog == (byte)InstantMessageDialog.InventoryAccepted)
138 {
139 m_log.DebugFormat(
140 "[AGENT INVENTORY]: Routing inventory accepted message from {0}, {1} to {2}",
141 client.AgentId, client.Name, toAgentID);
142
143 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
144 {
145 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
146
147 if (!user.IsChildAgent)
148 {
149 user.ControllingClient.SendInstantMessage(
150 fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromAgentName,
151 dialog, timestamp, binaryBucket);
152
153 if (m_pendingOffers.ContainsKey(imSessionID))
154 {
155 m_log.DebugFormat(
156 "[AGENT INVENTORY]: Accepted item id {0}", m_pendingOffers[imSessionID]);
157
158 // Since the message originates from the accepting client, the toAgentID is
159 // the agent giving the item.
160 m_scene.GiveInventoryItem(client, toAgentID, m_pendingOffers[imSessionID]);
161
162 m_pendingOffers.Remove(imSessionID);
163 }
164 else
165 {
166 m_log.ErrorFormat(
167 "[AGENT INVENTORY]: Could not find an item associated with session id {0} to accept",
168 imSessionID);
169 }
170
171 return;
172 }
173 else
174 {
175 m_log.WarnFormat(
176 "[AGENT INVENTORY]: Agent {0} targeted for inventory give by {1}, {2} of {3} was a child agent!",
177 toAgentID, client.AgentId, client.Name, message);
178 }
179 }
180 else
181 {
182 m_log.WarnFormat(
183 "[AGENT INVENTORY]: Could not find agent {0} for user {1}, {2} to give {3}",
184 toAgentID, client.AgentId, client.Name, message);
185 }
186 }
187 else if (dialog == (byte)InstantMessageDialog.InventoryDeclined)
188 {
189 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
190 {
191 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID];
192
193 if (!user.IsChildAgent)
194 {
195 user.ControllingClient.SendInstantMessage(
196 fromAgentID, fromAgentSession, message, toAgentID, imSessionID, fromAgentName,
197 dialog, timestamp, binaryBucket);
198
199 if (m_pendingOffers.ContainsKey(imSessionID))
200 {
201 m_log.DebugFormat(
202 "[AGENT INVENTORY]: Declined item id {0}", m_pendingOffers[imSessionID]);
203
204 m_pendingOffers.Remove(imSessionID);
205 }
206 else
207 {
208 m_log.ErrorFormat(
209 "[AGENT INVENTORY]: Could not find an item associated with session id {0} to decline",
210 imSessionID);
211 }
212 }
213 }
214 }
215 }
60 } 216 }
61} 217}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 2b8f344..f6f1367 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -286,10 +286,89 @@ namespace OpenSim.Region.Environment.Scenes
286 "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); 286 "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
287 } 287 }
288 } 288 }
289
290 /// <summary>
291 /// Give an inventory item from one avatar to another
292 /// </summary>
293 /// <param name="recipientClient"></param>
294 /// <param name="sender"></param>
295 /// <param name="itemId"></param>
296 public void GiveInventoryItem(IClientAPI recipientClient, LLUUID senderId, LLUUID itemId)
297 {
298 // Retrieve the item from the sender
299 CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId);
300
301 if (senderUserInfo == null)
302 {
303 m_log.ErrorFormat(
304 "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId);
305
306 return;
307 }
308
309 if (senderUserInfo.RootFolder != null)
310 {
311 InventoryItemBase item = senderUserInfo.RootFolder.HasItem(itemId);
312 if (item != null)
313 {
314 // TODO get recipient's root folder
315 CachedUserInfo recipientUserInfo
316 = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId);
317
318 if (recipientUserInfo != null)
319 {
320 // Insert a copy of the item into the recipient
321 InventoryItemBase itemCopy = new InventoryItemBase();
322 itemCopy.avatarID = recipientClient.AgentId;
323 itemCopy.creatorsID = recipientClient.AgentId;
324 itemCopy.inventoryID = LLUUID.Random();
325 itemCopy.assetID = item.assetID;
326 itemCopy.inventoryDescription = item.inventoryDescription;
327 itemCopy.inventoryName = item.inventoryName;
328 itemCopy.assetType = item.assetType;
329 itemCopy.invType = item.invType;
330 itemCopy.parentFolderID = recipientUserInfo.RootFolder.folderID;
331 itemCopy.inventoryCurrentPermissions = 2147483647;
332 itemCopy.inventoryNextPermissions = 2147483647;
333 itemCopy.inventoryEveryOnePermissions = item.inventoryEveryOnePermissions;
334 itemCopy.inventoryBasePermissions = item.inventoryBasePermissions;
335 itemCopy.inventoryCurrentPermissions = item.inventoryCurrentPermissions;
336
337 recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy);
338
339 // Let the recipient client know about this new item
340 recipientClient.SendBulkUpdateInventory(itemCopy);
341 }
342 else
343 {
344 m_log.ErrorFormat(
345 "[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}",
346 recipientClient.Name, recipientClient.AgentId, item.inventoryName,
347 item.inventoryID, senderId);
348 }
349 }
350 else
351 {
352 m_log.ErrorFormat(
353 "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId);
354
355 return;
356 }
357 }
358 else
359 {
360 m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder");
361 return;
362 }
363 }
289 364
290 public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, 365 public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID,
291 LLUUID newFolderID, string newName) 366 LLUUID newFolderID, string newName)
292 { 367 {
368 m_log.DebugFormat(
369 "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
370 remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
371
293 InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID); 372 InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID);
294 if (item == null) 373 if (item == null)
295 { 374 {
@@ -349,9 +428,8 @@ namespace OpenSim.Region.Environment.Scenes
349 public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, 428 public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length,
350 string newName) 429 string newName)
351 { 430 {
352 m_log.Info( 431 m_log.DebugFormat(
353 "[AGENT INVENTORY]: " + 432 "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId);
354 "Moving item for " + remoteClient.AgentId.ToString());
355 433
356 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 434 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
357 if (userInfo == null) 435 if (userInfo == null)
@@ -429,7 +507,8 @@ namespace OpenSim.Region.Environment.Scenes
429 } 507 }
430 508
431 /// <summary> 509 /// <summary>
432 /// Create a new inventory item. 510 /// Create a new inventory item. Called when the client creates a new item directly within their
511 /// inventory (e.g. by selecting a context inventory menu option).
433 /// </summary> 512 /// </summary>
434 /// <param name="remoteClient"></param> 513 /// <param name="remoteClient"></param>
435 /// <param name="transactionID"></param> 514 /// <param name="transactionID"></param>
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 3f090df..9901a50 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -270,6 +270,12 @@ namespace OpenSim.Region.Examples.SimpleModule
270 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 270 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
271 { 271 {
272 } 272 }
273
274 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
275 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp,
276 byte[] binaryBucket)
277 {
278 }
273 279
274 public virtual void SendLayerData(float[] map) 280 public virtual void SendLayerData(float[] map)
275 { 281 {
@@ -388,6 +394,11 @@ namespace OpenSim.Region.Examples.SimpleModule
388 public virtual void SendRemoveInventoryItem(LLUUID itemID) 394 public virtual void SendRemoveInventoryItem(LLUUID itemID)
389 { 395 {
390 } 396 }
397
398 /// <see>IClientAPI.SendBulkUpdateInventory(InventoryItemBase)</see>
399 public virtual void SendBulkUpdateInventory(InventoryItemBase item)
400 {
401 }
391 402
392 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) 403 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
393 { 404 {