diff options
author | lbsa71 | 2007-07-16 23:25:35 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-16 23:25:35 +0000 |
commit | 497ab5d7abec3c644a6340c1c64a2557dbade0ef (patch) | |
tree | 6ff6d849c724db80116205c3bbad6b704c73126d /OpenSim/Framework/General/AgentCircuitManager.cs | |
parent | * Trimmed a few hundred warnings off SimpleApp. (diff) | |
download | opensim-SC-497ab5d7abec3c644a6340c1c64a2557dbade0ef.zip opensim-SC-497ab5d7abec3c644a6340c1c64a2557dbade0ef.tar.gz opensim-SC-497ab5d7abec3c644a6340c1c64a2557dbade0ef.tar.bz2 opensim-SC-497ab5d7abec3c644a6340c1c64a2557dbade0ef.tar.xz |
* RegionApplicationBase restructuring now complete
* Still has some weird bug in SimpleApp though.
Diffstat (limited to 'OpenSim/Framework/General/AgentCircuitManager.cs')
-rw-r--r-- | OpenSim/Framework/General/AgentCircuitManager.cs | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/AgentCircuitManager.cs b/OpenSim/Framework/General/AgentCircuitManager.cs new file mode 100644 index 0000000..c19d6b1 --- /dev/null +++ b/OpenSim/Framework/General/AgentCircuitManager.cs | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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.Collections.Generic; | ||
29 | using libsecondlife; | ||
30 | using OpenSim.Framework.Interfaces; | ||
31 | using OpenSim.Framework.Types; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | public class AgentCircuitManager | ||
36 | { | ||
37 | public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>(); | ||
38 | |||
39 | public AgentCircuitManager() | ||
40 | { | ||
41 | |||
42 | } | ||
43 | |||
44 | public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
45 | { | ||
46 | AgentCircuitData validcircuit = null; | ||
47 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
48 | { | ||
49 | validcircuit = this.AgentCircuits[circuitcode]; | ||
50 | } | ||
51 | AuthenticateResponse user = new AuthenticateResponse(); | ||
52 | if (validcircuit == null) | ||
53 | { | ||
54 | //don't have this circuit code in our list | ||
55 | user.Authorised = false; | ||
56 | return (user); | ||
57 | } | ||
58 | |||
59 | if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID)) | ||
60 | { | ||
61 | user.Authorised = true; | ||
62 | user.LoginInfo = new Login(); | ||
63 | user.LoginInfo.Agent = agentID; | ||
64 | user.LoginInfo.Session = sessionID; | ||
65 | user.LoginInfo.SecureSession = validcircuit.SecureSessionID; | ||
66 | user.LoginInfo.First = validcircuit.firstname; | ||
67 | user.LoginInfo.Last = validcircuit.lastname; | ||
68 | user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder; | ||
69 | user.LoginInfo.BaseFolder = validcircuit.BaseFolder; | ||
70 | } | ||
71 | else | ||
72 | { | ||
73 | // Invalid | ||
74 | user.Authorised = false; | ||
75 | } | ||
76 | |||
77 | return (user); | ||
78 | } | ||
79 | |||
80 | public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) | ||
81 | { | ||
82 | if (this.AgentCircuits.ContainsKey(circuitCode)) | ||
83 | { | ||
84 | this.AgentCircuits[circuitCode] = agentData; | ||
85 | } | ||
86 | else | ||
87 | { | ||
88 | this.AgentCircuits.Add(circuitCode, agentData); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | public LLVector3 GetPosition(uint circuitCode) | ||
93 | { | ||
94 | LLVector3 vec = new LLVector3(); | ||
95 | if (this.AgentCircuits.ContainsKey(circuitCode)) | ||
96 | { | ||
97 | vec = this.AgentCircuits[circuitCode].startpos; | ||
98 | } | ||
99 | return vec; | ||
100 | } | ||
101 | |||
102 | public void UpdateAgentData(AgentCircuitData agentData) | ||
103 | { | ||
104 | if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) | ||
105 | { | ||
106 | this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; | ||
107 | this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; | ||
108 | this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; | ||
109 | // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) | ||
114 | { | ||
115 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
116 | { | ||
117 | this.AgentCircuits[circuitcode].child = childstatus; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | public bool GetAgentChildStatus(uint circuitcode) | ||
122 | { | ||
123 | if (this.AgentCircuits.ContainsKey(circuitcode)) | ||
124 | { | ||
125 | return this.AgentCircuits[circuitcode].child; | ||
126 | } | ||
127 | return false; | ||
128 | } | ||
129 | } | ||
130 | } \ No newline at end of file | ||