aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AgentCircuitManager.cs
diff options
context:
space:
mode:
authorlbsa712007-10-31 07:28:23 +0000
committerlbsa712007-10-31 07:28:23 +0000
commit064404ab409ddd0a3b25027a98582696295c46fd (patch)
treebd84ec2e23930f76e7cc81c8529ef71936c86dd9 /OpenSim/Framework/AgentCircuitManager.cs
parentmade illogical bitwise operations logical (diff)
downloadopensim-SC_OLD-064404ab409ddd0a3b25027a98582696295c46fd.zip
opensim-SC_OLD-064404ab409ddd0a3b25027a98582696295c46fd.tar.gz
opensim-SC_OLD-064404ab409ddd0a3b25027a98582696295c46fd.tar.bz2
opensim-SC_OLD-064404ab409ddd0a3b25027a98582696295c46fd.tar.xz
* Moved OpenSim/Framework/General to OpenSim/Framework for great justice.
Diffstat (limited to 'OpenSim/Framework/AgentCircuitManager.cs')
-rw-r--r--OpenSim/Framework/AgentCircuitManager.cs127
1 files changed, 127 insertions, 0 deletions
diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs
new file mode 100644
index 0000000..3658feb
--- /dev/null
+++ b/OpenSim/Framework/AgentCircuitManager.cs
@@ -0,0 +1,127 @@
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 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*/
28using System.Collections.Generic;
29using libsecondlife;
30
31namespace OpenSim.Framework
32{
33 public class AgentCircuitManager
34 {
35 public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
36
37 public AgentCircuitManager()
38 {
39 }
40
41 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
42 {
43 AgentCircuitData validcircuit = null;
44 if (AgentCircuits.ContainsKey(circuitcode))
45 {
46 validcircuit = AgentCircuits[circuitcode];
47 }
48 AuthenticateResponse user = new AuthenticateResponse();
49 if (validcircuit == null)
50 {
51 //don't have this circuit code in our list
52 user.Authorised = false;
53 return (user);
54 }
55
56 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
57 {
58 user.Authorised = true;
59 user.LoginInfo = new Login();
60 user.LoginInfo.Agent = agentID;
61 user.LoginInfo.Session = sessionID;
62 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
63 user.LoginInfo.First = validcircuit.firstname;
64 user.LoginInfo.Last = validcircuit.lastname;
65 user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder;
66 user.LoginInfo.BaseFolder = validcircuit.BaseFolder;
67 }
68 else
69 {
70 // Invalid
71 user.Authorised = false;
72 }
73
74 return (user);
75 }
76
77 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
78 {
79 if (AgentCircuits.ContainsKey(circuitCode))
80 {
81 AgentCircuits[circuitCode] = agentData;
82 }
83 else
84 {
85 AgentCircuits.Add(circuitCode, agentData);
86 }
87 }
88
89 public LLVector3 GetPosition(uint circuitCode)
90 {
91 LLVector3 vec = new LLVector3();
92 if (AgentCircuits.ContainsKey(circuitCode))
93 {
94 vec = AgentCircuits[circuitCode].startpos;
95 }
96 return vec;
97 }
98
99 public void UpdateAgentData(AgentCircuitData agentData)
100 {
101 if (AgentCircuits.ContainsKey((uint) agentData.circuitcode))
102 {
103 AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname;
104 AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname;
105 AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos;
106 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
107 }
108 }
109
110 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
111 {
112 if (AgentCircuits.ContainsKey(circuitcode))
113 {
114 AgentCircuits[circuitcode].child = childstatus;
115 }
116 }
117
118 public bool GetAgentChildStatus(uint circuitcode)
119 {
120 if (AgentCircuits.ContainsKey(circuitcode))
121 {
122 return AgentCircuits[circuitcode].child;
123 }
124 return false;
125 }
126 }
127} \ No newline at end of file