diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 325 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 191 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 76 |
3 files changed, 330 insertions, 262 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs new file mode 100644 index 0000000..3e2a97a --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -0,0 +1,325 @@ | |||
1 | using System; | ||
2 | using System.IO; | ||
3 | using System.Collections.Generic; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | using OpenSim.Framework.Interfaces; | ||
7 | using OpenSim.Framework.Types; | ||
8 | using OpenSim.Framework.Communications.Caches; | ||
9 | using OpenSim.Framework.Data; | ||
10 | using OpenSim.Framework.Utilities; | ||
11 | |||
12 | namespace OpenSim.Region.Environment.Scenes | ||
13 | { | ||
14 | public partial class Scene | ||
15 | { | ||
16 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete | ||
17 | // or at least some of they can be moved somewhere else | ||
18 | |||
19 | public void AddInventoryItem(LLUUID userID, InventoryItemBase item) | ||
20 | { | ||
21 | if (this.Avatars.ContainsKey(userID)) | ||
22 | { | ||
23 | this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); | ||
24 | } | ||
25 | } | ||
26 | |||
27 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | ||
28 | { | ||
29 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
30 | if (userInfo != null) | ||
31 | { | ||
32 | userInfo.AddItem(remoteClient.AgentId, item); | ||
33 | remoteClient.SendInventoryItemUpdate(item); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) | ||
38 | { | ||
39 | if (this.Avatars.ContainsKey(userID)) | ||
40 | { | ||
41 | return this.CapsUpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); | ||
42 | } | ||
43 | return LLUUID.Zero; | ||
44 | } | ||
45 | |||
46 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | ||
47 | { | ||
48 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
49 | if (userInfo != null) | ||
50 | { | ||
51 | if (userInfo.RootFolder != null) | ||
52 | { | ||
53 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
54 | if (item != null) | ||
55 | { | ||
56 | AssetBase asset; | ||
57 | asset = new AssetBase(); | ||
58 | asset.FullID = LLUUID.Random(); | ||
59 | asset.Type = (sbyte)item.assetType; | ||
60 | asset.InvType = (sbyte)item.invType; | ||
61 | asset.Name = item.inventoryName; | ||
62 | asset.Data = data; | ||
63 | commsManager.AssetCache.AddAsset(asset); | ||
64 | |||
65 | item.assetID = asset.FullID; | ||
66 | userInfo.UpdateItem(remoteClient.AgentId, item); | ||
67 | |||
68 | // remoteClient.SendInventoryItemUpdate(item); | ||
69 | if (item.invType == 7) | ||
70 | { | ||
71 | //do we want to know about updated note cards? | ||
72 | } | ||
73 | else if (item.invType == 10) | ||
74 | { | ||
75 | // do we want to know about updated scripts | ||
76 | } | ||
77 | |||
78 | return (asset.FullID); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | return LLUUID.Zero; | ||
83 | } | ||
84 | |||
85 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID) | ||
86 | { | ||
87 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
88 | if (userInfo != null) | ||
89 | { | ||
90 | if (userInfo.RootFolder != null) | ||
91 | { | ||
92 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
93 | if (item != null) | ||
94 | { | ||
95 | AgentAssetTransactions transactions = commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); | ||
96 | if (transactions != null) | ||
97 | { | ||
98 | AssetBase asset = null; | ||
99 | bool addToCache = false; | ||
100 | |||
101 | asset = commsManager.AssetCache.GetAsset(assetID); | ||
102 | if (asset == null) | ||
103 | { | ||
104 | asset = transactions.GetTransactionAsset(transactionID); | ||
105 | addToCache = true; | ||
106 | } | ||
107 | |||
108 | if (asset != null) | ||
109 | { | ||
110 | if (asset.FullID == assetID) | ||
111 | { | ||
112 | asset.Name = item.inventoryName; | ||
113 | asset.Description = item.inventoryDescription; | ||
114 | asset.InvType = (sbyte) item.invType; | ||
115 | asset.Type = (sbyte) item.assetType; | ||
116 | item.assetID = asset.FullID; | ||
117 | |||
118 | if (addToCache) | ||
119 | { | ||
120 | commsManager.AssetCache.AddAsset(asset); | ||
121 | } | ||
122 | |||
123 | userInfo.UpdateItem(remoteClient.AgentId, item); | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
133 | /// temporary method to test out creating new inventory items | ||
134 | /// </summary> | ||
135 | /// <param name="remoteClient"></param> | ||
136 | /// <param name="transActionID"></param> | ||
137 | /// <param name="folderID"></param> | ||
138 | /// <param name="callbackID"></param> | ||
139 | /// <param name="description"></param> | ||
140 | /// <param name="name"></param> | ||
141 | /// <param name="invType"></param> | ||
142 | /// <param name="type"></param> | ||
143 | /// <param name="wearableType"></param> | ||
144 | /// <param name="nextOwnerMask"></param> | ||
145 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | ||
146 | { | ||
147 | if (transActionID == LLUUID.Zero) | ||
148 | { | ||
149 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
150 | if (userInfo != null) | ||
151 | { | ||
152 | AssetBase asset = new AssetBase(); | ||
153 | asset.Name = name; | ||
154 | asset.Description = description; | ||
155 | asset.InvType = invType; | ||
156 | asset.Type = type; | ||
157 | asset.FullID = LLUUID.Random(); | ||
158 | asset.Data = new byte[1]; | ||
159 | this.commsManager.AssetCache.AddAsset(asset); | ||
160 | |||
161 | InventoryItemBase item = new InventoryItemBase(); | ||
162 | item.avatarID = remoteClient.AgentId; | ||
163 | item.creatorsID = remoteClient.AgentId; | ||
164 | item.inventoryID = LLUUID.Random(); | ||
165 | item.assetID = asset.FullID; | ||
166 | item.inventoryDescription = description; | ||
167 | item.inventoryName = name; | ||
168 | item.assetType = invType; | ||
169 | item.invType = invType; | ||
170 | item.parentFolderID = folderID; | ||
171 | item.inventoryCurrentPermissions = 2147483647; | ||
172 | item.inventoryNextPermissions = nextOwnerMask; | ||
173 | |||
174 | userInfo.AddItem(remoteClient.AgentId, item); | ||
175 | remoteClient.SendInventoryItemUpdate(item); | ||
176 | } | ||
177 | } | ||
178 | else | ||
179 | { | ||
180 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); | ||
181 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /// <summary> | ||
186 | /// | ||
187 | /// </summary> | ||
188 | /// <param name="remoteClient"></param> | ||
189 | /// <param name="primLocalID"></param> | ||
190 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | ||
191 | { | ||
192 | |||
193 | bool hasPrim = false; | ||
194 | foreach (EntityBase ent in Entities.Values) | ||
195 | { | ||
196 | if (ent is SceneObjectGroup) | ||
197 | { | ||
198 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); | ||
199 | if (hasPrim != false) | ||
200 | { | ||
201 | ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); | ||
202 | break; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | /// <summary> | ||
209 | /// | ||
210 | /// </summary> | ||
211 | /// <param name="packet"></param> | ||
212 | /// <param name="simClient"></param> | ||
213 | public void DeRezObject(Packet packet, IClientAPI remoteClient) | ||
214 | { | ||
215 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | ||
216 | |||
217 | |||
218 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | ||
219 | { | ||
220 | //currently following code not used (or don't know of any case of destination being zero | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | ||
225 | { | ||
226 | EntityBase selectedEnt = null; | ||
227 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | ||
228 | foreach (EntityBase ent in this.Entities.Values) | ||
229 | { | ||
230 | if (ent.LocalId == Data.ObjectLocalID) | ||
231 | { | ||
232 | selectedEnt = ent; | ||
233 | break; | ||
234 | } | ||
235 | } | ||
236 | if (selectedEnt != null) | ||
237 | { | ||
238 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup)selectedEnt).UUID)) | ||
239 | { | ||
240 | string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); | ||
241 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
242 | if (userInfo != null) | ||
243 | { | ||
244 | AssetBase asset = new AssetBase(); | ||
245 | asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); | ||
246 | asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); | ||
247 | asset.InvType = 6; | ||
248 | asset.Type = 6; | ||
249 | asset.FullID = LLUUID.Random(); | ||
250 | asset.Data = Helpers.StringToField(sceneObjectXml); | ||
251 | commsManager.AssetCache.AddAsset(asset); | ||
252 | |||
253 | |||
254 | InventoryItemBase item = new InventoryItemBase(); | ||
255 | item.avatarID = remoteClient.AgentId; | ||
256 | item.creatorsID = remoteClient.AgentId; | ||
257 | item.inventoryID = LLUUID.Random(); | ||
258 | item.assetID = asset.FullID; | ||
259 | item.inventoryDescription = asset.Description; | ||
260 | item.inventoryName = asset.Name; | ||
261 | item.assetType = asset.Type; | ||
262 | item.invType = asset.InvType; | ||
263 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; | ||
264 | item.inventoryCurrentPermissions = 2147483647; | ||
265 | item.inventoryNextPermissions = 2147483647; | ||
266 | |||
267 | userInfo.AddItem(remoteClient.AgentId, item); | ||
268 | remoteClient.SendInventoryItemUpdate(item); | ||
269 | } | ||
270 | |||
271 | storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); | ||
272 | ((SceneObjectGroup)selectedEnt).DeleteGroup(); | ||
273 | |||
274 | lock (Entities) | ||
275 | { | ||
276 | Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | } | ||
283 | |||
284 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | ||
285 | { | ||
286 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
287 | if (userInfo != null) | ||
288 | { | ||
289 | if (userInfo.RootFolder != null) | ||
290 | { | ||
291 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
292 | if (item != null) | ||
293 | { | ||
294 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | ||
295 | if (rezAsset != null) | ||
296 | { | ||
297 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); | ||
298 | userInfo.DeleteItem(remoteClient.AgentId, item); | ||
299 | remoteClient.SendRemoveInventoryItem(itemID); | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | //lets try once more incase the asset cache is being slow getting the asset from server | ||
304 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | ||
305 | if (rezAsset != null) | ||
306 | { | ||
307 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); | ||
308 | userInfo.DeleteItem(remoteClient.AgentId, item); | ||
309 | remoteClient.SendRemoveInventoryItem(itemID); | ||
310 | } | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | private void AddRezObject(string xmlData, LLVector3 pos) | ||
318 | { | ||
319 | SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); | ||
320 | this.AddEntity(group); | ||
321 | group.AbsolutePosition = pos; | ||
322 | } | ||
323 | } | ||
324 | |||
325 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 0449cd9..1db9d29 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -207,120 +207,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
207 | }); | 207 | }); |
208 | } | 208 | } |
209 | 209 | ||
210 | /// <summary> | ||
211 | /// | ||
212 | /// </summary> | ||
213 | /// <param name="packet"></param> | ||
214 | /// <param name="simClient"></param> | ||
215 | public void DeRezObject(Packet packet, IClientAPI remoteClient) | ||
216 | { | ||
217 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; | ||
218 | |||
219 | |||
220 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | ||
221 | { | ||
222 | //currently following code not used (or don't know of any case of destination being zero | ||
223 | } | ||
224 | else | ||
225 | { | ||
226 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | ||
227 | { | ||
228 | EntityBase selectedEnt = null; | ||
229 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | ||
230 | foreach (EntityBase ent in this.Entities.Values) | ||
231 | { | ||
232 | if (ent.LocalId == Data.ObjectLocalID) | ||
233 | { | ||
234 | selectedEnt = ent; | ||
235 | break; | ||
236 | } | ||
237 | } | ||
238 | if (selectedEnt != null) | ||
239 | { | ||
240 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId,((SceneObjectGroup)selectedEnt).UUID)) | ||
241 | { | ||
242 | string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString(); | ||
243 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
244 | if (userInfo != null) | ||
245 | { | ||
246 | AssetBase asset = new AssetBase(); | ||
247 | asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId); | ||
248 | asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId); | ||
249 | asset.InvType = 6; | ||
250 | asset.Type = 6; | ||
251 | asset.FullID = LLUUID.Random(); | ||
252 | asset.Data = Helpers.StringToField(sceneObjectXml); | ||
253 | this.assetCache.AddAsset(asset); | ||
254 | |||
255 | |||
256 | InventoryItemBase item = new InventoryItemBase(); | ||
257 | item.avatarID = remoteClient.AgentId; | ||
258 | item.creatorsID = remoteClient.AgentId; | ||
259 | item.inventoryID = LLUUID.Random(); | ||
260 | item.assetID = asset.FullID; | ||
261 | item.inventoryDescription = asset.Description; | ||
262 | item.inventoryName = asset.Name; | ||
263 | item.assetType = asset.Type; | ||
264 | item.invType = asset.InvType; | ||
265 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; | ||
266 | item.inventoryCurrentPermissions = 2147483647; | ||
267 | item.inventoryNextPermissions = 2147483647; | ||
268 | |||
269 | userInfo.AddItem(remoteClient.AgentId, item); | ||
270 | remoteClient.SendInventoryItemUpdate(item); | ||
271 | } | ||
272 | |||
273 | storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); | ||
274 | ((SceneObjectGroup)selectedEnt).DeleteGroup(); | ||
275 | |||
276 | lock (Entities) | ||
277 | { | ||
278 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | |||
286 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | ||
287 | { | ||
288 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
289 | if (userInfo != null) | ||
290 | { | ||
291 | if(userInfo.RootFolder != null) | ||
292 | { | ||
293 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
294 | if (item != null) | ||
295 | { | ||
296 | AssetBase rezAsset = this.assetCache.GetAsset(item.assetID, false); | ||
297 | if (rezAsset != null) | ||
298 | { | ||
299 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); | ||
300 | userInfo.DeleteItem(remoteClient.AgentId, item); | ||
301 | remoteClient.SendRemoveInventoryItem(itemID); | ||
302 | } | ||
303 | else | ||
304 | { | ||
305 | rezAsset = this.assetCache.GetAsset(item.assetID, false); | ||
306 | if (rezAsset != null) | ||
307 | { | ||
308 | this.AddRezObject(Util.FieldToString(rezAsset.Data), pos); | ||
309 | userInfo.DeleteItem(remoteClient.AgentId, item); | ||
310 | remoteClient.SendRemoveInventoryItem(itemID); | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | } | ||
317 | |||
318 | private void AddRezObject(string xmlData, LLVector3 pos) | ||
319 | { | ||
320 | SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); | ||
321 | this.AddEntity(group); | ||
322 | group.AbsolutePosition = pos; | ||
323 | } | ||
324 | 210 | ||
325 | /// <summary> | 211 | /// <summary> |
326 | /// | 212 | /// |
@@ -459,29 +345,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
459 | /// <summary> | 345 | /// <summary> |
460 | /// | 346 | /// |
461 | /// </summary> | 347 | /// </summary> |
462 | /// <param name="remoteClient"></param> | ||
463 | /// <param name="primLocalID"></param> | ||
464 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | ||
465 | { | ||
466 | |||
467 | bool hasPrim = false; | ||
468 | foreach (EntityBase ent in Entities.Values) | ||
469 | { | ||
470 | if (ent is SceneObjectGroup) | ||
471 | { | ||
472 | hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); | ||
473 | if (hasPrim != false) | ||
474 | { | ||
475 | ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); | ||
476 | break; | ||
477 | } | ||
478 | } | ||
479 | } | ||
480 | } | ||
481 | |||
482 | /// <summary> | ||
483 | /// | ||
484 | /// </summary> | ||
485 | /// <param name="primLocalID"></param> | 348 | /// <param name="primLocalID"></param> |
486 | /// <param name="remoteClient"></param> | 349 | /// <param name="remoteClient"></param> |
487 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 350 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) |
@@ -790,59 +653,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
790 | }*/ | 653 | }*/ |
791 | } | 654 | } |
792 | 655 | ||
793 | /// <summary> | 656 | |
794 | /// temporary method to test out creating new inventory items | ||
795 | /// </summary> | ||
796 | /// <param name="remoteClient"></param> | ||
797 | /// <param name="transActionID"></param> | ||
798 | /// <param name="folderID"></param> | ||
799 | /// <param name="callbackID"></param> | ||
800 | /// <param name="description"></param> | ||
801 | /// <param name="name"></param> | ||
802 | /// <param name="invType"></param> | ||
803 | /// <param name="type"></param> | ||
804 | /// <param name="wearableType"></param> | ||
805 | /// <param name="nextOwnerMask"></param> | ||
806 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | ||
807 | { | ||
808 | if (transActionID == LLUUID.Zero) | ||
809 | { | ||
810 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
811 | if (userInfo != null) | ||
812 | { | ||
813 | AssetBase asset = new AssetBase(); | ||
814 | asset.Name = name; | ||
815 | asset.Description = description; | ||
816 | asset.InvType = invType; | ||
817 | asset.Type = type; | ||
818 | asset.FullID = LLUUID.Random(); | ||
819 | asset.Data = new byte[1]; | ||
820 | this.assetCache.AddAsset(asset); | ||
821 | |||
822 | InventoryItemBase item = new InventoryItemBase(); | ||
823 | item.avatarID = remoteClient.AgentId; | ||
824 | item.creatorsID = remoteClient.AgentId; | ||
825 | item.inventoryID = LLUUID.Random(); | ||
826 | item.assetID = asset.FullID; | ||
827 | item.inventoryDescription = description; | ||
828 | item.inventoryName = name; | ||
829 | item.assetType = invType; | ||
830 | item.invType = invType; | ||
831 | item.parentFolderID = folderID; | ||
832 | item.inventoryCurrentPermissions = 2147483647; | ||
833 | item.inventoryNextPermissions = nextOwnerMask; | ||
834 | |||
835 | userInfo.AddItem(remoteClient.AgentId, item); | ||
836 | remoteClient.SendInventoryItemUpdate(item); | ||
837 | } | ||
838 | } | ||
839 | else | ||
840 | { | ||
841 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); | ||
842 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); | ||
843 | } | ||
844 | } | ||
845 | |||
846 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 657 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
847 | { | 658 | { |
848 | this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); | 659 | this.EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 10be283..537ab8c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -180,8 +180,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | ScenePresence.LoadAnims(); | 180 | ScenePresence.LoadAnims(); |
181 | 181 | ||
182 | httpListener = httpServer; | 182 | httpListener = httpServer; |
183 | |||
184 | |||
185 | } | 183 | } |
186 | 184 | ||
187 | #endregion | 185 | #endregion |
@@ -486,7 +484,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
486 | asset.Data = data; | 484 | asset.Data = data; |
487 | asset.Name = "terrainImage"; | 485 | asset.Name = "terrainImage"; |
488 | asset.Type = 0; | 486 | asset.Type = 0; |
489 | assetCache.AddAsset(asset); | 487 | commsManager.AssetCache.AddAsset(asset); |
490 | } | 488 | } |
491 | 489 | ||
492 | #endregion | 490 | #endregion |
@@ -707,6 +705,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
707 | client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents; | 705 | client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents; |
708 | client.OnRequestTaskInventory += RequestTaskInventory; | 706 | client.OnRequestTaskInventory += RequestTaskInventory; |
709 | client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; | 707 | client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; |
708 | client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset; | ||
710 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; | 709 | client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; |
711 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; | 710 | client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; |
712 | // client.OnRequestXfer += RequestXfer; | 711 | // client.OnRequestXfer += RequestXfer; |
@@ -921,11 +920,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
921 | if (agent.CapsPath != "") | 920 | if (agent.CapsPath != "") |
922 | { | 921 | { |
923 | //Console.WriteLine("new user, so creating caps handler for it"); | 922 | //Console.WriteLine("new user, so creating caps handler for it"); |
924 | Caps cap = new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); | 923 | Caps cap = new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); |
925 | Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); | 924 | Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); |
926 | cap.RegisterHandlers(); | 925 | cap.RegisterHandlers(); |
927 | cap.AddNewInventoryItem = this.AddInventoryItem; | 926 | cap.AddNewInventoryItem = this.AddInventoryItem; |
928 | cap.ItemUpdatedCall = this.UpdateInventoryItemAsset; | 927 | cap.ItemUpdatedCall = this.CapsUpdateInventoryItemAsset; |
929 | if (capsHandlers.ContainsKey(agent.AgentID)) | 928 | if (capsHandlers.ContainsKey(agent.AgentID)) |
930 | { | 929 | { |
931 | MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + | 930 | MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + |
@@ -1149,72 +1148,5 @@ namespace OpenSim.Region.Environment.Scenes | |||
1149 | } | 1148 | } |
1150 | return LLUUID.Zero; | 1149 | return LLUUID.Zero; |
1151 | } | 1150 | } |
1152 | |||
1153 | public void AddInventoryItem(LLUUID userID, InventoryItemBase item) | ||
1154 | { | ||
1155 | if (this.Avatars.ContainsKey(userID)) | ||
1156 | { | ||
1157 | this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); | ||
1158 | } | ||
1159 | } | ||
1160 | |||
1161 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | ||
1162 | { | ||
1163 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
1164 | if (userInfo != null) | ||
1165 | { | ||
1166 | userInfo.AddItem(remoteClient.AgentId, item); | ||
1167 | remoteClient.SendInventoryItemUpdate(item); | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | public LLUUID UpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) | ||
1172 | { | ||
1173 | if (this.Avatars.ContainsKey(userID)) | ||
1174 | { | ||
1175 | return this.UpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); | ||
1176 | } | ||
1177 | return LLUUID.Zero; | ||
1178 | } | ||
1179 | |||
1180 | public LLUUID UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | ||
1181 | { | ||
1182 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
1183 | if (userInfo != null) | ||
1184 | { | ||
1185 | if (userInfo.RootFolder != null) | ||
1186 | { | ||
1187 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
1188 | if (item != null) | ||
1189 | { | ||
1190 | AssetBase asset; | ||
1191 | asset = new AssetBase(); | ||
1192 | asset.FullID = LLUUID.Random(); | ||
1193 | asset.Type = (sbyte)item.assetType; | ||
1194 | asset.InvType = (sbyte)item.invType; | ||
1195 | asset.Name = item.inventoryName; | ||
1196 | asset.Data = data; | ||
1197 | this.assetCache.AddAsset(asset); | ||
1198 | |||
1199 | item.assetID = asset.FullID; | ||
1200 | userInfo.UpdateItem(remoteClient.AgentId, item); | ||
1201 | |||
1202 | // remoteClient.SendInventoryItemUpdate(item); | ||
1203 | if (item.invType == 7) | ||
1204 | { | ||
1205 | //do we want to know about updated note cards? | ||
1206 | } | ||
1207 | else if (item.invType == 10) | ||
1208 | { | ||
1209 | // do we want to know about updated scripts | ||
1210 | } | ||
1211 | |||
1212 | return (asset.FullID); | ||
1213 | } | ||
1214 | } | ||
1215 | } | ||
1216 | return LLUUID.Zero; | ||
1217 | } | ||
1218 | |||
1219 | } | 1151 | } |
1220 | } | 1152 | } |