diff options
author | Diva Canto | 2009-12-30 21:00:16 -0800 |
---|---|---|
committer | Diva Canto | 2009-12-30 21:00:16 -0800 |
commit | b29ae7246076126e8e39827564438db6e53eac8a (patch) | |
tree | 873131cf9b1bbbbf517910454c82d7076a8a02fd /OpenSim/Services/LLLoginService/LLLoginResponse.cs | |
parent | Make ScopeID be wild on user queries. Just pass it as UUID.Zero (diff) | |
download | opensim-SC_OLD-b29ae7246076126e8e39827564438db6e53eac8a.zip opensim-SC_OLD-b29ae7246076126e8e39827564438db6e53eac8a.tar.gz opensim-SC_OLD-b29ae7246076126e8e39827564438db6e53eac8a.tar.bz2 opensim-SC_OLD-b29ae7246076126e8e39827564438db6e53eac8a.tar.xz |
First pass at the new login service. Still incomplete, but doesn't disrupt the existing code.
Diffstat (limited to 'OpenSim/Services/LLLoginService/LLLoginResponse.cs')
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginResponse.cs | 740 |
1 files changed, 740 insertions, 0 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs new file mode 100644 index 0000000..e3935a8 --- /dev/null +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -0,0 +1,740 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using OpenSim.Framework; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.StructuredData; | ||
36 | |||
37 | namespace OpenSim.Services.LLLoginService | ||
38 | { | ||
39 | public class LLFailedLoginResponse : OpenSim.Services.Interfaces.FailedLoginResponse | ||
40 | { | ||
41 | string m_key; | ||
42 | string m_value; | ||
43 | string m_login; | ||
44 | |||
45 | public static LLFailedLoginResponse UserProblem; | ||
46 | public static LLFailedLoginResponse GridProblem; | ||
47 | public static LLFailedLoginResponse InventoryProblem; | ||
48 | public static LLFailedLoginResponse DeadRegionProblem; | ||
49 | public static LLFailedLoginResponse LoginBlockedProblem; | ||
50 | public static LLFailedLoginResponse AlreadyLoggedInProblem; | ||
51 | public static LLFailedLoginResponse InternalError; | ||
52 | |||
53 | static LLFailedLoginResponse() | ||
54 | { | ||
55 | UserProblem = new LLFailedLoginResponse("key", | ||
56 | "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", | ||
57 | "false"); | ||
58 | GridProblem = new LLFailedLoginResponse("key", | ||
59 | "Error connecting to grid. Could not percieve credentials from login XML.", | ||
60 | "false"); | ||
61 | InventoryProblem = new LLFailedLoginResponse("key", | ||
62 | "The inventory service is not responding. Please notify your login region operator.", | ||
63 | "false"); | ||
64 | DeadRegionProblem = new LLFailedLoginResponse("key", | ||
65 | "The region you are attempting to log into is not responding. Please select another region and try again.", | ||
66 | "false"); | ||
67 | LoginBlockedProblem = new LLFailedLoginResponse("presence", | ||
68 | "Logins are currently restricted. Please try again later.", | ||
69 | "false"); | ||
70 | AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", | ||
71 | "You appear to be already logged in. " + | ||
72 | "If this is not the case please wait for your session to timeout. " + | ||
73 | "If this takes longer than a few minutes please contact the grid owner. " + | ||
74 | "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", | ||
75 | "false"); | ||
76 | InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false"); | ||
77 | } | ||
78 | |||
79 | public LLFailedLoginResponse(string key, string value, string login) | ||
80 | { | ||
81 | m_key = key; | ||
82 | m_value = value; | ||
83 | m_login = login; | ||
84 | } | ||
85 | |||
86 | public override Hashtable ToHashtable() | ||
87 | { | ||
88 | Hashtable loginError = new Hashtable(); | ||
89 | loginError["reason"] = m_key; | ||
90 | loginError["message"] = m_value; | ||
91 | loginError["login"] = m_login; | ||
92 | return loginError; | ||
93 | } | ||
94 | |||
95 | public OSD ToOSDMap() | ||
96 | { | ||
97 | OSDMap map = new OSDMap(); | ||
98 | |||
99 | map["reason"] = OSD.FromString(m_key); | ||
100 | map["message"] = OSD.FromString(m_value); | ||
101 | map["login"] = OSD.FromString(m_login); | ||
102 | |||
103 | return map; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | /// <summary> | ||
108 | /// A class to handle LL login response. | ||
109 | /// </summary> | ||
110 | public class LLLoginResponse : OpenSim.Services.Interfaces.LoginResponse | ||
111 | { | ||
112 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
113 | private static Hashtable globalTexturesHash; | ||
114 | // Global Textures | ||
115 | private static string sunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
116 | private static string cloudTexture = "dc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
117 | private static string moonTexture = "ec4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
118 | |||
119 | private Hashtable loginFlagsHash; | ||
120 | private Hashtable uiConfigHash; | ||
121 | |||
122 | private ArrayList loginFlags; | ||
123 | private ArrayList globalTextures; | ||
124 | private ArrayList eventCategories; | ||
125 | private ArrayList uiConfig; | ||
126 | private ArrayList classifiedCategories; | ||
127 | private ArrayList inventoryRoot; | ||
128 | private ArrayList initialOutfit; | ||
129 | private ArrayList agentInventory; | ||
130 | private ArrayList inventoryLibraryOwner; | ||
131 | private ArrayList inventoryLibRoot; | ||
132 | private ArrayList inventoryLibrary; | ||
133 | private ArrayList activeGestures; | ||
134 | |||
135 | private UserInfo userProfile; | ||
136 | |||
137 | private UUID agentID; | ||
138 | private UUID sessionID; | ||
139 | private UUID secureSessionID; | ||
140 | |||
141 | // Login Flags | ||
142 | private string dst; | ||
143 | private string stipendSinceLogin; | ||
144 | private string gendered; | ||
145 | private string everLoggedIn; | ||
146 | private string login; | ||
147 | private uint simPort; | ||
148 | private uint simHttpPort; | ||
149 | private string simAddress; | ||
150 | private string agentAccess; | ||
151 | private string agentAccessMax; | ||
152 | private Int32 circuitCode; | ||
153 | private uint regionX; | ||
154 | private uint regionY; | ||
155 | |||
156 | // Login | ||
157 | private string firstname; | ||
158 | private string lastname; | ||
159 | |||
160 | // Error Flags | ||
161 | private string errorReason; | ||
162 | private string errorMessage; | ||
163 | |||
164 | private string welcomeMessage; | ||
165 | private string startLocation; | ||
166 | private string allowFirstLife; | ||
167 | private string home; | ||
168 | private string seedCapability; | ||
169 | private string lookAt; | ||
170 | |||
171 | private BuddyList m_buddyList = null; | ||
172 | |||
173 | static LLLoginResponse() | ||
174 | { | ||
175 | // This is being set, but it's not used | ||
176 | // not sure why. | ||
177 | globalTexturesHash = new Hashtable(); | ||
178 | globalTexturesHash["sun_texture_id"] = sunTexture; | ||
179 | globalTexturesHash["cloud_texture_id"] = cloudTexture; | ||
180 | globalTexturesHash["moon_texture_id"] = moonTexture; | ||
181 | } | ||
182 | |||
183 | public LLLoginResponse() | ||
184 | { | ||
185 | loginFlags = new ArrayList(); | ||
186 | globalTextures = new ArrayList(); | ||
187 | eventCategories = new ArrayList(); | ||
188 | uiConfig = new ArrayList(); | ||
189 | classifiedCategories = new ArrayList(); | ||
190 | |||
191 | uiConfigHash = new Hashtable(); | ||
192 | |||
193 | // defaultXmlRpcResponse = new XmlRpcResponse(); | ||
194 | userProfile = new UserInfo(); | ||
195 | inventoryRoot = new ArrayList(); | ||
196 | initialOutfit = new ArrayList(); | ||
197 | agentInventory = new ArrayList(); | ||
198 | inventoryLibrary = new ArrayList(); | ||
199 | inventoryLibraryOwner = new ArrayList(); | ||
200 | activeGestures = new ArrayList(); | ||
201 | |||
202 | SetDefaultValues(); | ||
203 | } | ||
204 | |||
205 | private void SetDefaultValues() | ||
206 | { | ||
207 | DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; | ||
208 | StipendSinceLogin = "N"; | ||
209 | Gendered = "Y"; | ||
210 | EverLoggedIn = "Y"; | ||
211 | login = "false"; | ||
212 | firstname = "Test"; | ||
213 | lastname = "User"; | ||
214 | agentAccess = "M"; | ||
215 | agentAccessMax = "A"; | ||
216 | startLocation = "last"; | ||
217 | allowFirstLife = "Y"; | ||
218 | |||
219 | ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; | ||
220 | ErrorReason = "key"; | ||
221 | welcomeMessage = "Welcome to OpenSim!"; | ||
222 | seedCapability = String.Empty; | ||
223 | home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" + | ||
224 | userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + | ||
225 | userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + | ||
226 | userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; | ||
227 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | ||
228 | RegionX = (uint) 255232; | ||
229 | RegionY = (uint) 254976; | ||
230 | |||
231 | // Classifieds; | ||
232 | AddClassifiedCategory((Int32) 1, "Shopping"); | ||
233 | AddClassifiedCategory((Int32) 2, "Land Rental"); | ||
234 | AddClassifiedCategory((Int32) 3, "Property Rental"); | ||
235 | AddClassifiedCategory((Int32) 4, "Special Attraction"); | ||
236 | AddClassifiedCategory((Int32) 5, "New Products"); | ||
237 | AddClassifiedCategory((Int32) 6, "Employment"); | ||
238 | AddClassifiedCategory((Int32) 7, "Wanted"); | ||
239 | AddClassifiedCategory((Int32) 8, "Service"); | ||
240 | AddClassifiedCategory((Int32) 9, "Personal"); | ||
241 | |||
242 | SessionID = UUID.Random(); | ||
243 | SecureSessionID = UUID.Random(); | ||
244 | AgentID = UUID.Random(); | ||
245 | |||
246 | Hashtable InitialOutfitHash = new Hashtable(); | ||
247 | InitialOutfitHash["folder_name"] = "Nightclub Female"; | ||
248 | InitialOutfitHash["gender"] = "female"; | ||
249 | initialOutfit.Add(InitialOutfitHash); | ||
250 | } | ||
251 | |||
252 | |||
253 | public override Hashtable ToHashtable() | ||
254 | { | ||
255 | try | ||
256 | { | ||
257 | Hashtable responseData = new Hashtable(); | ||
258 | |||
259 | loginFlagsHash = new Hashtable(); | ||
260 | loginFlagsHash["daylight_savings"] = DST; | ||
261 | loginFlagsHash["stipend_since_login"] = StipendSinceLogin; | ||
262 | loginFlagsHash["gendered"] = Gendered; | ||
263 | loginFlagsHash["ever_logged_in"] = EverLoggedIn; | ||
264 | loginFlags.Add(loginFlagsHash); | ||
265 | |||
266 | responseData["first_name"] = Firstname; | ||
267 | responseData["last_name"] = Lastname; | ||
268 | responseData["agent_access"] = agentAccess; | ||
269 | responseData["agent_access_max"] = agentAccessMax; | ||
270 | |||
271 | globalTextures.Add(globalTexturesHash); | ||
272 | // this.eventCategories.Add(this.eventCategoriesHash); | ||
273 | |||
274 | AddToUIConfig("allow_first_life", allowFirstLife); | ||
275 | uiConfig.Add(uiConfigHash); | ||
276 | |||
277 | responseData["sim_port"] = (Int32) SimPort; | ||
278 | responseData["sim_ip"] = SimAddress; | ||
279 | responseData["http_port"] = (Int32)SimHttpPort; | ||
280 | |||
281 | responseData["agent_id"] = AgentID.ToString(); | ||
282 | responseData["session_id"] = SessionID.ToString(); | ||
283 | responseData["secure_session_id"] = SecureSessionID.ToString(); | ||
284 | responseData["circuit_code"] = CircuitCode; | ||
285 | responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
286 | responseData["login-flags"] = loginFlags; | ||
287 | responseData["global-textures"] = globalTextures; | ||
288 | responseData["seed_capability"] = seedCapability; | ||
289 | |||
290 | responseData["event_categories"] = eventCategories; | ||
291 | responseData["event_notifications"] = new ArrayList(); // todo | ||
292 | responseData["classified_categories"] = classifiedCategories; | ||
293 | responseData["ui-config"] = uiConfig; | ||
294 | |||
295 | if (agentInventory != null) | ||
296 | { | ||
297 | responseData["inventory-skeleton"] = agentInventory; | ||
298 | responseData["inventory-root"] = inventoryRoot; | ||
299 | } | ||
300 | responseData["inventory-skel-lib"] = inventoryLibrary; | ||
301 | responseData["inventory-lib-root"] = inventoryLibRoot; | ||
302 | responseData["gestures"] = activeGestures; | ||
303 | responseData["inventory-lib-owner"] = inventoryLibraryOwner; | ||
304 | responseData["initial-outfit"] = initialOutfit; | ||
305 | responseData["start_location"] = startLocation; | ||
306 | responseData["seed_capability"] = seedCapability; | ||
307 | responseData["home"] = home; | ||
308 | responseData["look_at"] = lookAt; | ||
309 | responseData["message"] = welcomeMessage; | ||
310 | responseData["region_x"] = (Int32)(RegionX * Constants.RegionSize); | ||
311 | responseData["region_y"] = (Int32)(RegionY * Constants.RegionSize); | ||
312 | |||
313 | if (m_buddyList != null) | ||
314 | { | ||
315 | responseData["buddy-list"] = m_buddyList.ToArray(); | ||
316 | } | ||
317 | |||
318 | responseData["login"] = "true"; | ||
319 | |||
320 | return responseData; | ||
321 | } | ||
322 | catch (Exception e) | ||
323 | { | ||
324 | m_log.Warn("[CLIENT]: LoginResponse: Error creating Hashtable Response: " + e.Message); | ||
325 | |||
326 | return LLFailedLoginResponse.InternalError.ToHashtable(); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | public OSD ToLLSDResponse() | ||
331 | { | ||
332 | try | ||
333 | { | ||
334 | OSDMap map = new OSDMap(); | ||
335 | |||
336 | map["first_name"] = OSD.FromString(Firstname); | ||
337 | map["last_name"] = OSD.FromString(Lastname); | ||
338 | map["agent_access"] = OSD.FromString(agentAccess); | ||
339 | map["agent_access_max"] = OSD.FromString(agentAccessMax); | ||
340 | |||
341 | map["sim_port"] = OSD.FromInteger(SimPort); | ||
342 | map["sim_ip"] = OSD.FromString(SimAddress); | ||
343 | |||
344 | map["agent_id"] = OSD.FromUUID(AgentID); | ||
345 | map["session_id"] = OSD.FromUUID(SessionID); | ||
346 | map["secure_session_id"] = OSD.FromUUID(SecureSessionID); | ||
347 | map["circuit_code"] = OSD.FromInteger(CircuitCode); | ||
348 | map["seconds_since_epoch"] = OSD.FromInteger((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds); | ||
349 | |||
350 | #region Login Flags | ||
351 | |||
352 | OSDMap loginFlagsLLSD = new OSDMap(); | ||
353 | loginFlagsLLSD["daylight_savings"] = OSD.FromString(DST); | ||
354 | loginFlagsLLSD["stipend_since_login"] = OSD.FromString(StipendSinceLogin); | ||
355 | loginFlagsLLSD["gendered"] = OSD.FromString(Gendered); | ||
356 | loginFlagsLLSD["ever_logged_in"] = OSD.FromString(EverLoggedIn); | ||
357 | map["login-flags"] = WrapOSDMap(loginFlagsLLSD); | ||
358 | |||
359 | #endregion Login Flags | ||
360 | |||
361 | #region Global Textures | ||
362 | |||
363 | OSDMap globalTexturesLLSD = new OSDMap(); | ||
364 | globalTexturesLLSD["sun_texture_id"] = OSD.FromString(SunTexture); | ||
365 | globalTexturesLLSD["cloud_texture_id"] = OSD.FromString(CloudTexture); | ||
366 | globalTexturesLLSD["moon_texture_id"] = OSD.FromString(MoonTexture); | ||
367 | |||
368 | map["global-textures"] = WrapOSDMap(globalTexturesLLSD); | ||
369 | |||
370 | #endregion Global Textures | ||
371 | |||
372 | map["seed_capability"] = OSD.FromString(seedCapability); | ||
373 | |||
374 | map["event_categories"] = ArrayListToOSDArray(eventCategories); | ||
375 | //map["event_notifications"] = new OSDArray(); // todo | ||
376 | map["classified_categories"] = ArrayListToOSDArray(classifiedCategories); | ||
377 | |||
378 | #region UI Config | ||
379 | |||
380 | OSDMap uiConfigLLSD = new OSDMap(); | ||
381 | uiConfigLLSD["allow_first_life"] = OSD.FromString(allowFirstLife); | ||
382 | map["ui-config"] = WrapOSDMap(uiConfigLLSD); | ||
383 | |||
384 | #endregion UI Config | ||
385 | |||
386 | #region Inventory | ||
387 | |||
388 | map["inventory-skeleton"] = ArrayListToOSDArray(agentInventory); | ||
389 | |||
390 | map["inventory-skel-lib"] = ArrayListToOSDArray(inventoryLibrary); | ||
391 | map["inventory-root"] = ArrayListToOSDArray(inventoryRoot); ; | ||
392 | map["inventory-lib-root"] = ArrayListToOSDArray(inventoryLibRoot); | ||
393 | map["inventory-lib-owner"] = ArrayListToOSDArray(inventoryLibraryOwner); | ||
394 | |||
395 | #endregion Inventory | ||
396 | |||
397 | map["gestures"] = ArrayListToOSDArray(activeGestures); | ||
398 | |||
399 | map["initial-outfit"] = ArrayListToOSDArray(initialOutfit); | ||
400 | map["start_location"] = OSD.FromString(startLocation); | ||
401 | |||
402 | map["seed_capability"] = OSD.FromString(seedCapability); | ||
403 | map["home"] = OSD.FromString(home); | ||
404 | map["look_at"] = OSD.FromString(lookAt); | ||
405 | map["message"] = OSD.FromString(welcomeMessage); | ||
406 | map["region_x"] = OSD.FromInteger(RegionX * Constants.RegionSize); | ||
407 | map["region_y"] = OSD.FromInteger(RegionY * Constants.RegionSize); | ||
408 | |||
409 | if (m_buddyList != null) | ||
410 | { | ||
411 | map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); | ||
412 | } | ||
413 | |||
414 | map["login"] = OSD.FromString("true"); | ||
415 | |||
416 | return map; | ||
417 | } | ||
418 | catch (Exception e) | ||
419 | { | ||
420 | m_log.Warn("[CLIENT]: LoginResponse: Error creating LLSD Response: " + e.Message); | ||
421 | |||
422 | return LLFailedLoginResponse.InternalError.ToOSDMap(); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | public OSDArray ArrayListToOSDArray(ArrayList arrlst) | ||
427 | { | ||
428 | OSDArray llsdBack = new OSDArray(); | ||
429 | foreach (Hashtable ht in arrlst) | ||
430 | { | ||
431 | OSDMap mp = new OSDMap(); | ||
432 | foreach (DictionaryEntry deHt in ht) | ||
433 | { | ||
434 | mp.Add((string)deHt.Key, OSDString.FromObject(deHt.Value)); | ||
435 | } | ||
436 | llsdBack.Add(mp); | ||
437 | } | ||
438 | return llsdBack; | ||
439 | } | ||
440 | |||
441 | private static OSDArray WrapOSDMap(OSDMap wrapMe) | ||
442 | { | ||
443 | OSDArray array = new OSDArray(); | ||
444 | array.Add(wrapMe); | ||
445 | return array; | ||
446 | } | ||
447 | |||
448 | public void SetEventCategories(string category, string value) | ||
449 | { | ||
450 | // this.eventCategoriesHash[category] = value; | ||
451 | //TODO | ||
452 | } | ||
453 | |||
454 | public void AddToUIConfig(string itemName, string item) | ||
455 | { | ||
456 | uiConfigHash[itemName] = item; | ||
457 | } | ||
458 | |||
459 | public void AddClassifiedCategory(Int32 ID, string categoryName) | ||
460 | { | ||
461 | Hashtable hash = new Hashtable(); | ||
462 | hash["category_name"] = categoryName; | ||
463 | hash["category_id"] = ID; | ||
464 | classifiedCategories.Add(hash); | ||
465 | // this.classifiedCategoriesHash.Clear(); | ||
466 | } | ||
467 | |||
468 | #region Properties | ||
469 | |||
470 | public string Login | ||
471 | { | ||
472 | get { return login; } | ||
473 | set { login = value; } | ||
474 | } | ||
475 | |||
476 | public string DST | ||
477 | { | ||
478 | get { return dst; } | ||
479 | set { dst = value; } | ||
480 | } | ||
481 | |||
482 | public string StipendSinceLogin | ||
483 | { | ||
484 | get { return stipendSinceLogin; } | ||
485 | set { stipendSinceLogin = value; } | ||
486 | } | ||
487 | |||
488 | public string Gendered | ||
489 | { | ||
490 | get { return gendered; } | ||
491 | set { gendered = value; } | ||
492 | } | ||
493 | |||
494 | public string EverLoggedIn | ||
495 | { | ||
496 | get { return everLoggedIn; } | ||
497 | set { everLoggedIn = value; } | ||
498 | } | ||
499 | |||
500 | public uint SimPort | ||
501 | { | ||
502 | get { return simPort; } | ||
503 | set { simPort = value; } | ||
504 | } | ||
505 | |||
506 | public uint SimHttpPort | ||
507 | { | ||
508 | get { return simHttpPort; } | ||
509 | set { simHttpPort = value; } | ||
510 | } | ||
511 | |||
512 | public string SimAddress | ||
513 | { | ||
514 | get { return simAddress; } | ||
515 | set { simAddress = value; } | ||
516 | } | ||
517 | |||
518 | public UUID AgentID | ||
519 | { | ||
520 | get { return agentID; } | ||
521 | set { agentID = value; } | ||
522 | } | ||
523 | |||
524 | public UUID SessionID | ||
525 | { | ||
526 | get { return sessionID; } | ||
527 | set { sessionID = value; } | ||
528 | } | ||
529 | |||
530 | public UUID SecureSessionID | ||
531 | { | ||
532 | get { return secureSessionID; } | ||
533 | set { secureSessionID = value; } | ||
534 | } | ||
535 | |||
536 | public Int32 CircuitCode | ||
537 | { | ||
538 | get { return circuitCode; } | ||
539 | set { circuitCode = value; } | ||
540 | } | ||
541 | |||
542 | public uint RegionX | ||
543 | { | ||
544 | get { return regionX; } | ||
545 | set { regionX = value; } | ||
546 | } | ||
547 | |||
548 | public uint RegionY | ||
549 | { | ||
550 | get { return regionY; } | ||
551 | set { regionY = value; } | ||
552 | } | ||
553 | |||
554 | public string SunTexture | ||
555 | { | ||
556 | get { return sunTexture; } | ||
557 | set { sunTexture = value; } | ||
558 | } | ||
559 | |||
560 | public string CloudTexture | ||
561 | { | ||
562 | get { return cloudTexture; } | ||
563 | set { cloudTexture = value; } | ||
564 | } | ||
565 | |||
566 | public string MoonTexture | ||
567 | { | ||
568 | get { return moonTexture; } | ||
569 | set { moonTexture = value; } | ||
570 | } | ||
571 | |||
572 | public string Firstname | ||
573 | { | ||
574 | get { return firstname; } | ||
575 | set { firstname = value; } | ||
576 | } | ||
577 | |||
578 | public string Lastname | ||
579 | { | ||
580 | get { return lastname; } | ||
581 | set { lastname = value; } | ||
582 | } | ||
583 | |||
584 | public string AgentAccess | ||
585 | { | ||
586 | get { return agentAccess; } | ||
587 | set { agentAccess = value; } | ||
588 | } | ||
589 | |||
590 | public string AgentAccessMax | ||
591 | { | ||
592 | get { return agentAccessMax; } | ||
593 | set { agentAccessMax = value; } | ||
594 | } | ||
595 | |||
596 | public string StartLocation | ||
597 | { | ||
598 | get { return startLocation; } | ||
599 | set { startLocation = value; } | ||
600 | } | ||
601 | |||
602 | public string LookAt | ||
603 | { | ||
604 | get { return lookAt; } | ||
605 | set { lookAt = value; } | ||
606 | } | ||
607 | |||
608 | public string SeedCapability | ||
609 | { | ||
610 | get { return seedCapability; } | ||
611 | set { seedCapability = value; } | ||
612 | } | ||
613 | |||
614 | public string ErrorReason | ||
615 | { | ||
616 | get { return errorReason; } | ||
617 | set { errorReason = value; } | ||
618 | } | ||
619 | |||
620 | public string ErrorMessage | ||
621 | { | ||
622 | get { return errorMessage; } | ||
623 | set { errorMessage = value; } | ||
624 | } | ||
625 | |||
626 | public ArrayList InventoryRoot | ||
627 | { | ||
628 | get { return inventoryRoot; } | ||
629 | set { inventoryRoot = value; } | ||
630 | } | ||
631 | |||
632 | public ArrayList InventorySkeleton | ||
633 | { | ||
634 | get { return agentInventory; } | ||
635 | set { agentInventory = value; } | ||
636 | } | ||
637 | |||
638 | public ArrayList InventoryLibrary | ||
639 | { | ||
640 | get { return inventoryLibrary; } | ||
641 | set { inventoryLibrary = value; } | ||
642 | } | ||
643 | |||
644 | public ArrayList InventoryLibraryOwner | ||
645 | { | ||
646 | get { return inventoryLibraryOwner; } | ||
647 | set { inventoryLibraryOwner = value; } | ||
648 | } | ||
649 | |||
650 | public ArrayList InventoryLibRoot | ||
651 | { | ||
652 | get { return inventoryLibRoot; } | ||
653 | set { inventoryLibRoot = value; } | ||
654 | } | ||
655 | |||
656 | public ArrayList ActiveGestures | ||
657 | { | ||
658 | get { return activeGestures; } | ||
659 | set { activeGestures = value; } | ||
660 | } | ||
661 | |||
662 | public string Home | ||
663 | { | ||
664 | get { return home; } | ||
665 | set { home = value; } | ||
666 | } | ||
667 | |||
668 | public string Message | ||
669 | { | ||
670 | get { return welcomeMessage; } | ||
671 | set { welcomeMessage = value; } | ||
672 | } | ||
673 | |||
674 | public BuddyList BuddList | ||
675 | { | ||
676 | get { return m_buddyList; } | ||
677 | set { m_buddyList = value; } | ||
678 | } | ||
679 | |||
680 | #endregion | ||
681 | |||
682 | public class UserInfo | ||
683 | { | ||
684 | public string firstname; | ||
685 | public string lastname; | ||
686 | public ulong homeregionhandle; | ||
687 | public Vector3 homepos; | ||
688 | public Vector3 homelookat; | ||
689 | } | ||
690 | |||
691 | public class BuddyList | ||
692 | { | ||
693 | public List<BuddyInfo> Buddies = new List<BuddyInfo>(); | ||
694 | |||
695 | public void AddNewBuddy(BuddyInfo buddy) | ||
696 | { | ||
697 | if (!Buddies.Contains(buddy)) | ||
698 | { | ||
699 | Buddies.Add(buddy); | ||
700 | } | ||
701 | } | ||
702 | |||
703 | public ArrayList ToArray() | ||
704 | { | ||
705 | ArrayList buddyArray = new ArrayList(); | ||
706 | foreach (BuddyInfo buddy in Buddies) | ||
707 | { | ||
708 | buddyArray.Add(buddy.ToHashTable()); | ||
709 | } | ||
710 | return buddyArray; | ||
711 | } | ||
712 | |||
713 | public class BuddyInfo | ||
714 | { | ||
715 | public int BuddyRightsHave = 1; | ||
716 | public int BuddyRightsGiven = 1; | ||
717 | public UUID BuddyID; | ||
718 | |||
719 | public BuddyInfo(string buddyID) | ||
720 | { | ||
721 | BuddyID = new UUID(buddyID); | ||
722 | } | ||
723 | |||
724 | public BuddyInfo(UUID buddyID) | ||
725 | { | ||
726 | BuddyID = buddyID; | ||
727 | } | ||
728 | |||
729 | public Hashtable ToHashTable() | ||
730 | { | ||
731 | Hashtable hTable = new Hashtable(); | ||
732 | hTable["buddy_rights_has"] = BuddyRightsHave; | ||
733 | hTable["buddy_rights_given"] = BuddyRightsGiven; | ||
734 | hTable["buddy_id"] = BuddyID.ToString(); | ||
735 | return hTable; | ||
736 | } | ||
737 | } | ||
738 | } | ||
739 | } | ||
740 | } | ||