aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework
diff options
context:
space:
mode:
authorMW2007-03-29 11:08:42 +0000
committerMW2007-03-29 11:08:42 +0000
commit17b00785ee10a71d290cbcddca9b0152fdf60c8f (patch)
tree88a78c0b9a0357af823e4ecdad25e09a64569f79 /OpenSim.Framework
parentDoh! need to return the response (diff)
downloadopensim-SC-17b00785ee10a71d290cbcddca9b0152fdf60c8f.zip
opensim-SC-17b00785ee10a71d290cbcddca9b0152fdf60c8f.tar.gz
opensim-SC-17b00785ee10a71d290cbcddca9b0152fdf60c8f.tar.bz2
opensim-SC-17b00785ee10a71d290cbcddca9b0152fdf60c8f.tar.xz
Added lbsa71's http server changes.
So it now has a single http listener that passes incoming requests to the correct handler. This means that logins (in sandbox mode) now go through this listener, which for now is listening on the port you set in startup (default 9000). (This needs changing so that the http listener and udp server are not using the same port)
Diffstat (limited to 'OpenSim.Framework')
-rw-r--r--OpenSim.Framework/UserProfileManager.cs469
1 files changed, 329 insertions, 140 deletions
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs
index 22375bc..ef5ab71 100644
--- a/OpenSim.Framework/UserProfileManager.cs
+++ b/OpenSim.Framework/UserProfileManager.cs
@@ -32,164 +32,353 @@ namespace OpenSim.Framework.User
32 DefaultStartupMsg = message; 32 DefaultStartupMsg = message;
33 } 33 }
34 34
35 /* public virtual string ParseXMLRPC(string requestBody)
36 {
37 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
38
39 Hashtable requestData = (Hashtable)request.Params[0];
40 switch (request.MethodName)
41 {
42 case "login_to_simulator":*/
43
35 public virtual string ParseXMLRPC(string requestBody) 44 public virtual string ParseXMLRPC(string requestBody)
36 { 45 {
46
37 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); 47 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
38 48
39 Hashtable requestData = (Hashtable)request.Params[0];
40 switch (request.MethodName) 49 switch (request.MethodName)
41 { 50 {
42 case "login_to_simulator": 51 case "login_to_simulator":
43 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); 52 XmlRpcResponse response = XmlRpcLoginMethod(request);
44 bool GoodLogin = false;
45 string firstname = "";
46 string lastname = "";
47 string passwd = "";
48 53
49 if (GoodXML) 54 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(response), "utf-16", "utf-8"));
50 { 55 }
51 firstname = (string)requestData["first"]; 56
52 lastname = (string)requestData["last"]; 57 return "";
53 passwd = (string)requestData["passwd"]; 58 }
54 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
55 }
56 59
60 /* public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
61 {
62 XmlRpcResponse response = new XmlRpcResponse();
63 Hashtable requestData = (Hashtable)request.Params[0];
57 64
58 if (!(GoodXML && GoodLogin)) 65 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
59 { 66 bool GoodLogin = false;
60 XmlRpcResponse LoginErrorResp = new XmlRpcResponse(); 67 string firstname = "";
61 Hashtable ErrorRespData = new Hashtable(); 68 string lastname = "";
62 ErrorRespData["reason"] = "key"; 69 string passwd = "";
63 ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
64 ErrorRespData["login"] = "false";
65 LoginErrorResp.Value = ErrorRespData;
66 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp), " encoding=\"utf-16\"", ""));
67 }
68 70
69 UserProfile TheUser = GetProfileByName(firstname, lastname); 71 if (GoodXML)
72 {
73 firstname = (string)requestData["first"];
74 lastname = (string)requestData["last"];
75 passwd = (string)requestData["passwd"];
76 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
77 }
70 78
71 /*
72 if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
73 {
74 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
75 Hashtable PresenceErrorRespData = new Hashtable();
76 PresenceErrorRespData["reason"] = "presence";
77 PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
78 PresenceErrorRespData["login"] = "false";
79 PresenceErrorResp.Value = PresenceErrorRespData;
80 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
81 79
82 }*/ 80 if (!(GoodXML && GoodLogin))
81 {
82 XmlRpcResponse LoginErrorResp = new XmlRpcResponse();
83 Hashtable ErrorRespData = new Hashtable();
84 ErrorRespData["reason"] = "key";
85 ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
86 ErrorRespData["login"] = "false";
87 LoginErrorResp.Value = ErrorRespData;
88 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp), " encoding=\"utf-16\"", ""));
89 }
83 90
84 try 91 UserProfile TheUser = GetProfileByName(firstname, lastname);
85 {
86 LLUUID AgentID = TheUser.UUID;
87 TheUser.InitSessionData();
88 // SimProfile SimInfo = new SimProfile();
89 // SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
90
91 XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
92 Hashtable LoginGoodData = new Hashtable();
93
94 Hashtable GlobalT = new Hashtable();
95 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
96 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
97 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
98 ArrayList GlobalTextures = new ArrayList();
99 GlobalTextures.Add(GlobalT);
100
101 Hashtable LoginFlagsHash = new Hashtable();
102 LoginFlagsHash["daylight_savings"] = "N";
103 LoginFlagsHash["stipend_since_login"] = "N";
104 LoginFlagsHash["gendered"] = "Y";
105 LoginFlagsHash["ever_logged_in"] = "Y";
106 ArrayList LoginFlags = new ArrayList();
107 LoginFlags.Add(LoginFlagsHash);
108
109 Hashtable uiconfig = new Hashtable();
110 uiconfig["allow_first_life"] = "Y";
111 ArrayList ui_config = new ArrayList();
112 ui_config.Add(uiconfig);
113
114 Hashtable ClassifiedCategoriesHash = new Hashtable();
115 ClassifiedCategoriesHash["category_name"] = "bla bla";
116 ClassifiedCategoriesHash["category_id"] = (Int32)1;
117 ArrayList ClassifiedCategories = new ArrayList();
118 ClassifiedCategories.Add(ClassifiedCategoriesHash);
119
120 Console.WriteLine("copying inventory data to response");
121 ArrayList AgentInventory = new ArrayList();
122 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
123 {
124 Hashtable TempHash = new Hashtable();
125 TempHash["name"] = InvFolder.FolderName;
126 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
127 TempHash["version"] = (Int32)InvFolder.Version;
128 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
129 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
130 AgentInventory.Add(TempHash);
131 }
132
133 Hashtable InventoryRootHash = new Hashtable();
134 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
135 ArrayList InventoryRoot = new ArrayList();
136 InventoryRoot.Add(InventoryRootHash);
137
138 Hashtable InitialOutfitHash = new Hashtable();
139 InitialOutfitHash["folder_name"] = "Nightclub Female";
140 InitialOutfitHash["gender"] = "female";
141 ArrayList InitialOutfit = new ArrayList();
142 InitialOutfit.Add(InitialOutfitHash);
143
144 uint circode = (uint)(Util.RandomClass.Next());
145 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
146
147 LoginGoodData["last_name"] = TheUser.lastname ;
148 LoginGoodData["ui-config"] = ui_config;
149 LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
150 LoginGoodData["login-flags"] = LoginFlags;
151 LoginGoodData["global-textures"] = GlobalTextures;
152 LoginGoodData["classified_categories"] = ClassifiedCategories;
153 LoginGoodData["event_categories"] = new ArrayList();
154 LoginGoodData["inventory-skeleton"] = AgentInventory;
155 LoginGoodData["inventory-skel-lib"] = new ArrayList();
156 LoginGoodData["inventory-root"] = InventoryRoot;
157 LoginGoodData["event_notifications"] = new ArrayList();
158 LoginGoodData["gestures"] = new ArrayList();
159 LoginGoodData["inventory-lib-owner"] = new ArrayList();
160 LoginGoodData["initial-outfit"] = InitialOutfit;
161 LoginGoodData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
162 LoginGoodData["start_location"] = "last";
163 LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
164 LoginGoodData["message"] = DefaultStartupMsg;
165 LoginGoodData["first_name"] = TheUser.firstname ;
166 LoginGoodData["circuit_code"] = (Int32)circode;
167 LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
168 LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
169 LoginGoodData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
170 LoginGoodData["agent_id"] = AgentID.ToStringHyphenated();
171 LoginGoodData["region_y"] = (Int32) 996 * 256; // (Int32)SimInfo.RegionLocY * 256;
172 LoginGoodData["region_x"] = (Int32) 997 * 256; //SimInfo.RegionLocX * 256;
173 LoginGoodData["seed_capability"] = null;
174 LoginGoodData["agent_access"] = "M";
175 LoginGoodData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
176 LoginGoodData["login"] = "true";
177
178 this.CustomiseResponse(ref LoginGoodData, TheUser);
179 LoginGoodResp.Value = LoginGoodData;
180 //TheUser.SendDataToSim(SimInfo);
181 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp), "utf-16", "utf-8"));
182 92
183 } 93
184 catch (Exception E) 94 if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
95 {
96 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
97 Hashtable PresenceErrorRespData = new Hashtable();
98 PresenceErrorRespData["reason"] = "presence";
99 PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
100 PresenceErrorRespData["login"] = "false";
101 PresenceErrorResp.Value = PresenceErrorRespData;
102 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
103
104 }
105
106 try
107 {
108 LLUUID AgentID = TheUser.UUID;
109 TheUser.InitSessionData();
110 // SimProfile SimInfo = new SimProfile();
111 // SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
112
113 XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
114 Hashtable LoginGoodData = new Hashtable();
115
116 Hashtable GlobalT = new Hashtable();
117 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
118 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
119 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
120 ArrayList GlobalTextures = new ArrayList();
121 GlobalTextures.Add(GlobalT);
122
123 Hashtable LoginFlagsHash = new Hashtable();
124 LoginFlagsHash["daylight_savings"] = "N";
125 LoginFlagsHash["stipend_since_login"] = "N";
126 LoginFlagsHash["gendered"] = "Y";
127 LoginFlagsHash["ever_logged_in"] = "Y";
128 ArrayList LoginFlags = new ArrayList();
129 LoginFlags.Add(LoginFlagsHash);
130
131 Hashtable uiconfig = new Hashtable();
132 uiconfig["allow_first_life"] = "Y";
133 ArrayList ui_config = new ArrayList();
134 ui_config.Add(uiconfig);
135
136 Hashtable ClassifiedCategoriesHash = new Hashtable();
137 ClassifiedCategoriesHash["category_name"] = "bla bla";
138 ClassifiedCategoriesHash["category_id"] = (Int32)1;
139 ArrayList ClassifiedCategories = new ArrayList();
140 ClassifiedCategories.Add(ClassifiedCategoriesHash);
141
142 Console.WriteLine("copying inventory data to response");
143 ArrayList AgentInventory = new ArrayList();
144 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
145 {
146 Hashtable TempHash = new Hashtable();
147 TempHash["name"] = InvFolder.FolderName;
148 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
149 TempHash["version"] = (Int32)InvFolder.Version;
150 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
151 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
152 AgentInventory.Add(TempHash);
153 }
154
155 Hashtable InventoryRootHash = new Hashtable();
156 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
157 ArrayList InventoryRoot = new ArrayList();
158 InventoryRoot.Add(InventoryRootHash);
159
160 Hashtable InitialOutfitHash = new Hashtable();
161 InitialOutfitHash["folder_name"] = "Nightclub Female";
162 InitialOutfitHash["gender"] = "female";
163 ArrayList InitialOutfit = new ArrayList();
164 InitialOutfit.Add(InitialOutfitHash);
165
166 uint circode = (uint)(Util.RandomClass.Next());
167 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
168
169 LoginGoodData["last_name"] = TheUser.lastname ;
170 LoginGoodData["ui-config"] = ui_config;
171 LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
172 LoginGoodData["login-flags"] = LoginFlags;
173 LoginGoodData["global-textures"] = GlobalTextures;
174 LoginGoodData["classified_categories"] = ClassifiedCategories;
175 LoginGoodData["event_categories"] = new ArrayList();
176 LoginGoodData["inventory-skeleton"] = AgentInventory;
177 LoginGoodData["inventory-skel-lib"] = new ArrayList();
178 LoginGoodData["inventory-root"] = InventoryRoot;
179 LoginGoodData["event_notifications"] = new ArrayList();
180 LoginGoodData["gestures"] = new ArrayList();
181 LoginGoodData["inventory-lib-owner"] = new ArrayList();
182 LoginGoodData["initial-outfit"] = InitialOutfit;
183 LoginGoodData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
184 LoginGoodData["start_location"] = "last";
185 LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
186 LoginGoodData["message"] = DefaultStartupMsg;
187 LoginGoodData["first_name"] = TheUser.firstname ;
188 LoginGoodData["circuit_code"] = (Int32)circode;
189 LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
190 LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
191 LoginGoodData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
192 LoginGoodData["agent_id"] = AgentID.ToStringHyphenated();
193 LoginGoodData["region_y"] = (Int32) 996 * 256; // (Int32)SimInfo.RegionLocY * 256;
194 LoginGoodData["region_x"] = (Int32) 997 * 256; //SimInfo.RegionLocX * 256;
195 LoginGoodData["seed_capability"] = null;
196 LoginGoodData["agent_access"] = "M";
197 LoginGoodData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
198 LoginGoodData["login"] = "true";
199
200 this.CustomiseResponse(ref LoginGoodData, TheUser);
201 LoginGoodResp.Value = LoginGoodData;
202 //TheUser.SendDataToSim(SimInfo);
203 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp), "utf-16", "utf-8"));
204
205 }
206 catch (Exception E)
207 {
208 Console.WriteLine(E.ToString());
209 }
210
211 break;
212 }
213
214 return "";
215 }*/
216
217 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
218 {
219 XmlRpcResponse response = new XmlRpcResponse();
220 Hashtable requestData = (Hashtable)request.Params[0];
221
222 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
223 bool GoodLogin = false;
224 string firstname = "";
225 string lastname = "";
226 string passwd = "";
227
228 if (GoodXML)
229 {
230 firstname = (string)requestData["first"];
231 lastname = (string)requestData["last"];
232 passwd = (string)requestData["passwd"];
233 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
234 }
235
236
237 if (!(GoodXML && GoodLogin))
238 {
239 response = CreateErrorConnectingToGridResponse();
240 }
241 else
242 {
243 UserProfile TheUser = GetProfileByName(firstname, lastname);
244 //we need to sort out how sessions are logged out , currently the sim tells the gridserver
245 //but if as this suggests the userserver handles it then please have the sim telling the userserver instead
246 //as it really makes things messy for sandbox mode
247 //if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
248 // {
249 // response = CreateAlreadyLoggedInResponse();
250 // }
251 //else
252 //{
253 try
254 {
255 Hashtable responseData = new Hashtable();
256
257 LLUUID AgentID = TheUser.UUID;
258 TheUser.InitSessionData();
259 // SimProfile SimInfo = new SimProfile();
260 // SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
261
262
263 Hashtable GlobalT = new Hashtable();
264 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
265 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
266 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
267 ArrayList GlobalTextures = new ArrayList();
268 GlobalTextures.Add(GlobalT);
269
270 Hashtable LoginFlagsHash = new Hashtable();
271 LoginFlagsHash["daylight_savings"] = "N";
272 LoginFlagsHash["stipend_since_login"] = "N";
273 LoginFlagsHash["gendered"] = "Y";
274 LoginFlagsHash["ever_logged_in"] = "Y";
275 ArrayList LoginFlags = new ArrayList();
276 LoginFlags.Add(LoginFlagsHash);
277
278 Hashtable uiconfig = new Hashtable();
279 uiconfig["allow_first_life"] = "Y";
280 ArrayList ui_config = new ArrayList();
281 ui_config.Add(uiconfig);
282
283 Hashtable ClassifiedCategoriesHash = new Hashtable();
284 ClassifiedCategoriesHash["category_name"] = "bla bla";
285 ClassifiedCategoriesHash["category_id"] = (Int32)1;
286 ArrayList ClassifiedCategories = new ArrayList();
287 ClassifiedCategories.Add(ClassifiedCategoriesHash);
288
289 ArrayList AgentInventory = new ArrayList();
290 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
185 { 291 {
186 Console.WriteLine(E.ToString()); 292 Hashtable TempHash = new Hashtable();
293 TempHash["name"] = InvFolder.FolderName;
294 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
295 TempHash["version"] = (Int32)InvFolder.Version;
296 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
297 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
298 AgentInventory.Add(TempHash);
187 } 299 }
188 300
189 break; 301 Hashtable InventoryRootHash = new Hashtable();
302 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
303 ArrayList InventoryRoot = new ArrayList();
304 InventoryRoot.Add(InventoryRootHash);
305
306 Hashtable InitialOutfitHash = new Hashtable();
307 InitialOutfitHash["folder_name"] = "Nightclub Female";
308 InitialOutfitHash["gender"] = "female";
309 ArrayList InitialOutfit = new ArrayList();
310 InitialOutfit.Add(InitialOutfitHash);
311
312 uint circode = (uint)(Util.RandomClass.Next());
313 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
314
315 responseData["last_name"] = TheUser.lastname;
316 responseData["ui-config"] = ui_config;
317 responseData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
318 responseData["login-flags"] = LoginFlags;
319 responseData["global-textures"] = GlobalTextures;
320 responseData["classified_categories"] = ClassifiedCategories;
321 responseData["event_categories"] = new ArrayList();
322 responseData["inventory-skeleton"] = AgentInventory;
323 responseData["inventory-skel-lib"] = new ArrayList();
324 responseData["inventory-root"] = InventoryRoot;
325 responseData["event_notifications"] = new ArrayList();
326 responseData["gestures"] = new ArrayList();
327 responseData["inventory-lib-owner"] = new ArrayList();
328 responseData["initial-outfit"] = InitialOutfit;
329 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
330 responseData["start_location"] = "last";
331 responseData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
332 responseData["message"] = DefaultStartupMsg;
333 responseData["first_name"] = TheUser.firstname;
334 responseData["circuit_code"] = (Int32)circode;
335 responseData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
336 responseData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
337 responseData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
338 responseData["agent_id"] = AgentID.ToStringHyphenated();
339 responseData["region_y"] = (Int32)996 * 256; // (Int32)SimInfo.RegionLocY * 256;
340 responseData["region_x"] = (Int32)997 * 256; //SimInfo.RegionLocX * 256;
341 responseData["seed_capability"] = null;
342 responseData["agent_access"] = "M";
343 responseData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
344 responseData["login"] = "true";
345
346 this.CustomiseResponse(ref responseData, TheUser);
347 response.Value = responseData;
348 //TheUser.SendDataToSim(SimInfo);
349
350
351
352 }
353 catch (Exception E)
354 {
355 Console.WriteLine(E.ToString());
356 }
357 //}
190 } 358 }
359 return response;
360 }
191 361
192 return ""; 362 private static XmlRpcResponse CreateErrorConnectingToGridResponse()
363 {
364 XmlRpcResponse response = new XmlRpcResponse();
365 Hashtable ErrorRespData = new Hashtable();
366 ErrorRespData["reason"] = "key";
367 ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
368 ErrorRespData["login"] = "false";
369 response.Value = ErrorRespData;
370 return response;
371 }
372
373 private static XmlRpcResponse CreateAlreadyLoggedInResponse()
374 {
375 XmlRpcResponse response = new XmlRpcResponse();
376 Hashtable PresenceErrorRespData = new Hashtable();
377 PresenceErrorRespData["reason"] = "presence";
378 PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
379 PresenceErrorRespData["login"] = "false";
380 response.Value = PresenceErrorRespData;
381 return response;
193 } 382 }
194 383
195 public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser) 384 public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
@@ -203,8 +392,8 @@ namespace OpenSim.Framework.User
203 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}"; 392 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
204 response["sim_ip"] = SimInfo.sim_ip.ToString(); 393 response["sim_ip"] = SimInfo.sim_ip.ToString();
205 response["sim_port"] = (Int32)SimInfo.sim_port; 394 response["sim_port"] = (Int32)SimInfo.sim_port;
206 response["region_y"] = (Int32) SimInfo.RegionLocY * 256; 395 response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
207 response["region_x"] = (Int32) SimInfo.RegionLocX * 256; 396 response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
208 397
209 //default is ogs user server, so let the sim know about the user via a XmlRpcRequest 398 //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
210 Console.WriteLine(SimInfo.caps_url); 399 Console.WriteLine(SimInfo.caps_url);