Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-09-05 15:06:00 +01:00
commit e4c2b44e5c
41 changed files with 547 additions and 429 deletions

View File

@ -588,6 +588,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// <item><term>estate_name</term>
/// <description>the name of the estate to join (or to create if it doesn't
/// already exist)</description></item>
/// <item><term>region_file</term>
/// <description>The name of the file to persist the region specifications to.
/// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional)</description></item>
/// </list>
///
/// XmlRpcCreateRegionMethod returns
@ -701,7 +704,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
bool persist = Convert.ToBoolean((string) requestData["persist"]);
if (persist)
{
// default place for region XML files is in the
// default place for region configuration files is in the
// Regions directory of the config dir (aka /bin)
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
try
@ -714,19 +717,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
// No INI setting recorded.
}
string regionXmlPath = Path.Combine(regionConfigPath,
string regionIniPath;
if (requestData.Contains("region_file"))
{
// Make sure that the file to be created is in a subdirectory of the region storage directory.
string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]);
string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath));
if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath)))
regionIniPath = requestedFilePath;
else
throw new Exception("Invalid location for region file.");
}
else
{
regionIniPath = Path.Combine(regionConfigPath,
String.Format(
m_config.GetString("region_file_template",
"{0}x{1}-{2}.xml"),
"{0}x{1}-{2}.ini"),
region.RegionLocX.ToString(),
region.RegionLocY.ToString(),
regionID.ToString(),
region.InternalEndPoint.Port.ToString(),
region.RegionName.Replace(" ", "_").Replace(":", "_").
Replace("/", "_")));
}
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionXmlPath);
region.SaveRegionToFile("dynamic region", regionXmlPath);
region.RegionID, regionIniPath);
region.SaveRegionToFile("dynamic region", regionIniPath);
}
else
{
@ -1700,8 +1720,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = destinationFolder.ID;
inventoryService.AddItem(destinationItem);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
// Wear item
AvatarWearable newWearable = new AvatarWearable();
@ -1711,7 +1731,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
else
{
m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
}
}
}
@ -1753,16 +1773,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = destinationFolder.ID;
inventoryService.AddItem(destinationItem);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
// Attach item
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID);
m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
}
else
{
m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
}
}
}
@ -1860,16 +1880,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
destinationItem.CreationDate = item.CreationDate;
destinationItem.Folder = extraFolder.ID;
inventoryService.AddItem(destinationItem);
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
inventoryMap.Add(item.ID, destinationItem.ID);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
// Attach item, if original is attached
int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
if (attachpoint != 0)
{
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID);
m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
}
}
}
@ -1888,7 +1908,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private bool CreateDefaultAvatars()
{
// Only load once
if (m_defaultAvatarsLoaded)
{
return false;
@ -2146,7 +2165,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
inventoryItem.Folder = extraFolder.ID; // Parent folder
inventoryService.AddItem(inventoryItem);
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
}

View File

@ -305,94 +305,94 @@ namespace OpenSim.Client.MXP.ClientStack
#region MXP Outgoing Message Processing
private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
{
String typeName = ToOmType(primShape.PCode);
m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
PerceptionEventMessage pe = new PerceptionEventMessage();
pe.ObjectFragment.ObjectId = objectID.Guid;
pe.ObjectFragment.ParentObjectId = Guid.Empty;
// Resolving parent UUID.
OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene;
if (scene.Entities.ContainsKey(parentID))
{
pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid;
}
pe.ObjectFragment.ObjectIndex = localID;
pe.ObjectFragment.ObjectName = typeName + " Object";
pe.ObjectFragment.OwnerId = ownerID.Guid;
pe.ObjectFragment.TypeId = Guid.Empty;
pe.ObjectFragment.TypeName = typeName;
pe.ObjectFragment.Acceleration = ToOmVector(acc);
pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f();
pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel);
pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
pe.ObjectFragment.Location = ToOmVector(pos);
pe.ObjectFragment.Mass = 1.0f;
pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
pe.ObjectFragment.Velocity =ToOmVector(vel);
OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
{
ext.PathBegin = primShape.PathBegin;
ext.PathEnd = primShape.PathEnd;
ext.PathScaleX = primShape.PathScaleX;
ext.PathScaleY = primShape.PathScaleY;
ext.PathShearX = primShape.PathShearX;
ext.PathShearY = primShape.PathShearY;
ext.PathSkew = primShape.PathSkew;
ext.ProfileBegin = primShape.ProfileBegin;
ext.ProfileEnd = primShape.ProfileEnd;
ext.PathCurve = primShape.PathCurve;
ext.ProfileCurve = primShape.ProfileCurve;
ext.ProfileHollow = primShape.ProfileHollow;
ext.PathRadiusOffset = primShape.PathRadiusOffset;
ext.PathRevolutions = primShape.PathRevolutions;
ext.PathTaperX = primShape.PathTaperX;
ext.PathTaperY = primShape.PathTaperY;
ext.PathTwist = primShape.PathTwist;
ext.PathTwistBegin = primShape.PathTwistBegin;
}
ext.UpdateFlags = flags;
ext.ExtraParams = primShape.ExtraParams;
ext.State = primShape.State;
ext.TextureEntry = primShape.TextureEntry;
ext.TextureAnim = textureanim;
ext.Scale = ToOmVector(primShape.Scale);
ext.Text = text;
ext.TextColor = ToOmColor(textColor);
ext.PSBlock = particleSystem;
ext.ClickAction = clickAction;
ext.Material = material;
pe.SetExtension<OmSlPrimitiveExt>(ext);
Session.Send(pe);
if (m_objectsSynchronized != -1)
{
m_objectsSynchronized++;
if (m_objectsToSynchronize >= m_objectsSynchronized)
{
SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage();
Session.Send(synchronizationEndEventMessage);
m_objectsSynchronized = -1;
}
}
}
// private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
// {
// String typeName = ToOmType(primShape.PCode);
// m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
//
// PerceptionEventMessage pe = new PerceptionEventMessage();
// pe.ObjectFragment.ObjectId = objectID.Guid;
//
// pe.ObjectFragment.ParentObjectId = Guid.Empty;
//
// // Resolving parent UUID.
// OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene;
// if (scene.Entities.ContainsKey(parentID))
// {
// pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid;
// }
//
// pe.ObjectFragment.ObjectIndex = localID;
// pe.ObjectFragment.ObjectName = typeName + " Object";
// pe.ObjectFragment.OwnerId = ownerID.Guid;
// pe.ObjectFragment.TypeId = Guid.Empty;
// pe.ObjectFragment.TypeName = typeName;
// pe.ObjectFragment.Acceleration = ToOmVector(acc);
// pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f();
// pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel);
// pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
//
// pe.ObjectFragment.Location = ToOmVector(pos);
//
// pe.ObjectFragment.Mass = 1.0f;
// pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
// pe.ObjectFragment.Velocity =ToOmVector(vel);
//
// OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
//
// if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
// {
//
// ext.PathBegin = primShape.PathBegin;
// ext.PathEnd = primShape.PathEnd;
// ext.PathScaleX = primShape.PathScaleX;
// ext.PathScaleY = primShape.PathScaleY;
// ext.PathShearX = primShape.PathShearX;
// ext.PathShearY = primShape.PathShearY;
// ext.PathSkew = primShape.PathSkew;
// ext.ProfileBegin = primShape.ProfileBegin;
// ext.ProfileEnd = primShape.ProfileEnd;
// ext.PathCurve = primShape.PathCurve;
// ext.ProfileCurve = primShape.ProfileCurve;
// ext.ProfileHollow = primShape.ProfileHollow;
// ext.PathRadiusOffset = primShape.PathRadiusOffset;
// ext.PathRevolutions = primShape.PathRevolutions;
// ext.PathTaperX = primShape.PathTaperX;
// ext.PathTaperY = primShape.PathTaperY;
// ext.PathTwist = primShape.PathTwist;
// ext.PathTwistBegin = primShape.PathTwistBegin;
//
//
// }
//
// ext.UpdateFlags = flags;
// ext.ExtraParams = primShape.ExtraParams;
// ext.State = primShape.State;
// ext.TextureEntry = primShape.TextureEntry;
// ext.TextureAnim = textureanim;
// ext.Scale = ToOmVector(primShape.Scale);
// ext.Text = text;
// ext.TextColor = ToOmColor(textColor);
// ext.PSBlock = particleSystem;
// ext.ClickAction = clickAction;
// ext.Material = material;
//
// pe.SetExtension<OmSlPrimitiveExt>(ext);
//
// Session.Send(pe);
//
// if (m_objectsSynchronized != -1)
// {
// m_objectsSynchronized++;
//
// if (m_objectsToSynchronize >= m_objectsSynchronized)
// {
// SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage();
// Session.Send(synchronizationEndEventMessage);
// m_objectsSynchronized = -1;
// }
// }
// }
public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation)
{

View File

@ -63,7 +63,7 @@ namespace OpenSim.Client.MXP.PacketHandler
private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
private readonly int m_port;
private readonly bool m_accountsAuthenticate;
// private readonly bool m_accountsAuthenticate;
private readonly String m_programName;
private readonly byte m_programMajorVersion;
@ -76,7 +76,7 @@ namespace OpenSim.Client.MXP.PacketHandler
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate)
{
m_port = port;
m_accountsAuthenticate = accountsAuthenticate;
// m_accountsAuthenticate = accountsAuthenticate;
m_scenes = scenes;
@ -491,7 +491,6 @@ namespace OpenSim.Client.MXP.PacketHandler
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account)
{
UUID userId = UUID.Zero;
string firstName = "";
string lastName = "";
account = null;

View File

@ -806,7 +806,7 @@ namespace OpenSim.Framework
IConfig config = source.Configs[RegionName];
if (config != null)
source.Configs.Remove(RegionName);
source.Configs.Remove(config);
config = source.AddConfig(RegionName);
@ -865,10 +865,15 @@ namespace OpenSim.Framework
return;
}
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
ignoreIncomingConfiguration, false);
configMember.performConfigurationRetrieve();
RegionFile = filename;
else if (filename.ToLower().EndsWith(".xml"))
{
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
ignoreIncomingConfiguration, false);
configMember.performConfigurationRetrieve();
RegionFile = filename;
}
else
throw new Exception("Invalid file type for region persistence.");
}
public void loadConfigurationOptionsFromMe()

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Net.Sockets;
@ -737,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer
if (methodWasFound)
{
xmlRprcRequest.Params.Add(request.Url); // Param[2]
xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3]
try
{

View File

@ -1495,5 +1495,49 @@ namespace OpenSim.Framework
}
}
/// <summary>
/// Gets the client IP address
/// </summary>
/// <param name="xff"></param>
/// <returns></returns>
public static IPEndPoint GetClientIPFromXFF(string xff)
{
if (xff == string.Empty)
return null;
string[] parts = xff.Split(new char[] { ',' });
if (parts.Length > 0)
{
try
{
return new IPEndPoint(IPAddress.Parse(parts[0]), 0);
}
catch (Exception e)
{
m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message);
}
}
return null;
}
public static string GetCallerIP(Hashtable req)
{
if (req.ContainsKey("headers"))
{
try
{
Hashtable headers = (Hashtable)req["headers"];
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
return headers["remote_addr"].ToString();
}
catch (Exception e)
{
m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message);
}
}
return string.Empty;
}
}
}

