From b8d9737a47696952bedec33dface8f18df47341f Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 17 Sep 2007 12:52:03 +0000 Subject: fixing me some line endings --- .../Communications/Local/LocalInventoryService.cs | 144 ++++----- .../Communications/Local/LocalLoginService.cs | 332 ++++++++++----------- .../Communications/OGS1/OGS1InventoryService.cs | 76 ++--- 3 files changed, 276 insertions(+), 276 deletions(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index af58d33..b8f57f6 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -1,72 +1,72 @@ -using System; -using System.Collections.Generic; -using libsecondlife; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Data; -using OpenSim.Framework.Types; -using OpenSim.Framework.UserManagement; -using OpenSim.Framework.Utilities; -using OpenSim.Framework.InventoryServiceBase; -using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; - -namespace OpenSim.Region.Communications.Local -{ - public class LocalInventoryService : InventoryServiceBase , IInventoryServices - { - - public LocalInventoryService() - { - - } - - public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) - { - List folders = this.RequestFirstLevelFolders(userID); - InventoryFolder rootFolder = null; - - //need to make sure we send root folder first - foreach (InventoryFolderBase folder in folders) - { - if (folder.parentID == libsecondlife.LLUUID.Zero) - { - InventoryFolder newfolder = new InventoryFolder(folder); - rootFolder = newfolder; - folderCallBack(userID, newfolder); - } - } - - if (rootFolder != null) - { - foreach (InventoryFolderBase folder in folders) - { - if (folder.folderID != rootFolder.folderID) - { - InventoryFolder newfolder = new InventoryFolder(folder); - folderCallBack(userID, newfolder); - - List items = this.RequestFolderItems(newfolder.folderID); - foreach (InventoryItemBase item in items) - { - itemCallBack(userID, item); - } - } - } - } - } - - public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) - { - this.AddFolder(folder); - } - - public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) - { - this.AddItem(item); - } - - public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) - { - this.deleteItem(item); - } - } -} +using System; +using System.Collections.Generic; +using libsecondlife; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; +using OpenSim.Framework.Types; +using OpenSim.Framework.UserManagement; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.InventoryServiceBase; +using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; + +namespace OpenSim.Region.Communications.Local +{ + public class LocalInventoryService : InventoryServiceBase , IInventoryServices + { + + public LocalInventoryService() + { + + } + + public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) + { + List folders = this.RequestFirstLevelFolders(userID); + InventoryFolder rootFolder = null; + + //need to make sure we send root folder first + foreach (InventoryFolderBase folder in folders) + { + if (folder.parentID == libsecondlife.LLUUID.Zero) + { + InventoryFolder newfolder = new InventoryFolder(folder); + rootFolder = newfolder; + folderCallBack(userID, newfolder); + } + } + + if (rootFolder != null) + { + foreach (InventoryFolderBase folder in folders) + { + if (folder.folderID != rootFolder.folderID) + { + InventoryFolder newfolder = new InventoryFolder(folder); + folderCallBack(userID, newfolder); + + List items = this.RequestFolderItems(newfolder.folderID); + foreach (InventoryItemBase item in items) + { + itemCallBack(userID, item); + } + } + } + } + } + + public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) + { + this.AddFolder(folder); + } + + public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + { + this.AddItem(item); + } + + public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) + { + this.deleteItem(item); + } + } +} diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index c461661..3c43d29 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -1,166 +1,166 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Data; -using OpenSim.Framework.Types; -using OpenSim.Framework.UserManagement; -using OpenSim.Framework.Utilities; -using OpenSim.Framework.Inventory; - -namespace OpenSim.Region.Communications.Local -{ - public class LocalLoginService : LoginService - { - private CommunicationsLocal m_Parent; - - private NetworkServersInfo serversInfo; - private uint defaultHomeX; - private uint defaultHomeY; - private bool authUsers = false; - - public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) - : base(userManager, welcomeMess) - { - m_Parent = parent; - this.serversInfo = serversInfo; - defaultHomeX = this.serversInfo.DefaultHomeLocX; - defaultHomeY = this.serversInfo.DefaultHomeLocY; - this.authUsers = authenticate; - } - - - public override UserProfileData GetTheUser(string firstname, string lastname) - { - UserProfileData profile = this.m_userManager.getUserProfile(firstname, lastname); - if (profile != null) - { - - return profile; - } - - if (!authUsers) - { - //no current user account so make one - Console.WriteLine("No User account found so creating a new one "); - this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); - - profile = this.m_userManager.getUserProfile(firstname, lastname); - if (profile != null) - { - m_Parent.InvenServices.CreateNewUserInventory(profile.UUID); - } - - return profile; - } - return null; - } - - public override bool AuthenticateUser(UserProfileData profile, string password) - { - if (!authUsers) - { - //for now we will accept any password in sandbox mode - Console.WriteLine("authorising user"); - return true; - } - else - { - Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); - - password = password.Remove(0, 3); //remove $1$ - - string s = Util.Md5Hash(password + ":" + profile.passwordSalt); - - return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); - } - } - - public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) - { - ulong currentRegion = theUser.currentAgent.currentHandle; - RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); - - if (reg != null) - { - response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.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() + "]}"; - string capsPath = Util.GetRandomCapsPath(); - response.SimAddress = reg.ExternalEndPoint.Address.ToString(); - response.SimPort = (Int32)reg.ExternalEndPoint.Port; - response.RegionX = reg.RegionLocX; - response.RegionY = reg.RegionLocY; - - response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; - // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; - theUser.currentAgent.currentRegion = reg.SimUUID; - theUser.currentAgent.currentHandle = reg.RegionHandle; - - Login _login = new Login(); - //copy data to login object - _login.First = response.Firstname; - _login.Last = response.Lastname; - _login.Agent = response.AgentID; - _login.Session = response.SessionID; - _login.SecureSession = response.SecureSessionID; - _login.CircuitCode = (uint)response.CircuitCode; - _login.CapsPath = capsPath; - - m_Parent.InformRegionOfLogin(currentRegion, _login); - } - else - { - Console.WriteLine("not found region " + currentRegion); - } - - } - - protected override InventoryData CreateInventoryData(LLUUID userID) - { - List folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID); - if (folders.Count > 0) - { - LLUUID rootID = LLUUID.Zero; - ArrayList AgentInventoryArray = new ArrayList(); - Hashtable TempHash; - foreach (InventoryFolderBase InvFolder in folders) - { - if (InvFolder.parentID == LLUUID.Zero) - { - rootID = InvFolder.folderID; - } - TempHash = new Hashtable(); - TempHash["name"] = InvFolder.name; - TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.version; - TempHash["type_default"] = (Int32)InvFolder.type; - TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); - AgentInventoryArray.Add(TempHash); - } - return new InventoryData(AgentInventoryArray, rootID); - } - else - { - AgentInventory userInventory = new AgentInventory(); - userInventory.CreateRootFolder(userID, false); - - ArrayList AgentInventoryArray = new ArrayList(); - Hashtable TempHash; - foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) - { - TempHash = new Hashtable(); - TempHash["name"] = InvFolder.FolderName; - TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.Version; - TempHash["type_default"] = (Int32)InvFolder.DefaultType; - TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); - AgentInventoryArray.Add(TempHash); - } - - return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); - } - } - } -} +using System; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; +using OpenSim.Framework.Types; +using OpenSim.Framework.UserManagement; +using OpenSim.Framework.Utilities; +using OpenSim.Framework.Inventory; + +namespace OpenSim.Region.Communications.Local +{ + public class LocalLoginService : LoginService + { + private CommunicationsLocal m_Parent; + + private NetworkServersInfo serversInfo; + private uint defaultHomeX; + private uint defaultHomeY; + private bool authUsers = false; + + public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) + : base(userManager, welcomeMess) + { + m_Parent = parent; + this.serversInfo = serversInfo; + defaultHomeX = this.serversInfo.DefaultHomeLocX; + defaultHomeY = this.serversInfo.DefaultHomeLocY; + this.authUsers = authenticate; + } + + + public override UserProfileData GetTheUser(string firstname, string lastname) + { + UserProfileData profile = this.m_userManager.getUserProfile(firstname, lastname); + if (profile != null) + { + + return profile; + } + + if (!authUsers) + { + //no current user account so make one + Console.WriteLine("No User account found so creating a new one "); + this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); + + profile = this.m_userManager.getUserProfile(firstname, lastname); + if (profile != null) + { + m_Parent.InvenServices.CreateNewUserInventory(profile.UUID); + } + + return profile; + } + return null; + } + + public override bool AuthenticateUser(UserProfileData profile, string password) + { + if (!authUsers) + { + //for now we will accept any password in sandbox mode + Console.WriteLine("authorising user"); + return true; + } + else + { + Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); + + password = password.Remove(0, 3); //remove $1$ + + string s = Util.Md5Hash(password + ":" + profile.passwordSalt); + + return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); + } + } + + public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) + { + ulong currentRegion = theUser.currentAgent.currentHandle; + RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion); + + if (reg != null) + { + response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.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() + "]}"; + string capsPath = Util.GetRandomCapsPath(); + response.SimAddress = reg.ExternalEndPoint.Address.ToString(); + response.SimPort = (Int32)reg.ExternalEndPoint.Port; + response.RegionX = reg.RegionLocX; + response.RegionY = reg.RegionLocY; + + response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; + // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; + theUser.currentAgent.currentRegion = reg.SimUUID; + theUser.currentAgent.currentHandle = reg.RegionHandle; + + Login _login = new Login(); + //copy data to login object + _login.First = response.Firstname; + _login.Last = response.Lastname; + _login.Agent = response.AgentID; + _login.Session = response.SessionID; + _login.SecureSession = response.SecureSessionID; + _login.CircuitCode = (uint)response.CircuitCode; + _login.CapsPath = capsPath; + + m_Parent.InformRegionOfLogin(currentRegion, _login); + } + else + { + Console.WriteLine("not found region " + currentRegion); + } + + } + + protected override InventoryData CreateInventoryData(LLUUID userID) + { + List folders = this.m_Parent.InvenServices.RequestFirstLevelFolders(userID); + if (folders.Count > 0) + { + LLUUID rootID = LLUUID.Zero; + ArrayList AgentInventoryArray = new ArrayList(); + Hashtable TempHash; + foreach (InventoryFolderBase InvFolder in folders) + { + if (InvFolder.parentID == LLUUID.Zero) + { + rootID = InvFolder.folderID; + } + TempHash = new Hashtable(); + TempHash["name"] = InvFolder.name; + TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); + TempHash["version"] = (Int32)InvFolder.version; + TempHash["type_default"] = (Int32)InvFolder.type; + TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); + AgentInventoryArray.Add(TempHash); + } + return new InventoryData(AgentInventoryArray, rootID); + } + else + { + AgentInventory userInventory = new AgentInventory(); + userInventory.CreateRootFolder(userID, false); + + ArrayList AgentInventoryArray = new ArrayList(); + Hashtable TempHash; + foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) + { + TempHash = new Hashtable(); + TempHash["name"] = InvFolder.FolderName; + TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); + TempHash["version"] = (Int32)InvFolder.Version; + TempHash["type_default"] = (Int32)InvFolder.DefaultType; + TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); + AgentInventoryArray.Add(TempHash); + } + + return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); + } + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 70ab75e..1428639 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -1,38 +1,38 @@ -using System; -using System.Collections.Generic; -using libsecondlife; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Data; -using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; - -namespace OpenSim.Region.Communications.OGS1 -{ - public class OGS1InventoryService : IInventoryServices - { - - public OGS1InventoryService() - { - - } - - public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) - { - - } - - public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) - { - - } - - public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) - { - - } - - public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) - { - - } - } -} +using System; +using System.Collections.Generic; +using libsecondlife; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Data; +using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1InventoryService : IInventoryServices + { + + public OGS1InventoryService() + { + + } + + public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) + { + + } + + public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) + { + + } + + public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + { + + } + + public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) + { + + } + } +} -- cgit v1.1