aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/AuthenticateSessionBase.cs
diff options
context:
space:
mode:
authorMW2007-06-27 15:28:52 +0000
committerMW2007-06-27 15:28:52 +0000
commit646bbbc84b8010e0dacbeed5342cdb045f46cc49 (patch)
tree770b34d19855363c3c113ab9a0af9a56d821d887 /OpenSim/Framework/General/AuthenticateSessionBase.cs
downloadopensim-SC_OLD-646bbbc84b8010e0dacbeed5342cdb045f46cc49.zip
opensim-SC_OLD-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.gz
opensim-SC_OLD-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.bz2
opensim-SC_OLD-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.xz
Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces.
Diffstat (limited to 'OpenSim/Framework/General/AuthenticateSessionBase.cs')
-rw-r--r--OpenSim/Framework/General/AuthenticateSessionBase.cs132
1 files changed, 132 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/AuthenticateSessionBase.cs b/OpenSim/Framework/General/AuthenticateSessionBase.cs
new file mode 100644
index 0000000..73dd3e2
--- /dev/null
+++ b/OpenSim/Framework/General/AuthenticateSessionBase.cs
@@ -0,0 +1,132 @@
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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types;
34
35namespace OpenSim.Framework
36{
37 public class AuthenticateSessionsBase
38 {
39 public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
40
41 public AuthenticateSessionsBase()
42 {
43
44 }
45
46 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
47 {
48 AgentCircuitData validcircuit = null;
49 if (this.AgentCircuits.ContainsKey(circuitcode))
50 {
51 validcircuit = this.AgentCircuits[circuitcode];
52 }
53 AuthenticateResponse user = new AuthenticateResponse();
54 if (validcircuit == null)
55 {
56 //don't have this circuit code in our list
57 user.Authorised = false;
58 return (user);
59 }
60
61 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
62 {
63 user.Authorised = true;
64 user.LoginInfo = new Login();
65 user.LoginInfo.Agent = agentID;
66 user.LoginInfo.Session = sessionID;
67 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
68 user.LoginInfo.First = validcircuit.firstname;
69 user.LoginInfo.Last = validcircuit.lastname;
70 user.LoginInfo.InventoryFolder = validcircuit.InventoryFolder;
71 user.LoginInfo.BaseFolder = validcircuit.BaseFolder;
72 }
73 else
74 {
75 // Invalid
76 user.Authorised = false;
77 }
78
79 return (user);
80 }
81
82 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
83 {
84 if (this.AgentCircuits.ContainsKey(circuitCode))
85 {
86 this.AgentCircuits[circuitCode] = agentData;
87 }
88 else
89 {
90 this.AgentCircuits.Add(circuitCode, agentData);
91 }
92 }
93
94 public LLVector3 GetPosition(uint circuitCode)
95 {
96 LLVector3 vec = new LLVector3();
97 if (this.AgentCircuits.ContainsKey(circuitCode))
98 {
99 vec = this.AgentCircuits[circuitCode].startpos;
100 }
101 return vec;
102 }
103
104 public void UpdateAgentData(AgentCircuitData agentData)
105 {
106 if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode))
107 {
108 this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname;
109 this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname;
110 this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos;
111 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
112 }
113 }
114
115 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
116 {
117 if (this.AgentCircuits.ContainsKey(circuitcode))
118 {
119 this.AgentCircuits[circuitcode].child = childstatus;
120 }
121 }
122
123 public bool GetAgentChildStatus(uint circuitcode)
124 {
125 if (this.AgentCircuits.ContainsKey(circuitcode))
126 {
127 return this.AgentCircuits[circuitcode].child;
128 }
129 return false;
130 }
131 }
132} \ No newline at end of file