View File

@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
InventoryItemBase item = new InventoryItemBase();
item.Owner = ourClient.AgentId;
item.CreatorId = ourClient.AgentId.ToString();
@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
item.Flags = (uint) wearableType;
item.CreationDate = Util.UnixTimeSinceEpoch();
if (invService.AddItem(item))
if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
else
ourClient.SendAlertMessage("Unable to create inventory item");

View File

@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Reset folder ID to the one in which we want to load it
item.Folder = loadFolder.ID;
//m_userInfo.AddItem(item);
m_scene.InventoryService.AddItem(item);
m_scene.AddInventoryItem(item);
return item;
}

View File

@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary>
public static class InventoryArchiveUtils
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
public static readonly char ESCAPE_CHARACTER = '\\';

View File

@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1);
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1);
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(userId, item1);
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;

View File

@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
};
}
private static byte[] uintToByteArray(uint uIntValue)
{
byte[] result = new byte[4];
Utils.UIntToBytesBig(uIntValue, result, 0);
return result;
}
// private static byte[] uintToByteArray(uint uIntValue)
// {
// byte[] result = new byte[4];
// Utils.UIntToBytesBig(uIntValue, result, 0);
// return result;
// }
public static OSD buildEvent(string eventName, OSD eventBody)
{

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
// DO NOT OVERRIDE THE BASE METHOD
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient)
{
UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);

