diff options
author | MW | 2007-07-19 20:21:02 +0000 |
---|---|---|
committer | MW | 2007-07-19 20:21:02 +0000 |
commit | b2c6f316e16e9bb33f81997319a4130fa683bc48 (patch) | |
tree | 632f901a43267c2f3a7c0de8feff2e4ddc845275 /OpenSim/Framework | |
parent | *Handler Functions can now refuse an object as invalid by returning false, th... (diff) | |
download | opensim-SC-b2c6f316e16e9bb33f81997319a4130fa683bc48.zip opensim-SC-b2c6f316e16e9bb33f81997319a4130fa683bc48.tar.gz opensim-SC-b2c6f316e16e9bb33f81997319a4130fa683bc48.tar.bz2 opensim-SC-b2c6f316e16e9bb33f81997319a4130fa683bc48.tar.xz |
Some work on Inventory (not yet finished or enabled)
Diffstat (limited to 'OpenSim/Framework')
-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 |
7 files changed, 100 insertions, 15 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()); |