aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-25 16:13:02 -0400
committerTeravus Ovares (Dan Olivares)2009-08-25 16:13:02 -0400
commita7917b428a6bc3c9e33da64879b9e473516540a3 (patch)
tree2c38d9c33c4977a3d0356912915082a8bd568a23 /OpenSim/Region
parentPatch from jhurliman to HttpServer (diff)
parentImplemented osPenCap, that sets EndCap and StartCap to Pen. This allows using... (diff)
downloadopensim-SC_OLD-a7917b428a6bc3c9e33da64879b9e473516540a3.zip
opensim-SC_OLD-a7917b428a6bc3c9e33da64879b9e473516540a3.tar.gz
opensim-SC_OLD-a7917b428a6bc3c9e33da64879b9e473516540a3.tar.bz2
opensim-SC_OLD-a7917b428a6bc3c9e33da64879b9e473516540a3.tar.xz
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs78
-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/InstantMessage/MessageTransferModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs125
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs64
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs21
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs109
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs74
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs9
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs148
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs29
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs43
25 files changed, 816 insertions, 210 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 06bea3d..dd01780 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2177,7 +2177,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2177 bulkUpdate.AgentData.AgentID = AgentId; 2177 bulkUpdate.AgentData.AgentID = AgentId;
2178 bulkUpdate.AgentData.TransactionID = transactionId; 2178 bulkUpdate.AgentData.TransactionID = transactionId;
2179 bulkUpdate.FolderData = folderDataBlocks.ToArray(); 2179 bulkUpdate.FolderData = folderDataBlocks.ToArray();
2180 2180 List<BulkUpdateInventoryPacket.ItemDataBlock> foo = new List<BulkUpdateInventoryPacket.ItemDataBlock>();
2181 bulkUpdate.ItemData = foo.ToArray();
2182
2181 //m_log.Debug("SendBulkUpdateInventory :" + bulkUpdate); 2183 //m_log.Debug("SendBulkUpdateInventory :" + bulkUpdate);
2182 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); 2184 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
2183 } 2185 }
@@ -6633,9 +6635,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6633 } 6635 }
6634 else // Agent 6636 else // Agent
6635 { 6637 {
6636 //InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
6637 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); 6638 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
6638 InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID)); 6639 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
6640 assetRequestItem = invService.GetItem(assetRequestItem);
6639 if (assetRequestItem == null) 6641 if (assetRequestItem == null)
6640 { 6642 {
6641 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 6643 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
@@ -7027,14 +7029,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7027 if (OnMoveInventoryItem != null) 7029 if (OnMoveInventoryItem != null)
7028 { 7030 {
7029 handlerMoveInventoryItem = null; 7031 handlerMoveInventoryItem = null;
7032 InventoryItemBase itm = null;
7033 List<InventoryItemBase> items = new List<InventoryItemBase>();
7030 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 7034 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
7031 { 7035 {
7032 handlerMoveInventoryItem = OnMoveInventoryItem; 7036 itm = new InventoryItemBase(datablock.ItemID, AgentId);
7033 if (handlerMoveInventoryItem != null) 7037 itm.Folder = datablock.FolderID;
7034 { 7038 itm.Name = Util.FieldToString(datablock.NewName);
7035 handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, 7039 // weird, comes out as empty string
7036 Util.FieldToString(datablock.NewName)); 7040 //m_log.DebugFormat("[XXX] new name: {0}", itm.Name);
7037 } 7041 items.Add(itm);
7042 }
7043 handlerMoveInventoryItem = OnMoveInventoryItem;
7044 if (handlerMoveInventoryItem != null)
7045 {
7046 handlerMoveInventoryItem(this, items);
7038 } 7047 }
7039 } 7048 }
7040 break; 7049 break;
@@ -7053,14 +7062,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7053 if (OnRemoveInventoryItem != null) 7062 if (OnRemoveInventoryItem != null)
7054 { 7063 {
7055 handlerRemoveInventoryItem = null; 7064 handlerRemoveInventoryItem = null;
7065 List<UUID> uuids = new List<UUID>();
7056 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) 7066 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
7057 { 7067 {
7058 handlerRemoveInventoryItem = OnRemoveInventoryItem; 7068 uuids.Add(datablock.ItemID);
7059 if (handlerRemoveInventoryItem != null) 7069 }
7060 { 7070 handlerRemoveInventoryItem = OnRemoveInventoryItem;
7061 handlerRemoveInventoryItem(this, datablock.ItemID); 7071 if (handlerRemoveInventoryItem != null)
7062 } 7072 {
7073 handlerRemoveInventoryItem(this, uuids);
7063 } 7074 }
7075
7064 } 7076 }
7065 break; 7077 break;
7066 case PacketType.RemoveInventoryFolder: 7078 case PacketType.RemoveInventoryFolder:
@@ -7078,14 +7090,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7078 if (OnRemoveInventoryFolder != null) 7090 if (OnRemoveInventoryFolder != null)
7079 { 7091 {
7080 handlerRemoveInventoryFolder = null; 7092 handlerRemoveInventoryFolder = null;
7093 List<UUID> uuids = new List<UUID>();
7081 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) 7094 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
7082 { 7095 {
7083 handlerRemoveInventoryFolder = OnRemoveInventoryFolder; 7096 uuids.Add(datablock.FolderID);
7084 7097 }
7085 if (handlerRemoveInventoryFolder != null) 7098 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7086 { 7099 if (handlerRemoveInventoryFolder != null)
7087 handlerRemoveInventoryFolder(this, datablock.FolderID); 7100 {
7088 } 7101 handlerRemoveInventoryFolder(this, uuids);
7089 } 7102 }
7090 } 7103 }
7091 break; 7104 break;
@@ -7102,27 +7115,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7102 if (OnRemoveInventoryFolder != null) 7115 if (OnRemoveInventoryFolder != null)
7103 { 7116 {
7104 handlerRemoveInventoryFolder = null; 7117 handlerRemoveInventoryFolder = null;
7118 List<UUID> uuids = new List<UUID>();
7105 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) 7119 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
7106 { 7120 {
7107 handlerRemoveInventoryFolder = OnRemoveInventoryFolder; 7121 uuids.Add(datablock.FolderID);
7108 7122 }
7109 if (handlerRemoveInventoryFolder != null) 7123 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7110 { 7124 if (handlerRemoveInventoryFolder != null)
7111 handlerRemoveInventoryFolder(this, datablock.FolderID); 7125 {
7112 } 7126 handlerRemoveInventoryFolder(this, uuids);
7113 } 7127 }
7114 } 7128 }
7115 7129
7116 if (OnRemoveInventoryItem != null) 7130 if (OnRemoveInventoryItem != null)
7117 { 7131 {
7118 handlerRemoveInventoryItem = null; 7132 handlerRemoveInventoryItem = null;
7133 List<UUID> uuids = new List<UUID>();
7119 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData) 7134 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData)
7120 { 7135 {
7121 handlerRemoveInventoryItem = OnRemoveInventoryItem; 7136 uuids.Add(datablock.ItemID);
7122 if (handlerRemoveInventoryItem != null) 7137 }
7123 { 7138 handlerRemoveInventoryItem = OnRemoveInventoryItem;
7124 handlerRemoveInventoryItem(this, datablock.ItemID); 7139 if (handlerRemoveInventoryItem != null)
7125 } 7140 {
7141 handlerRemoveInventoryItem(this, uuids);
7126 } 7142 }
7127 } 7143 }
7128 break; 7144 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/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 5e7cf4b..4495303 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -56,7 +56,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
56 if (cnf != null && cnf.GetString( 56 if (cnf != null && cnf.GetString(
57 "MessageTransferModule", "MessageTransferModule") != 57 "MessageTransferModule", "MessageTransferModule") !=
58 "MessageTransferModule") 58 "MessageTransferModule")
59 {
60 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration");
59 return; 61 return;
62 }
60 63
61 cnf = config.Configs["Startup"]; 64 cnf = config.Configs["Startup"];
62 if (cnf != null) 65 if (cnf != null)
@@ -72,6 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
72 "grid_instant_message", processXMLRPCGridInstantMessage); 75 "grid_instant_message", processXMLRPCGridInstantMessage);
73 } 76 }
74 77
78 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
75 scene.RegisterModuleInterface<IMessageTransferModule>(this); 79 scene.RegisterModuleInterface<IMessageTransferModule>(this);
76 m_Scenes.Add(scene); 80 m_Scenes.Add(scene);
77 } 81 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 5315c11..75976e2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -67,13 +67,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
67 67
68 if (!m_Scenelist.Contains(scene)) 68 if (!m_Scenelist.Contains(scene))
69 { 69 {
70 if (m_Scenelist.Count == 0)
71 {
72 m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
73 if (m_TransferModule == null)
74 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
75 }
76
77 m_Scenelist.Add(scene); 70 m_Scenelist.Add(scene);
78 71
79 scene.RegisterModuleInterface<IInventoryTransferModule>(this); 72 scene.RegisterModuleInterface<IInventoryTransferModule>(this);
@@ -86,6 +79,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
86 79
87 public void PostInitialise() 80 public void PostInitialise()
88 { 81 {
82 if (m_Scenelist.Count > 0)
83 {
84 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
85 if (m_TransferModule == null)
86 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
87 }
89 } 88 }
90 89
91 public void Close() 90 public void Close()
@@ -257,8 +256,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
257 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); 256 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
258 257
259 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip 258 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
260 259
261 InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID)); 260 InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId);
261 item = invService.GetItem(item);
262 InventoryFolderBase folder = null; 262 InventoryFolderBase folder = null;
263 263
264 if (item != null && trashFolder != null) 264 if (item != null && trashFolder != null)
@@ -266,12 +266,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
266 item.Folder = trashFolder.ID; 266 item.Folder = trashFolder.ID;
267 267
268 // Diva comment: can't we just update this item??? 268 // Diva comment: can't we just update this item???
269 invService.DeleteItem(item); 269 List<UUID> uuids = new List<UUID>();
270 uuids.Add(item.ID);
271 invService.DeleteItems(item.Owner, uuids);
270 scene.AddInventoryItem(client, item); 272 scene.AddInventoryItem(client, item);
271 } 273 }
272 else 274 else
273 { 275 {
274 folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID)); 276 folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
277 folder = invService.GetFolder(folder);
275 278
276 if (folder != null & trashFolder != null) 279 if (folder != null & trashFolder != null)
277 { 280 {
@@ -451,10 +454,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
451 else 454 else
452 { 455 {
453 UUID itemID = new UUID(msg.binaryBucket, 1); 456 UUID itemID = new UUID(msg.binaryBucket, 1);
454 InventoryItemBase item = new InventoryItemBase(); 457 InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId);
455
456 item.ID = itemID;
457 item.Owner = user.ControllingClient.AgentId;
458 458
459 // Fetch from service 459 // Fetch from service
460 // 460 //
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
new file mode 100644
index 0000000..cd2fe4f
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.CoreModules.Avatar.NPC
32{
33 public interface INPCModule
34 {
35 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
36 void Autopilot(UUID agentID, Scene scene, Vector3 pos);
37 void Say(UUID agentID, Scene scene, string text);
38 void DeleteNPC(UUID agentID, Scene scene);
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 2640f08..e577fbe 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -443,7 +443,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
443 endPoint.X = (int) x; 443 endPoint.X = (int) x;
444 endPoint.Y = (int) y; 444 endPoint.Y = (int) y;
445 Image image = ImageHttpRequest(nextLine); 445 Image image = ImageHttpRequest(nextLine);
446 graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y); 446 if (image != null)
447 {
448 graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y);
449 }
450 else
451 {
452 graph.DrawString("URL couldn't be resolved or is", new Font("Arial",6), myBrush, startPoint);
453 graph.DrawString("not an image. Please check URL.", new Font("Arial", 6), myBrush, new Point(startPoint.X, 12 + startPoint.Y));
454 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
455 }
447 startPoint.X += endPoint.X; 456 startPoint.X += endPoint.X;
448 startPoint.Y += endPoint.Y; 457 startPoint.Y += endPoint.Y;
449 } 458 }
@@ -469,13 +478,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
469 startPoint.X += endPoint.X; 478 startPoint.X += endPoint.X;
470 startPoint.Y += endPoint.Y; 479 startPoint.Y += endPoint.Y;
471 } 480 }
481 else if (nextLine.StartsWith("FillPolygon"))
482 {
483 PointF[] points = null;
484 GetParams(partsDelimiter, ref nextLine, 11, ref points);
485 graph.FillPolygon(myBrush, points);
486 }
472 else if (nextLine.StartsWith("Ellipse")) 487 else if (nextLine.StartsWith("Ellipse"))
473 { 488 {
474 float x = 0; 489 float x = 0;
475 float y = 0; 490 float y = 0;
476 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); 491 GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y);
477 endPoint.X = (int) x; 492 endPoint.X = (int)x;
478 endPoint.Y = (int) y; 493 endPoint.Y = (int)y;
479 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 494 graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
480 startPoint.X += endPoint.X; 495 startPoint.X += endPoint.X;
481 startPoint.Y += endPoint.Y; 496 startPoint.Y += endPoint.Y;
@@ -492,30 +507,31 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
492 nextLine = nextLine.Remove(0, 8); 507 nextLine = nextLine.Remove(0, 8);
493 nextLine = nextLine.Trim(); 508 nextLine = nextLine.Trim();
494 509
495 string [] fprops = nextLine.Split(partsDelimiter); 510 string[] fprops = nextLine.Split(partsDelimiter);
496 foreach (string prop in fprops) { 511 foreach (string prop in fprops)
497 512 {
513
498 switch (prop) 514 switch (prop)
499 { 515 {
500 case "B": 516 case "B":
501 if (!(myFont.Bold)) 517 if (!(myFont.Bold))
502 myFont = new Font(myFont, myFont.Style | FontStyle.Bold); 518 myFont = new Font(myFont, myFont.Style | FontStyle.Bold);
503 break; 519 break;
504 case "I": 520 case "I":
505 if (!(myFont.Italic)) 521 if (!(myFont.Italic))
506 myFont = new Font(myFont, myFont.Style | FontStyle.Italic); 522 myFont = new Font(myFont, myFont.Style | FontStyle.Italic);
507 break; 523 break;
508 case "U": 524 case "U":
509 if (!(myFont.Underline)) 525 if (!(myFont.Underline))
510 myFont = new Font(myFont, myFont.Style | FontStyle.Underline); 526 myFont = new Font(myFont, myFont.Style | FontStyle.Underline);
511 break; 527 break;
512 case "S": 528 case "S":
513 if (!(myFont.Strikeout)) 529 if (!(myFont.Strikeout))
514 myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); 530 myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout);
515 break; 531 break;
516 case "R": 532 case "R":
517 myFont = new Font(myFont, FontStyle.Regular); 533 myFont = new Font(myFont, FontStyle.Regular);
518 break; 534 break;
519 } 535 }
520 } 536 }
521 } 537 }
@@ -532,6 +548,57 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
532 float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); 548 float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture);
533 drawPen.Width = size; 549 drawPen.Width = size;
534 } 550 }
551 else if (nextLine.StartsWith("PenCap"))
552 {
553 bool start = true, end = true;
554 nextLine = nextLine.Remove(0, 6);
555 nextLine = nextLine.Trim();
556 string[] cap = nextLine.Split(partsDelimiter);
557 if (cap[0].ToLower() == "start")
558 end = false;
559 else if (cap[0].ToLower() == "end")
560 start = false;
561 else if (cap[0].ToLower() != "both")
562 return;
563 string type = cap[1].ToLower();
564
565 if (end)
566 {
567 switch (type)
568 {
569 case "arrow":
570 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
571 break;
572 case "round":
573 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
574 break;
575 case "diamond":
576 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
577 break;
578 case "flat":
579 drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
580 break;
581 }
582 }
583 if (start)
584 {
585 switch (type)
586 {
587 case "arrow":
588 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
589 break;
590 case "round":
591 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
592 break;
593 case "diamond":
594 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;
595 break;
596 case "flat":
597 drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat;
598 break;
599 }
600 }
601 }
535 else if (nextLine.StartsWith("PenColour")) 602 else if (nextLine.StartsWith("PenColour"))
536 { 603 {
537 nextLine = nextLine.Remove(0, 9); 604 nextLine = nextLine.Remove(0, 9);
@@ -542,7 +609,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
542 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 609 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
543 { 610 {
544 newColour = Color.FromArgb(hex); 611 newColour = Color.FromArgb(hex);
545 } 612 }
546 else 613 else
547 { 614 {
548 // this doesn't fail, it just returns black if nothing is found 615 // this doesn't fail, it just returns black if nothing is found
@@ -582,18 +649,40 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
582 } 649 }
583 } 650 }
584 651
652 private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref PointF[] points)
653 {
654 line = line.Remove(0, startLength);
655 string[] parts = line.Split(partsDelimiter);
656 if (parts.Length > 1 && parts.Length % 2 == 0)
657 {
658 points = new PointF[parts.Length / 2];
659 for (int i = 0; i < parts.Length; i = i + 2)
660 {
661 string xVal = parts[i].Trim();
662 string yVal = parts[i+1].Trim();
663 float x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture);
664 float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture);
665 PointF point = new PointF(x, y);
666 points[i / 2] = point;
667 }
668 }
669 }
670
585 private Bitmap ImageHttpRequest(string url) 671 private Bitmap ImageHttpRequest(string url)
586 { 672 {
673 try
674 {
587 WebRequest request = HttpWebRequest.Create(url); 675 WebRequest request = HttpWebRequest.Create(url);
588//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. 676//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
589//Ckrinke Stream str = null; 677//Ckrinke Stream str = null;
590 HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); 678 HttpWebResponse response = (HttpWebResponse)(request).GetResponse();
591 if (response.StatusCode == HttpStatusCode.OK) 679 if (response.StatusCode == HttpStatusCode.OK)
592 { 680 {
593 Bitmap image = new Bitmap(response.GetResponseStream()); 681 Bitmap image = new Bitmap(response.GetResponseStream());
594 return image; 682 return image;
683 }
595 } 684 }
596 685 catch { }
597 return null; 686 return null;
598 } 687 }
599 } 688 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index ef5ffe1..bd32f3b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -139,6 +139,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
139 public abstract bool MoveFolder(InventoryFolderBase folder); 139 public abstract bool MoveFolder(InventoryFolderBase folder);
140 140
141 /// <summary> 141 /// <summary>
142 /// Delete a list of inventory folders (from trash)
143 /// </summary>
144 public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs);
145
146 /// <summary>
142 /// Purge an inventory folder of all its items and subfolders. 147 /// Purge an inventory folder of all its items and subfolders.
143 /// </summary> 148 /// </summary>
144 /// <param name="folder"></param> 149 /// <param name="folder"></param>
@@ -181,12 +186,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
181 /// <returns>true if the item was successfully updated</returns> 186 /// <returns>true if the item was successfully updated</returns>
182 public abstract bool UpdateItem(InventoryItemBase item); 187 public abstract bool UpdateItem(InventoryItemBase item);
183 188
189 public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
190
184 /// <summary> 191 /// <summary>
185 /// Delete an item from the user's inventory 192 /// Delete an item from the user's inventory
186 /// </summary> 193 /// </summary>
187 /// <param name="item"></param> 194 /// <param name="item"></param>
188 /// <returns>true if the item was successfully deleted</returns> 195 /// <returns>true if the item was successfully deleted</returns>
189 public abstract bool DeleteItem(InventoryItemBase item); 196 public abstract bool DeleteItems(UUID ownerID, List<UUID> itemIDs);
190 197
191 public abstract InventoryItemBase GetItem(InventoryItemBase item); 198 public abstract InventoryItemBase GetItem(InventoryItemBase item);
192 199
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index dd451ef..1c66254 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)
@@ -323,6 +330,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
323 } 330 }
324 } 331 }
325 332
333 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
334 {
335 if (folderIDs == null)
336 return false;
337 if (folderIDs.Count == 0)
338 return false;
339
340 if (IsLocalGridUser(ownerID))
341 return m_GridService.DeleteFolders(ownerID, folderIDs);
342 else
343 {
344 UUID sessionID = GetSessionID(ownerID);
345 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
346 return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
347 }
348 }
349
326 public override bool MoveFolder(InventoryFolderBase folder) 350 public override bool MoveFolder(InventoryFolderBase folder)
327 { 351 {
328 if (folder == null) 352 if (folder == null)
@@ -386,18 +410,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
386 } 410 }
387 } 411 }
388 412
389 public override bool DeleteItem(InventoryItemBase item) 413 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
390 { 414 {
391 if (item == null) 415 if (items == null)
392 return false; 416 return false;
417 if (items.Count == 0)
418 return true;
393 419
394 if (IsLocalGridUser(item.Owner)) 420 if (IsLocalGridUser(ownerID))
395 return m_GridService.DeleteItem(item); 421 return m_GridService.MoveItems(ownerID, items);
396 else 422 else
397 { 423 {
398 UUID sessionID = GetSessionID(item.Owner); 424 UUID sessionID = GetSessionID(ownerID);
399 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 425 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
400 return m_HGService.DeleteItem(uri, item, sessionID); 426 return m_HGService.MoveItems(uri, items, sessionID);
427 }
428 }
429
430 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
431 {
432 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
433
434 if (itemIDs == null)
435 return false;
436 if (itemIDs.Count == 0)
437 return true;
438
439 if (IsLocalGridUser(ownerID))
440 return m_GridService.DeleteItems(ownerID, itemIDs);
441 else
442 {
443 UUID sessionID = GetSessionID(ownerID);
444 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
445 return m_HGService.DeleteItems(uri, itemIDs, sessionID);
401 } 446 }
402 } 447 }
403 448
@@ -483,12 +528,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
483 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 528 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
484 string uri = m_LocalGridInventoryURI.TrimEnd('/'); 529 string uri = m_LocalGridInventoryURI.TrimEnd('/');
485 530
486 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri);
487
488 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 531 if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
489 { 532 {
490 return true; 533 return true;
491 } 534 }
535 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
492 return false; 536 return false;
493 } 537 }
494 538
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 2fbc5fe..66d11dd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
191 191
192 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) 192 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
193 { 193 {
194 InventoryFolderBase root = GetRootFolder(userID); 194 InventoryFolderBase root = m_InventoryService.GetRootFolder(userID);
195 if (root != null) 195 if (root != null)
196 { 196 {
197 InventoryCollection content = GetFolderContent(userID, root.ID); 197 InventoryCollection content = GetFolderContent(userID, root.ID);
@@ -202,13 +202,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
202 { 202 {
203 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) 203 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
204 { 204 {
205 m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type); 205 //m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type);
206 folders[(AssetType)folder.Type] = folder; 206 folders[(AssetType)folder.Type] = folder;
207 } 207 }
208 } 208 }
209 // Put the root folder there, as type Folder 209 // Put the root folder there, as type Folder
210 folders[AssetType.Folder] = root; 210 folders[AssetType.Folder] = root;
211 m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type); 211 //m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type);
212 212
213 return folders; 213 return folders;
214 } 214 }
@@ -258,6 +258,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
258 return m_InventoryService.MoveFolder(folder); 258 return m_InventoryService.MoveFolder(folder);
259 } 259 }
260 260
261 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
262 {
263 return m_InventoryService.DeleteFolders(ownerID, folderIDs);
264 }
265
261 /// <summary> 266 /// <summary>
262 /// Purge an inventory folder of all its items and subfolders. 267 /// Purge an inventory folder of all its items and subfolders.
263 /// </summary> 268 /// </summary>
@@ -289,14 +294,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
289 return m_InventoryService.UpdateItem(item); 294 return m_InventoryService.UpdateItem(item);
290 } 295 }
291 296
297
298 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
299 {
300 return m_InventoryService.MoveItems(ownerID, items);
301 }
302
292 /// <summary> 303 /// <summary>
293 /// Delete an item from the user's inventory 304 /// Delete an item from the user's inventory
294 /// </summary> 305 /// </summary>
295 /// <param name="item"></param> 306 /// <param name="item"></param>
296 /// <returns>true if the item was successfully deleted</returns> 307 /// <returns>true if the item was successfully deleted</returns>
297 public override bool DeleteItem(InventoryItemBase item) 308 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
298 { 309 {
299 return m_InventoryService.DeleteItem(item); 310 return m_InventoryService.DeleteItems(ownerID, itemIDs);
300 } 311 }
301 312
302 public override InventoryItemBase GetItem(InventoryItemBase item) 313 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..0d32c77 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)
@@ -242,6 +243,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
242 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); 243 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
243 } 244 }
244 245
246 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
247 {
248 if (folderIDs == null)
249 return false;
250 if (folderIDs.Count == 0)
251 return false;
252
253 UUID sessionID = GetSessionID(ownerID);
254 return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID);
255 }
256
257
245 public override bool PurgeFolder(InventoryFolderBase folder) 258 public override bool PurgeFolder(InventoryFolderBase folder)
246 { 259 {
247 if (folder == null) 260 if (folder == null)
@@ -272,13 +285,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
272 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); 285 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
273 } 286 }
274 287
275 public override bool DeleteItem(InventoryItemBase item) 288 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
276 { 289 {
277 if (item == null) 290 if (items == null)
278 return false; 291 return false;
279 292
280 UUID sessionID = GetSessionID(item.Owner); 293 UUID sessionID = GetSessionID(ownerID);
281 return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); 294 return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID);
295 }
296
297
298 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
299 {
300 if (itemIDs == null)
301 return false;
302 if (itemIDs.Count == 0)
303 return true;
304
305 UUID sessionID = GetSessionID(ownerID);
306 return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID);
282 } 307 }
283 308
284 public override InventoryItemBase GetItem(InventoryItemBase item) 309 public override InventoryItemBase GetItem(InventoryItemBase item)
@@ -320,14 +345,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
320 345
321 private UUID GetSessionID(UUID userID) 346 private UUID GetSessionID(UUID userID)
322 { 347 {
323 if (m_Scene == null) 348 //if (m_Scene == null)
324 { 349 //{
325 m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); 350 // m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
326 } 351 //}
327 352
328 if (m_UserProfileService == null) 353 if (m_UserProfileService == null)
329 { 354 {
330 m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); 355 //m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
331 return UUID.Zero; 356 return UUID.Zero;
332 } 357 }
333 358
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..3301536 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 {
@@ -178,8 +179,8 @@ namespace OpenSim.Region.Framework.Scenes
178 else 179 else
179 { 180 {
180 m_log.ErrorFormat( 181 m_log.ErrorFormat(
181 "[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update", 182 "[AGENT INVENTORY]: Could not find item {0} for caps inventory update",
182 remoteClient.AgentId); 183 itemID);
183 } 184 }
184 185
185 return UUID.Zero; 186 return UUID.Zero;
@@ -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
641 if (item != null)
642 {
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 645
658 return; 646 if (!InventoryService.MoveItems(remoteClient.AgentId, items))
659 } 647 m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + remoteClient.AgentId);
660 } 648 }
661 649
662 /// <summary> 650 /// <summary>
@@ -794,29 +782,22 @@ 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>
803 /// Removes an inventory folder. Although there is a packet in the Linden protocol for this, it may be 792 /// Removes an inventory folder. This packet is sent when the user
804 /// legacy and not currently used (purge folder is used to remove folders from trash instead). 793 /// right-clicks a folder that's already in trash and chooses "purge"
805 /// </summary> 794 /// </summary>
806 /// <param name="remoteClient"></param> 795 /// <param name="remoteClient"></param>
807 /// <param name="folderID"></param> 796 /// <param name="folderID"></param>
808 private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) 797 private void RemoveInventoryFolder(IClientAPI remoteClient, List<UUID> folderIDs)
809 { 798 {
810 // Unclear is this handler is ever called by the Linden client, but it might 799 m_log.DebugFormat("[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count);
811 800 InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
812 InventoryFolderBase folder = new InventoryFolderBase(folderID);
813 folder.Owner = remoteClient.AgentId;
814 InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
815 if (trash != null)
816 {
817 folder.ParentID = trash.ID;
818 InventoryService.MoveFolder(folder);
819 }
820 } 801 }
821 802
822 private SceneObjectGroup GetGroupByPrim(uint localID) 803 private SceneObjectGroup GetGroupByPrim(uint localID)
@@ -1224,7 +1205,8 @@ namespace OpenSim.Region.Framework.Scenes
1224 UUID copyID = UUID.Random(); 1205 UUID copyID = UUID.Random();
1225 if (itemID != UUID.Zero) 1206 if (itemID != UUID.Zero)
1226 { 1207 {
1227 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1208 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1209 item = InventoryService.GetItem(item);
1228 1210
1229 // Try library 1211 // Try library
1230 if (null == item) 1212 if (null == item)
@@ -1242,7 +1224,11 @@ namespace OpenSim.Region.Framework.Scenes
1242 if (!Permissions.BypassPermissions()) 1224 if (!Permissions.BypassPermissions())
1243 { 1225 {
1244 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1226 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1245 RemoveInventoryItem(remoteClient, itemID); 1227 {
1228 List<UUID> uuids = new List<UUID>();
1229 uuids.Add(itemID);
1230 RemoveInventoryItem(remoteClient, uuids);
1231 }
1246 } 1232 }
1247 } 1233 }
1248 else 1234 else
@@ -1287,7 +1273,8 @@ namespace OpenSim.Region.Framework.Scenes
1287 1273
1288 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory 1274 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
1289 { 1275 {
1290 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1276 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1277 item = InventoryService.GetItem(item);
1291 1278
1292 // Try library 1279 // Try library
1293 // XXX clumsy, possibly should be one call 1280 // XXX clumsy, possibly should be one call
@@ -1672,7 +1659,7 @@ namespace OpenSim.Region.Framework.Scenes
1672 1659
1673 if (DeRezAction.SaveToExistingUserInventoryItem == action) 1660 if (DeRezAction.SaveToExistingUserInventoryItem == action)
1674 { 1661 {
1675 item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID); 1662 item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID);
1676 item = InventoryService.GetItem(item); 1663 item = InventoryService.GetItem(item);
1677 1664
1678 //item = userInfo.RootFolder.FindItem( 1665 //item = userInfo.RootFolder.FindItem(
@@ -1834,7 +1821,8 @@ namespace OpenSim.Region.Framework.Scenes
1834 1821
1835 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); 1822 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
1836 1823
1837 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1824 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1825 item = InventoryService.GetItem(item);
1838 1826
1839 if (item != null) 1827 if (item != null)
1840 { 1828 {
@@ -1984,7 +1972,8 @@ namespace OpenSim.Region.Framework.Scenes
1984 BypassRayCast, bRayEndIsIntersection,true,scale, false); 1972 BypassRayCast, bRayEndIsIntersection,true,scale, false);
1985 1973
1986 // Rez object 1974 // Rez object
1987 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1975 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1976 item = InventoryService.GetItem(item);
1988 1977
1989 if (item != null) 1978 if (item != null)
1990 { 1979 {
@@ -2135,7 +2124,11 @@ namespace OpenSim.Region.Framework.Scenes
2135 // copy ones will be lost, so avoid it 2124 // copy ones will be lost, so avoid it
2136 // 2125 //
2137 if (!attachment) 2126 if (!attachment)
2138 InventoryService.DeleteItem(item); 2127 {
2128 List<UUID> uuids = new List<UUID>();
2129 uuids.Add(item.ID);
2130 InventoryService.DeleteItems(item.Owner, uuids);
2131 }
2139 } 2132 }
2140 } 2133 }
2141 2134
@@ -2309,7 +2302,8 @@ namespace OpenSim.Region.Framework.Scenes
2309 ScenePresence presence; 2302 ScenePresence presence;
2310 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2303 if (TryGetAvatar(remoteClient.AgentId, out presence))
2311 { 2304 {
2312 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID, remoteClient.AgentId)); 2305 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2306 item = InventoryService.GetItem(item);
2313 2307
2314 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2308 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2315 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2309 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
@@ -2360,7 +2354,8 @@ namespace OpenSim.Region.Framework.Scenes
2360 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2354 if (TryGetAvatar(remoteClient.AgentId, out presence))
2361 { 2355 {
2362 // XXYY!! 2356 // XXYY!!
2363 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 2357 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2358 item = InventoryService.GetItem(item);
2364 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2359 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2365 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2360 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
2366 if (ava != null) 2361 if (ava != null)
@@ -2393,7 +2388,9 @@ namespace OpenSim.Region.Framework.Scenes
2393 } 2388 }
2394 part.ParentGroup.DetachToGround(); 2389 part.ParentGroup.DetachToGround();
2395 2390
2396 InventoryService.DeleteItem(new InventoryItemBase(inventoryID)); 2391 List<UUID> uuids = new List<UUID>();
2392 uuids.Add(inventoryID);
2393 InventoryService.DeleteItems(remoteClient.AgentId, uuids);
2397 remoteClient.SendRemoveInventoryItem(inventoryID); 2394 remoteClient.SendRemoveInventoryItem(inventoryID);
2398 } 2395 }
2399 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); 2396 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 2bf4ea8..d3e414f 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 {
@@ -439,9 +441,24 @@ namespace OpenSim.Region.Framework.Scenes
439 return; 441 return;
440 } 442 }
441 443
444 // We're going to send the reply async, because there may be
445 // an enormous quantity of packets -- basically the entire inventory!
446 // We don't want to block the client thread while all that is happening.
447 SendInventoryDelegate d = SendInventoryAsync;
448 d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d);
449 }
450
451 delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
452
453 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
454 {
442 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); 455 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
443 } 456 }
444 457
458 void SendInventoryComplete(IAsyncResult iar)
459 {
460 }
461
445 /// <summary> 462 /// <summary>
446 /// Handle the caps inventory descendents fetch. 463 /// Handle the caps inventory descendents fetch.
447 /// 464 ///
@@ -517,27 +534,25 @@ namespace OpenSim.Region.Framework.Scenes
517// m_log.DebugFormat( 534// m_log.DebugFormat(
518// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); 535// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
519 536
520 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 537 InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
521 538 folder = InventoryService.GetFolder(folder);
522 if (null == userProfile) 539 if (folder != null)
523 {
524 m_log.ErrorFormat(
525 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
526 remoteClient.Name, remoteClient.AgentId);
527 return;
528 }
529
530 if (!userProfile.UpdateFolder(name, folderID, type, parentID))
531 { 540 {
532 m_log.ErrorFormat( 541 folder.Name = name;
533 "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", 542 folder.Type = (short)type;
534 remoteClient.Name, remoteClient.AgentId); 543 folder.ParentID = parentID;
544 if (!InventoryService.UpdateFolder(folder))
545 {
546 m_log.ErrorFormat(
547 "[AGENT INVENTORY]: Failed to update folder for user {0} {1}",
548 remoteClient.Name, remoteClient.AgentId);
549 }
535 } 550 }
536 } 551 }
537 552
538 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) 553 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
539 { 554 {
540 InventoryFolderBase folder = new InventoryFolderBase(folderID); 555 InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
541 folder = InventoryService.GetFolder(folder); 556 folder = InventoryService.GetFolder(folder);
542 if (folder != null) 557 if (folder != null)
543 { 558 {
@@ -559,15 +574,34 @@ namespace OpenSim.Region.Framework.Scenes
559 /// <param name="remoteClient"></param> 574 /// <param name="remoteClient"></param>
560 /// <param name="folderID"></param> 575 /// <param name="folderID"></param>
561 576
577 delegate void PurgeFolderDelegate(UUID userID, UUID folder);
578
562 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) 579 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
563 { 580 {
564 InventoryFolderBase folder = new InventoryFolderBase(folderID); 581 PurgeFolderDelegate d = PurgeFolderAsync;
582 try
583 {
584 d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d);
585 }
586 catch (Exception e)
587 {
588 m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
589 }
590 }
591
592
593 private void PurgeFolderAsync(UUID userID, UUID folderID)
594 {
595 InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);
565 596
566 if (InventoryService.PurgeFolder(folder)) 597 if (InventoryService.PurgeFolder(folder))
567 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); 598 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
568 else 599 else
569 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); 600 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
570 } 601 }
571 602
603 private void PurgeFolderCompleted(IAsyncResult iar)
604 {
605 }
572 } 606 }
573} 607}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d1f7a4b..6118a70 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2044,9 +2044,14 @@ namespace OpenSim.Region.Framework.Scenes
2044 { 2044 {
2045 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2045 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2046 2046
2047 m_log.DebugFormat( 2047 m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2048 "[SCENE]: Adding new {0} agent for {1} in {2}", 2048 /*
2049 ((aCircuit.child == true) ? "child" : "root"), client.Name, RegionInfo.RegionName); 2049 string logMsg = string.Format("[SCENE]: Adding new {0} agent for {1} in {2}",
2050 ((aCircuit.child == true) ? "child" : "root"), client.Name,
2051 RegionInfo.RegionName);
2052
2053 m_log.Debug(logMsg);
2054 */
2050 2055
2051 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2056 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2052 2057
@@ -2055,7 +2060,7 @@ namespace OpenSim.Region.Framework.Scenes
2055 // HERE!!! Do the initial attachments right here 2060 // HERE!!! Do the initial attachments right here
2056 // first agent upon login is a root agent by design. 2061 // first agent upon login is a root agent by design.
2057 // All other AddNewClient calls find aCircuit.child to be true 2062 // All other AddNewClient calls find aCircuit.child to be true
2058 if (aCircuit.child == false) 2063 if (aCircuit == null || aCircuit.child == false)
2059 { 2064 {
2060 sp.IsChildAgent = false; 2065 sp.IsChildAgent = false;
2061 sp.RezAttachments(); 2066 sp.RezAttachments();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index ce6f3d6..3ee6007 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -225,7 +225,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
225 Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered"); 225 Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered");
226 } 226 }
227 227
228 [Test] 228 // I'm commenting this test because it does not represent
229 // crossings. The Thread.Sleep's in here are not meaningful mocks,
230 // and they sometimes fail in panda.
231 // We need to talk in order to develop a test
232 // that really tests region crossings. There are 3 async components,
233 // but things are synchronous among them. So there should be
234 // 3 threads in here.
235 //[Test]
229 public void T021_TestCrossToNewRegion() 236 public void T021_TestCrossToNewRegion()
230 { 237 {
231 TestHelper.InMethod(); 238 TestHelper.InMethod();
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
index b61959f..3c5e8c9 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
213 m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); 213 m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword);
214 string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' }); 214 string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' });
215 cs.ExcludeList = new List<string>(excludes.Length); 215 cs.ExcludeList = new List<string>(excludes.Length);
216 foreach(string name in excludes) 216 foreach (string name in excludes)
217 { 217 {
218 cs.ExcludeList.Add(name.Trim().ToLower()); 218 cs.ExcludeList.Add(name.Trim().ToLower());
219 } 219 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 8c9717c..b3bfe07 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -25,26 +25,158 @@
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.Collections.Generic;
29using System.Threading;
28using OpenMetaverse; 30using OpenMetaverse;
29using Nini.Config; 31using Nini.Config;
30using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.CoreModules.Avatar.NPC;
35using OpenSim.Framework;
36using Timer=System.Timers.Timer;
32 37
33namespace OpenSim.Region.OptionalModules.World.NPC 38namespace OpenSim.Region.OptionalModules.World.NPC
34{ 39{
35 public class NPCModule : IRegionModule 40 public class NPCModule : IRegionModule, INPCModule
36 { 41 {
37 // private const bool m_enabled = false; 42 // private const bool m_enabled = false;
38 43
44 private Mutex m_createMutex = new Mutex(false);
45
46 private Timer m_timer = new Timer(500);
47
48 private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
49
50 private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
51
52 // Timer vars.
53 private bool p_inUse = false;
54 private readonly object p_lock = new object();
55 // Private Temporary Variables.
56 private string p_firstname;
57 private string p_lastname;
58 private Vector3 p_position;
59 private Scene p_scene;
60 private UUID p_cloneAppearanceFrom;
61 private UUID p_returnUuid;
62
63 private AvatarAppearance GetAppearance(UUID target, Scene scene)
64 {
65 if (m_appearanceCache.ContainsKey(target))
66 return m_appearanceCache[target];
67
68 AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(target);
69
70 m_appearanceCache.Add(target, x);
71
72 return x;
73 }
74
75 public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom)
76 {
77 // Block.
78 m_createMutex.WaitOne();
79
80 // Copy Temp Variables for Timer to pick up.
81 lock (p_lock)
82 {
83 p_firstname = firstname;
84 p_lastname = lastname;
85 p_position = position;
86 p_scene = scene;
87 p_cloneAppearanceFrom = cloneAppearanceFrom;
88 p_inUse = true;
89 p_returnUuid = UUID.Zero;
90 }
91
92 while (p_returnUuid == UUID.Zero)
93 {
94 Thread.Sleep(250);
95 }
96
97 m_createMutex.ReleaseMutex();
98
99 return p_returnUuid;
100 }
101
102 public void Autopilot(UUID agentID, Scene scene, Vector3 pos)
103 {
104 lock (m_avatars)
105 {
106 if (m_avatars.ContainsKey(agentID))
107 {
108 ScenePresence sp;
109 scene.TryGetAvatar(agentID, out sp);
110 sp.DoAutoPilot(0, pos, m_avatars[agentID]);
111 }
112 }
113 }
114
115 public void Say(UUID agentID, Scene scene, string text)
116 {
117 lock (m_avatars)
118 {
119 if (m_avatars.ContainsKey(agentID))
120 {
121 m_avatars[agentID].Say(text);
122 }
123 }
124 }
125
126 public void DeleteNPC(UUID agentID, Scene scene)
127 {
128 lock (m_avatars)
129 {
130 if (m_avatars.ContainsKey(agentID))
131 {
132 scene.RemoveClient(agentID);
133 m_avatars.Remove(agentID);
134 }
135 }
136 }
137
138
39 public void Initialise(Scene scene, IConfigSource source) 139 public void Initialise(Scene scene, IConfigSource source)
40 { 140 {
41 // if (m_enabled) 141 scene.RegisterModuleInterface<INPCModule>(this);
42 // { 142
43 // NPCAvatar testAvatar = new NPCAvatar("Jack", "NPC", new Vector3(128, 128, 40), scene); 143 m_timer.Elapsed += m_timer_Elapsed;
44 // NPCAvatar testAvatar2 = new NPCAvatar("Jill", "NPC", new Vector3(136, 128, 40), scene); 144 m_timer.Start();
45 // scene.AddNewClient(testAvatar); 145 }
46 // scene.AddNewClient(testAvatar2); 146
47 // } 147 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
148 {
149 lock (p_lock)
150 {
151 if (p_inUse)
152 {
153 p_inUse = false;
154
155 NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene);
156 npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue);
157
158 p_scene.ClientManager.Add(npcAvatar.CircuitCode, npcAvatar);
159 p_scene.AddNewClient(npcAvatar);
160
161 ScenePresence sp;
162 if (p_scene.TryGetAvatar(npcAvatar.AgentId, out sp))
163 {
164 AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene);
165
166 List<byte> wearbyte = new List<byte>();
167 for (int i = 0; i < x.VisualParams.Length; i++)
168 {
169 wearbyte.Add(x.VisualParams[i]);
170 }
171
172 sp.SetAppearance(x.Texture.GetBytes(), wearbyte);
173 }
174
175 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
176
177 p_returnUuid = npcAvatar.AgentId;
178 }
179 }
48 } 180 }
49 181
50 public void PostInitialise() 182 public void PostInitialise()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2dbbf70..16dd834 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,6 +1978,32 @@ 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 {
1991 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1992 q = avatar.CameraRotation; // Mouselook
1993 else
1994 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1995 }
1996 else
1997 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1998 }
1999 else
2000 q = part.ParentGroup.GroupRotation; // just the group rotation
2001 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2002 }
2003 q = part.GetWorldRotation();
2004 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2005 }
2006
1981 public LSL_Rotation llGetLocalRot() 2007 public LSL_Rotation llGetLocalRot()
1982 { 2008 {
1983 m_host.AddScriptLPS(1); 2009 m_host.AddScriptLPS(1);
@@ -7299,7 +7325,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7299 break; 7325 break;
7300 7326
7301 case (int)ScriptBaseClass.PRIM_ROTATION: 7327 case (int)ScriptBaseClass.PRIM_ROTATION:
7302 res.Add(llGetRot()); 7328 res.Add(GetPartRot(part));
7303 break; 7329 break;
7304 7330
7305 case (int)ScriptBaseClass.PRIM_TYPE: 7331 case (int)ScriptBaseClass.PRIM_TYPE:
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e3a3ab..b1c357c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -31,12 +31,14 @@ using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Net; 33using System.Net;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using Nini.Config; 36using Nini.Config;
36using OpenSim; 37using OpenSim;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Region.CoreModules.Avatar.NPC;
40using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Hypergrid; 44using OpenSim.Region.Framework.Scenes.Hypergrid;
@@ -831,6 +833,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
831 return drawList; 833 return drawList;
832 } 834 }
833 835
836 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
837 {
838 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon");
839
840 m_host.AddScriptLPS(1);
841
842 if (x.Length != y.Length || x.Length < 3)
843 {
844 return "";
845 }
846 drawList += "FillPolygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
847 for (int i = 1; i < x.Length; i++)
848 {
849 drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
850 }
851 drawList += "; ";
852 return drawList;
853 }
854
834 public string osSetFontSize(string drawList, int fontSize) 855 public string osSetFontSize(string drawList, int fontSize)
835 { 856 {
836 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 857 CheckThreatLevel(ThreatLevel.None, "osSetFontSize");
@@ -858,6 +879,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
858 return drawList; 879 return drawList;
859 } 880 }
860 881
882 public string osSetPenCap(string drawList, string direction, string type)
883 {
884 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
885
886 m_host.AddScriptLPS(1);
887 drawList += "PenCap " + direction + "," + type + "; ";
888 return drawList;
889 }
890
861 public string osDrawImage(string drawList, int width, int height, string imageUrl) 891 public string osDrawImage(string drawList, int width, int height, string imageUrl)
862 { 892 {
863 CheckThreatLevel(ThreatLevel.None, "osDrawImage"); 893 CheckThreatLevel(ThreatLevel.None, "osDrawImage");
@@ -1762,5 +1792,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1762 return retVal; 1792 return retVal;
1763 } 1793 }
1764 1794
1795 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
1796 {
1797 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
1798 //QueueUserWorkItem
1799
1800 INPCModule module = World.RequestModuleInterface<INPCModule>();
1801 if (module != null)
1802 {
1803 UUID x = module.CreateNPC(firstname,
1804 lastname,
1805 new Vector3((float) position.x, (float) position.y, (float) position.z),
1806 World,
1807 new UUID(cloneFrom));
1808
1809 return new LSL_Key(x.ToString());
1810 }
1811 return new LSL_Key(UUID.Zero.ToString());
1812 }
1813
1814 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
1815 {
1816 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
1817
1818 INPCModule module = World.RequestModuleInterface<INPCModule>();
1819 if (module != null)
1820 {
1821 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
1822 module.Autopilot(new UUID(npc.m_string), World, pos);
1823 }
1824 }
1825
1826 public void osNpcSay(LSL_Key npc, string message)
1827 {
1828 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
1829
1830 INPCModule module = World.RequestModuleInterface<INPCModule>();
1831 if (module != null)
1832 {
1833 module.Say(new UUID(npc.m_string), World, message);
1834 }
1835 }
1836
1837 public void osNpcRemove(LSL_Key npc)
1838 {
1839 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
1840
1841 INPCModule module = World.RequestModuleInterface<INPCModule>();
1842 if (module != null)
1843 {
1844 module.DeleteNPC(new UUID(npc.m_string), World);
1845 }
1846 }
1765 } 1847 }
1766} 1848}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0be29f2..2365bee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -97,9 +97,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
97 string osDrawEllipse(string drawList, int width, int height); 97 string osDrawEllipse(string drawList, int width, int height);
98 string osDrawRectangle(string drawList, int width, int height); 98 string osDrawRectangle(string drawList, int width, int height);
99 string osDrawFilledRectangle(string drawList, int width, int height); 99 string osDrawFilledRectangle(string drawList, int width, int height);
100 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y);
100 string osSetFontSize(string drawList, int fontSize); 101 string osSetFontSize(string drawList, int fontSize);
101 string osSetPenSize(string drawList, int penSize); 102 string osSetPenSize(string drawList, int penSize);
102 string osSetPenColour(string drawList, string colour); 103 string osSetPenColour(string drawList, string colour);
104 string osSetPenCap(string drawList, string direction, string type);
103 string osDrawImage(string drawList, int width, int height, string imageUrl); 105 string osDrawImage(string drawList, int width, int height, string imageUrl);
104 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); 106 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize);
105 void osSetStateEvents(int events); 107 void osSetStateEvents(int events);
@@ -149,5 +151,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
149 151
150 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 152 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
151 153
154
155 key osNpcCreate(string user, string name, vector position, key cloneFrom);
156 void osNpcMoveTo(key npc, vector position);
157 void osNpcSay(key npc, string message);
158 void osNpcRemove(key npc);
159
152 } 160 }
153} 161}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index abdba05..f877acb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -267,6 +267,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height); 267 return m_OSSL_Functions.osDrawFilledRectangle(drawList, width, height);
268 } 268 }
269 269
270 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
271 {
272 return m_OSSL_Functions.osDrawFilledPolygon(drawList, x, y);
273 }
274
270 public string osSetFontSize(string drawList, int fontSize) 275 public string osSetFontSize(string drawList, int fontSize)
271 { 276 {
272 return m_OSSL_Functions.osSetFontSize(drawList, fontSize); 277 return m_OSSL_Functions.osSetFontSize(drawList, fontSize);
@@ -277,6 +282,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
277 return m_OSSL_Functions.osSetPenSize(drawList, penSize); 282 return m_OSSL_Functions.osSetPenSize(drawList, penSize);
278 } 283 }
279 284
285 public string osSetPenCap(string drawList, string direction, string type)
286 {
287 return m_OSSL_Functions.osSetPenCap(drawList, direction, type);
288 }
289
280 public string osSetPenColour(string drawList, string colour) 290 public string osSetPenColour(string drawList, string colour)
281 { 291 {
282 return m_OSSL_Functions.osSetPenColour(drawList, colour); 292 return m_OSSL_Functions.osSetPenColour(drawList, colour);
@@ -393,6 +403,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
393 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); 403 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
394 } 404 }
395 405
406 public key osNpcCreate(string user, string name, vector position, key cloneFrom)
407 {
408 return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom);
409 }
410
411 public void osNpcMoveTo(key npc, vector position)
412 {
413 m_OSSL_Functions.osNpcMoveTo(npc, position);
414 }
415
416 public void osNpcSay(key npc, string message)
417 {
418 m_OSSL_Functions.osNpcSay(npc, message);
419 }
420
421 public void osNpcRemove(key npc)
422 {
423 m_OSSL_Functions.osNpcRemove(npc);
424 }
396 425
397 public OSSLPrim Prim; 426 public OSSLPrim Prim;
398 427
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index bdacf8b..2842f6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -439,6 +439,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
439 439
440 set {m_data = value; } 440 set {m_data = value; }
441 } 441 }
442 // Function to obtain LSL type from an index. This is needed
443 // because LSL lists allow for multiple types, and safely
444 // iterating in them requires a type check.
445 public Type GetLSLListItemType(int itemIndex)
446 {
447 return m_data[itemIndex].GetType();
448 }
442 449
443 // Member functions to obtain item as specific types. 450 // Member functions to obtain item as specific types.
444 // For cases where implicit conversions would apply if items 451 // For cases where implicit conversions would apply if items
@@ -465,6 +472,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
465 { 472 {
466 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]); 473 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]);
467 } 474 }
475 else if (m_data[itemIndex] is LSL_Types.LSLString)
476 {
477 return new LSL_Types.LSLFloat(m_data[itemIndex].ToString());
478 }
468 else 479 else
469 { 480 {
470 return (LSL_Types.LSLFloat)m_data[itemIndex]; 481 return (LSL_Types.LSLFloat)m_data[itemIndex];
@@ -481,20 +492,32 @@ namespace OpenSim.Region.ScriptEngine.Shared
481 { 492 {
482 return new LSL_Types.LSLString((string)m_data[itemIndex]); 493 return new LSL_Types.LSLString((string)m_data[itemIndex]);
483 } 494 }
495 else if (m_data[itemIndex] is LSL_Types.LSLFloat)
496 {
497 return new LSL_Types.LSLString((LSLFloat)m_data[itemIndex]);
498 }
499 else if (m_data[itemIndex] is LSL_Types.LSLInteger)
500 {
501 return new LSL_Types.LSLString((LSLInteger)m_data[itemIndex]);
502 }
484 else 503 else
485 { 504 {
486 return (LSL_Types.LSLString)m_data[itemIndex]; 505 return (LSL_Types.LSLString)m_data[itemIndex];
487 } 506 }
488 } 507 }
489 508
490 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) 509 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)
491 { 510 {
492 if (m_data[itemIndex] is LSL_Types.LSLInteger) 511 if (m_data[itemIndex] is LSL_Types.LSLInteger)
493 return (LSL_Types.LSLInteger)m_data[itemIndex]; 512 return (LSL_Types.LSLInteger)m_data[itemIndex];
494 else if (m_data[itemIndex] is Int32) 513 if (m_data[itemIndex] is LSL_Types.LSLFloat)
495 return new LSLInteger((int)m_data[itemIndex]); 514 return new LSLInteger((int)m_data[itemIndex]);
496 else 515 else if (m_data[itemIndex] is Int32)
497 throw new InvalidCastException(); 516 return new LSLInteger((int)m_data[itemIndex]);
517 else if (m_data[itemIndex] is LSL_Types.LSLString)
518 return new LSLInteger((string)m_data[itemIndex]);
519 else
520 throw new InvalidCastException();
498 } 521 }
499 522
500 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 523 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
@@ -1331,6 +1354,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
1331 m_string=s; 1354 m_string=s;
1332 } 1355 }
1333 1356
1357 public LSLString(LSLInteger i)
1358 {
1359 string s = String.Format("{0}", i);
1360 m_string = s;
1361 }
1362
1334 #endregion 1363 #endregion
1335 1364
1336 #region Operators 1365 #region Operators