View File

@ -430,7 +430,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
item.Name = asset.Name;
item.AssetType = asset.Type;
m_Scene.InventoryService.AddItem(item);
m_Scene.AddInventoryItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId)
{

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*

View File

@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
// m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
// item.Name, item.Owner, item.Folder);
if (UUID.Zero == item.Folder)
{
InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
{
// m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
// f.Name, (AssetType)f.Type, item.Name);
item.Folder = f.ID;
}
else
{
f = m_InventoryService.GetRootFolder(item.Owner);
if (f != null)
{
item.Folder = f.ID;
}
else
{
// m_log.WarnFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
// item.Owner, item.Name);
return false;
}
}
}
return m_InventoryService.AddItem(item);
}

View File

@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public bool AddItem(InventoryItemBase item)
{
if (item == null)
return false;
if (UUID.Zero == item.Folder)
{
InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
{
item.Folder = f.ID;
}
else
{
f = m_RemoteConnector.GetRootFolder(item.Owner);
if (f != null)
{
item.Folder = f.ID;
}
else
{
m_log.WarnFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
item.Owner, item.Name);
return false;
}
}
}
return false;
return m_RemoteConnector.AddItem(item);
}

View File

@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
item.CurrentPermissions |= 16; // Slam!
item.CreationDate = Util.UnixTimeSinceEpoch();
if (m_scene.InventoryService.AddItem(item))
if (m_scene.AddInventoryItem(item))
{
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}

