diff options
Diffstat (limited to '')
-rw-r--r-- | Login_manager.cs | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/Login_manager.cs b/Login_manager.cs index a41bde3..c8251b6 100644 --- a/Login_manager.cs +++ b/Login_manager.cs | |||
@@ -1,6 +1,5 @@ | |||
1 | /*Copyright (c) 2007 Michael Wright | 1 | /* |
2 | 2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/> | |
3 | * Copyright (c) <year>, <copyright holder> | ||
4 | * All rights reserved. | 3 | * All rights reserved. |
5 | * | 4 | * |
6 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
@@ -34,6 +33,7 @@ using System.Text; | |||
34 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
35 | using System.Threading; | 34 | using System.Threading; |
36 | using System.Collections; | 35 | using System.Collections; |
36 | using System.Xml; | ||
37 | using libsecondlife; | 37 | using libsecondlife; |
38 | 38 | ||
39 | namespace OpenSim | 39 | namespace OpenSim |
@@ -48,7 +48,7 @@ namespace OpenSim | |||
48 | Login=login; | 48 | Login=login; |
49 | } | 49 | } |
50 | public Logon Login; | 50 | public Logon Login; |
51 | public ushort loginPort = 8080; | 51 | public ushort loginPort = Globals.Instance.LoginServerPort; |
52 | public IPAddress clientAddress = IPAddress.Loopback; | 52 | public IPAddress clientAddress = IPAddress.Loopback; |
53 | public IPAddress remoteAddress = IPAddress.Any; | 53 | public IPAddress remoteAddress = IPAddress.Any; |
54 | private Socket loginServer; | 54 | private Socket loginServer; |
@@ -128,7 +128,7 @@ namespace OpenSim | |||
128 | // read the HTTP body into a buffer | 128 | // read the HTTP body into a buffer |
129 | char[] content = new char[contentLength]; | 129 | char[] content = new char[contentLength]; |
130 | reader.Read(content, 0, contentLength); | 130 | reader.Read(content, 0, contentLength); |
131 | // System.Text.Encoding enc = System.Text.Encoding.ASCII; | 131 | //System.Text.Encoding enc = System.Text.Encoding.ASCII; |
132 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); | 132 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content)); |
133 | Hashtable requestData = (Hashtable)request.Params[0]; | 133 | Hashtable requestData = (Hashtable)request.Params[0]; |
134 | 134 | ||
@@ -162,6 +162,41 @@ namespace OpenSim | |||
162 | int SessionRand=this.RandomClass.Next(1,999); | 162 | int SessionRand=this.RandomClass.Next(1,999); |
163 | Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); | 163 | Session=new LLUUID("aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797"); |
164 | 164 | ||
165 | |||
166 | StreamReader SR; | ||
167 | string ResponseString=""; | ||
168 | string lines; | ||
169 | SR=File.OpenText("new-login.dat"); | ||
170 | |||
171 | lines=SR.ReadLine(); | ||
172 | |||
173 | while(lines!="end-mfile") | ||
174 | { | ||
175 | |||
176 | ResponseString+=lines; | ||
177 | lines=SR.ReadLine(); | ||
178 | } | ||
179 | SR.Close(); | ||
180 | |||
181 | XmlRpcResponse response =(XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(ResponseString); | ||
182 | Hashtable responseData = (Hashtable)response.Value; | ||
183 | |||
184 | responseData["agent_id"]=Agent.ToStringHyphenated(); | ||
185 | responseData["session_id"]=Session.ToStringHyphenated(); | ||
186 | ArrayList InventoryList=(ArrayList) responseData["inventory-skeleton"]; | ||
187 | Hashtable Inventory1=(Hashtable)InventoryList[0]; | ||
188 | Hashtable Inventory2=(Hashtable)InventoryList[1]; | ||
189 | LLUUID BaseFolderID=LLUUID.Random(); | ||
190 | LLUUID InventoryFolderID=LLUUID.Random(); | ||
191 | Inventory2["name"]="Base"; | ||
192 | Inventory2["folder_id"]=BaseFolderID.ToStringHyphenated(); | ||
193 | Inventory1["folder_id"]=InventoryFolderID.ToStringHyphenated(); | ||
194 | |||
195 | ArrayList InventoryRoot=(ArrayList) responseData["inventory-root"]; | ||
196 | Hashtable Inventoryroot=(Hashtable)InventoryRoot[0]; | ||
197 | Inventoryroot["folder_id"]=InventoryFolderID.ToStringHyphenated(); | ||
198 | |||
199 | |||
165 | //copy data to login object | 200 | //copy data to login object |
166 | lock(Login) | 201 | lock(Login) |
167 | { | 202 | { |
@@ -169,38 +204,18 @@ namespace OpenSim | |||
169 | Login.last=last; | 204 | Login.last=last; |
170 | Login.Agent=Agent; | 205 | Login.Agent=Agent; |
171 | Login.Session=Session; | 206 | Login.Session=Session; |
207 | Login.BaseFolder=BaseFolderID; | ||
208 | Login.InventoryFolder=InventoryFolderID; | ||
172 | } | 209 | } |
173 | 210 | ||
174 | // forward the XML-RPC response to the client | 211 | // forward the XML-RPC response to the client |
175 | writer.WriteLine("HTTP/1.0 200 OK"); | 212 | writer.WriteLine("HTTP/1.0 200 OK"); |
176 | writer.WriteLine("Content-type: text/xml"); | 213 | writer.WriteLine("Content-type: text/xml"); |
177 | writer.WriteLine(); | 214 | writer.WriteLine(); |
178 | 215 | ||
179 | 216 | XmlTextWriter responseWriter = new XmlTextWriter(writer); | |
180 | StreamReader SR; | 217 | XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response); |
181 | string lines; | 218 | responseWriter.Close(); |
182 | SR=File.OpenText("login.dat"); | ||
183 | lines=SR.ReadLine(); | ||
184 | writer.WriteLine(lines); | ||
185 | |||
186 | lines=SR.ReadLine(); | ||
187 | //lines="<member><name>session_id</name><value><string>"+Agent.ToString()+"</string></value></member>"; | ||
188 | lines="<member><name>session_id</name><value><string>99998888-"+AgentRand.ToString("0000")+"-4f52-8ec1-0b1d5cd6aead</string></value></member>"; | ||
189 | writer.WriteLine(lines); | ||
190 | lines=SR.ReadLine(); | ||
191 | writer.WriteLine(lines); | ||
192 | lines=SR.ReadLine(); | ||
193 | //lines="<member><name>agent_id</name><value><string>"+Session.ToString()+"</string></value></member>"; | ||
194 | lines="<member><name>agent_id</name><value><string>aaaabbbb-8932-"+SessionRand.ToString("0000")+"-8664-58f53e442797</string></value></member>"; | ||
195 | writer.WriteLine(lines); | ||
196 | lines=SR.ReadLine(); | ||
197 | |||
198 | while(lines!="end-mfile") | ||
199 | { | ||
200 | writer.WriteLine(lines); | ||
201 | lines=SR.ReadLine(); | ||
202 | } | ||
203 | SR.Close(); | ||
204 | } | 219 | } |
205 | } | 220 | } |
206 | } | 221 | } |