aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/UserLoginService.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Grid/UserServer/UserLoginService.cs
parent* removed always true if (diff)
downloadopensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to 'OpenSim/Grid/UserServer/UserLoginService.cs')
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs65
1 files changed, 32 insertions, 33 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 9b9360d..0eb2db1 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -29,16 +29,15 @@
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Net;
33using System.Threading; 32using System.Threading;
34using Nwc.XmlRpc;
35using libsecondlife; 33using libsecondlife;
34using Nwc.XmlRpc;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Data; 37using OpenSim.Framework.Data;
38using OpenSim.Framework.Servers;
40using OpenSim.Framework.UserManagement; 39using OpenSim.Framework.UserManagement;
41using InventoryFolder = OpenSim.Framework.InventoryFolder; 40using InventoryFolder=OpenSim.Framework.InventoryFolder;
42 41
43namespace OpenSim.Grid.UserServer 42namespace OpenSim.Grid.UserServer
44{ 43{
@@ -72,8 +71,8 @@ namespace OpenSim.Grid.UserServer
72 // Customise the response 71 // Customise the response
73 //CFK: This is redundant and the next message should always appear. 72 //CFK: This is redundant and the next message should always appear.
74 //CFK: MainLog.Instance.Verbose("LOGIN", "Home Location"); 73 //CFK: MainLog.Instance.Verbose("LOGIN", "Home Location");
75 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + 74 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
76 (SimInfo.regionLocY * 256).ToString() + "], " + 75 (SimInfo.regionLocY*256).ToString() + "], " +
77 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 76 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
78 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 77 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
79 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 78 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
@@ -106,7 +105,7 @@ namespace OpenSim.Grid.UserServer
106 SimParams["firstname"] = theUser.username; 105 SimParams["firstname"] = theUser.username;
107 SimParams["lastname"] = theUser.surname; 106 SimParams["lastname"] = theUser.surname;
108 SimParams["agent_id"] = theUser.UUID.ToString(); 107 SimParams["agent_id"] = theUser.UUID.ToString();
109 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 108 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
110 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 109 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
111 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 110 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
112 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 111 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
@@ -119,9 +118,9 @@ namespace OpenSim.Grid.UserServer
119 theUser.currentAgent.currentRegion = SimInfo.UUID; 118 theUser.currentAgent.currentRegion = SimInfo.UUID;
120 theUser.currentAgent.currentHandle = SimInfo.regionHandle; 119 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
121 120
122 MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + 121 MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
123 SimInfo.regionLocX + "," + SimInfo.regionLocY); 122 SimInfo.regionLocX + "," + SimInfo.regionLocY);
124 123
125 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 124 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
126 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 125 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
127 } 126 }
@@ -129,17 +128,17 @@ namespace OpenSim.Grid.UserServer
129 { 128 {
130 tryDefault = true; 129 tryDefault = true;
131 } 130 }
132 if(tryDefault) 131 if (tryDefault)
133 { 132 {
134 // Send him to default region instead 133 // Send him to default region instead
135 // Load information from the gridserver 134 // Load information from the gridserver
136 135
137 ulong defaultHandle = (((ulong)m_config.DefaultX * 256) << 32) | ((ulong) m_config.DefaultY * 256); 136 ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256);
138 137
139 MainLog.Instance.Warn( 138 MainLog.Instance.Warn(
140 "LOGIN", 139 "LOGIN",
141 "Home region not available: sending to default " + defaultHandle.ToString()); 140 "Home region not available: sending to default " + defaultHandle.ToString());
142 141
143 SimInfo = new RegionProfileData(); 142 SimInfo = new RegionProfileData();
144 try 143 try
145 { 144 {
@@ -149,15 +148,16 @@ namespace OpenSim.Grid.UserServer
149 148
150 // Customise the response 149 // Customise the response
151 MainLog.Instance.Verbose("LOGIN", "Home Location"); 150 MainLog.Instance.Verbose("LOGIN", "Home Location");
152 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + 151 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
153 (SimInfo.regionLocY * 256).ToString() + "], " + 152 (SimInfo.regionLocY*256).ToString() + "], " +
154 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 153 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
155 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 154 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
156 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 155 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
157 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 156 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
158 157
159 // Destination 158 // Destination
160 MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + 159 MainLog.Instance.Verbose("LOGIN",
160 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
161 SimInfo.regionLocY); 161 SimInfo.regionLocY);
162 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); 162 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
163 response.SimPort = (uint) SimInfo.serverPort; 163 response.SimPort = (uint) SimInfo.serverPort;
@@ -182,7 +182,7 @@ namespace OpenSim.Grid.UserServer
182 SimParams["firstname"] = theUser.username; 182 SimParams["firstname"] = theUser.username;
183 SimParams["lastname"] = theUser.surname; 183 SimParams["lastname"] = theUser.surname;
184 SimParams["agent_id"] = theUser.UUID.ToString(); 184 SimParams["agent_id"] = theUser.UUID.ToString();
185 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 185 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
186 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 186 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
187 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 187 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
188 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 188 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
@@ -202,35 +202,34 @@ namespace OpenSim.Grid.UserServer
202 MainLog.Instance.Warn("LOGIN", "Default region also not available"); 202 MainLog.Instance.Warn("LOGIN", "Default region also not available");
203 MainLog.Instance.Warn("LOGIN", e.ToString()); 203 MainLog.Instance.Warn("LOGIN", e.ToString());
204 } 204 }
205
206 } 205 }
207 } 206 }
208 207
209 protected override InventoryData CreateInventoryData(LLUUID userID) 208 protected override InventoryData CreateInventoryData(LLUUID userID)
210 { 209 {
211 List<InventoryFolderBase> folders 210 List<InventoryFolderBase> folders
212 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 211 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
213 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 212 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
214 213
215 // In theory, the user will only ever be missing a root folder in situations where a grid 214 // In theory, the user will only ever be missing a root folder in situations where a grid
216 // which didn't previously run a grid wide inventory server is being transitioned to one 215 // which didn't previously run a grid wide inventory server is being transitioned to one
217 // which does. 216 // which does.
218 if (null == folders | folders.Count == 0) 217 if (null == folders | folders.Count == 0)
219 { 218 {
220 MainLog.Instance.Warn( 219 MainLog.Instance.Warn(
221 "LOGIN", 220 "LOGIN",
222 "A root inventory folder for user ID " + userID + " was not found. A new set" 221 "A root inventory folder for user ID " + userID + " was not found. A new set"
223 + " of empty inventory folders is being created."); 222 + " of empty inventory folders is being created.");
224 223
225 RestObjectPoster.BeginPostObject<Guid>( 224 RestObjectPoster.BeginPostObject<Guid>(
226 m_config.InventoryUrl + "CreateInventory/", userID.UUID); 225 m_config.InventoryUrl + "CreateInventory/", userID.UUID);
227 226
228 // A big delay should be okay here since the recreation of the user's root folders should 227 // A big delay should be okay here since the recreation of the user's root folders should
229 // only ever happen once. We need to sleep to let the inventory server do its work - 228 // only ever happen once. We need to sleep to let the inventory server do its work -
230 // previously 1000ms has been found to be too short. 229 // previously 1000ms has been found to be too short.
231 Thread.Sleep(10000); 230 Thread.Sleep(10000);
232 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 231 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
233 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 232 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
234 } 233 }
235 234
236 if (folders.Count > 0) 235 if (folders.Count > 0)
@@ -247,8 +246,8 @@ namespace OpenSim.Grid.UserServer
247 TempHash = new Hashtable(); 246 TempHash = new Hashtable();
248 TempHash["name"] = InvFolder.name; 247 TempHash["name"] = InvFolder.name;
249 TempHash["parent_id"] = InvFolder.parentID.ToString(); 248 TempHash["parent_id"] = InvFolder.parentID.ToString();
250 TempHash["version"] = (Int32)InvFolder.version; 249 TempHash["version"] = (Int32) InvFolder.version;
251 TempHash["type_default"] = (Int32)InvFolder.type; 250 TempHash["type_default"] = (Int32) InvFolder.type;
252 TempHash["folder_id"] = InvFolder.folderID.ToString(); 251 TempHash["folder_id"] = InvFolder.folderID.ToString();
253 AgentInventoryArray.Add(TempHash); 252 AgentInventoryArray.Add(TempHash);
254 } 253 }
@@ -257,8 +256,8 @@ namespace OpenSim.Grid.UserServer
257 else 256 else
258 { 257 {
259 MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" + 258 MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" +
260 " for user ID " + userID); 259 " for user ID " + userID);
261 260
262 AgentInventory userInventory = new AgentInventory(); 261 AgentInventory userInventory = new AgentInventory();
263 userInventory.CreateRootFolder(userID, false); 262 userInventory.CreateRootFolder(userID, false);
264 263
@@ -269,8 +268,8 @@ namespace OpenSim.Grid.UserServer
269 TempHash = new Hashtable(); 268 TempHash = new Hashtable();
270 TempHash["name"] = InvFolder.FolderName; 269 TempHash["name"] = InvFolder.FolderName;
271 TempHash["parent_id"] = InvFolder.ParentID.ToString(); 270 TempHash["parent_id"] = InvFolder.ParentID.ToString();
272 TempHash["version"] = (Int32)InvFolder.Version; 271 TempHash["version"] = (Int32) InvFolder.Version;
273 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 272 TempHash["type_default"] = (Int32) InvFolder.DefaultType;
274 TempHash["folder_id"] = InvFolder.FolderID.ToString(); 273 TempHash["folder_id"] = InvFolder.FolderID.ToString();
275 AgentInventoryArray.Add(TempHash); 274 AgentInventoryArray.Add(TempHash);
276 } 275 }
@@ -279,4 +278,4 @@ namespace OpenSim.Grid.UserServer
279 } 278 }
280 } 279 }
281 } 280 }
282} 281} \ No newline at end of file