View File

@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
{
IMoneyModule money=RequestModuleInterface<IMoneyModule>();
IMoneyModule money = RequestModuleInterface<IMoneyModule>();
if (money != null)
{
money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
}
AddInventoryItem(agentID, item);
AddInventoryItem(item);
}
public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
{
if (InventoryService.AddItem(item))
if (AddInventoryItem(item))
return true;
else
{
@ -92,19 +92,23 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
/// <summary>
/// Add the given inventory item to a user's inventory.
/// </summary>
/// <param name="item"></param>
public bool AddInventoryItem(InventoryItemBase item)
{
InventoryFolderBase folder;
if (item.Folder == UUID.Zero)
{
folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType);
folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (folder == null)
{
folder = InventoryService.GetRootFolder(AgentID);
folder = InventoryService.GetRootFolder(item.Owner);
if (folder == null)
return;
return false;
}
item.Folder = folder.ID;
@ -113,20 +117,37 @@ namespace OpenSim.Region.Framework.Scenes
if (InventoryService.AddItem(item))
{
int userlevel = 0;
if (Permissions.IsGod(AgentID))
if (Permissions.IsGod(item.Owner))
{
userlevel = 1;
}
EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel);
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
return true;
}
else
{
m_log.WarnFormat(
"[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
AgentID, item.Name, item.ID);
item.Owner, item.Name, item.ID);
return;
}
return false;
}
}
/// <summary>
/// Add the given inventory item to a user's inventory.
/// </summary>
/// <param name="AgentID">
/// A <see cref="UUID"/>
/// </param>
/// <param name="item">
/// A <see cref="InventoryItemBase"/>
/// </param>
[Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
{
AddInventoryItem(item);
}
/// <summary>
@ -137,7 +158,7 @@ namespace OpenSim.Region.Framework.Scenes
/// in which the item is to be placed.</param>
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{
AddInventoryItem(remoteClient.AgentId, item);
AddInventoryItem(item);
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
@ -529,7 +550,7 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.SalePrice = item.SalePrice;
itemCopy.SaleType = item.SaleType;
if (InventoryService.AddItem(itemCopy))
if (AddInventoryItem(itemCopy))
{
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
@ -775,8 +796,10 @@ namespace OpenSim.Region.Framework.Scenes
item.BasePermissions = baseMask;
item.CreationDate = creationDate;
if (InventoryService.AddItem(item))
if (AddInventoryItem(item))
{
remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
}
else
{
m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
@ -1142,7 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.Folder = folderId;
AddInventoryItem(avatarId, agentItem);
AddInventoryItem(agentItem);
return agentItem;
}
@ -1266,7 +1289,7 @@ namespace OpenSim.Region.Framework.Scenes
{
agentItem.Folder = newFolderID;
AddInventoryItem(destID, agentItem);
AddInventoryItem(agentItem);
}
}
@ -1908,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes
// sets itemID so client can show item as 'attached' in inventory
grp.SetFromItemID(item.ID);
if (InventoryService.AddItem(item))
if (AddInventoryItem(item))
remoteClient.SendInventoryItemCreateUpdate(item, 0);
else
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");

View File

@ -2729,6 +2729,8 @@ namespace OpenSim.Region.Framework.Scenes
try
{
ScenePresence sp = GetScenePresence(agentID);
PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
if (sp != null)
sp.ControllingClient.Close();

View File

@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
#endregion
[Test]
// llRot2Euler test.
public void TestllRot2Euler()
{
// 180, 90 and zero degree rotations.
CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f));
// A couple of messy rotations.
CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f));
CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f));
}
private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck)
{
// Call LSL function to convert quaternion rotaion to euler radians.
LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot);
// Check upper and lower bounds of x, y and z.
// This type of check is performed as opposed to comparing for equal numbers, in order to allow slight
// differences in accuracy.
Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail");
Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail");
Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail");
Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail");
Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail");
Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail");
}
}
}

