From efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Dec 2007 21:41:48 +0000 Subject: * Optimized usings * shortened references * Removed redundant 'this' * Normalized EOF --- OpenSim/Grid/AssetServer/Main.cs | 2 +- .../Grid/AssetServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Grid/AssetServer/RestService.cs | 4 +- OpenSim/Grid/GridServer/GridManager.cs | 17 +++--- OpenSim/Grid/GridServer/Main.cs | 4 +- OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | 2 +- .../Grid/InventoryServer/GridInventoryService.cs | 45 ++++++++------- OpenSim/Grid/InventoryServer/InventoryManager.cs | 43 +++++++------- OpenSim/Grid/InventoryServer/Main.cs | 34 +++++------ OpenSim/Grid/ScriptServer/Application.cs | 2 +- .../ScriptServer/ScriptServer/RegionCommManager.cs | 2 +- .../ScriptEngineManager/ScriptEngineInterface.cs | 2 +- .../ScriptEngineManager/ScriptEngineLoader.cs | 2 +- OpenSim/Grid/UserServer/Main.cs | 21 ++++--- OpenSim/Grid/UserServer/UserLoginService.cs | 65 +++++++++++----------- OpenSim/Grid/UserServer/UserManager.cs | 32 ++++++----- 16 files changed, 142 insertions(+), 137 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index c4e8e64..5d3d265 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -242,4 +242,4 @@ namespace OpenSim.Grid.AssetServer { } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs index 6608bd0..d598094 100644 --- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 1f44686..ee44108 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs @@ -45,7 +45,7 @@ namespace OpenSim.Grid.AssetServer public override byte[] Handle(string path, Stream request) { - MainLog.Instance.Verbose("REST", "In Handle"); + MainLog.Instance.Verbose("REST", "In Handle"); string param = GetParam(path); byte[] result = new byte[] {}; try @@ -129,4 +129,4 @@ namespace OpenSim.Grid.AssetServer m_assetProvider = assetProvider; } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index cb9f979..65df708 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -434,8 +434,8 @@ namespace OpenSim.Grid.GridServer } else { - MainLog.Instance.Verbose("DATA", "found " + (string)simData.regionName + " regionHandle = " + - (string)requestData["region_handle"]); + MainLog.Instance.Verbose("DATA", "found " + (string) simData.regionName + " regionHandle = " + + (string) requestData["region_handle"]); responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); responseData["sim_port"] = simData.serverPort.ToString(); responseData["http_port"] = simData.httpPort.ToString(); @@ -513,7 +513,7 @@ namespace OpenSim.Grid.GridServer simProfileList.Add(simProfileBlock); } MainLog.Instance.Verbose("MAP", "Fast map " + simProfileList.Count.ToString() + - " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")" ); + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } else { @@ -548,7 +548,7 @@ namespace OpenSim.Grid.GridServer } } MainLog.Instance.Verbose("MAP", "Std map " + simProfileList.Count.ToString() + - " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } responseData["sim-profiles"] = simProfileList; @@ -713,7 +713,8 @@ namespace OpenSim.Grid.GridServer try { - MainLog.Instance.Verbose("DATA", "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); + MainLog.Instance.Verbose("DATA", + "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); foreach (KeyValuePair kvp in _plugins) { try @@ -733,14 +734,14 @@ namespace OpenSim.Grid.GridServer { MainLog.Instance.Warn("grid", "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); - // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); + // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); return "Unable to update region (RestSetSimMethod): Incorrect auth key."; } } catch (Exception e) { MainLog.Instance.Warn("GRID", "getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + - e.ToString()); + e.ToString()); } } return "OK"; @@ -751,4 +752,4 @@ namespace OpenSim.Grid.GridServer } } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index 5bae6a6..cdd37c4 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -103,7 +103,7 @@ namespace OpenSim.Grid.GridServer public void Startup() { Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); - //Yeah srsly, that's it. + //Yeah srsly, that's it. if (setuponly) Environment.Exit(0); m_console.Verbose("GRID", "Connecting to Storage Server"); @@ -218,4 +218,4 @@ namespace OpenSim.Grid.GridServer } }*/ } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs index 0399b3b..6f837e6 100644 --- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index ca2e526..d36a915 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -28,23 +28,22 @@ using System; using System.Collections.Generic; -using System.Text; +using libsecondlife; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Console; -using libsecondlife; namespace OpenSim.Grid.InventoryServer { public class GridInventoryService : InventoryServiceBase { public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, - InventoryItemInfo itemCallBack) + InventoryItemInfo itemCallBack) { - } - private bool TryGetUsersInventory(LLUUID userID, out List folderList, out List itemsList) + private bool TryGetUsersInventory(LLUUID userID, out List folderList, + out List itemsList) { List rootFolders = RequestFirstLevelFolders(userID); List allItems = new List(); @@ -107,10 +106,10 @@ namespace OpenSim.Grid.InventoryServer public InventoryCollection GetUserInventory(Guid rawUserID) { LLUUID userID = new LLUUID(rawUserID); - + // We get enough verbose messages later on for diagnostics //MainLog.Instance.Verbose("INVENTORY", "Request for inventory for " + userID.ToString()); - + InventoryCollection invCollection = new InventoryCollection(); List folders; List allItems; @@ -126,14 +125,14 @@ namespace OpenSim.Grid.InventoryServer public bool CreateUsersInventory(Guid rawUserID) { LLUUID userID = new LLUUID(rawUserID); - + MainLog.Instance.Verbose( "INVENTORY", "Creating new set of inventory folders for " + userID.ToString()); - + CreateNewUserInventory(userID); return true; } - + public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) { @@ -156,30 +155,30 @@ namespace OpenSim.Grid.InventoryServer MainLog.Instance.Verbose( "INVENTORY", "Updating in " + folder.parentID.ToString() - + ", folder " + folder.name); - + + ", folder " + folder.name); + AddNewInventoryFolder(folder.agentID, folder); return true; } public bool MoveInventoryFolder(InventoryFolderBase folder) - { + { MainLog.Instance.Verbose( "INVENTORY", "Moving folder " + folder.folderID - + " to " + folder.parentID.ToString()); - + + " to " + folder.parentID.ToString()); + MoveExistingInventoryFolder(folder); return true; } - public bool AddInventoryItem( InventoryItemBase item) + public bool AddInventoryItem(InventoryItemBase item) { // Right now, this actions act more like an update/insert combination than a simple create. MainLog.Instance.Verbose( - "INVENTORY", + "INVENTORY", "Updating in " + item.parentFolderID.ToString() - + ", item " + item.inventoryName); + + ", item " + item.inventoryName); AddNewInventoryItem(item.avatarID, item); return true; @@ -191,15 +190,15 @@ namespace OpenSim.Grid.InventoryServer MainLog.Instance.Verbose( "INVENTORY", "Deleting in " + item.parentFolderID.ToString() - + ", item " + item.inventoryName); - + + ", item " + item.inventoryName); + DeleteItem(item); } - public bool DeleteInvItem( InventoryItemBase item) + public bool DeleteInvItem(InventoryItemBase item) { DeleteInventoryItem(item.avatarID, item); return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs index 1070bcf..a003ce3 100644 --- a/OpenSim/Grid/InventoryServer/InventoryManager.cs +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs @@ -25,26 +25,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.IO; -using System.Text; using System.Reflection; -using System.Collections; -using System.Collections.Generic; +using System.Text; using System.Xml; using System.Xml.Serialization; using libsecondlife; - using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; namespace OpenSim.Grid.InventoryServer { - public class InventoryManager { - IInventoryData _databasePlugin; + private IInventoryData _databasePlugin; /// /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. @@ -55,7 +52,8 @@ namespace OpenSim.Grid.InventoryServer MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName); - MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + MainLog.Instance.Verbose(OpenInventory_Main.LogName, + "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); foreach (Type pluginType in pluginAssembly.GetTypes()) { if (!pluginType.IsAbstract) @@ -64,10 +62,12 @@ namespace OpenSim.Grid.InventoryServer if (typeInterface != null) { - IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + IInventoryData plug = + (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _databasePlugin = plug; - MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Added IInventoryData Interface"); + MainLog.Instance.Verbose(OpenInventory_Main.LogName, + "Invenstorage: Added IInventoryData Interface"); break; } @@ -82,8 +82,8 @@ namespace OpenSim.Grid.InventoryServer { FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); XmlReader reader = new XmlTextReader(fs); - XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); - SerializableInventory inventory = (SerializableInventory)x.Deserialize(reader); + XmlSerializer x = new XmlSerializer(typeof (SerializableInventory)); + SerializableInventory inventory = (SerializableInventory) x.Deserialize(reader); fs.Close(); fs.Dispose(); return inventory; @@ -93,11 +93,12 @@ namespace OpenSim.Grid.InventoryServer { XmlTextWriter writer = new XmlTextWriter(s, Encoding.UTF8); writer.Formatting = Formatting.Indented; - XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); + XmlSerializer x = new XmlSerializer(typeof (SerializableInventory)); x.Serialize(writer, inventory); } - protected static bool fixupFolder(SerializableInventory.SerializableFolder f, SerializableInventory.SerializableFolder parent) + protected static bool fixupFolder(SerializableInventory.SerializableFolder f, + SerializableInventory.SerializableFolder parent) { bool modified = false; @@ -142,6 +143,7 @@ namespace OpenSim.Grid.InventoryServer { private SerializableInventory _inventory; private InventoryManager _manager; + public GetInventory(InventoryManager manager) : base("GET", "/inventory") { @@ -165,23 +167,24 @@ namespace OpenSim.Grid.InventoryServer private byte[] GetUserInventory(LLUUID userID) { MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString()); - byte[] result = new byte[] { }; + byte[] result = new byte[] {}; InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID); if (fb == null) { - MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", userID.ToString()); + MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", + userID.ToString()); CreateDefaultInventory(userID); } return result; } - override public byte[] Handle(string path, Stream request) + public override byte[] Handle(string path, Stream request) { - byte[] result = new byte[] { }; + byte[] result = new byte[] {}; - string[] parms = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if (parms.Length > 1) { if (string.Compare(parms[1], "library", true) == 0) @@ -190,7 +193,7 @@ namespace OpenSim.Grid.InventoryServer saveInventoryToStream(_inventory, ms); result = ms.GetBuffer(); - Array.Resize(ref result, (int)ms.Length); + Array.Resize(ref result, (int) ms.Length); } else if (string.Compare(parms[1], "user", true) == 0) { @@ -204,4 +207,4 @@ namespace OpenSim.Grid.InventoryServer } } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index df854f9..ce371bf 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -25,29 +25,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; -using System.Collections; using System.Collections.Generic; -using System.Reflection; using System.IO; -using System.Text; - using libsecondlife; - using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; -using InventoryManager = OpenSim.Grid.InventoryServer.InventoryManager; - namespace OpenSim.Grid.InventoryServer { public class OpenInventory_Main : conscmd_callback { - LogBase m_console; - InventoryManager m_inventoryManager; - InventoryConfig m_config; - GridInventoryService m_inventoryService; + private LogBase m_console; + private InventoryManager m_inventoryManager; + private InventoryConfig m_config; + private GridInventoryService m_inventoryService; public const string LogName = "INVENTORY"; @@ -72,20 +66,20 @@ namespace OpenSim.Grid.InventoryServer m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); m_inventoryService = new GridInventoryService(); - // m_inventoryManager = new InventoryManager(); + // m_inventoryManager = new InventoryManager(); m_inventoryService.AddPlugin(m_config.DatabaseProvider); MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/GetInventory/", - m_inventoryService.GetUserInventory)); + m_inventoryService.GetUserInventory)); httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/CreateInventory/", - m_inventoryService.CreateUsersInventory)); + m_inventoryService.CreateUsersInventory)); httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/NewFolder/", - m_inventoryService.AddInventoryFolder)); + m_inventoryService.AddInventoryFolder)); httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/MoveFolder/", @@ -93,16 +87,16 @@ namespace OpenSim.Grid.InventoryServer httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/NewItem/", - m_inventoryService.AddInventoryItem)); + m_inventoryService.AddInventoryItem)); httpServer.AddStreamHandler( new RestDeserialisehandler("POST", "/DeleteItem/", - m_inventoryService.DeleteInvItem)); + m_inventoryService.DeleteInvItem)); httpServer.AddStreamHandler( new RestDeserialisehandler>("POST", "/RootFolders/", - m_inventoryService.RequestFirstLevelFolders)); + m_inventoryService.RequestFirstLevelFolders)); - // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); + // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); httpServer.Start(); MainLog.Instance.Notice(LogName, "Started HTTP server"); @@ -137,4 +131,4 @@ namespace OpenSim.Grid.InventoryServer { } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs index dd1da66..5076618 100644 --- a/OpenSim/Grid/ScriptServer/Application.cs +++ b/OpenSim/Grid/ScriptServer/Application.cs @@ -52,4 +52,4 @@ namespace OpenSim.Grid.ScriptServer Console.WriteLine(e.ExceptionObject.ToString()); } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index 87198d1..7d29129 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs @@ -101,4 +101,4 @@ namespace OpenSim.Grid.ScriptServer Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs index fc6939c..518c198 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs @@ -35,4 +35,4 @@ namespace OpenSim.Grid.ScriptServer void Shutdown(); // void StartScript(string ScriptID, IScriptHost ObjectID); } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs index d02955e..7f39931 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs @@ -121,4 +121,4 @@ namespace OpenSim.Grid.ScriptServer return ret; } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 4806e52..6e3ccb7 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -129,7 +129,8 @@ namespace OpenSim.Grid.UserServer tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); - RestObjectPoster.BeginPostObject(m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); + RestObjectPoster.BeginPostObject(m_userManager._config.InventoryUrl + "CreateInventory/", + userID.UUID); m_lastCreatedUser = userID; break; } @@ -154,17 +155,23 @@ namespace OpenSim.Grid.UserServer break; case "test-inventory": - // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); - // requester.ReturnResponseVal = TestResponse; - // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); - List folders = SynchronousRestObjectPoster.BeginPostObject< LLUUID, List>("POST",m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); + // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); + // requester.ReturnResponseVal = TestResponse; + // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); + List folders = + SynchronousRestObjectPoster.BeginPostObject>("POST", + m_userManager. + _config. + InventoryUrl + + "RootFolders/", + m_lastCreatedUser); break; } } public void TestResponse(List resp) { - System.Console.WriteLine("response got"); + Console.WriteLine("response got"); } /*private void ConfigDB(IGenericConfig configData) @@ -194,4 +201,4 @@ namespace OpenSim.Grid.UserServer { } } -} +} \ No newline at end of file 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 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Net; using System.Threading; -using Nwc.XmlRpc; using libsecondlife; +using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; using OpenSim.Framework.Data; +using OpenSim.Framework.Servers; using OpenSim.Framework.UserManagement; -using InventoryFolder = OpenSim.Framework.InventoryFolder; +using InventoryFolder=OpenSim.Framework.InventoryFolder; namespace OpenSim.Grid.UserServer { @@ -72,8 +71,8 @@ namespace OpenSim.Grid.UserServer // Customise the response //CFK: This is redundant and the next message should always appear. //CFK: MainLog.Instance.Verbose("LOGIN", "Home Location"); - response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + - (SimInfo.regionLocY * 256).ToString() + "], " + + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + + (SimInfo.regionLocY*256).ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + @@ -106,7 +105,7 @@ namespace OpenSim.Grid.UserServer SimParams["firstname"] = theUser.username; SimParams["lastname"] = theUser.surname; SimParams["agent_id"] = theUser.UUID.ToString(); - SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); + SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); @@ -119,9 +118,9 @@ namespace OpenSim.Grid.UserServer theUser.currentAgent.currentRegion = SimInfo.UUID; theUser.currentAgent.currentHandle = SimInfo.regionHandle; - MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + - SimInfo.regionLocX + "," + SimInfo.regionLocY); - + MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + + SimInfo.regionLocX + "," + SimInfo.regionLocY); + XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); } @@ -129,17 +128,17 @@ namespace OpenSim.Grid.UserServer { tryDefault = true; } - if(tryDefault) + if (tryDefault) { // Send him to default region instead // Load information from the gridserver - ulong defaultHandle = (((ulong)m_config.DefaultX * 256) << 32) | ((ulong) m_config.DefaultY * 256); - + ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256); + MainLog.Instance.Warn( - "LOGIN", + "LOGIN", "Home region not available: sending to default " + defaultHandle.ToString()); - + SimInfo = new RegionProfileData(); try { @@ -149,15 +148,16 @@ namespace OpenSim.Grid.UserServer // Customise the response MainLog.Instance.Verbose("LOGIN", "Home Location"); - response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + - (SimInfo.regionLocY * 256).ToString() + "], " + + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + + (SimInfo.regionLocY*256).ToString() + "], " + "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; // Destination - MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + + MainLog.Instance.Verbose("LOGIN", + "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); response.SimPort = (uint) SimInfo.serverPort; @@ -182,7 +182,7 @@ namespace OpenSim.Grid.UserServer SimParams["firstname"] = theUser.username; SimParams["lastname"] = theUser.surname; SimParams["agent_id"] = theUser.UUID.ToString(); - SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); + SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode); SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); @@ -202,35 +202,34 @@ namespace OpenSim.Grid.UserServer MainLog.Instance.Warn("LOGIN", "Default region also not available"); MainLog.Instance.Warn("LOGIN", e.ToString()); } - } } protected override InventoryData CreateInventoryData(LLUUID userID) { - List folders + List folders = SynchronousRestObjectPoster.BeginPostObject>( "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); - + // In theory, the user will only ever be missing a root folder in situations where a grid // which didn't previously run a grid wide inventory server is being transitioned to one // which does. if (null == folders | folders.Count == 0) { MainLog.Instance.Warn( - "LOGIN", + "LOGIN", "A root inventory folder for user ID " + userID + " was not found. A new set" + " of empty inventory folders is being created."); - + RestObjectPoster.BeginPostObject( m_config.InventoryUrl + "CreateInventory/", userID.UUID); - + // A big delay should be okay here since the recreation of the user's root folders should // only ever happen once. We need to sleep to let the inventory server do its work - // previously 1000ms has been found to be too short. Thread.Sleep(10000); folders = SynchronousRestObjectPoster.BeginPostObject>( - "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); + "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); } if (folders.Count > 0) @@ -247,8 +246,8 @@ namespace OpenSim.Grid.UserServer TempHash = new Hashtable(); TempHash["name"] = InvFolder.name; TempHash["parent_id"] = InvFolder.parentID.ToString(); - TempHash["version"] = (Int32)InvFolder.version; - TempHash["type_default"] = (Int32)InvFolder.type; + TempHash["version"] = (Int32) InvFolder.version; + TempHash["type_default"] = (Int32) InvFolder.type; TempHash["folder_id"] = InvFolder.folderID.ToString(); AgentInventoryArray.Add(TempHash); } @@ -257,8 +256,8 @@ namespace OpenSim.Grid.UserServer else { MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" + - " for user ID " + userID); - + " for user ID " + userID); + AgentInventory userInventory = new AgentInventory(); userInventory.CreateRootFolder(userID, false); @@ -269,8 +268,8 @@ namespace OpenSim.Grid.UserServer TempHash = new Hashtable(); TempHash["name"] = InvFolder.FolderName; TempHash["parent_id"] = InvFolder.ParentID.ToString(); - TempHash["version"] = (Int32)InvFolder.Version; - TempHash["type_default"] = (Int32)InvFolder.DefaultType; + TempHash["version"] = (Int32) InvFolder.Version; + TempHash["type_default"] = (Int32) InvFolder.DefaultType; TempHash["folder_id"] = InvFolder.FolderID.ToString(); AgentInventoryArray.Add(TempHash); } @@ -279,4 +278,4 @@ namespace OpenSim.Grid.UserServer } } } -} +} \ No newline at end of file diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index be9e6f1..a50419e 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Text.RegularExpressions; using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework; @@ -76,8 +77,8 @@ namespace OpenSim.Grid.UserServer XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); // Query Result Information - responseData["queryid"] = (string)queryID.ToString(); - responseData["avcount"] = (string)returnUsers.Count.ToString(); + responseData["queryid"] = (string) queryID.ToString(); + responseData["avcount"] = (string) returnUsers.Count.ToString(); for (int i = 0; i < returnUsers.Count; i++) { @@ -86,9 +87,10 @@ namespace OpenSim.Grid.UserServer responseData["lastname" + i.ToString()] = returnUsers[i].lastName; } response.Value = responseData; - + return response; } + /// /// Converts a user profile to an XML element which can be returned /// @@ -135,18 +137,18 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; List returnAvatar = new List(); LLUUID queryID = new LLUUID(LLUUID.Zero.ToString()); if (requestData.Contains("avquery") && requestData.Contains("queryid")) { - queryID = new LLUUID((string)requestData["queryid"]); - returnAvatar = GenerateAgentPickerRequestResponse(queryID,(string)requestData["avquery"]); + queryID = new LLUUID((string) requestData["queryid"]); + returnAvatar = GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]); } - Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]); - return AvatarPickerListtoXmlRPCResponse(queryID,returnAvatar); + Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]); + return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar); } public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) @@ -156,16 +158,16 @@ namespace OpenSim.Grid.UserServer UserProfileData userProfile; if (requestData.Contains("avatar_name")) { - string query = (string)requestData["avatar_name"]; + string query = (string) requestData["avatar_name"]; - System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); + Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); string[] querysplit; querysplit = query.Split(' '); if (querysplit.Length == 2) { - userProfile = GetUserProfile(querysplit[0],querysplit[1]); + userProfile = GetUserProfile(querysplit[0], querysplit[1]); if (userProfile == null) { return CreateUnknownUserErrorResponse(); @@ -196,11 +198,11 @@ namespace OpenSim.Grid.UserServer LLUUID guess = new LLUUID(); try { - guess = new LLUUID((string)requestData["avatar_uuid"]); + guess = new LLUUID((string) requestData["avatar_uuid"]); userProfile = GetUserProfile(guess); } - catch (System.FormatException) + catch (FormatException) { return CreateUnknownUserErrorResponse(); } @@ -231,9 +233,9 @@ namespace OpenSim.Grid.UserServer throw new Exception("The method or operation is not implemented."); } - public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid) + public override UserProfileData SetupMasterUser(LLUUID uuid) { throw new Exception("The method or operation is not implemented."); } } -} +} \ No newline at end of file -- cgit v1.1