* Rex merge, local communications -- LocalLoginService line 186 needs tweaking.
parent
5745db2a35
commit
fe50f2e6b9
|
@ -1,443 +1,467 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Region.Communications.Local
|
namespace OpenSim.Region.Communications.Local
|
||||||
{
|
{
|
||||||
public class LocalBackEndServices : IGridServices, IInterRegionCommunications
|
public class LocalBackEndServices : IGridServices, IInterRegionCommunications
|
||||||
{
|
{
|
||||||
protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
|
protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
|
||||||
new Dictionary<ulong, RegionCommsListener>();
|
|
||||||
|
protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
|
||||||
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
|
new Dictionary<ulong, RegionCommsListener>();
|
||||||
|
|
||||||
private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
|
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
|
||||||
|
|
||||||
public string _gdebugRegionName = "";
|
private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
|
||||||
|
|
||||||
public string gdebugRegionName
|
public string _gdebugRegionName = System.String.Empty;
|
||||||
{
|
|
||||||
get { return _gdebugRegionName; }
|
bool m_bAvailable=true;
|
||||||
set { _gdebugRegionName = value; }
|
|
||||||
}
|
public void CheckRegion(string address, uint port)
|
||||||
|
{
|
||||||
public string _rdebugRegionName = "";
|
m_bAvailable = true;
|
||||||
|
}
|
||||||
public string rdebugRegionName
|
|
||||||
{
|
public bool Available
|
||||||
get { return _rdebugRegionName; }
|
{
|
||||||
set { _rdebugRegionName = value; }
|
get { return m_bAvailable; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalBackEndServices()
|
public string gdebugRegionName
|
||||||
{
|
{
|
||||||
}
|
get { return _gdebugRegionName; }
|
||||||
|
set { _gdebugRegionName = value; }
|
||||||
/// <summary>
|
}
|
||||||
/// Register a region method with the BackEnd Services.
|
|
||||||
/// </summary>
|
public string _rdebugRegionName = System.String.Empty;
|
||||||
/// <param name="regionInfo"></param>
|
|
||||||
/// <returns></returns>
|
public string rdebugRegionName
|
||||||
public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
|
{
|
||||||
{
|
get { return _rdebugRegionName; }
|
||||||
//Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
|
set { _rdebugRegionName = value; }
|
||||||
if (!m_regions.ContainsKey(regionInfo.RegionHandle))
|
}
|
||||||
{
|
|
||||||
//Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
|
public LocalBackEndServices()
|
||||||
m_regions.Add(regionInfo.RegionHandle, regionInfo);
|
{
|
||||||
|
}
|
||||||
RegionCommsListener regionHost = new RegionCommsListener();
|
|
||||||
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
|
/// <summary>
|
||||||
{
|
/// Register a region method with the BackEnd Services.
|
||||||
MainLog.Instance.Error("INTERREGION",
|
/// </summary>
|
||||||
"Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
|
/// <param name="regionInfo"></param>
|
||||||
m_regionListeners.Remove(regionInfo.RegionHandle);
|
/// <returns></returns>
|
||||||
}
|
public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
|
||||||
m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
|
{
|
||||||
|
//Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
|
||||||
return regionHost;
|
if (!m_regions.ContainsKey(regionInfo.RegionHandle))
|
||||||
}
|
{
|
||||||
else
|
//Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
|
||||||
{
|
m_regions.Add(regionInfo.RegionHandle, regionInfo);
|
||||||
// Already in our list, so the region went dead and restarted.
|
|
||||||
m_regions.Remove(regionInfo.RegionHandle);
|
RegionCommsListener regionHost = new RegionCommsListener();
|
||||||
MainLog.Instance.Warn("INTERREGION", "Region registered twice. Region went down and came back up.");
|
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
|
||||||
|
{
|
||||||
RegionCommsListener regionHost = new RegionCommsListener();
|
m_log.Error("[INTERREGION]: " +
|
||||||
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
|
"Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. " +
|
||||||
{
|
"In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
|
||||||
m_regionListeners.Remove(regionInfo.RegionHandle);
|
m_regionListeners.Remove(regionInfo.RegionHandle);
|
||||||
}
|
}
|
||||||
m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
|
m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
|
||||||
|
|
||||||
return regionHost;
|
return regionHost;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
public bool DeregisterRegion(RegionInfo regionInfo)
|
// Already in our list, so the region went dead and restarted.
|
||||||
{
|
m_regions.Remove(regionInfo.RegionHandle);
|
||||||
if (m_regions.ContainsKey(regionInfo.RegionHandle))
|
m_log.Warn("[INTERREGION]: Region registered twice. Region went down and came back up.");
|
||||||
{
|
|
||||||
m_regions.Remove(regionInfo.RegionHandle);
|
RegionCommsListener regionHost = new RegionCommsListener();
|
||||||
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
|
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
|
||||||
{
|
{
|
||||||
m_regionListeners.Remove(regionInfo.RegionHandle);
|
m_regionListeners.Remove(regionInfo.RegionHandle);
|
||||||
}
|
}
|
||||||
return true;
|
m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
|
||||||
}
|
|
||||||
return false;
|
return regionHost;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// </summary>
|
public bool DeregisterRegion(RegionInfo regionInfo)
|
||||||
/// <param name="regionInfo"></param>
|
{
|
||||||
/// <returns></returns>
|
if (m_regions.ContainsKey(regionInfo.RegionHandle))
|
||||||
public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
|
{
|
||||||
{
|
m_regions.Remove(regionInfo.RegionHandle);
|
||||||
// Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
|
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
|
||||||
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
|
{
|
||||||
|
m_regionListeners.Remove(regionInfo.RegionHandle);
|
||||||
foreach (RegionInfo reg in m_regions.Values)
|
}
|
||||||
{
|
return true;
|
||||||
// Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
|
}
|
||||||
if (reg.RegionLocX != x || reg.RegionLocY != y)
|
return false;
|
||||||
{
|
}
|
||||||
//Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
|
|
||||||
if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
|
/// <summary>
|
||||||
{
|
/// </summary>
|
||||||
if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2)))
|
/// <param name="regionInfo"></param>
|
||||||
{
|
/// <returns></returns>
|
||||||
neighbours.Add(reg);
|
public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
|
||||||
}
|
{
|
||||||
}
|
// Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
|
||||||
}
|
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
|
||||||
}
|
|
||||||
return neighbours;
|
foreach (RegionInfo reg in m_regions.Values)
|
||||||
}
|
{
|
||||||
|
// Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
|
||||||
/// <summary>
|
if (reg.RegionLocX != x || reg.RegionLocY != y)
|
||||||
///
|
{
|
||||||
/// </summary>
|
//Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
|
||||||
/// <param name="regionHandle"></param>
|
if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
|
||||||
/// <returns></returns>
|
{
|
||||||
public RegionInfo RequestNeighbourInfo(ulong regionHandle)
|
if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2)))
|
||||||
{
|
{
|
||||||
if (m_regions.ContainsKey(regionHandle))
|
neighbours.Add(reg);
|
||||||
{
|
}
|
||||||
return m_regions[regionHandle];
|
}
|
||||||
}
|
}
|
||||||
return null;
|
}
|
||||||
}
|
return neighbours;
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
/// <summary>
|
||||||
/// </summary>
|
///
|
||||||
/// <param name="minX"></param>
|
/// </summary>
|
||||||
/// <param name="minY"></param>
|
/// <param name="regionHandle"></param>
|
||||||
/// <param name="maxX"></param>
|
/// <returns></returns>
|
||||||
/// <param name="maxY"></param>
|
public RegionInfo RequestNeighbourInfo(ulong regionHandle)
|
||||||
/// <returns></returns>
|
{
|
||||||
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
|
if (m_regions.ContainsKey(regionHandle))
|
||||||
{
|
{
|
||||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
return m_regions[regionHandle];
|
||||||
foreach (RegionInfo regInfo in m_regions.Values)
|
}
|
||||||
{
|
return null;
|
||||||
if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
|
}
|
||||||
((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
|
|
||||||
{
|
/// <summary>
|
||||||
MapBlockData map = new MapBlockData();
|
///
|
||||||
map.Name = regInfo.RegionName;
|
/// </summary>
|
||||||
map.X = (ushort) regInfo.RegionLocX;
|
/// <param name="minX"></param>
|
||||||
map.Y = (ushort) regInfo.RegionLocY;
|
/// <param name="minY"></param>
|
||||||
map.WaterHeight = (byte) regInfo.EstateSettings.waterHeight;
|
/// <param name="maxX"></param>
|
||||||
map.MapImageId = regInfo.EstateSettings.terrainImageID;
|
/// <param name="maxY"></param>
|
||||||
map.Agents = 1;
|
/// <returns></returns>
|
||||||
map.RegionFlags = 72458694;
|
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
|
||||||
map.Access = 13;
|
{
|
||||||
mapBlocks.Add(map);
|
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||||
}
|
foreach (RegionInfo regInfo in m_regions.Values)
|
||||||
}
|
{
|
||||||
return mapBlocks;
|
if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
|
||||||
}
|
((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
|
||||||
|
{
|
||||||
|
MapBlockData map = new MapBlockData();
|
||||||
public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
|
map.Name = regInfo.RegionName;
|
||||||
{
|
map.X = (ushort) regInfo.RegionLocX;
|
||||||
RegionInfo region = new RegionInfo(sregion);
|
map.Y = (ushort) regInfo.RegionLocY;
|
||||||
if (m_regionListeners.ContainsKey(regionhandle))
|
map.WaterHeight = (byte) regInfo.EstateSettings.waterHeight;
|
||||||
{
|
map.MapImageId = regInfo.EstateSettings.terrainImageID;
|
||||||
return m_regionListeners[regionhandle].TriggerRegionUp(region);
|
map.Agents = 1;
|
||||||
}
|
map.RegionFlags = 72458694;
|
||||||
|
map.Access = 13;
|
||||||
return false;
|
mapBlocks.Add(map);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
|
return mapBlocks;
|
||||||
{
|
}
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
|
||||||
{
|
{
|
||||||
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
|
{
|
||||||
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
|
return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
|
||||||
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
|
||||||
|
{
|
||||||
// This function Is only here to keep this class in line with the Grid Interface.
|
RegionInfo region = new RegionInfo(sregion);
|
||||||
// It never gets called.
|
if (m_regionListeners.ContainsKey(regionhandle))
|
||||||
public virtual Dictionary<string, string> GetGridSettings()
|
{
|
||||||
{
|
return m_regionListeners[regionhandle].TriggerRegionUp(region);
|
||||||
Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
|
}
|
||||||
lock (m_queuedGridSettings)
|
|
||||||
{
|
return false;
|
||||||
returnGridSettings = m_queuedGridSettings;
|
}
|
||||||
m_queuedGridSettings.Clear();
|
|
||||||
}
|
public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
|
||||||
|
{
|
||||||
return returnGridSettings;
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
}
|
{
|
||||||
|
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
|
||||||
public virtual void SetForcefulBanlistsDisallowed(ulong regionHandle)
|
m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
|
||||||
{
|
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
|
||||||
m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
|
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
|
return false;
|
||||||
{
|
}
|
||||||
if (m_regionListeners.ContainsKey(regionhandle))
|
|
||||||
{
|
// This function Is only here to keep this class in line with the Grid Interface.
|
||||||
return m_regionListeners[regionhandle].TriggerRegionUp(region);
|
// It never gets called.
|
||||||
}
|
public virtual Dictionary<string, string> GetGridSettings()
|
||||||
|
{
|
||||||
return false;
|
Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
|
||||||
}
|
lock (m_queuedGridSettings)
|
||||||
|
{
|
||||||
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
|
returnGridSettings = m_queuedGridSettings;
|
||||||
{
|
m_queuedGridSettings.Clear();
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
}
|
||||||
{
|
|
||||||
return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
|
return returnGridSettings;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
public virtual void SetForcefulBanlistsDisallowed(ulong regionHandle)
|
||||||
|
{
|
||||||
/// <summary>
|
m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="regionHandle"></param>
|
|
||||||
/// <param name="agentData"></param>
|
public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
|
||||||
/// <returns></returns>
|
{
|
||||||
///
|
if (m_regionListeners.ContainsKey(regionhandle))
|
||||||
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
|
{
|
||||||
//should change from agentCircuitData
|
return m_regionListeners[regionhandle].TriggerRegionUp(region);
|
||||||
{
|
}
|
||||||
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
|
|
||||||
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
|
return false;
|
||||||
|
}
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
|
||||||
{
|
public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
|
||||||
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
|
{
|
||||||
m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
|
{
|
||||||
|
return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
|
||||||
return true;
|
}
|
||||||
}
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
|
||||||
public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
|
{
|
||||||
{
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
{
|
||||||
{
|
return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
|
||||||
m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData);
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
/// <summary>
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="regionHandle"></param>
|
||||||
/// <summary>
|
/// <param name="agentData"></param>
|
||||||
///
|
/// <returns></returns>
|
||||||
/// </summary>
|
///
|
||||||
/// <param name="regionHandle"></param>
|
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
|
||||||
/// <param name="agentID"></param>
|
//should change from agentCircuitData
|
||||||
/// <param name="position"></param>
|
{
|
||||||
/// <returns></returns>
|
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
|
||||||
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
|
||||||
{
|
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
{
|
{
|
||||||
// Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
|
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
|
||||||
m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
|
m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
|
||||||
return true;
|
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
|
||||||
}
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
|
}
|
||||||
{
|
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
|
||||||
{
|
{
|
||||||
m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical);
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
return true;
|
{
|
||||||
}
|
m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
|
}
|
||||||
{
|
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
/// <summary>
|
||||||
{
|
///
|
||||||
m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
|
/// </summary>
|
||||||
}
|
/// <param name="regionHandle"></param>
|
||||||
}
|
/// <param name="agentID"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
|
/// <returns></returns>
|
||||||
{
|
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
{
|
||||||
{
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
return true;
|
{
|
||||||
}
|
// Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
|
||||||
return false;
|
m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID)
|
return false;
|
||||||
{
|
}
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
|
||||||
{
|
public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
|
||||||
return true;
|
{
|
||||||
}
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
return false;
|
{
|
||||||
}
|
m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical);
|
||||||
|
return true;
|
||||||
/// <summary>
|
}
|
||||||
/// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
|
return false;
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="regionHandle"></param>
|
|
||||||
/// <param name="loginData"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public void AddNewSession(ulong regionHandle, Login loginData)
|
public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
|
||||||
{
|
{
|
||||||
AgentCircuitData agent = new AgentCircuitData();
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
agent.AgentID = loginData.Agent;
|
{
|
||||||
agent.firstname = loginData.First;
|
return true;
|
||||||
agent.lastname = loginData.Last;
|
}
|
||||||
agent.SessionID = loginData.Session;
|
return false;
|
||||||
agent.SecureSessionID = loginData.SecureSession;
|
}
|
||||||
agent.circuitcode = loginData.CircuitCode;
|
|
||||||
agent.BaseFolder = loginData.BaseFolder;
|
public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID)
|
||||||
agent.InventoryFolder = loginData.InventoryFolder;
|
{
|
||||||
agent.startpos = loginData.StartPos;
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
|
{
|
||||||
agent.ClientVersion = loginData.ClientVersion; //rex
|
return true;
|
||||||
|
}
|
||||||
agent.CapsPath = loginData.CapsPath;
|
return false;
|
||||||
|
}
|
||||||
agent.authenticationAddr = loginData.AuthAddr;
|
|
||||||
agent.asAddress = loginData.asAddress;
|
/// <summary>
|
||||||
|
/// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
|
||||||
TriggerExpectUser(regionHandle, agent);
|
/// </summary>
|
||||||
}
|
/// <param name="regionHandle"></param>
|
||||||
|
/// <param name="loginData"></param>
|
||||||
public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
|
/// <returns></returns>
|
||||||
{
|
public void AddNewSession(ulong regionHandle, Login loginData)
|
||||||
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
|
{
|
||||||
|
AgentCircuitData agent = new AgentCircuitData();
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
agent.AgentID = loginData.Agent;
|
||||||
{
|
agent.firstname = loginData.First;
|
||||||
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
|
agent.lastname = loginData.Last;
|
||||||
|
agent.SessionID = loginData.Session;
|
||||||
m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent);
|
agent.SecureSessionID = loginData.SecureSession;
|
||||||
}
|
agent.circuitcode = loginData.CircuitCode;
|
||||||
}
|
agent.BaseFolder = loginData.BaseFolder;
|
||||||
|
agent.InventoryFolder = loginData.InventoryFolder;
|
||||||
public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData)
|
agent.startpos = loginData.StartPos;
|
||||||
{
|
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
agent.ClientVersion = loginData.ClientVersion; //rex
|
||||||
{
|
|
||||||
m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData);
|
agent.CapsPath = loginData.CapsPath;
|
||||||
}
|
|
||||||
}
|
agent.authenticationAddr = loginData.AuthAddr;
|
||||||
|
agent.asAddress = loginData.asAddress;
|
||||||
public void PingCheckReply(Hashtable respData)
|
|
||||||
{
|
TriggerExpectUser(regionHandle, agent);
|
||||||
foreach (ulong region in m_regions.Keys)
|
}
|
||||||
{
|
|
||||||
Hashtable regData = new Hashtable();
|
public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
|
||||||
RegionInfo reg = m_regions[region];
|
{
|
||||||
regData["status"] = "active";
|
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
|
||||||
regData["handle"] = region.ToString();
|
|
||||||
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
respData[reg.RegionID.ToString()] = regData;
|
{
|
||||||
}
|
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
|
||||||
}
|
|
||||||
|
m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent);
|
||||||
public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
}
|
||||||
{
|
}
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
|
||||||
{
|
public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData)
|
||||||
return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position,
|
{
|
||||||
isFlying);
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
}
|
{
|
||||||
|
m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData);
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
|
public void PingCheckReply(Hashtable respData)
|
||||||
{
|
{
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
foreach (ulong region in m_regions.Keys)
|
||||||
{
|
{
|
||||||
return
|
Hashtable regData = new Hashtable();
|
||||||
m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical);
|
RegionInfo reg = m_regions[region];
|
||||||
}
|
regData["status"] = "active";
|
||||||
return false;
|
regData["handle"] = region.ToString();
|
||||||
}
|
|
||||||
|
respData[reg.RegionID.ToString()] = regData;
|
||||||
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
|
}
|
||||||
{
|
}
|
||||||
// MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
|
|
||||||
|
public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
||||||
if (m_regionListeners.ContainsKey(regionHandle))
|
{
|
||||||
{
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname);
|
{
|
||||||
|
return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position,
|
||||||
TriggerExpectUser(regionHandle, agentData);
|
isFlying);
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
}
|
public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
|
||||||
}
|
{
|
||||||
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
|
{
|
||||||
|
return
|
||||||
|
m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
|
||||||
|
{
|
||||||
|
// m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
|
||||||
|
|
||||||
|
if (m_regionListeners.ContainsKey(regionHandle))
|
||||||
|
{
|
||||||
|
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname);
|
||||||
|
|
||||||
|
TriggerExpectUser(regionHandle, agentData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,107 +1,142 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
|
||||||
namespace OpenSim.Region.Communications.Local
|
namespace OpenSim.Region.Communications.Local
|
||||||
{
|
{
|
||||||
public class LocalInventoryService : InventoryServiceBase
|
/// <summary>
|
||||||
{
|
/// An implementation of user inventory where the inventory is held locally (e.g. when OpenSim is
|
||||||
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
|
/// operating in standalone mode.
|
||||||
InventoryItemInfo itemCallBack)
|
/// </summary>
|
||||||
{
|
public class LocalInventoryService : InventoryServiceBase
|
||||||
List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID);
|
{
|
||||||
InventoryFolderImpl rootFolder = null;
|
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
|
||||||
|
InventoryItemInfo itemCallBack)
|
||||||
//need to make sure we send root folder first
|
{
|
||||||
foreach (InventoryFolderBase folder in folders)
|
List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID);
|
||||||
{
|
InventoryFolderImpl rootFolder = null;
|
||||||
if (folder.parentID == LLUUID.Zero)
|
|
||||||
{
|
//need to make sure we send root folder first
|
||||||
rootFolder = RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack);
|
foreach (InventoryFolderBase folder in folders)
|
||||||
}
|
{
|
||||||
}
|
if (folder.parentID == LLUUID.Zero)
|
||||||
|
{
|
||||||
if (rootFolder != null)
|
rootFolder = RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack);
|
||||||
{
|
}
|
||||||
foreach (InventoryFolderBase folder in folders)
|
}
|
||||||
{
|
|
||||||
if (folder.folderID != rootFolder.folderID)
|
if (rootFolder != null)
|
||||||
{
|
{
|
||||||
RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack);
|
foreach (InventoryFolderBase folder in folders)
|
||||||
}
|
{
|
||||||
}
|
if (folder.folderID != rootFolder.folderID)
|
||||||
}
|
{
|
||||||
}
|
RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack);
|
||||||
|
}
|
||||||
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
}
|
||||||
{
|
}
|
||||||
AddFolder(folder);
|
}
|
||||||
}
|
|
||||||
|
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
public override void MoveExistingInventoryFolder(InventoryFolderBase folder)
|
{
|
||||||
{
|
AddFolder(folder);
|
||||||
MoveFolder(folder);
|
}
|
||||||
}
|
|
||||||
|
public override void MoveExistingInventoryFolder(InventoryFolderBase folder)
|
||||||
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
{
|
||||||
{
|
MoveFolder(folder);
|
||||||
AddItem(item);
|
}
|
||||||
}
|
|
||||||
|
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
|
{
|
||||||
{
|
AddItem(item);
|
||||||
DeleteItem(item);
|
}
|
||||||
}
|
|
||||||
|
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
/// <summary>
|
{
|
||||||
/// Send the given inventory folder and its item contents back to the requester.
|
DeleteItem(item);
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <param name="folder"></param>
|
public override bool HasInventoryForUser(LLUUID userID)
|
||||||
private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder,
|
{
|
||||||
InventoryFolderInfo folderCallBack,
|
InventoryFolderBase root = RequestUsersRoot(userID);
|
||||||
InventoryItemInfo itemCallBack)
|
if (root == null)
|
||||||
{
|
{
|
||||||
InventoryFolderImpl newFolder = new InventoryFolderImpl(folder);
|
return false;
|
||||||
folderCallBack(userID, newFolder);
|
}
|
||||||
|
else
|
||||||
List<InventoryItemBase> items = RequestFolderItems(newFolder.folderID);
|
{
|
||||||
foreach (InventoryItemBase item in items)
|
return true;
|
||||||
{
|
}
|
||||||
itemCallBack(userID, item);
|
}
|
||||||
}
|
|
||||||
|
public override InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName)
|
||||||
return newFolder;
|
{
|
||||||
}
|
List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID);
|
||||||
}
|
InventoryFolderBase requestedFolder = null;
|
||||||
}
|
|
||||||
|
//need to make sure we send root folder first
|
||||||
|
foreach (InventoryFolderBase folder in folders)
|
||||||
|
{
|
||||||
|
if (folder.name == folderName)
|
||||||
|
{
|
||||||
|
requestedFolder = folder;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestedFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send the given inventory folder and its item contents back to the requester.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder,
|
||||||
|
InventoryFolderInfo folderCallBack,
|
||||||
|
InventoryItemInfo itemCallBack)
|
||||||
|
{
|
||||||
|
InventoryFolderImpl newFolder = new InventoryFolderImpl(folder);
|
||||||
|
folderCallBack(userID, newFolder);
|
||||||
|
|
||||||
|
List<InventoryItemBase> items = RequestFolderItems(newFolder.folderID);
|
||||||
|
foreach (InventoryItemBase item in items)
|
||||||
|
{
|
||||||
|
itemCallBack(userID, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newFolder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,261 +1,274 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.UserManagement;
|
using OpenSim.Framework.Statistics;
|
||||||
using InventoryFolder=OpenSim.Framework.InventoryFolder;
|
using OpenSim.Framework.UserManagement;
|
||||||
|
using InventoryFolder=OpenSim.Framework.InventoryFolder;
|
||||||
namespace OpenSim.Region.Communications.Local
|
|
||||||
{
|
namespace OpenSim.Region.Communications.Local
|
||||||
public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
|
{
|
||||||
|
public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
|
||||||
public class LocalLoginService : LoginService
|
|
||||||
{
|
public class LocalLoginService : LoginService
|
||||||
private CommunicationsLocal m_Parent;
|
{
|
||||||
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private NetworkServersInfo serversInfo;
|
|
||||||
private uint defaultHomeX;
|
private CommunicationsLocal m_Parent;
|
||||||
private uint defaultHomeY;
|
|
||||||
private bool authUsers = false;
|
private NetworkServersInfo serversInfo;
|
||||||
|
private uint defaultHomeX;
|
||||||
public event LoginToRegionEvent OnLoginToRegion;
|
private uint defaultHomeY;
|
||||||
|
private bool authUsers = false;
|
||||||
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent,
|
|
||||||
NetworkServersInfo serversInfo, bool authenticate, bool rexMode)
|
public event LoginToRegionEvent OnLoginToRegion;
|
||||||
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess, rexMode)
|
|
||||||
{
|
private LoginToRegionEvent handler001 = null; // OnLoginToRegion;
|
||||||
m_Parent = parent;
|
|
||||||
this.serversInfo = serversInfo;
|
public LocalLoginService(UserManagerBase userManager, string welcomeMess,
|
||||||
defaultHomeX = this.serversInfo.DefaultHomeLocX;
|
CommunicationsLocal parent, NetworkServersInfo serversInfo,
|
||||||
defaultHomeY = this.serversInfo.DefaultHomeLocY;
|
bool authenticate)
|
||||||
authUsers = authenticate;
|
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess)
|
||||||
}
|
{
|
||||||
|
m_Parent = parent;
|
||||||
|
this.serversInfo = serversInfo;
|
||||||
public override UserProfileData GetTheUser(string firstname, string lastname, string authAddr)
|
defaultHomeX = this.serversInfo.DefaultHomeLocX;
|
||||||
{
|
defaultHomeY = this.serversInfo.DefaultHomeLocY;
|
||||||
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname, authAddr);
|
authUsers = authenticate;
|
||||||
if (profile != null)
|
}
|
||||||
{
|
|
||||||
return profile;
|
|
||||||
}
|
public override UserProfileData GetTheUser(string firstname, string lastname, string authAddr)
|
||||||
|
{
|
||||||
if (!authUsers)
|
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname, authAddr);
|
||||||
{
|
if (profile != null)
|
||||||
//no current user account so make one
|
{
|
||||||
MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one.");
|
return profile;
|
||||||
|
}
|
||||||
m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
|
||||||
|
if (!authUsers)
|
||||||
profile = m_userManager.GetUserProfile(firstname, lastname, "");
|
{
|
||||||
if (profile != null)
|
//no current user account so make one
|
||||||
{
|
m_log.Info("[LOGIN]: No user account found so creating a new one.");
|
||||||
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
|
|
||||||
}
|
m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
||||||
|
|
||||||
return profile;
|
profile = m_userManager.GetUserProfile(firstname, lastname, "");
|
||||||
}
|
if (profile != null)
|
||||||
return null;
|
{
|
||||||
}
|
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
|
||||||
|
}
|
||||||
public override bool AuthenticateUser(UserProfileData profile, string password)
|
|
||||||
{
|
return profile;
|
||||||
if (!authUsers)
|
}
|
||||||
{
|
return null;
|
||||||
//for now we will accept any password in sandbox mode
|
}
|
||||||
MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)");
|
|
||||||
|
public override bool AuthenticateUser(UserProfileData profile, string password)
|
||||||
return true;
|
{
|
||||||
}
|
if (!authUsers)
|
||||||
else
|
{
|
||||||
{
|
//for now we will accept any password in sandbox mode
|
||||||
MainLog.Instance.Notice(
|
m_log.Info("[LOGIN]: Authorising user (no actual password check)");
|
||||||
"LOGIN", "Authenticating " + profile.username + " " + profile.surname);
|
|
||||||
|
return true;
|
||||||
password = password.Remove(0, 3); //remove $1$
|
}
|
||||||
|
else
|
||||||
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
{
|
||||||
|
m_log.Info(
|
||||||
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
"[LOGIN]: Authenticating " + profile.username + " " + profile.surname);
|
||||||
}
|
|
||||||
}
|
if (!password.StartsWith("$1$"))
|
||||||
|
password = "$1$" + Util.Md5Hash(password);
|
||||||
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string ASaddress)
|
|
||||||
{
|
password = password.Remove(0, 3); //remove $1$
|
||||||
ulong currentRegion = theUser.currentAgent.currentHandle;
|
|
||||||
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
|
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
||||||
|
|
||||||
if (reg != null)
|
bool loginresult = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
||||||
{
|
|| profile.passwordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
|
||||||
// rex, start
|
return loginresult;
|
||||||
LLVector3 StartLoc,StartLookAt;
|
}
|
||||||
bool bCustomStartLoc = true;
|
}
|
||||||
if (!RexScriptAccess.GetAvatarStartLocation(out StartLoc, out StartLookAt))
|
|
||||||
{
|
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string ASaddress)
|
||||||
StartLoc = theUser.homeLocation;
|
{
|
||||||
StartLookAt = theUser.homeLocation;
|
ulong currentRegion = theUser.currentAgent.currentHandle;
|
||||||
bCustomStartLoc = false;
|
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
|
||||||
}
|
|
||||||
|
if (reg != null)
|
||||||
response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" +
|
{
|
||||||
(reg.RegionLocY*256).ToString() + "], " +
|
// rex, start
|
||||||
"'position':[r" + StartLoc.X.ToString() + ",r" +
|
LLVector3 StartLoc,StartLookAt;
|
||||||
StartLoc.Y.ToString() + ",r" + StartLoc.Z.ToString() + "], " +
|
bool bCustomStartLoc = true;
|
||||||
"'look_at':[r" + StartLoc.X.ToString() + ",r" +
|
if (!RexScriptAccess.GetAvatarStartLocation(out StartLoc, out StartLookAt))
|
||||||
StartLoc.Y.ToString() + ",r" + StartLoc.Z.ToString() + "]}"; // rex end
|
{
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
StartLoc = theUser.homeLocation;
|
||||||
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
|
StartLookAt = theUser.homeLocation;
|
||||||
response.SimPort = (uint) reg.ExternalEndPoint.Port;
|
bCustomStartLoc = false;
|
||||||
response.RegionX = reg.RegionLocX;
|
}
|
||||||
response.RegionY = reg.RegionLocY;
|
|
||||||
|
response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" +
|
||||||
response.SeedCapability = "http://" + reg.ExternalHostName + ":" +
|
(reg.RegionLocY*256).ToString() + "], " +
|
||||||
serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
|
"'position':[r" + StartLoc.X.ToString() + ",r" +
|
||||||
// response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
|
StartLoc.Y.ToString() + ",r" + StartLoc.Z.ToString() + "], " +
|
||||||
theUser.currentAgent.currentRegion = reg.RegionID;
|
"'look_at':[r" + StartLoc.X.ToString() + ",r" +
|
||||||
theUser.currentAgent.currentHandle = reg.RegionHandle;
|
StartLoc.Y.ToString() + ",r" + StartLoc.Z.ToString() + "]}"; // rex end
|
||||||
|
string capsPath = Util.GetRandomCapsPath();
|
||||||
LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList();
|
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
|
||||||
|
response.SimPort = (uint) reg.ExternalEndPoint.Port;
|
||||||
response.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(theUser.UUID));
|
response.RegionX = reg.RegionLocX;
|
||||||
|
response.RegionY = reg.RegionLocY ;
|
||||||
Login _login = new Login();
|
|
||||||
//copy data to login object
|
response.SeedCapability = "http://" + reg.ExternalHostName + ":" +
|
||||||
_login.First = response.Firstname;
|
serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
|
||||||
_login.Last = response.Lastname;
|
// response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
|
||||||
_login.Agent = response.AgentID;
|
theUser.currentAgent.currentRegion = reg.RegionID;
|
||||||
_login.Session = response.SessionID;
|
theUser.currentAgent.currentHandle = reg.RegionHandle;
|
||||||
_login.SecureSession = response.SecureSessionID;
|
|
||||||
_login.CircuitCode = (uint) response.CircuitCode;
|
LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList();
|
||||||
if(bCustomStartLoc) // rex
|
|
||||||
_login.StartPos = StartLoc;
|
response.BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(theUser.UUID));
|
||||||
else
|
|
||||||
_login.StartPos = theUser.currentAgent.currentPos;
|
Login _login = new Login();
|
||||||
_login.CapsPath = capsPath;
|
//copy data to login object
|
||||||
|
_login.First = response.Firstname;
|
||||||
_login.ClientVersion = response.ClientVersion; //rex
|
_login.Last = response.Lastname;
|
||||||
if (m_rexMode)
|
_login.Agent = response.AgentID;
|
||||||
{
|
_login.Session = response.SessionID;
|
||||||
_login.AuthAddr = theUser.authenticationAddr;
|
_login.SecureSession = response.SecureSessionID;
|
||||||
_login.asAddress = ASaddress;
|
_login.CircuitCode = (uint) response.CircuitCode;
|
||||||
}
|
if(bCustomStartLoc) // rex
|
||||||
|
_login.StartPos = StartLoc;
|
||||||
if (OnLoginToRegion != null)
|
else
|
||||||
{
|
_login.StartPos = theUser.currentAgent.currentPos;
|
||||||
OnLoginToRegion(currentRegion, _login);
|
_login.CapsPath = capsPath;
|
||||||
}
|
|
||||||
}
|
_login.ClientVersion = response.ClientVersion; //rex
|
||||||
else
|
if (m_rexMode)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion);
|
_login.AuthAddr = theUser.authenticationAddr;
|
||||||
}
|
_login.asAddress = ASaddress;
|
||||||
}
|
}
|
||||||
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
|
|
||||||
{
|
if (OnLoginToRegion != null)
|
||||||
LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList();
|
handler001 = OnLoginToRegion;
|
||||||
foreach (FriendListItem fl in LFL)
|
if (handler001 != null)
|
||||||
{
|
{
|
||||||
LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend);
|
handler001(currentRegion, _login);
|
||||||
buddyitem.BuddyID = fl.Friend;
|
}
|
||||||
buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms;
|
}
|
||||||
buddyitem.BuddyRightsGiven = (int)fl.FriendPerms;
|
else
|
||||||
buddylistreturn.AddNewBuddy(buddyitem);
|
{
|
||||||
|
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
|
||||||
}
|
}
|
||||||
return buddylistreturn;
|
}
|
||||||
}
|
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
|
||||||
protected override InventoryData CreateInventoryData(LLUUID userID)
|
{
|
||||||
{
|
LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList();
|
||||||
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
foreach (FriendListItem fl in LFL)
|
||||||
if (folders.Count > 0)
|
{
|
||||||
{
|
LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend);
|
||||||
return GetInventoryData(folders);
|
buddyitem.BuddyID = fl.Friend;
|
||||||
}
|
buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms;
|
||||||
else {
|
buddyitem.BuddyRightsGiven = (int)fl.FriendPerms;
|
||||||
if (!m_rexMode)
|
buddylistreturn.AddNewBuddy(buddyitem);
|
||||||
{
|
|
||||||
AgentInventory userInventory = new AgentInventory();
|
}
|
||||||
userInventory.CreateRootFolder(userID, false);
|
return buddylistreturn;
|
||||||
|
}
|
||||||
ArrayList AgentInventoryArray = new ArrayList();
|
protected override InventoryData CreateInventoryData(LLUUID userID)
|
||||||
Hashtable TempHash;
|
{
|
||||||
foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
|
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
||||||
{
|
if (folders.Count > 0)
|
||||||
TempHash = new Hashtable();
|
{
|
||||||
TempHash["name"] = InvFolder.FolderName;
|
return GetInventoryData(folders);
|
||||||
TempHash["parent_id"] = InvFolder.ParentID.ToString();
|
}
|
||||||
TempHash["version"] = (Int32) InvFolder.Version;
|
else {
|
||||||
TempHash["type_default"] = (Int32) InvFolder.DefaultType;
|
if (!m_rexMode)
|
||||||
TempHash["folder_id"] = InvFolder.FolderID.ToString();
|
{
|
||||||
AgentInventoryArray.Add(TempHash);
|
AgentInventory userInventory = new AgentInventory();
|
||||||
}
|
userInventory.CreateRootFolder(userID, false);
|
||||||
|
|
||||||
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
|
ArrayList AgentInventoryArray = new ArrayList();
|
||||||
}
|
Hashtable TempHash;
|
||||||
else { // in rex mode users are created at the authentication server and folders must be created at
|
foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
|
||||||
// first login to db
|
{
|
||||||
m_Parent.InventoryService.CreateNewUserInventory(userID);
|
TempHash = new Hashtable();
|
||||||
|
TempHash["name"] = InvFolder.FolderName;
|
||||||
folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
TempHash["parent_id"] = InvFolder.ParentID.ToString();
|
||||||
return GetInventoryData(folders);
|
TempHash["version"] = (Int32) InvFolder.Version;
|
||||||
}
|
TempHash["type_default"] = (Int32) InvFolder.DefaultType;
|
||||||
|
TempHash["folder_id"] = InvFolder.FolderID.ToString();
|
||||||
|
AgentInventoryArray.Add(TempHash);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
|
||||||
private InventoryData GetInventoryData(List<InventoryFolderBase> folders)
|
}
|
||||||
{
|
else { // in rex mode users are created at the authentication server and folders must be created at
|
||||||
LLUUID rootID = LLUUID.Zero;
|
// first login to db
|
||||||
ArrayList AgentInventoryArray = new ArrayList();
|
m_Parent.InventoryService.CreateNewUserInventory(userID);
|
||||||
Hashtable TempHash;
|
|
||||||
foreach (InventoryFolderBase InvFolder in folders)
|
folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
|
||||||
{
|
return GetInventoryData(folders);
|
||||||
if (InvFolder.parentID == LLUUID.Zero)
|
}
|
||||||
{
|
|
||||||
rootID = InvFolder.folderID;
|
|
||||||
}
|
}
|
||||||
TempHash = new Hashtable();
|
}
|
||||||
TempHash["name"] = InvFolder.name;
|
|
||||||
TempHash["parent_id"] = InvFolder.parentID.ToString();
|
private InventoryData GetInventoryData(List<InventoryFolderBase> folders)
|
||||||
TempHash["version"] = (Int32)InvFolder.version;
|
{
|
||||||
TempHash["type_default"] = (Int32)InvFolder.type;
|
LLUUID rootID = LLUUID.Zero;
|
||||||
TempHash["folder_id"] = InvFolder.folderID.ToString();
|
ArrayList AgentInventoryArray = new ArrayList();
|
||||||
AgentInventoryArray.Add(TempHash);
|
Hashtable TempHash;
|
||||||
}
|
foreach (InventoryFolderBase InvFolder in folders)
|
||||||
return new InventoryData(AgentInventoryArray, rootID);
|
{
|
||||||
}
|
if (InvFolder.parentID == LLUUID.Zero)
|
||||||
}
|
{
|
||||||
}
|
rootID = InvFolder.folderID;
|
||||||
|
}
|
||||||
|
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["folder_id"] = InvFolder.folderID.ToString();
|
||||||
|
AgentInventoryArray.Add(TempHash);
|
||||||
|
}
|
||||||
|
return new InventoryData(AgentInventoryArray, rootID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,96 +1,105 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.UserManagement;
|
using OpenSim.Framework.Statistics;
|
||||||
|
using OpenSim.Framework.UserManagement;
|
||||||
namespace OpenSim.Region.Communications.Local
|
|
||||||
{
|
namespace OpenSim.Region.Communications.Local
|
||||||
public class LocalUserServices : UserManagerBase
|
{
|
||||||
{
|
public class LocalUserServices : UserManagerBase
|
||||||
private readonly NetworkServersInfo m_serversInfo;
|
{
|
||||||
private readonly uint m_defaultHomeX;
|
private readonly NetworkServersInfo m_serversInfo;
|
||||||
private readonly uint m_defaultHomeY;
|
private readonly uint m_defaultHomeX;
|
||||||
private IInventoryServices m_inventoryService;
|
private readonly uint m_defaultHomeY;
|
||||||
|
private IInventoryServices m_inventoryService;
|
||||||
|
|
||||||
public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
|
|
||||||
IInventoryServices inventoryService)
|
/// <summary>
|
||||||
{
|
///
|
||||||
m_serversInfo = serversInfo;
|
/// </summary>
|
||||||
|
/// <param name="serversInfo"></param>
|
||||||
m_defaultHomeX = defaultHomeLocX;
|
/// <param name="defaultHomeLocX"></param>
|
||||||
m_defaultHomeY = defaultHomeLocY;
|
/// <param name="defaultHomeLocY"></param>
|
||||||
|
/// <param name="inventoryService"></param>
|
||||||
m_inventoryService = inventoryService;
|
/// <param name="statsCollector">Can be null if stats collection is not required.</param>
|
||||||
}
|
public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
|
||||||
|
IInventoryServices inventoryService)
|
||||||
public override UserProfileData SetupMasterUser(string firstName, string lastName)
|
{
|
||||||
{
|
m_serversInfo = serversInfo;
|
||||||
return SetupMasterUser(firstName, lastName, "");
|
|
||||||
}
|
m_defaultHomeX = defaultHomeLocX;
|
||||||
|
m_defaultHomeY = defaultHomeLocY;
|
||||||
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
|
|
||||||
{
|
m_inventoryService = inventoryService;
|
||||||
UserProfileData profile = GetUserProfile(firstName, lastName, "");
|
}
|
||||||
if (profile != null)
|
|
||||||
{
|
public override UserProfileData SetupMasterUser(string firstName, string lastName)
|
||||||
return profile;
|
{
|
||||||
}
|
return SetupMasterUser(firstName, lastName, String.Empty);
|
||||||
|
}
|
||||||
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
|
|
||||||
AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
|
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
|
||||||
|
{
|
||||||
profile = GetUserProfile(firstName, lastName, "");
|
UserProfileData profile = GetUserProfile(firstName, lastName, "");
|
||||||
|
if (profile != null)
|
||||||
if (profile == null)
|
{
|
||||||
{
|
return profile;
|
||||||
Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here.");
|
}
|
||||||
}
|
|
||||||
else
|
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
|
||||||
{
|
AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
|
||||||
m_inventoryService.CreateNewUserInventory(profile.UUID);
|
|
||||||
}
|
profile = GetUserProfile(firstName, lastName, "");
|
||||||
|
|
||||||
return profile;
|
if (profile == null)
|
||||||
}
|
{
|
||||||
|
Console.WriteLine("Unknown Master User after creation attempt. No clue what to do here.");
|
||||||
public override UserProfileData SetupMasterUser(LLUUID uuid)
|
}
|
||||||
{
|
else
|
||||||
UserProfileData data = GetUserProfile(uuid, "");
|
{
|
||||||
if (data == null)
|
m_inventoryService.CreateNewUserInventory(profile.UUID);
|
||||||
{
|
}
|
||||||
throw new Exception("Unknown master user UUID");
|
|
||||||
}
|
return profile;
|
||||||
return data;
|
}
|
||||||
}
|
|
||||||
}
|
public override UserProfileData SetupMasterUser(LLUUID uuid)
|
||||||
}
|
{
|
||||||
|
UserProfileData data = GetUserProfile(uuid, "");
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Unknown master user UUID. Possible reason: UserServer is not running.");
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,38 +1,66 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.Region.Communications.Local")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.Region.Communications.Local")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
[assembly : Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// associated with an assembly.
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
[assembly : AssemblyTitle("OpenSim.Region.Communications.Local")]
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.Region.Communications.Local")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
Loading…
Reference in New Issue