View File

@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IUserAgentService m_UserAgentService;
public HomeAgentHandler(IUserAgentService userAgentService)
private string m_LoginServerIP;
public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP)
{
m_UserAgentService = userAgentService;
m_LoginServerIP = loginServerIP;
}
public Hashtable Handler(Hashtable request)
@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
string regionname = string.Empty;
string gatekeeper_host = string.Empty;
int gatekeeper_port = 0;
IPEndPoint client_ipaddress = null;
if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
gatekeeper_host = args["gatekeeper_host"].AsString();
@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid
if (args.ContainsKey("destination_name") && args["destination_name"] != null)
regionname = args["destination_name"].ToString();
if (args.ContainsKey("client_ip") && args["client_ip"] != null)
{
string ip_str = args["client_ip"].ToString();
try
{
string callerIP = Util.GetCallerIP(request);
// Verify if this caller has authority to send the client IP
if (callerIP == m_LoginServerIP)
client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0);
else
m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str);
}
catch
{
m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str);
}
}
GridRegion destination = new GridRegion();
destination.RegionID = uuid;
destination.RegionLocX = x;
@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
OSDMap resp = new OSDMap(2);
string reason = String.Empty;
bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason);
bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason);
resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result);

View File

@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
if (m_HomeUsersService == null)
throw new Exception("UserAgent server connector cannot proceed because of missing service");
string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
server.AddXmlRPCHandler("verify_client", VerifyClient, false);
server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);
server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler);
server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler);
}
public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)

View File

@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ILoginService m_LocalService;
private bool m_Proxy;
public LLLoginHandlers(ILoginService service)
public LLLoginHandlers(ILoginService service, bool hasProxy)
{
m_LocalService = service;
m_Proxy = hasProxy;
}
public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
{
Hashtable requestData = (Hashtable)request.Params[0];
if (m_Proxy && request.Params[3] != null)
{
IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
if (ep != null)
// Bang!
remoteClient = ep;
}
if (requestData != null)
{
@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login
return map;
}
}
}

View File

@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ILoginService m_LoginService;
private bool m_Proxy;
public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
base(config, server, String.Empty)
@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login
if (loginService == string.Empty)
throw new Exception(String.Format("No LocalServiceModule for LoginService in config file"));
m_Proxy = serverConfig.GetBoolean("HasProxy", false);
return loginService;
}
private void InitializeHandlers(IHttpServer server)
{
LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService);
LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy);
server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);

View File

@ -184,7 +184,7 @@ namespace OpenSim.Server.Handlers.Simulation
resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result);
// Let's also send out the IP address of the caller back to the caller (HG 1.5)
resp["your_ip"] = OSD.FromString(GetCallerIP(request));
resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request));
// TODO: add reason if not String.Empty?
responsedata["int_response_code"] = HttpStatusCode.OK;
@ -378,23 +378,6 @@ namespace OpenSim.Server.Handlers.Simulation
m_SimulationService.ReleaseAgent(regionID, id, "");
}
private string GetCallerIP(Hashtable req)
{
if (req.ContainsKey("headers"))
{
try
{
Hashtable headers = (Hashtable)req["headers"];
if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
return headers["remote_addr"].ToString();
}
catch (Exception e)
{
m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message);
}
}
return string.Empty;
}
}
}

View File

