diff options
Added a LoginResponse class for LoginServer.
Diffstat (limited to 'Servers/LoginServer.cs')
-rw-r--r-- | Servers/LoginServer.cs | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/Servers/LoginServer.cs b/Servers/LoginServer.cs index e0c090a..9be0966 100644 --- a/Servers/LoginServer.cs +++ b/Servers/LoginServer.cs | |||
@@ -46,7 +46,6 @@ using OpenSim.Framework.Utilities; | |||
46 | 46 | ||
47 | namespace OpenSim.UserServer | 47 | namespace OpenSim.UserServer |
48 | { | 48 | { |
49 | |||
50 | /// <summary> | 49 | /// <summary> |
51 | /// When running in local (default) mode , handles client logins. | 50 | /// When running in local (default) mode , handles client logins. |
52 | /// </summary> | 51 | /// </summary> |
@@ -83,7 +82,7 @@ namespace OpenSim.UserServer | |||
83 | public void Startup() | 82 | public void Startup() |
84 | { | 83 | { |
85 | this._needPasswd = false; | 84 | this._needPasswd = false; |
86 | //read in default response string | 85 | // read in default response string |
87 | StreamReader SR; | 86 | StreamReader SR; |
88 | string lines; | 87 | string lines; |
89 | SR = File.OpenText("new-login.dat"); | 88 | SR = File.OpenText("new-login.dat"); |
@@ -111,7 +110,7 @@ namespace OpenSim.UserServer | |||
111 | LLUUID Agent; | 110 | LLUUID Agent; |
112 | LLUUID Session; | 111 | LLUUID Session; |
113 | 112 | ||
114 | XmlRpcResponse response = new XmlRpcResponse(); | 113 | LoginResponse loginResponse = new LoginResponse(); |
115 | 114 | ||
116 | //get login name | 115 | //get login name |
117 | if (requestData.Contains("first")) | 116 | if (requestData.Contains("first")) |
@@ -143,50 +142,27 @@ namespace OpenSim.UserServer | |||
143 | 142 | ||
144 | if (!Authenticate(first, last, passwd)) | 143 | if (!Authenticate(first, last, passwd)) |
145 | { | 144 | { |
146 | Hashtable loginError = new Hashtable(); | 145 | return loginResponse.LoginFailedResponse(); |
147 | loginError["reason"] = "key"; ; | ||
148 | loginError["message"] = "You have entered an invalid name/password combination. Check Caps/lock."; | ||
149 | loginError["login"] = "false"; | ||
150 | response.Value = loginError; | ||
151 | } | 146 | } |
152 | 147 | ||
153 | NumClients++; | 148 | NumClients++; |
154 | 149 | ||
155 | //create a agent and session LLUUID | 150 | // Create a agent and session LLUUID |
156 | Agent = GetAgentId(first, last); | 151 | Agent = GetAgentId(first, last); |
157 | int SessionRand = Util.RandomClass.Next(1, 999); | 152 | int SessionRand = Util.RandomClass.Next(1, 999); |
158 | Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797"); | 153 | Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797"); |
159 | LLUUID secureSess = LLUUID.Random(); | 154 | LLUUID secureSess = LLUUID.Random(); |
160 | //create some login info | 155 | |
161 | Hashtable LoginFlagsHash = new Hashtable(); | 156 | loginResponse.SimPort = m_simPort.ToString(); |
162 | LoginFlagsHash["daylight_savings"] = "N"; | 157 | loginResponse.SimAddress = m_simAddr.ToString(); |
163 | LoginFlagsHash["stipend_since_login"] = "N"; | 158 | loginResponse.AgentID = Agent.ToStringHyphenated(); |
164 | LoginFlagsHash["gendered"] = "Y"; | 159 | loginResponse.SessionID = Session.ToStringHyphenated(); |
165 | LoginFlagsHash["ever_logged_in"] = "Y"; | 160 | loginResponse.SecureSessionID = secureSess.ToStringHyphenated(); |
166 | ArrayList LoginFlags = new ArrayList(); | 161 | loginResponse.CircuitCode = (Int32)(Util.RandomClass.Next()); |
167 | LoginFlags.Add(LoginFlagsHash); | 162 | XmlRpcResponse response = loginResponse.ToXmlRpcResponse(); |
168 | |||
169 | Hashtable GlobalT = new Hashtable(); | ||
170 | GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271"; | ||
171 | GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
172 | GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; | ||
173 | ArrayList GlobalTextures = new ArrayList(); | ||
174 | GlobalTextures.Add(GlobalT); | ||
175 | |||
176 | response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse); | ||
177 | Hashtable responseData = (Hashtable)response.Value; | 163 | Hashtable responseData = (Hashtable)response.Value; |
178 | 164 | ||
179 | responseData["sim_port"] = m_simPort; | 165 | // inventory |
180 | responseData["sim_ip"] = m_simAddr; | ||
181 | responseData["agent_id"] = Agent.ToStringHyphenated(); | ||
182 | responseData["session_id"] = Session.ToStringHyphenated(); | ||
183 | responseData["secure_session_id"] = secureSess.ToStringHyphenated(); | ||
184 | responseData["circuit_code"] = (Int32)(Util.RandomClass.Next()); | ||
185 | responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
186 | responseData["login-flags"] = LoginFlags; | ||
187 | responseData["global-textures"] = GlobalTextures; | ||
188 | |||
189 | //inventory | ||
190 | ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"]; | 166 | ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"]; |
191 | Hashtable Inventory1 = (Hashtable)InventoryList[0]; | 167 | Hashtable Inventory1 = (Hashtable)InventoryList[0]; |
192 | Hashtable Inventory2 = (Hashtable)InventoryList[1]; | 168 | Hashtable Inventory2 = (Hashtable)InventoryList[1]; |