diff options
Some work on Inventory (not yet finished or enabled)
-rw-r--r-- | OpenSim/Framework/Communications/caches/InventoryFolder.cs | 12 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/caches/UserProfileCache.cs | 67 | ||||
-rw-r--r-- | OpenSim/Framework/Data/UserProfileData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/General/AgentInventory.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 13 | ||||
-rw-r--r-- | OpenSim/Framework/General/NullClientAPI.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/UserManager/UserManagerBase.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Capabilities/Caps.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs | 12 |
14 files changed, 216 insertions, 46 deletions
diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs index af38b12..8978cee 100644 --- a/OpenSim/Framework/Communications/caches/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/caches/InventoryFolder.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
36 | return returnFolder; | 36 | return returnFolder; |
37 | } | 37 | } |
38 | 38 | ||
39 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) | 39 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type ) |
40 | { | 40 | { |
41 | InventoryFolder subFold = new InventoryFolder(); | 41 | InventoryFolder subFold = new InventoryFolder(); |
42 | subFold.name = folderName; | 42 | subFold.name = folderName; |
@@ -47,5 +47,15 @@ namespace OpenSim.Framework.Communications.Caches | |||
47 | this.SubFolders.Add(subFold.folderID, subFold); | 47 | this.SubFolders.Add(subFold.folderID, subFold); |
48 | return subFold; | 48 | return subFold; |
49 | } | 49 | } |
50 | |||
51 | public List<InventoryItemBase> RequestListOfItems() | ||
52 | { | ||
53 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); | ||
54 | foreach (InventoryItemBase item in this.Items.Values) | ||
55 | { | ||
56 | itemList.Add(item); | ||
57 | } | ||
58 | return itemList; | ||
59 | } | ||
50 | } | 60 | } |
51 | } | 61 | } |
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs index f651b8a..bfb6f07 100644 --- a/OpenSim/Framework/Communications/caches/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs | |||
@@ -2,6 +2,7 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | ||
5 | using OpenSim.Framework.Data; | 6 | using OpenSim.Framework.Data; |
6 | using OpenSim.Framework.Communications; | 7 | using OpenSim.Framework.Communications; |
7 | 8 | ||
@@ -29,14 +30,17 @@ namespace OpenSim.Framework.Communications.Caches | |||
29 | { | 30 | { |
30 | CachedUserInfo userInfo = new CachedUserInfo(); | 31 | CachedUserInfo userInfo = new CachedUserInfo(); |
31 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); | 32 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); |
32 | this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | 33 | |
33 | if (userInfo.UserProfile != null) | 34 | if (userInfo.UserProfile != null) |
34 | { | 35 | { |
36 | this.RequestInventoryForUser(userID, userInfo); | ||
35 | this.UserProfiles.Add(userID, userInfo); | 37 | this.UserProfiles.Add(userID, userInfo); |
36 | } | 38 | } |
37 | else | 39 | else |
38 | { | 40 | { |
39 | //no profile for this user, what do we do now? | 41 | //no profile for this user, what do we do now? |
42 | Console.WriteLine("UserProfileCache.cs: user profile for user not found"); | ||
43 | |||
40 | } | 44 | } |
41 | } | 45 | } |
42 | else | 46 | else |
@@ -68,6 +72,52 @@ namespace OpenSim.Framework.Communications.Caches | |||
68 | 72 | ||
69 | } | 73 | } |
70 | 74 | ||
75 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) | ||
76 | { | ||
77 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | ||
78 | { | ||
79 | CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId]; | ||
80 | if (userInfo.RootFolder.folderID == parentID) | ||
81 | { | ||
82 | userInfo.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(parentID); | ||
87 | if (parentFolder != null) | ||
88 | { | ||
89 | parentFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | ||
96 | { | ||
97 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | ||
98 | { | ||
99 | CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId]; | ||
100 | if (userInfo.RootFolder.folderID == folderID) | ||
101 | { | ||
102 | if (fetchItems) | ||
103 | { | ||
104 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, userInfo.RootFolder.RequestListOfItems()); | ||
105 | } | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(folderID); | ||
110 | if(parentFolder != null) | ||
111 | { | ||
112 | if(fetchItems) | ||
113 | { | ||
114 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, parentFolder.RequestListOfItems()); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | |||
71 | /// <summary> | 121 | /// <summary> |
72 | /// Request the user profile from User server | 122 | /// Request the user profile from User server |
73 | /// </summary> | 123 | /// </summary> |
@@ -81,9 +131,20 @@ namespace OpenSim.Framework.Communications.Caches | |||
81 | /// Request Iventory Info from Inventory server | 131 | /// Request Iventory Info from Inventory server |
82 | /// </summary> | 132 | /// </summary> |
83 | /// <param name="userID"></param> | 133 | /// <param name="userID"></param> |
84 | private void RequestInventoryForUser(LLUUID userID) | 134 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) |
85 | { | 135 | { |
86 | 136 | // this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | |
137 | |||
138 | //for now we manually create the root folder, | ||
139 | // but should be requesting all inventory from inventory server. | ||
140 | InventoryFolder rootFolder = new InventoryFolder(); | ||
141 | rootFolder.agentID = userID; | ||
142 | rootFolder.folderID = userInfo.UserProfile.rootInventoryFolderID; | ||
143 | rootFolder.name = "My Inventory"; | ||
144 | rootFolder.parentID = LLUUID.Zero; | ||
145 | rootFolder.type = 8; | ||
146 | rootFolder.version = 1; | ||
147 | userInfo.FolderReceive(userID, rootFolder); | ||
87 | } | 148 | } |
88 | 149 | ||
89 | /// <summary> | 150 | /// <summary> |
diff --git a/OpenSim/Framework/Data/UserProfileData.cs b/OpenSim/Framework/Data/UserProfileData.cs index 88f956f..67ff64c 100644 --- a/OpenSim/Framework/Data/UserProfileData.cs +++ b/OpenSim/Framework/Data/UserProfileData.cs | |||
@@ -81,6 +81,8 @@ namespace OpenSim.Framework.Data | |||
81 | /// </summary> | 81 | /// </summary> |
82 | public int lastLogin; | 82 | public int lastLogin; |
83 | 83 | ||
84 | public LLUUID rootInventoryFolderID; | ||
85 | |||
84 | /// <summary> | 86 | /// <summary> |
85 | /// A URI to the users inventory server, used for foreigners and large grids | 87 | /// A URI to the users inventory server, used for foreigners and large grids |
86 | /// </summary> | 88 | /// </summary> |
diff --git a/OpenSim/Framework/General/AgentInventory.cs b/OpenSim/Framework/General/AgentInventory.cs index 0aeb0b3..4c80791 100644 --- a/OpenSim/Framework/General/AgentInventory.cs +++ b/OpenSim/Framework/General/AgentInventory.cs | |||
@@ -52,12 +52,11 @@ namespace OpenSim.Framework.Inventory | |||
52 | 52 | ||
53 | public virtual void Initialise() | 53 | public virtual void Initialise() |
54 | { | 54 | { |
55 | Wearables = new AvatarWearable[13]; //should be 12 of these | 55 | Wearables = new AvatarWearable[13]; |
56 | for (int i = 0; i < 13; i++) | 56 | for (int i = 0; i < 13; i++) |
57 | { | 57 | { |
58 | Wearables[i] = new AvatarWearable(); | 58 | Wearables[i] = new AvatarWearable(); |
59 | } | 59 | } |
60 | |||
61 | } | 60 | } |
62 | 61 | ||
63 | public bool CreateNewFolder(LLUUID folderID, ushort type) | 62 | public bool CreateNewFolder(LLUUID folderID, ushort type) |
@@ -96,11 +95,10 @@ namespace OpenSim.Framework.Inventory | |||
96 | Folder.DefaultType = type; | 95 | Folder.DefaultType = type; |
97 | Folder.FolderName = folderName; | 96 | Folder.FolderName = folderName; |
98 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 97 | this.InventoryFolders.Add(Folder.FolderID, Folder); |
99 | |||
100 | return (true); | 98 | return (true); |
101 | } | 99 | } |
102 | 100 | ||
103 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) | 101 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) |
104 | { | 102 | { |
105 | if (!this.InventoryFolders.ContainsKey(folderID)) | 103 | if (!this.InventoryFolders.ContainsKey(folderID)) |
106 | { | 104 | { |
@@ -110,10 +108,9 @@ namespace OpenSim.Framework.Inventory | |||
110 | Folder.OwnerID = this.AgentID; | 108 | Folder.OwnerID = this.AgentID; |
111 | Folder.DefaultType = type; | 109 | Folder.DefaultType = type; |
112 | Folder.FolderName = folderName; | 110 | Folder.FolderName = folderName; |
113 | Folder.ParentID = parent; | 111 | Folder.ParentID = parentID; |
114 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 112 | this.InventoryFolders.Add(Folder.FolderID, Folder); |
115 | } | 113 | } |
116 | |||
117 | return (true); | 114 | return (true); |
118 | } | 115 | } |
119 | 116 | ||
@@ -135,7 +132,6 @@ namespace OpenSim.Framework.Inventory | |||
135 | return inv.FolderID; | 132 | return inv.FolderID; |
136 | } | 133 | } |
137 | } | 134 | } |
138 | |||
139 | return LLUUID.Zero; | 135 | return LLUUID.Zero; |
140 | } | 136 | } |
141 | 137 | ||
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 808a857..df65027 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -80,7 +80,10 @@ namespace OpenSim.Framework.Interfaces | |||
80 | 80 | ||
81 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); | 81 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); |
82 | 82 | ||
83 | 83 | public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); | |
84 | public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); | ||
85 | |||
86 | public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); | ||
84 | 87 | ||
85 | public interface IClientAPI | 88 | public interface IClientAPI |
86 | { | 89 | { |
@@ -125,6 +128,10 @@ namespace OpenSim.Framework.Interfaces | |||
125 | event NewAvatar OnNewAvatar; | 128 | event NewAvatar OnNewAvatar; |
126 | event GenericCall6 OnRemoveAvatar; | 129 | event GenericCall6 OnRemoveAvatar; |
127 | 130 | ||
131 | event CreateInventoryFolder OnCreateNewInventoryFolder; | ||
132 | event FetchInventoryDescendents OnFetchInventoryDescendents; | ||
133 | event RequestTaskInventory OnRequestTaskInventory; | ||
134 | |||
128 | event UUIDNameRequest OnNameFromUUIDRequest; | 135 | event UUIDNameRequest OnNameFromUUIDRequest; |
129 | 136 | ||
130 | event ParcelPropertiesRequest OnParcelPropertiesRequest; | 137 | event ParcelPropertiesRequest OnParcelPropertiesRequest; |
@@ -188,8 +195,10 @@ namespace OpenSim.Framework.Interfaces | |||
188 | 195 | ||
189 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); | 196 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); |
190 | void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); | 197 | void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); |
191 | void SendNameReply(LLUUID profileId, string firstname, string lastname); | 198 | void SendInventoryItemUpdate(InventoryItemBase Item); |
199 | void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); | ||
192 | 200 | ||
201 | void SendNameReply(LLUUID profileId, string firstname, string lastname); | ||
193 | void SendAlertMessage(string message); | 202 | void SendAlertMessage(string message); |
194 | void SendAgentAlertMessage(string message, bool modal); | 203 | void SendAgentAlertMessage(string message, bool modal); |
195 | } | 204 | } |
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index cfba228..18ac527 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -52,6 +52,10 @@ namespace OpenSim.Framework | |||
52 | public event NewAvatar OnNewAvatar; | 52 | public event NewAvatar OnNewAvatar; |
53 | public event GenericCall6 OnRemoveAvatar; | 53 | public event GenericCall6 OnRemoveAvatar; |
54 | 54 | ||
55 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | ||
56 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | ||
57 | public event RequestTaskInventory OnRequestTaskInventory; | ||
58 | |||
55 | public event UUIDNameRequest OnNameFromUUIDRequest; | 59 | public event UUIDNameRequest OnNameFromUUIDRequest; |
56 | 60 | ||
57 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | 61 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; |
@@ -124,8 +128,10 @@ namespace OpenSim.Framework | |||
124 | 128 | ||
125 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} | 129 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} |
126 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){} | 130 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){} |
127 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} | 131 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } |
132 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | ||
128 | 133 | ||
134 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} | ||
129 | public void SendAlertMessage(string message) { } | 135 | public void SendAlertMessage(string message) { } |
130 | public void SendAgentAlertMessage(string message, bool modal) { } | 136 | public void SendAgentAlertMessage(string message, bool modal) { } |
131 | } | 137 | } |
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index 865adbe..c614300 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs | |||
@@ -417,7 +417,7 @@ namespace OpenSim.Framework.UserManagement | |||
417 | Hashtable TempHash; | 417 | Hashtable TempHash; |
418 | 418 | ||
419 | AgentInventory Library = new AgentInventory(); | 419 | AgentInventory Library = new AgentInventory(); |
420 | Library.CreateRootFolder(AgentID, true); | 420 | Library.CreateRootFolder(AgentID, false); |
421 | 421 | ||
422 | foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) | 422 | foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) |
423 | { | 423 | { |
@@ -434,6 +434,7 @@ namespace OpenSim.Framework.UserManagement | |||
434 | InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); | 434 | InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); |
435 | ArrayList InventoryRoot = new ArrayList(); | 435 | ArrayList InventoryRoot = new ArrayList(); |
436 | InventoryRoot.Add(InventoryRootHash); | 436 | InventoryRoot.Add(InventoryRootHash); |
437 | userProfile.rootInventoryFolderID = Library.InventoryRoot.FolderID; | ||
437 | 438 | ||
438 | // Circuit Code | 439 | // Circuit Code |
439 | uint circode = (uint)(Util.RandomClass.Next()); | 440 | uint circode = (uint)(Util.RandomClass.Next()); |
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 110ba6f..ab2b3a6 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs | |||
@@ -38,7 +38,7 @@ using OpenSim.Region.Caches; | |||
38 | 38 | ||
39 | namespace OpenSim.Region.Capabilities | 39 | namespace OpenSim.Region.Capabilities |
40 | { | 40 | { |
41 | public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); | 41 | public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data); |
42 | 42 | ||
43 | public class Caps | 43 | public class Caps |
44 | { | 44 | { |
@@ -223,12 +223,14 @@ namespace OpenSim.Region.Capabilities | |||
223 | /// <returns></returns> | 223 | /// <returns></returns> |
224 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | 224 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) |
225 | { | 225 | { |
226 | // Console.WriteLine("asset upload request via CAPS"); | ||
227 | string assetName = llsdRequest.name; | ||
226 | string capsBase = "/CAPS/" + m_capsObjectPath; | 228 | string capsBase = "/CAPS/" + m_capsObjectPath; |
227 | LLUUID newAsset = LLUUID.Random(); | 229 | LLUUID newAsset = LLUUID.Random(); |
228 | LLUUID newInvItem = LLUUID.Random(); | 230 | LLUUID newInvItem = LLUUID.Random(); |
229 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 231 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
230 | 232 | ||
231 | AssetUploader uploader = new AssetUploader(newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); | 233 | AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); |
232 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 234 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
233 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | 235 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; |
234 | 236 | ||
@@ -245,14 +247,14 @@ namespace OpenSim.Region.Capabilities | |||
245 | /// <param name="assetID"></param> | 247 | /// <param name="assetID"></param> |
246 | /// <param name="inventoryItem"></param> | 248 | /// <param name="inventoryItem"></param> |
247 | /// <param name="data"></param> | 249 | /// <param name="data"></param> |
248 | public void UploadCompleteHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) | 250 | public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data) |
249 | { | 251 | { |
250 | AssetBase asset; | 252 | AssetBase asset; |
251 | asset = new AssetBase(); | 253 | asset = new AssetBase(); |
252 | asset.FullID = assetID; | 254 | asset.FullID = assetID; |
253 | asset.Type = 0; | 255 | asset.Type = 0; |
254 | asset.InvType = 0; | 256 | asset.InvType = 0; |
255 | asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); | 257 | asset.Name = assetName; //"UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); |
256 | asset.Data = data; | 258 | asset.Data = data; |
257 | this.assetCache.AddAsset(asset); | 259 | this.assetCache.AddAsset(asset); |
258 | } | 260 | } |
@@ -265,6 +267,8 @@ namespace OpenSim.Region.Capabilities | |||
265 | private LLUUID newAssetID; | 267 | private LLUUID newAssetID; |
266 | private LLUUID inventoryItemID; | 268 | private LLUUID inventoryItemID; |
267 | private BaseHttpServer httpListener; | 269 | private BaseHttpServer httpListener; |
270 | private bool SaveImages = true; | ||
271 | private string m_assetName = ""; | ||
268 | 272 | ||
269 | /// <summary> | 273 | /// <summary> |
270 | /// | 274 | /// |
@@ -273,8 +277,9 @@ namespace OpenSim.Region.Capabilities | |||
273 | /// <param name="inventoryItem"></param> | 277 | /// <param name="inventoryItem"></param> |
274 | /// <param name="path"></param> | 278 | /// <param name="path"></param> |
275 | /// <param name="httpServer"></param> | 279 | /// <param name="httpServer"></param> |
276 | public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) | 280 | public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) |
277 | { | 281 | { |
282 | m_assetName = assetName; | ||
278 | newAssetID = assetID; | 283 | newAssetID = assetID; |
279 | inventoryItemID = inventoryItem; | 284 | inventoryItemID = inventoryItem; |
280 | uploaderPath = path; | 285 | uploaderPath = path; |
@@ -299,13 +304,27 @@ namespace OpenSim.Region.Capabilities | |||
299 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 304 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |
300 | 305 | ||
301 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 306 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
302 | 307 | ||
308 | if(this.SaveImages) | ||
309 | this.SaveImageToFile(m_assetName + ".jp2", data); | ||
310 | |||
303 | if (OnUpLoad != null) | 311 | if (OnUpLoad != null) |
304 | { | 312 | { |
305 | OnUpLoad(newAssetID, inv, data); | 313 | OnUpLoad(m_assetName, newAssetID, inv, data); |
306 | } | 314 | } |
315 | |||
307 | return res; | 316 | return res; |
308 | } | 317 | } |
318 | |||
319 | private void SaveImageToFile(string filename, byte[] data) | ||
320 | { | ||
321 | |||
322 | FileStream fs = File.Create(filename); | ||
323 | BinaryWriter bw = new BinaryWriter(fs); | ||
324 | bw.Write(data); | ||
325 | bw.Close(); | ||
326 | fs.Close(); | ||
327 | } | ||
309 | } | 328 | } |
310 | } | 329 | } |
311 | } | 330 | } |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 8a5e631..084f7e0 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -81,6 +81,10 @@ namespace OpenSim.Region.ClientStack | |||
81 | public event RequestMapBlocks OnRequestMapBlocks; | 81 | public event RequestMapBlocks OnRequestMapBlocks; |
82 | public event TeleportLocationRequest OnTeleportLocationRequest; | 82 | public event TeleportLocationRequest OnTeleportLocationRequest; |
83 | 83 | ||
84 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | ||
85 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | ||
86 | public event RequestTaskInventory OnRequestTaskInventory; | ||
87 | |||
84 | public event UUIDNameRequest OnNameFromUUIDRequest; | 88 | public event UUIDNameRequest OnNameFromUUIDRequest; |
85 | 89 | ||
86 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | 90 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; |
@@ -577,6 +581,48 @@ namespace OpenSim.Region.ClientStack | |||
577 | this.OutPacket(inventoryReply); | 581 | this.OutPacket(inventoryReply); |
578 | } | 582 | } |
579 | 583 | ||
584 | public void SendInventoryItemUpdate(InventoryItemBase Item) | ||
585 | { | ||
586 | Encoding enc = Encoding.ASCII; | ||
587 | uint FULL_MASK_PERMISSIONS = 2147483647; | ||
588 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); | ||
589 | InventoryReply.AgentData.AgentID = this.AgentID; | ||
590 | InventoryReply.AgentData.SimApproved = true; | ||
591 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | ||
592 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | ||
593 | InventoryReply.InventoryData[0].ItemID = Item.inventoryID; | ||
594 | InventoryReply.InventoryData[0].AssetID = Item.assetID; | ||
595 | InventoryReply.InventoryData[0].CreatorID = Item.creatorsID; | ||
596 | InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; | ||
597 | InventoryReply.InventoryData[0].CreationDate = 1000; | ||
598 | InventoryReply.InventoryData[0].Description = enc.GetBytes(Item.inventoryDescription + "\0"); | ||
599 | InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; | ||
600 | InventoryReply.InventoryData[0].Flags = 0; | ||
601 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; | ||
602 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
603 | InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; | ||
604 | InventoryReply.InventoryData[0].InvType =(sbyte) Item.type; | ||
605 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); | ||
606 | InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
607 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; | ||
608 | InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; | ||
609 | InventoryReply.InventoryData[0].SalePrice = 100; | ||
610 | InventoryReply.InventoryData[0].SaleType = 0; | ||
611 | InventoryReply.InventoryData[0].Type =(sbyte) Item.type; | ||
612 | InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | ||
613 | |||
614 | OutPacket(InventoryReply); | ||
615 | } | ||
616 | |||
617 | public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) | ||
618 | { | ||
619 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | ||
620 | replytask.InventoryData.TaskID = taskID; | ||
621 | replytask.InventoryData.Serial = serial; | ||
622 | replytask.InventoryData.Filename = fileName; | ||
623 | OutPacket(replytask); | ||
624 | } | ||
625 | |||
580 | /// <summary> | 626 | /// <summary> |
581 | /// | 627 | /// |
582 | /// </summary> | 628 | /// </summary> |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index c248b29..267e7ee 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -373,7 +373,8 @@ namespace OpenSim.Region.ClientStack | |||
373 | break; | 373 | break; |
374 | case PacketType.AssetUploadRequest: | 374 | case PacketType.AssetUploadRequest: |
375 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 375 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; |
376 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); | 376 | // Console.WriteLine(request.ToString()); |
377 | //this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); | ||
377 | break; | 378 | break; |
378 | case PacketType.RequestXfer: | 379 | case PacketType.RequestXfer: |
379 | //Console.WriteLine(Pack.ToString()); | 380 | //Console.WriteLine(Pack.ToString()); |
@@ -382,9 +383,12 @@ namespace OpenSim.Region.ClientStack | |||
382 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); | 383 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); |
383 | break; | 384 | break; |
384 | case PacketType.CreateInventoryFolder: | 385 | case PacketType.CreateInventoryFolder: |
385 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 386 | if (this.OnCreateNewInventoryFolder != null) |
386 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 387 | { |
387 | //Console.WriteLine(Pack.ToString()); | 388 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; |
389 | this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | ||
390 | //m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | ||
391 | } | ||
388 | break; | 392 | break; |
389 | case PacketType.CreateInventoryItem: | 393 | case PacketType.CreateInventoryItem: |
390 | //Console.WriteLine(Pack.ToString()); | 394 | //Console.WriteLine(Pack.ToString()); |
@@ -405,8 +409,12 @@ namespace OpenSim.Region.ClientStack | |||
405 | m_inventoryCache.FetchInventory(this, FetchInventory); | 409 | m_inventoryCache.FetchInventory(this, FetchInventory); |
406 | break; | 410 | break; |
407 | case PacketType.FetchInventoryDescendents: | 411 | case PacketType.FetchInventoryDescendents: |
408 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | 412 | if (this.OnFetchInventoryDescendents != null) |
409 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); | 413 | { |
414 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | ||
415 | // m_inventoryCache.FetchInventoryDescendents(this, Fetch); | ||
416 | this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); | ||
417 | } | ||
410 | break; | 418 | break; |
411 | case PacketType.UpdateInventoryItem: | 419 | case PacketType.UpdateInventoryItem: |
412 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | 420 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; |
@@ -444,22 +452,10 @@ namespace OpenSim.Region.ClientStack | |||
444 | case PacketType.RequestTaskInventory: | 452 | case PacketType.RequestTaskInventory: |
445 | // Console.WriteLine(Pack.ToString()); | 453 | // Console.WriteLine(Pack.ToString()); |
446 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | 454 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; |
447 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | 455 | if (this.OnRequestTaskInventory != null) |
448 | //bool foundent = false; | 456 | { |
449 | /* foreach (Entity ent in m_world.Entities.Values) | 457 | this.OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); |
450 | { | 458 | } |
451 | if (ent.localid == requesttask.InventoryData.LocalID) | ||
452 | { | ||
453 | replytask.InventoryData.TaskID = ent.uuid; | ||
454 | replytask.InventoryData.Serial = 0; | ||
455 | replytask.InventoryData.Filename = new byte[0]; | ||
456 | foundent = true; | ||
457 | } | ||
458 | } | ||
459 | if (foundent) | ||
460 | { | ||
461 | this.OutPacket(replytask); | ||
462 | }*/ | ||
463 | break; | 459 | break; |
464 | case PacketType.UpdateTaskInventory: | 460 | case PacketType.UpdateTaskInventory: |
465 | // Console.WriteLine(Pack.ToString()); | 461 | // Console.WriteLine(Pack.ToString()); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f435681..3e7b820 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -529,6 +529,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
529 | m_estateManager.sendRegionHandshake(client); | 529 | m_estateManager.sendRegionHandshake(client); |
530 | CreateAndAddScenePresence(client); | 530 | CreateAndAddScenePresence(client); |
531 | m_LandManager.sendParcelOverlay(client); | 531 | m_LandManager.sendParcelOverlay(client); |
532 | //commsManager.UserProfilesCache.AddNewUser(client.AgentId); | ||
532 | } | 533 | } |
533 | 534 | ||
534 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 535 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
@@ -569,6 +570,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
569 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); | 570 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); |
570 | 571 | ||
571 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); | 572 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); |
573 | |||
574 | //client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder; | ||
575 | // client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents; | ||
572 | } | 576 | } |
573 | 577 | ||
574 | protected ScenePresence CreateAndAddScenePresence(IClientAPI client) | 578 | protected ScenePresence CreateAndAddScenePresence(IClientAPI client) |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3bfc70f..473dae9 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
53 | private List<NewForce> forcesList = new List<NewForce>(); | 53 | private List<NewForce> forcesList = new List<NewForce>(); |
54 | private short _updateCount = 0; | 54 | private short _updateCount = 0; |
55 | private Quaternion bodyRot; | 55 | private Quaternion bodyRot; |
56 | private LLObject.TextureEntry avatarAppearanceTexture = null; | 56 | // private LLObject.TextureEntry avatarAppearanceTexture = null; |
57 | private byte[] visualParams; | 57 | private byte[] visualParams; |
58 | private AvatarWearable[] Wearables; | 58 | private AvatarWearable[] Wearables; |
59 | private ulong m_regionHandle; | 59 | private ulong m_regionHandle; |
@@ -140,7 +140,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
140 | Animations = new ScenePresence.AvatarAnimations(); | 140 | Animations = new ScenePresence.AvatarAnimations(); |
141 | Animations.LoadAnims(); | 141 | Animations.LoadAnims(); |
142 | 142 | ||
143 | this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | 143 | // this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); |
144 | 144 | ||
145 | //register for events | 145 | //register for events |
146 | ControllingClient.OnRequestWearables += this.SendOurAppearance; | 146 | ControllingClient.OnRequestWearables += this.SendOurAppearance; |
@@ -605,6 +605,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
605 | br.Close(); | 605 | br.Close(); |
606 | fStream.Close(); | 606 | fStream.Close(); |
607 | DefaultTexture = data1; | 607 | DefaultTexture = data1; |
608 | // LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); | ||
609 | // Console.WriteLine("default texture entry: " + textu.ToString()); | ||
608 | } | 610 | } |
609 | 611 | ||
610 | public class NewForce | 612 | public class NewForce |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 7acef97..e64d9f0 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -66,6 +66,10 @@ namespace SimpleApp | |||
66 | public event NewAvatar OnNewAvatar; | 66 | public event NewAvatar OnNewAvatar; |
67 | public event GenericCall6 OnRemoveAvatar; | 67 | public event GenericCall6 OnRemoveAvatar; |
68 | 68 | ||
69 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | ||
70 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | ||
71 | public event RequestTaskInventory OnRequestTaskInventory; | ||
72 | |||
69 | public event UUIDNameRequest OnNameFromUUIDRequest; | 73 | public event UUIDNameRequest OnNameFromUUIDRequest; |
70 | 74 | ||
71 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | 75 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; |
@@ -139,6 +143,8 @@ namespace SimpleApp | |||
139 | 143 | ||
140 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } | 144 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } |
141 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { } | 145 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { } |
146 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | ||
147 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | ||
142 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } | 148 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } |
143 | 149 | ||
144 | public void SendAlertMessage(string message) { } | 150 | public void SendAlertMessage(string message) { } |
diff --git a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs index 2f827cf..7de9d55 100644 --- a/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs +++ b/OpenSim/Region/GridInterfaces/Local/LocalAssetServer.cs | |||
@@ -246,6 +246,18 @@ namespace OpenSim.Region.GridInterfaces.Local | |||
246 | db.Set(store); | 246 | db.Set(store); |
247 | db.Commit(); | 247 | db.Commit(); |
248 | 248 | ||
249 | /* | ||
250 | Image = new AssetBase(); | ||
251 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000008"); | ||
252 | Image.Name = "Default Avatar Face"; | ||
253 | this.LoadAsset(Image, true, "femaleface.j2c"); | ||
254 | store = new AssetStorage(); | ||
255 | store.Data = Image.Data; | ||
256 | store.Name = Image.Name; | ||
257 | store.UUID = Image.FullID; | ||
258 | db.Set(store); | ||
259 | db.Commit();*/ | ||
260 | |||
249 | Image = new AssetBase(); | 261 | Image = new AssetBase(); |
250 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 262 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
251 | Image.Name = "Shape"; | 263 | Image.Name = "Shape"; |