@ -66,20 +66,34 @@ namespace OpenSim.Services.Connectors.Hypergrid
{
m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message);
}
m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
}
public UserAgentServiceConnector(IConfigSource config)
{
IConfig serviceConfig = config.Configs["UserAgentService"];
if (serviceConfig == null)
{
m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini");
throw new Exception("UserAgent connector init error");
}
string serviceURI = serviceConfig.GetString("UserAgentServerURI",
String.Empty);
if (serviceURI == String.Empty)
{
m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
throw new Exception("UserAgent connector init error");
}
m_ServerURL = serviceURI;
m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
}
public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason)
{
// not available over remote calls
reason = "Method not available over remote calls";
return false;
}
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
// The Login service calls this interface with a non-null [client] ipaddress
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason)
{
reason = String.Empty;
@ -90,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
return false;
}
string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri);
@ -102,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
//AgentCreateRequest.Headers.Add("Authorization", authKey);
// Fill it in
OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination);
OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
string strBuffer = "";
byte[] buffer = new byte[1];
@ -199,7 +213,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
}
protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination)
// The simulators call this interface
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
{
return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason);
}
protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
{
OSDMap args = null;
try
@ -217,6 +238,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
if (ipaddress != null)
args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
return args;
}

View File

@ -85,27 +85,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "AssetServices", this.Name))
IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig != null)
{
IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig == null)
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
throw new Exception("Asset connector init error");
}
string serviceUrl = gridConfig.GetString("AssetServerURI");
if (String.IsNullOrEmpty(serviceUrl))
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService");
throw new Exception("Asset connector init error");
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
}
#region IAssetService

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -73,24 +73,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name))
IConfig gridConfig = source.Configs["AuthenticationService"];
if (gridConfig != null)
{
IConfig assetConfig = source.Configs["AuthenticationService"];
if (assetConfig == null)
string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini");
throw new Exception("Authentication connector init error");
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
string serviceURI = assetConfig.GetString("AuthenticationServerURI");
if (String.IsNullOrEmpty(serviceURI))
{
m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
throw new Exception("Authentication connector init error");
}
m_serverUrl = serviceURI;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
}
public string Authenticate(UUID principalID, string password, int lifetime)
@ -253,7 +249,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (password == simianGridCredential ||
"$1$" + password == simianGridCredential ||
"$1$" + Utils.MD5String(password) == simianGridCredential ||
Utils.MD5String(password) == simianGridCredential)
Utils.MD5String(password) == simianGridCredential ||
"$1$" + Utils.MD5String(password + ":") == simianGridCredential)
{
authorizeResult = Authorize(userID);
return true;

View File

@ -78,27 +78,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name))
IConfig gridConfig = source.Configs["AvatarService"];
if (gridConfig != null)
{
IConfig gridConfig = source.Configs["AvatarService"];
if (gridConfig == null)
{
m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
throw new Exception("Avatar connector init error");
}
string serviceUrl = gridConfig.GetString("AvatarServerURI");
if (String.IsNullOrEmpty(serviceUrl))
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService");
throw new Exception("Avatar connector init error");
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
if (!serviceUrl.EndsWith("/"))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector");
}
#region IAvatarService

View File

@ -76,38 +76,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
bool isSimianEnabled = false;
if (source.Configs["Friends"] != null)
IConfig gridConfig = source.Configs["FriendsService"];
if (gridConfig != null)
{
string module = source.Configs["Friends"].GetString("Connector");
isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name);
string serviceUrl = gridConfig.GetString("FriendsServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
}
if (isSimianEnabled)
{
IConfig assetConfig = source.Configs["FriendsService"];
if (assetConfig == null)
{
m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini");
throw new Exception("Friends connector init error");
}
string serviceURI = assetConfig.GetString("FriendsServerURI");
if (String.IsNullOrEmpty(serviceURI))
{
m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService");
throw new Exception("Friends connector init error");
}
m_serverUrl = serviceURI;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector");
}
#region IFriendsService
public FriendInfo[] GetFriends(UUID principalID)
{
if (String.IsNullOrEmpty(m_serverUrl))
return new FriendInfo[0];
Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>();
OSDArray friendsArray = GetFriended(principalID);
@ -156,6 +147,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
public bool StoreFriend(UUID principalID, string friend, int flags)
{
if (String.IsNullOrEmpty(m_serverUrl))
return true;
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "AddGeneric" },
@ -176,6 +170,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
public bool Delete(UUID principalID, string friend)
{
if (String.IsNullOrEmpty(m_serverUrl))
return true;
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "RemoveGeneric" },

View File

@ -31,17 +31,3 @@ using Nini.Config;
[assembly: Addin("SimianGrid", "1.0")]
[assembly: AddinDependency("OpenSim", "0.5")]
public static class Simian
{
public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName)
{
if (config.Configs["Modules"] != null)
{
string module = config.Configs["Modules"].GetString(moduleName);
return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName);
}
return false;
}
}

