diff options
author | Sean Dague | 2007-10-19 20:28:18 +0000 |
---|---|---|
committer | Sean Dague | 2007-10-19 20:28:18 +0000 |
commit | d4bb430f78d9a70137957c8fe42de8fa620597ef (patch) | |
tree | 49612ce0a47acaedfa826d33edbe200c4c2d8b3c /OpenSim/Framework/Communications/LoginService.cs | |
parent | changes to pass nini config object to the modules that get (diff) | |
download | opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.zip opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.tar.gz opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.tar.bz2 opensim-SC-d4bb430f78d9a70137957c8fe42de8fa620597ef.tar.xz |
get rid of all the ^M line endings
Diffstat (limited to 'OpenSim/Framework/Communications/LoginService.cs')
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 630 |
1 files changed, 315 insertions, 315 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 85af5db..674c746 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -1,315 +1,315 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Security.Cryptography; | 33 | using System.Security.Cryptography; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.Framework.Inventory; | 38 | using OpenSim.Framework.Inventory; |
39 | using OpenSim.Framework.Types; | 39 | using OpenSim.Framework.Types; |
40 | using OpenSim.Framework.Utilities; | 40 | using OpenSim.Framework.Utilities; |
41 | 41 | ||
42 | using OpenSim.Framework.Configuration; | 42 | using OpenSim.Framework.Configuration; |
43 | using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; | 43 | using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; |
44 | 44 | ||
45 | namespace OpenSim.Framework.UserManagement | 45 | namespace OpenSim.Framework.UserManagement |
46 | { | 46 | { |
47 | public class LoginService | 47 | public class LoginService |
48 | { | 48 | { |
49 | protected string m_welcomeMessage = "Welcome to OpenSim"; | 49 | protected string m_welcomeMessage = "Welcome to OpenSim"; |
50 | protected UserManagerBase m_userManager = null; | 50 | protected UserManagerBase m_userManager = null; |
51 | 51 | ||
52 | public LoginService(UserManagerBase userManager, string welcomeMess) | 52 | public LoginService(UserManagerBase userManager, string welcomeMess) |
53 | { | 53 | { |
54 | m_userManager = userManager; | 54 | m_userManager = userManager; |
55 | if (welcomeMess != "") | 55 | if (welcomeMess != "") |
56 | { | 56 | { |
57 | m_welcomeMessage = welcomeMess; | 57 | m_welcomeMessage = welcomeMess; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// Main user login function | 62 | /// Main user login function |
63 | /// </summary> | 63 | /// </summary> |
64 | /// <param name="request">The XMLRPC request</param> | 64 | /// <param name="request">The XMLRPC request</param> |
65 | /// <returns>The response to send</returns> | 65 | /// <returns>The response to send</returns> |
66 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 66 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
67 | { | 67 | { |
68 | 68 | ||
69 | MainLog.Instance.Verbose("Attempting login now..."); | 69 | MainLog.Instance.Verbose("Attempting login now..."); |
70 | XmlRpcResponse response = new XmlRpcResponse(); | 70 | XmlRpcResponse response = new XmlRpcResponse(); |
71 | Hashtable requestData = (Hashtable)request.Params[0]; | 71 | Hashtable requestData = (Hashtable)request.Params[0]; |
72 | 72 | ||
73 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | 73 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); |
74 | bool GoodLogin = false; | 74 | bool GoodLogin = false; |
75 | 75 | ||
76 | UserProfileData userProfile; | 76 | UserProfileData userProfile; |
77 | LoginResponse logResponse = new LoginResponse(); | 77 | LoginResponse logResponse = new LoginResponse(); |
78 | 78 | ||
79 | if (GoodXML) | 79 | if (GoodXML) |
80 | { | 80 | { |
81 | string firstname = (string)requestData["first"]; | 81 | string firstname = (string)requestData["first"]; |
82 | string lastname = (string)requestData["last"]; | 82 | string lastname = (string)requestData["last"]; |
83 | string passwd = (string)requestData["passwd"]; | 83 | string passwd = (string)requestData["passwd"]; |
84 | 84 | ||
85 | userProfile = GetTheUser(firstname, lastname); | 85 | userProfile = GetTheUser(firstname, lastname); |
86 | if (userProfile == null) | 86 | if (userProfile == null) |
87 | return logResponse.CreateLoginFailedResponse(); | 87 | return logResponse.CreateLoginFailedResponse(); |
88 | 88 | ||
89 | GoodLogin = AuthenticateUser(userProfile, passwd); | 89 | GoodLogin = AuthenticateUser(userProfile, passwd); |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | return logResponse.CreateGridErrorResponse(); | 93 | return logResponse.CreateGridErrorResponse(); |
94 | } | 94 | } |
95 | 95 | ||
96 | if (!GoodLogin) | 96 | if (!GoodLogin) |
97 | { | 97 | { |
98 | return logResponse.CreateLoginFailedResponse(); | 98 | return logResponse.CreateLoginFailedResponse(); |
99 | } | 99 | } |
100 | else | 100 | else |
101 | { | 101 | { |
102 | // If we already have a session... | 102 | // If we already have a session... |
103 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) | 103 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) |
104 | { | 104 | { |
105 | // Reject the login | 105 | // Reject the login |
106 | return logResponse.CreateAlreadyLoggedInResponse(); | 106 | return logResponse.CreateAlreadyLoggedInResponse(); |
107 | } | 107 | } |
108 | // Otherwise... | 108 | // Otherwise... |
109 | // Create a new agent session | 109 | // Create a new agent session |
110 | CreateAgent(userProfile, request); | 110 | CreateAgent(userProfile, request); |
111 | 111 | ||
112 | try | 112 | try |
113 | { | 113 | { |
114 | LLUUID agentID = userProfile.UUID; | 114 | LLUUID agentID = userProfile.UUID; |
115 | 115 | ||
116 | // Inventory Library Section | 116 | // Inventory Library Section |
117 | InventoryData inventData = this.CreateInventoryData(agentID); | 117 | InventoryData inventData = this.CreateInventoryData(agentID); |
118 | ArrayList AgentInventoryArray = inventData.InventoryArray; | 118 | ArrayList AgentInventoryArray = inventData.InventoryArray; |
119 | 119 | ||
120 | Hashtable InventoryRootHash = new Hashtable(); | 120 | Hashtable InventoryRootHash = new Hashtable(); |
121 | InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); | 121 | InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); |
122 | ArrayList InventoryRoot = new ArrayList(); | 122 | ArrayList InventoryRoot = new ArrayList(); |
123 | InventoryRoot.Add(InventoryRootHash); | 123 | InventoryRoot.Add(InventoryRootHash); |
124 | userProfile.rootInventoryFolderID = inventData.RootFolderID; | 124 | userProfile.rootInventoryFolderID = inventData.RootFolderID; |
125 | 125 | ||
126 | // Circuit Code | 126 | // Circuit Code |
127 | uint circode = (uint)(Util.RandomClass.Next()); | 127 | uint circode = (uint)(Util.RandomClass.Next()); |
128 | 128 | ||
129 | logResponse.Lastname = userProfile.surname; | 129 | logResponse.Lastname = userProfile.surname; |
130 | logResponse.Firstname = userProfile.username; | 130 | logResponse.Firstname = userProfile.username; |
131 | logResponse.AgentID = agentID.ToStringHyphenated(); | 131 | logResponse.AgentID = agentID.ToStringHyphenated(); |
132 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); | 132 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); |
133 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); | 133 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); |
134 | logResponse.InventoryRoot = InventoryRoot; | 134 | logResponse.InventoryRoot = InventoryRoot; |
135 | logResponse.InventorySkeleton = AgentInventoryArray; | 135 | logResponse.InventorySkeleton = AgentInventoryArray; |
136 | logResponse.InventoryLibrary = this.GetInventoryLibrary(); | 136 | logResponse.InventoryLibrary = this.GetInventoryLibrary(); |
137 | logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); | 137 | logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); |
138 | logResponse.CircuitCode = (Int32)circode; | 138 | logResponse.CircuitCode = (Int32)circode; |
139 | //logResponse.RegionX = 0; //overwritten | 139 | //logResponse.RegionX = 0; //overwritten |
140 | //logResponse.RegionY = 0; //overwritten | 140 | //logResponse.RegionY = 0; //overwritten |
141 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | 141 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten |
142 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | 142 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; |
143 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | 143 | //logResponse.SimAddress = "127.0.0.1"; //overwritten |
144 | //logResponse.SimPort = 0; //overwritten | 144 | //logResponse.SimPort = 0; //overwritten |
145 | logResponse.Message = this.GetMessage(); | 145 | logResponse.Message = this.GetMessage(); |
146 | 146 | ||
147 | try | 147 | try |
148 | { | 148 | { |
149 | this.CustomiseResponse(logResponse, userProfile); | 149 | this.CustomiseResponse(logResponse, userProfile); |
150 | } | 150 | } |
151 | catch (Exception e) | 151 | catch (Exception e) |
152 | { | 152 | { |
153 | MainLog.Instance.Verbose(e.ToString()); | 153 | MainLog.Instance.Verbose(e.ToString()); |
154 | return logResponse.CreateDeadRegionResponse(); | 154 | return logResponse.CreateDeadRegionResponse(); |
155 | //return logResponse.ToXmlRpcResponse(); | 155 | //return logResponse.ToXmlRpcResponse(); |
156 | } | 156 | } |
157 | CommitAgent(ref userProfile); | 157 | CommitAgent(ref userProfile); |
158 | return logResponse.ToXmlRpcResponse(); | 158 | return logResponse.ToXmlRpcResponse(); |
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | catch (Exception E) | 162 | catch (Exception E) |
163 | { | 163 | { |
164 | MainLog.Instance.Verbose(E.ToString()); | 164 | MainLog.Instance.Verbose(E.ToString()); |
165 | } | 165 | } |
166 | //} | 166 | //} |
167 | } | 167 | } |
168 | return response; | 168 | return response; |
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | /// <summary> | 172 | /// <summary> |
173 | /// Customises the login response and fills in missing values. | 173 | /// Customises the login response and fills in missing values. |
174 | /// </summary> | 174 | /// </summary> |
175 | /// <param name="response">The existing response</param> | 175 | /// <param name="response">The existing response</param> |
176 | /// <param name="theUser">The user profile</param> | 176 | /// <param name="theUser">The user profile</param> |
177 | public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 177 | public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) |
178 | { | 178 | { |
179 | } | 179 | } |
180 | 180 | ||
181 | /// <summary> | 181 | /// <summary> |
182 | /// Saves a target agent to the database | 182 | /// Saves a target agent to the database |
183 | /// </summary> | 183 | /// </summary> |
184 | /// <param name="profile">The users profile</param> | 184 | /// <param name="profile">The users profile</param> |
185 | /// <returns>Successful?</returns> | 185 | /// <returns>Successful?</returns> |
186 | public bool CommitAgent(ref UserProfileData profile) | 186 | public bool CommitAgent(ref UserProfileData profile) |
187 | { | 187 | { |
188 | // Saves the agent to database | 188 | // Saves the agent to database |
189 | return true; | 189 | return true; |
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
193 | /// <summary> | 193 | /// <summary> |
194 | /// Checks a user against it's password hash | 194 | /// Checks a user against it's password hash |
195 | /// </summary> | 195 | /// </summary> |
196 | /// <param name="profile">The users profile</param> | 196 | /// <param name="profile">The users profile</param> |
197 | /// <param name="password">The supplied password</param> | 197 | /// <param name="password">The supplied password</param> |
198 | /// <returns>Authenticated?</returns> | 198 | /// <returns>Authenticated?</returns> |
199 | public virtual bool AuthenticateUser(UserProfileData profile, string password) | 199 | public virtual bool AuthenticateUser(UserProfileData profile, string password) |
200 | { | 200 | { |
201 | 201 | ||
202 | MainLog.Instance.Verbose( | 202 | MainLog.Instance.Verbose( |
203 | "Authenticating " + profile.username + " " + profile.surname); | 203 | "Authenticating " + profile.username + " " + profile.surname); |
204 | 204 | ||
205 | password = password.Remove(0, 3); //remove $1$ | 205 | password = password.Remove(0, 3); //remove $1$ |
206 | 206 | ||
207 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | 207 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); |
208 | 208 | ||
209 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); | 209 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); |
210 | } | 210 | } |
211 | 211 | ||
212 | /// <summary> | 212 | /// <summary> |
213 | /// | 213 | /// |
214 | /// </summary> | 214 | /// </summary> |
215 | /// <param name="profile"></param> | 215 | /// <param name="profile"></param> |
216 | /// <param name="request"></param> | 216 | /// <param name="request"></param> |
217 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 217 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
218 | { | 218 | { |
219 | this.m_userManager.CreateAgent(profile, request); | 219 | this.m_userManager.CreateAgent(profile, request); |
220 | } | 220 | } |
221 | 221 | ||
222 | /// <summary> | 222 | /// <summary> |
223 | /// | 223 | /// |
224 | /// </summary> | 224 | /// </summary> |
225 | /// <param name="firstname"></param> | 225 | /// <param name="firstname"></param> |
226 | /// <param name="lastname"></param> | 226 | /// <param name="lastname"></param> |
227 | /// <returns></returns> | 227 | /// <returns></returns> |
228 | public virtual UserProfileData GetTheUser(string firstname, string lastname) | 228 | public virtual UserProfileData GetTheUser(string firstname, string lastname) |
229 | { | 229 | { |
230 | return this.m_userManager.GetUserProfile(firstname, lastname); | 230 | return this.m_userManager.GetUserProfile(firstname, lastname); |
231 | } | 231 | } |
232 | 232 | ||
233 | /// <summary> | 233 | /// <summary> |
234 | /// | 234 | /// |
235 | /// </summary> | 235 | /// </summary> |
236 | /// <returns></returns> | 236 | /// <returns></returns> |
237 | public virtual string GetMessage() | 237 | public virtual string GetMessage() |
238 | { | 238 | { |
239 | return m_welcomeMessage; | 239 | return m_welcomeMessage; |
240 | } | 240 | } |
241 | 241 | ||
242 | /// <summary> | 242 | /// <summary> |
243 | /// | 243 | /// |
244 | /// </summary> | 244 | /// </summary> |
245 | /// <returns></returns> | 245 | /// <returns></returns> |
246 | protected virtual ArrayList GetInventoryLibrary() | 246 | protected virtual ArrayList GetInventoryLibrary() |
247 | { | 247 | { |
248 | //return new ArrayList(); | 248 | //return new ArrayList(); |
249 | Hashtable TempHash = new Hashtable(); | 249 | Hashtable TempHash = new Hashtable(); |
250 | TempHash["name"] = "OpenSim Library"; | 250 | TempHash["name"] = "OpenSim Library"; |
251 | TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); | 251 | TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); |
252 | TempHash["version"] = 1; | 252 | TempHash["version"] = 1; |
253 | TempHash["type_default"] = -1; | 253 | TempHash["type_default"] = -1; |
254 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; | 254 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; |
255 | ArrayList temp = new ArrayList(); | 255 | ArrayList temp = new ArrayList(); |
256 | temp.Add(TempHash); | 256 | temp.Add(TempHash); |
257 | 257 | ||
258 | TempHash = new Hashtable(); | 258 | TempHash = new Hashtable(); |
259 | TempHash["name"] = "Texture Library"; | 259 | TempHash["name"] = "Texture Library"; |
260 | TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; | 260 | TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; |
261 | TempHash["version"] = 1; | 261 | TempHash["version"] = 1; |
262 | TempHash["type_default"] = -1; | 262 | TempHash["type_default"] = -1; |
263 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; | 263 | TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; |
264 | temp.Add(TempHash); | 264 | temp.Add(TempHash); |
265 | return temp; | 265 | return temp; |
266 | } | 266 | } |
267 | 267 | ||
268 | /// <summary> | 268 | /// <summary> |
269 | /// | 269 | /// |
270 | /// </summary> | 270 | /// </summary> |
271 | /// <returns></returns> | 271 | /// <returns></returns> |
272 | protected virtual ArrayList GetLibraryOwner() | 272 | protected virtual ArrayList GetLibraryOwner() |
273 | { | 273 | { |
274 | //for now create random inventory library owner | 274 | //for now create random inventory library owner |
275 | Hashtable TempHash = new Hashtable(); | 275 | Hashtable TempHash = new Hashtable(); |
276 | TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; | 276 | TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; |
277 | ArrayList inventoryLibOwner = new ArrayList(); | 277 | ArrayList inventoryLibOwner = new ArrayList(); |
278 | inventoryLibOwner.Add(TempHash); | 278 | inventoryLibOwner.Add(TempHash); |
279 | return inventoryLibOwner; | 279 | return inventoryLibOwner; |
280 | } | 280 | } |
281 | 281 | ||
282 | protected virtual InventoryData CreateInventoryData(LLUUID userID) | 282 | protected virtual InventoryData CreateInventoryData(LLUUID userID) |
283 | { | 283 | { |
284 | AgentInventory userInventory = new AgentInventory(); | 284 | AgentInventory userInventory = new AgentInventory(); |
285 | userInventory.CreateRootFolder(userID, false); | 285 | userInventory.CreateRootFolder(userID, false); |
286 | 286 | ||
287 | ArrayList AgentInventoryArray = new ArrayList(); | 287 | ArrayList AgentInventoryArray = new ArrayList(); |
288 | Hashtable TempHash; | 288 | Hashtable TempHash; |
289 | foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) | 289 | foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) |
290 | { | 290 | { |
291 | TempHash = new Hashtable(); | 291 | TempHash = new Hashtable(); |
292 | TempHash["name"] = InvFolder.FolderName; | 292 | TempHash["name"] = InvFolder.FolderName; |
293 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 293 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
294 | TempHash["version"] = (Int32)InvFolder.Version; | 294 | TempHash["version"] = (Int32)InvFolder.Version; |
295 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 295 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; |
296 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 296 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
297 | AgentInventoryArray.Add(TempHash); | 297 | AgentInventoryArray.Add(TempHash); |
298 | } | 298 | } |
299 | 299 | ||
300 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); | 300 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); |
301 | } | 301 | } |
302 | 302 | ||
303 | public class InventoryData | 303 | public class InventoryData |
304 | { | 304 | { |
305 | public ArrayList InventoryArray = null; | 305 | public ArrayList InventoryArray = null; |
306 | public LLUUID RootFolderID = LLUUID.Zero; | 306 | public LLUUID RootFolderID = LLUUID.Zero; |
307 | 307 | ||
308 | public InventoryData(ArrayList invList, LLUUID rootID) | 308 | public InventoryData(ArrayList invList, LLUUID rootID) |
309 | { | 309 | { |
310 | InventoryArray = invList; | 310 | InventoryArray = invList; |
311 | RootFolderID = rootID; | 311 | RootFolderID = rootID; |
312 | } | 312 | } |
313 | } | 313 | } |
314 | } | 314 | } |
315 | } | 315 | } |