View File

@ -98,24 +98,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "GridServices", this.Name))
IConfig gridConfig = source.Configs["GridService"];
if (gridConfig != null)
{
IConfig gridConfig = source.Configs["GridService"];
if (gridConfig == null)
{
m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini");
throw new Exception("Grid connector init error");
}
string serviceUrl = gridConfig.GetString("GridServerURI");
if (String.IsNullOrEmpty(serviceUrl))
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService");
throw new Exception("Grid connector init error");
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
m_serverUrl = serviceUrl;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
}
#region IGridService

View File

@ -92,38 +92,30 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name))
IConfig gridConfig = source.Configs["InventoryService"];
if (gridConfig != null)
{
IConfig gridConfig = source.Configs["InventoryService"];
if (gridConfig == null)
{
m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
throw new Exception("Inventory connector init error");
}
string serviceUrl = gridConfig.GetString("InventoryServerURI");
if (String.IsNullOrEmpty(serviceUrl))
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
throw new Exception("Inventory connector init error");
}
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_serverUrl = serviceUrl;
gridConfig = source.Configs["UserAccountService"];
if (gridConfig != null)
{
serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
m_userServerUrl = serviceUrl;
else
m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService");
}
else
{
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini");
gridConfig = source.Configs["UserAccountService"];
if (gridConfig != null)
{
serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
m_userServerUrl = serviceUrl;
}
}
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
else if (String.IsNullOrEmpty(m_userServerUrl))
m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
}
/// <summary>

View File

@ -103,24 +103,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name))
IConfig gridConfig = source.Configs["PresenceService"];
if (gridConfig != null)
{
IConfig gridConfig = source.Configs["PresenceService"];
if (gridConfig == null)
{
m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini");
throw new Exception("Presence connector init error");
}
string serviceUrl = gridConfig.GetString("PresenceServerURI");
if (String.IsNullOrEmpty(serviceUrl))
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService");
throw new Exception("Presence connector init error");
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
m_serverUrl = serviceUrl;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
}
#region IPresenceService

View File

@ -88,44 +88,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector"))
IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig != null)
{
IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig == null)
{
m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini");
throw new Exception("Profiles init error");
}
string serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (String.IsNullOrEmpty(serviceUrl))
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService");
throw new Exception("Profiles init error");
}
if (!serviceUrl.EndsWith("/"))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
IConfig profilesConfig = source.Configs["Profiles"];
if (profilesConfig == null)
{
// Do not run this module by default.
return;
}
else
{
// if profiles aren't enabled, we're not needed.
// if we're not specified as the connector to use, then we're not wanted
if (profilesConfig.GetString("Module", String.Empty) != Name)
{
return;
}
m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name);
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN PROFILES]: No UserAccountServerURI specified, disabling connector");
}
private void ClientConnectHandler(IClientCore clientCore)

View File

@ -77,25 +77,20 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name))
IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig != null)
{
IConfig assetConfig = source.Configs["UserAccountService"];
if (assetConfig == null)
string serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini");
throw new Exception("User account connector init error");
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
}
string serviceURI = assetConfig.GetString("UserAccountServerURI");
if (String.IsNullOrEmpty(serviceURI))
{
m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector");
throw new Exception("User account connector init error");
}
m_accountCache = new ExpiringCache<UUID, UserAccount>();
m_serverUrl = serviceURI;
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector");
}
public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)

View File

@ -44,7 +44,7 @@ namespace OpenSim.Services.InventoryService
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected IXInventoryData m_Database;
protected new IXInventoryData m_Database;
public HGInventoryService(IConfigSource config)
: base(config)

View File

@ -104,7 +104,7 @@ namespace OpenSim.Services.LLLoginService
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
// These are required; the others aren't
if (accountService == string.Empty || authService == string.Empty)
throw new Exception("LoginService is missing service specifications");

View File

@ -646,7 +646,7 @@
; {2} - region UUID
; {3} - region port
; {4} - region name with " ", ":", "/" mapped to "_"
region_file_template = "{0}x{1}-{2}.xml"
region_file_template = "{0}x{1}-{2}.ini"
; we can limit the number of regions that XmlRpcCreateRegion will
; allow by setting this to a positive, non-0 number: as long as the
@ -1325,11 +1325,12 @@ Message = "The MOTD module is working!"
[Architecture]
; Choose exactly one and only one of the architectures below.
Include-Standalone = "config-include/Standalone.ini"
;Include-HGStandalone = "config-include/StandaloneHypergrid.ini"
;Include-Grid = "config-include/Grid.ini"
;Include-HGGrid = "config-include/GridHypergrid.ini"
;Include-SimianGrid = "config-include/SimianGrid.ini"
Include-Standalone = "config-include/Standalone.ini"
;Include-HGStandalone = "config-include/StandaloneHypergrid.ini"
;Include-Grid = "config-include/Grid.ini"
;Include-HGGrid = "config-include/GridHypergrid.ini"
;Include-SimianGrid = "config-include/SimianGrid.ini"
;Include-HyperSimianGrid = "config-include/HyperSimianGrid.ini"
; Then choose
; config-include/StandaloneCommon.ini.example (if you're in standlone) OR

View File

@ -147,6 +147,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
WelcomeMessage = "Welcome, Avatar!"
AllowRemoteSetLoginLevel = "false"
; If you run this login server behind a proxy, set this to true
; HasProxy = true
; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs)
; CHANGE THIS
HomeURI = "http://127.0.0.1:8002"
@ -216,6 +219,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
GridService = "OpenSim.Services.GridService.dll:GridService"
GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService"
;; If you separate the UserAgentService from the LoginService, set this to
;; the IP address of the machine where your LoginService is
;LoginServerIP = "127.0.0.1"
; * The interface that local users get when they are in other grids.
; * This restricts the inventory operations while in other grids.

View File

@ -0,0 +1,77 @@
;;
;; Please don't change this file.
;; All optional settings are in GridCommon.ini.example,
;; which you can copy and change.
;;
;;
;; In GridCommon.ini, these are the URLs you would use if SimianGrid is
;; installed at http://www.mygrid.com/Grid/
;;
; AssetServerURI = "http://www.mygrid.com/Grid/?id="
; InventoryServerURI = "http://www.mygrid.com/Grid/"
; AvatarServerURI = "http://www.mygrid.com/Grid/"
; PresenceServerURI = "http://www.mygrid.com/Grid/"
; UserAccountServerURI = "http://www.mygrid.com/Grid/"
; AuthenticationServerURI = "http://www.mygrid.com/Grid/"
; FriendsServerURI = "http://www.mygrid.com/Grid/"
; GroupsServerURI = "http://www.mygrid.com/Grid/"
[Includes]
Include-Common = "config-include/GridCommon.ini"
[Modules]
GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector"
PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector"
UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector"
AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector"
AssetServices = "HGAssetBroker"
InventoryServices = "HGInventoryBroker"
AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector"
NeighbourServices = "RemoteNeighbourServicesConnector"
SimulationServices = "RemoteSimulationConnectorModule"
EntityTransferModule = "HGEntityTransferModule"
InventoryAccessModule = "HGInventoryAccessModule"
LandServiceInConnector = true
NeighbourServiceInConnector = true
SimulationServiceInConnector = true
LibraryModule = false
AssetCaching = "FlotsamAssetCache"
[Friends]
Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector"
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
AllowHypergridMapSearch = true
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library"
DefaultLibrary = "./inventory/Libraries.xml"
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
LocalGridAssetService = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector"
HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector"
AssetLoaderArgs = "assets/AssetSets.xml"
[InventoryService]
LocalGridInventoryService = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector"
[Groups]
Enabled = true
Module = GroupsModule
DebugEnabled = false
NoticesEnabled = true
MessagingModule = GroupsMessagingModule
MessagingEnabled = true
ServicesConnectorModule = SimianGroupsServicesConnector
[Profiles]
Module = SimianProfiles